|
|
sybperl-l Archive
Up Prev Next
From: "Raja Sambamurty" <rajags at hotmail dot com>
Subject: dberrhandle (one more time :-()
Date: Nov 7 1997 10:26PM
Hi,
I tried using the dberrhandle after browsing thru some of the archvies.
It quite doesn't seem to work. What follows is 5 lines of simple code
with sql syntax error (introduced to test the err handler). Once in the
debugger, I break in the error_handler routine, but it seems to skip
right past it. Any ideas would be appreciated. thanks
Raja
=====================================================================
hosta% 61: l.pl
Loading DB routines from perl5db.pl version 1
Emacs support available.
Enter h or `h h' for help.
main::(l.pl:5): require "srvpas.pl";
DB<1> n
main::(srvpas.pl:60): 1;
DB<1>
main::(l.pl:6): require "sybutil.pl";
DB<1>
main::(/opt/perl_lib/sybutil.pl:64):
64: &dbmsghandle ("message_handler");
DB<1>
main::(/opt/perl_lib/sybutil.pl:65):
65: &dberrhandle ("error_handler");
DB<1>
main::(/opt/perl_lib/sybutil.pl:67):
67: 1;
DB<1>
main::(l.pl:8): $Server="SYBASE";
DB<1> b error_handler
DB<2> b message_handler
DB<4> n
main::(l.pl:9): $user="sa";
DB<4> l 1,30
1 #!/opt/perl5.004/bin/perl5.004 -d
2: use Sybase::DBlib;
3: use File::Basename;
4
5: require "srvpas.pl";
6: require "sybutil.pl";
7
8: $Server="SYBASE";
9==> $user="sa";
10: $pass=&getpass($Server);
11: $Database="test_db";
12: $table_name="custodian";
13
14: $dbfh = new Sybase::DBlib $user,$pass,$Server,$appname;
15: if (not defined $dbfh)
16 {
17: die "Fatal error during dblogin $!";
18 }
19 #
20 # test the error handler
21 #
22: $sqlcmd="select * from $Database..One where like 'Raja%'\n";
#note lack of col name after like
23: $dbstat=$dbfh->dbcmd ($sqlcmd);
24: $dbfh->dbsqlexec;
25: while (@dat = $dbfh->dbnextrow(1)) {
26: print "@dat\n";
27 }
28: print "After\n";
DB<5> c
Msg 156, Level 15, State 1
Server 'SYBASE', Line 1
Incorrect syntax near the keyword 'like'.
DB-Library error:
General SQL Server error: Check messages from the SQL Server.
After
DB::fake::(/opt/perl5.004/lib/perl5db.pl:2043):
2043: "Debugged program terminated. Use `q' to quit or `R' to
restart.";
DB<5> q
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
|