Subject: | $sql value is undefined in error handler for Sybase |
Hi there
After I've called prepare/execute, any subsequent prepare/execute
calls that fail do not set the 'sql' in the error handler.
I am attaching a repo file which uses the same invalid sql twice. The
first time the sql is reported and the second time it is undefined.
Please could you help
Thanks a lot
Russell
Additional Info
DBI-1.48
uname -a:
SunOS in-csg179.uk.jpmorgan.com 5.8 Generic_117350-05 sun4u sparc
SUNW,Ultra-2
perl -V:
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris-thread-multi
uname='sunos testserver2.uk.jpmorgan.com 5.8 generic_108528-23
sun4u sparc sunw,ultra-250 '
config_args='-Dprefix=/usr/local/dbms_toolkit'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -fno-
strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -
D_FILE_OFFSET_BITS=64',
optimize='-O',
cppflags='-D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -fno-strict-
aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.4.2', gccosandvers='solaris2.8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib '
libpth=/usr/local/lib /usr/lib /usr/ccs/lib /usr/openwin/lib /usr/share
/lib /usr/sadm/lib /usr/openv/lib /usr/dt/lib /usr/snadm/lib
libs=-lsocket -lnsl -lgdbm -ldl -lm -lpthread -lc
perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Locally applied patches:
ActivePerl Build 813
Iin_load_module moved for compatibility with build 806
PerlEx hacks for CGI::Carp
Less verbose ExtUtils::Install and Pod::Find
instmodsh upgraded from ExtUtils-MakeMaker-6.25
24699 ICMP_UNREACHABLE handling in Net::Ping
21540 Fix backward-compatibility issues in if.pm
Built under solaris
Compiled at Oct 24 2005 14:36:51
%ENV:
PERL5LIB="/usr/local/dbms_toolkit/lib/perl5:/usr/local/dbms_toolkit/lib
/perl5/site_perl"
@INC:
/usr/local/dbms_toolkit/lib/perl5/5.8.7/sun4-solaris-thread-multi
/usr/local/dbms_toolkit/lib/perl5/5.8.7
/usr/local/dbms_toolkit/lib/perl5
/usr/local/dbms_toolkit/lib/perl5/site_perl/5.8.7/sun4-solaris-
thread-multi
/usr/local/dbms_toolkit/lib/perl5/site_perl/5.8.7
/usr/local/dbms_toolkit/lib/perl5/site_perl
/usr/local/dbms_toolkit/lib/perl5/5.8.7/sun4-solaris-thread-multi
/usr/local/dbms_toolkit/lib/perl5/5.8.7
/usr/local/dbms_toolkit/lib/perl5/site_perl/5.8.7/sun4-solaris-
thread-multi
/usr/local/dbms_toolkit/lib/perl5/site_perl/5.8.7
/usr/local/dbms_toolkit/lib/perl5/site_perl
Subject: | t2.pl |
#!/usr/local/bin/perl
use strict;
use warnings;
use DBI;
my ($server, $user, $password,$dbh,$sth);
my $i;
my $sql2;
$server="myserver";
$user="myuser";
$password="mypword";
$dbh = DBI->connect("dbi:Sybase:server=$server",$user,$password,{
syb_err_handler => \&syb_err_handler,
PrintError => 0,
AutoCommit => 1
});
for ($i=0;$i<=1;$i++) {
$sql2="qselect \@\@version";
if (! ($sth = $dbh->prepare($sql2))) {return 1;}
$sth->execute();
$sth->finish;
}
$dbh->disconnect();
exit;
sub syb_err_handler {
print "==========================================================\n";
print "$#_\n";
foreach (@_){if ($_){print "$_\n";}else{print "undef\n";}}
return 1;
}