List:MySQL and Perl« Previous MessageNext Message »
From:Jochen Wiedmann Date:October 3 1999 4:08pm
Subject:Re: is_num function...
View as plain text  
Kurt,

which version of DBD::mysql are you using? I cannot reproduce your
problem with 1.2207:

	#!/usr/bin/perl

	use strict;
	use DBI ();

	my $dbh = DBI->connect("DBI:mysql:test", undef, undef, {RaiseError => 1});
	eval { $dbh->do("DROP TABLE product") };
	$dbh->do(<<"EOS");
	CREATE TABLE product (
	  pt_id         INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
	  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
	)
	EOS
	my $sth=$dbh->prepare("SELECT * FROM product");
	$sth->execute;
	my $name = $sth->{'NAME'};
	my $isnum = $sth->{'mysql_is_num'};
	my $old_isnum = $sth->{'is_num'};
	for (my $i = 0;  $i < @$name;  $i++) {
	    print "  $name->[$i]: $isnum->[$i], $old_isnum->[$i]\n";
	}
	$sth->finish();
	$dbh->disconnect();

which produces the output:

	  pt_id: 1, 1
	  pt_name: 0, 0
	  pt_rprice: 1, 1
	  pt_desc: 0, 0
	  pt_headtag: 0, 0
	  pt_pictag: 0, 0
	  pt_cy_id: 1, 1
	  pt_rstocknum: 0, 0
	  pt_status: 1, 1
	  pt_keywords: 0, 0
	  pt_sr_id: 1, 1
	  pt_wcost: 1, 1
	  pt_wstocknum: 0, 0

Besides, note you should not use $sth->{is_num}, but $sth->{mysql_is_num}.
The former will be removed in one of the next versions.


Bye,

Jochen


-- 
Jochen Wiedmann						joe@stripped
Life has brown and green eyes. :-)			+49 7123 14887


Thread
is_num function...Kurt Godel2 Oct
  • Re: is_num function...Jochen Wiedmann3 Oct