| Store | Cart

RE: DBD/DBD-ODBC on Foxpro truncating column names

From: Paul Rogers <e...@coservers.net>
Sat, 2 May 2009 09:12:37 -0400
Never mind...updating DBD::ODBD from 1.18 to 1.21 fixed the problem. :-)

Paul ---


> -----Original Message-----> From: perl...@listserv.ActiveState.com> [mailto:perl...@listserv.ActiveState.com] On Behalf> Of Paul Rogers> Sent: Friday, May 01, 2009 9:44 AM> To: perl...@listserv.ActiveState.com> Subject: DBD/DBD-ODBC on Foxpro truncating column names> > Hi,> > I'm running SELECT queries against some FoxPro tables using DBI and> DBD::ODBC and it's chopping off column names if they're ten characters> in> length.  It strips off the 10th character and pads it with a space (ten> character foxpro column names are the max accepted length).  Has anyone> seen> this?> > I reran the same query using the old Win32::ODBC module and it returns> the> column names without a problem.> > Cheers,> Paul ---> > > > Code:> #######################################################################> #####> ###> use DBI;> use DBD::ODBC;> > my $dbdir = "c:\\data";> my $dsn = "Driver={Microsoft Visual FoxPro> Driver};UID=;PWD=;SourceDB=$dbdir;SourceType=DBF;Exclusive=No;Backgroun> dFetc> h=Yes;Collate=Machine;Null=Yes;Deleted=Yes;";> > my $dbh = DBI->connect("dbi:ODBC:$dsn", '','') or die "$DBI::errstr\n";> $sqlstatement = "SELECT TOP 10 * FROM tblsales ORDER BY keys";> $sth = $dbh->prepare($sqlstatement);> $sth->execute ||> 	die "Could not execute SQL statement ... maybe invalid?";> > my %row;> $sth->{LongReadLen} = 0;> $sth->{LongTruncOk} = 0;> $sth->bind_columns( \( @row{ @{$sth->{NAME_lc} } } ));> while ($sth->fetch) {> 	foreach (keys(%row)) {> 		print "$_: $row{$_}\n";> 	}> 	print "\n\n";> }> $dbh->disconnect;> #######################################################################> #####> ###> > > _______________________________________________> Perl-Win32-Database mailing list> Perl...@listserv.ActiveState.com> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Recent Messages in this Thread
Paul Rogers May 01, 2009 01:43 pm
Paul Rogers May 02, 2009 01:12 pm
Messages in this thread