Gary,
I think there is something wrong with your table or environment/settings
within access. Here's my test which prints the integral values as integers.
Note I couldn't find a LongInteger type as Access only reports certain types
to me.
This is what Access 2000 reports to me
Listing all SQL_ALL_TYPES types
GUID
BIT
BYTE
LONGBINARY
VARBINARY
BINARY
LONGCHAR
CHAR
CURRENCY
INTEGER
COUNTER
SMALLINT
REAL
DOUBLE
VARCHAR
DATETIME
Here's a script that works fine for me:
#!perl -w
use strict;
use DBI qw(:sql_types);
my $dbh=DBI->connect() or die "Can't connect";
$dbh->{RaiseError} = 1;
$dbh->{LongReadLen} = 800;
eval {
$dbh->do("drop table foo");
};
my $dbname = $dbh->get_info(17); # sql_dbms_name
$dbh->do("Create table foo (id integer not null primary key, longint long
integer)");
my $sth = $dbh->prepare("INSERT INTO FOO (ID, longint) values (?, ?)");
my $sth2 = $dbh->prepare("select id, longint from foo where id = ?");
my @numbers = (
4,
4,
7,
7,
7,
7,
7,
7,
12,
12,
12,
7,
7,
7,
7,
7,
7,
7,
7,
7,
88,
7,
7,
7,
100,
100,
12,
7,
183,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
7,
114,
251,
282,
281,
276,
131,
284,
144,
131,
144,
144,
131,
284,
144,
251,
284,
144,
284,
3,
284,
276,
284,
276,
3,
284,
144,
284,
7,
131,
144,
284,
284,
276,
131,
131,
114,
122
);
my $tmp;
my $i = 0;
while ($i <= $#numbers) {
$sth->execute($i, $numbers[$i]);
$i++;
}
print "Inserted $i records.\n";
$i = 0;
while ($i <= $#numbers) {
$sth2->execute($i);
my @row = $sth2->fetchrow_array();
$sth2->finish;
print "Checking row $row[0] ($row[1])\n";
if ($numbers[$i] != $row[1]) {
print "Mismatch @ $i, ", $numbers[$i], " != ", $row[1], ": \n";
}
# print "$i: $txtinserted[$i]\n";
$i++;
}
print "Checked $i records\n";
$dbh->disconnect;
-----Original Message-----
From: Gary Gauthier [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 23, 2002 9:18 AM
To: [EMAIL PROTECTED]
Cc: >
Subject: RE: :ODBC 0.45_4
Jeff;
I note that DBI/DBD extracts Access2000 longinteger and integer types as
reals eg. (0 in the database becomes 0.0 on extraction into a perl
variable.)
I'm not sure whether this is a function of the DBD or DBI, and I presume
that this is because of the variety of databases that are serviced by DBI
and DBD-ODBC.
Any chance of making it possible to typecast the returned values when
binding columns, in a manner similar to that used when binding parameters?
Regards;
Gary