Class::DBI not returning consistent results through DBD::ODBC

[prev] [thread] [next] [Date index for 2005/06/02]

From: Kevin Old
Subject: Class::DBI not returning consistent results through DBD::ODBC
Date: 19:28 on 02 Jun 2005
Hello everyone,

I have a problem with Class::DBI not working *consistently* with
DBD::ODBC and I can't seem to find a solution.

First, let me clarify that my DBD::ODBC setup works flawless outside
of Class::DBI, with or without Apache::DBI, running as a CGI or via
mod_perl.

I'm running Fedora Core 3 with Apache/1.3.31 (Unix) PHP/5.0.2
mod_throttle/3.1.2 DAV/1.0.3 mod_perl/1.29 mod_ssl/2.8.19
OpenSSL/0.9.7a.  I'm using Openlink's single-tier driver and have not
restricted it in any way.

I have a CGI script that runs a few queries against my SQL Server
database and prints the results.  When visiting the script for the
first time after Apache is started, all queries run successfully and
the results are printed to the screen.

The problem occurs when I hit the refresh button in my browser - page
refreshes and is blank.  According to the log (below, all of the
"favicon" lines are the refreshes) no DB connection is tried, no
queries run.  All subsequent "visits" to this script are the same, no
data.  There are no errors in a DBI trace or from Apache::DBI (if it's
enabled) when this happens.  This is not a server/browser caching
issue, as I've tried it from several different computers with several
different browsers.

If I implement this script without Class::DBI it works flawlessly.

I'm not sure where to turn other than to implement my web app without
Class::DBI (which means I can't use Catalyst :( )

Any help is greatly appreciated!

Thanks,
Kevin

#### Script #####

#!/usr/bin/perl
                       =20
use IVR::DBI;
use IVR::TestResponses;
use IVR::EmpsTable;
use CGI qw/:all/;

print header;
print start_html;

my $ordlines =3D IVR::TestResponses->search({confirmationnum =3D>
'871737', response =3D> '2'});

while ( my $o =3D $ordlines->next ) {
        print $o->promptnum, " ", $o->response, "<br>";
}

print "before search_emps_uniq<br>";

my @emps_uniq =3D IVR::TestResponses->search_emps("7%");

foreach (@emps_uniq) {
        print $_->employeeid, "<br>";
}

print "after search_emps_uniq<br>";

my $count =3D IVR::TestResponses->count_search_like('employeeid' =3D> '7%')=
;

print "There are $count emps with 7000 id's<br>";

#my @emps =3D IVR::EmpsTable->search_emps2();
my @emps =3D IVR::EmpsTable->retrieve_all();

foreach (@emps) {
        print $_->employeeid, "<br>";
}

print end_html;

###### IVR Modules #####

package IVR::DBI;
use strict;
use base 'Class::DBI';
use Class::DBI::Plugin::Connection;
use Class::DBI::Plugin::CountSearch;
                                                                           =
    =20
__PACKAGE__->connection('dbi:ODBC:ivr', 'xxxUSERxxxx', 'xxxxPASSxxxx', {
       LongReadLen =3D> 6000,
       Taint         =3D> 1,
       PrintError         =3D> 1,
       RaiseError         =3D> 1,
       AutoCommit         =3D> 0,
       FetchHashKeyName   =3D> 'NAME_lc',
       ShowErrorStatement =3D> 1,
       ChopBlanks         =3D> 1,
       RootClass          =3D> 'DBIx::ContextualFetch'
   }
);
                                        =20
1;

package IVR::EmpsTable;
use strict;
use base 'IVR::DBI';
                                                                           =
    =20
my $table =3D '[Employees Table]';                                         =
    =20
__PACKAGE__->table($table);                                                =
   =20
__PACKAGE__->columns(All =3D> qw/employeeid password/);
__PACKAGE__->columns(Primary =3D> qw/employeeid/);
__PACKAGE__->set_sql(emps2 =3D> qq {
                        select employeeid
                        from __TABLE__
                        });
1;

package IVR::TestResponses;
use strict;
use base 'IVR::DBI';
                                                                           =
    =20
my $table =3D '[Test Responses Table]';
__PACKAGE__->table($table);                    =20
__PACKAGE__->columns(All =3D> qw/responseid customernum storenum
promptnum datetimeentered g2pog itemnum response prompttype employeeid
confirmationnum callerid/);
__PACKAGE__->columns(Primary =3D> qw/responseid/);
                                                                           =
    =20
__PACKAGE__->set_sql(emps =3D> qq {
                        select employeeid
                        from __TABLE__
                        where employeeid like ?});
1;

=3D=3D=3D=3D=3D=3D error_log =3D=3D=3D=3D=3D=3D
[Thu Jun  2 14:58:11 2005] [notice] Apache/1.3.31 (Unix) PHP/5.0.2
mod_throttle/3.1.2 DAV/1.0.3 mod_perl/1.29 mod_ssl/2.8.19
OpenSSL/0.9.7a configured -- resuming normal operations
[Thu Jun  2 14:58:11 2005] [notice] suEXEC mechanism enabled (wrapper:
/usr/local/apache/bin/suexec)
[Thu Jun  2 14:58:11 2005] [notice] Accept mutex: sysvsem (Default: sysvsem=
)
21302 Apache::DBI             push PerlCleanupHandler
21302 Apache::DBI             need ping: yes
21302 Apache::DBI             new connect to
'ivr^\uavracks^\uavracks^\AutoCommit=3D0^\ChopBlanks=3D1^\FetchHashKeyName=
=3DNAME_lc^\LongReadLen=3D6000^\PrintError=3D1^\RaiseError=3D1^\RootClass=
=3DDBIx::ContextualFetch^\ShowErrorStatement=3D1^\Taint=3D1^\Username=3Duav=
racks'
21302 Apache::DBI             PerlCleanupHandler
21302 Apache::DBI             PerlCleanupHandler rollback for
ivr^\uavracks^\uavracks^\AutoCommit=3D0^\ChopBlanks=3D1^\FetchHashKeyName=
=3DNAME_lc^\LongReadLen=3D6000^\PrintError=3D1^\RaiseError=3D1^\RootClass=
=3DDBIx::ContextualFetch^\ShowErrorStatement=3D1^\Taint=3D1^\Username=3Duav=
racks
[Thu Jun  2 14:58:17 2005] [error] [client 172.16.1.180] File does not
exist: /usr/local/apache/htdocs/favicon.ico
[Thu Jun  2 14:58:20 2005] [error] [client 172.16.1.180] File does not
exist: /usr/local/apache/htdocs/favicon.ico
[Thu Jun  2 14:58:22 2005] [error] [client 172.16.1.180] File does not
exist: /usr/local/apache/htdocs/favicon.ico
[Thu Jun  2 14:58:22 2005] [error] [client 172.16.1.180] File does not
exist: /usr/local/apache/htdocs/favicon.ico

--=20
Kevin Old
kevinold@xxxxx.xxx

(message missing)

Class::DBI not returning consistent results through DBD::ODBC
Kevin Old 19:28 on 02 Jun 2005

Generated at 16:37 on 28 Jul 2005 by mariachi v0.52