Subject: | Empty values with long column names?? |
I seem to have several problems accessing an MDB through unixODBC ->
mdbtools on Ubuntu 10.4. Everything looks OK using unixODBC's "isql"
utility, but various problems occur through DBD::ODBC.
Picking one I can't find a workaround for as a starting point....
This query looks fine in isql:
Show quoted text
SQL> select
Call,STATION_CALLSIGN,APP_DXKEEPER_LOTW_QSL_Rcvd,APP_DXKEEPER_EQSL_QSLSDATE,QSO_End
from QSOs where DXCCID = '324'
+---------------------------+---------------------------+---------------------------+---------------------------+---------------------+
| Call | STATION_CALLSIGN |
APP_DXKEEPER_LOTW_QSL_Rcvd| APP_DXKEEPER_EQSL_QSLSDATE| QSO_End
|
+---------------------------+---------------------------+---------------------------+---------------------------+---------------------+
| VU2RAK | N6ML | R
| 2009-09-01 00:00:00 | 2009-09-01 15:29:23 |
| VU2PAI | N6ML | R
| 2010-03-10 00:00:00 | 2010-03-09 16:50:52 |
| VU2NKS | N6ML | Y
| 2010-08-22 00:00:00 | 2010-08-21 20:38:22 |
+---------------------------+---------------------------+---------------------------+---------------------------+---------------------+
SQLRowCount returns 3
3 rows fetched
Show quoted textSQL>
Using DBD::ODBC 1.23 that comes with Ubuntu and the same query
statement, it seems that the columns that have long names return empty
results...
mini-ubuntu ~ % perl -I/usr/lib/perl5 ./getlog.pl
DBD::ODBC::VERSION = 1.23
VU2RAK, N6ML, , , 2009-09-01 15:29:23
VU2PAI, N6ML, , , 2010-03-09 16:50:52
VU2NKS, N6ML, , , 2010-08-21 20:38:22
mini-ubuntu ~ %
Using the latest SVN version is even worse - all fields are empty after
the first row...
mini-ubuntu ~ % ./getlog.pl
DBD::ODBC::VERSION = 1.24_6
VU2RAK, N6ML, , , 2009-09-01 15:29:23
, , , ,
, , , ,
mini-ubuntu ~ %
Here's the perl code....
mini-ubuntu ~ % cat getlog.pl
#!/usr/bin/perl
use DBI;
use DBD::ODBC;
printf "DBD::ODBC::VERSION = %s\n", $DBD::ODBC::VERSION;
my $dbh = DBI->connect("dbi:ODBC:dxkmega") or die "$DBI::errstr\n";
my $sql = qq/select
Call,STATION_CALLSIGN,APP_DXKEEPER_LOTW_QSL_Rcvd,APP_DXKEEPER_EQSL_QSLSDATE,QSO_End
from QSOs where DXCCID = '324'/;
my $sth = $dbh->prepare($sql);
$sth->execute();
$sth->{RaiseError} = 1;
my $rows = [];
while(my $row = (shift(@$rows) ||
shift(@{$rows=$sth->fetchall_arrayref(undef,1)||[]}))) {
print join(", ", @{$row}), "\n";
}
mini-ubuntu ~ %
Perl is v5.10.1 that comes with Ubuntu 10.4.