2 messages in com.mysql.lists.perlis_num function...| From | Sent On | Attachments |
|---|---|---|
| Kurt Godel | 02 Oct 1999 09:34 | |
| Jochen Wiedmann | 03 Oct 1999 09:07 |
| Subject: | is_num function...![]() |
|---|---|
| From: | Kurt Godel (meta...@hotmail.com) |
| Date: | 10/02/1999 09:34:08 AM |
| List: | com.mysql.lists.perl |
I've been having a problem getting the is_num method on a statement handle to work correctly. Basically want to use it for a "conditional quote" function for inserting data into tables.
Tried this on several versions of DBI, DBD, Perl, and MySQL. Last time I tried it was on a system I compiled from the latest versions, downloaded about a week ago.
THE TABLE: pt_id INT UNSIGNED NOT NULL AUTO_INCREMENT pt_name VARCHAR(30) NOT NULL pt_rprice FLOAT(10,2) UNSIGNED NOT NULL pt_desc TEXT pt_headtag VARCHAR(200) pt_pictag VARCHAR(200) pt_cy_id INT UNSIGNED pt_rstocknum VARCHAR(10) NOT NULL pt_status TINYINT UNSIGNED NOT NULL pt_keywords TEXT pt_sr_id INT UNSIGNED NOT NULL pt_wcost FLOAT(10,2) UNSIGNED NOT NULL pt_wstocknum VARCHAR(10) NOT NULL
THE CODE: use DBI; my $dbh=DBI->connect('DBI:mysql:ringo:localhost','ringo','xxxxxxx'); my $sth=$dbh->prepare("SELECT * FROM product"); $sth->execute; my @isnum=@{$sth->{is_num}}; my @name= @{$sth->{NAME}}; foreach $index (0..$#name) { print "$name[$index]: $isnum[$index]\n"; } $sth->finish; $dbh->disconnect; print "\n\n";
THE RESULT: pt_id: pt_name: 1 pt_rprice: pt_desc: pt_headtag: 1 pt_pictag: 1 pt_cy_id: pt_rstocknum: 1 pt_status: pt_keywords: pt_sr_id: pt_wcost: pt_wstocknum: 1
I had thought at first the test was reversed, but then noticed that TEXT columns were showing up as not numeric.
Is this a bug in the DBD or my logic?
R. Anthony Kolstee
______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com




