Up Prev Next
From: Troy Taylor <ttaylor at JCLLC dot COM>
Subject: RE: trapping errors with db-lib
Date: Mar 13 2000 9:48PM
Well, I already did a s/'//gs; and a s/"//gs;
Shouldn't that cover it?
From: Murali Kumar [mailto:firstname.lastname@example.org]
Sent: Monday, March 13, 2000 2:30 PM
To: SybPerl Discussion List
Subject: Re: trapping errors with db-lib
If this error is during insert/update, it's probably due to presence quotes
(single/double") as part of data. If so, do 'dbsafestr' before
$myvalue = $dbh->dbsafestr($myvalue) ;
Trust this helps.
Troy Taylor wrote:
> I have spent hours looking through the Sybperl DBLib docs and cant figure
> out how to trap errors like this:
> Msg 102, Level 15, State 1
> Server 'sybaseserver', Line 4
> Incorrect syntax near 'searchterm'.
> DB-Library error:
> General SQL Server error: Check messages from the SQL Server.
> This error causes my script to crash. I am doing error trapping using
> $status = $dbh->dbretstatus; BUT it doesnt seem to trap the above kinds of
> errors. My sql syntax is built on the fly, so I need to trap the above
> types of errors if they occur.
> Thanks for any help in advance, Sorry if this question has been covered
> before. If it has been covered before any points to the correct reference
> would be greatly appreciated!
> Thanks again!
> Troy D. Taylor