|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: Issues w/ error detection using DBI and multiple statements
Date: Apr 2 2002 4:25PM
Michael Burstin writes:
> On Tue, Apr 02, 2002 at 07:33:51AM -0800, Michael Peppler wrote:
> > Michael Burstin writes:
> > > I am running into some issues with detecting errors when submitting
> > > multiple SQL statements to the dataserver using DBI/DBD::Sybase. Any
> > > help that anyone can give me is greatly appreciated. I am running
> > > this under Solaris 8, Sybase 12.5, perl 5.005_03 (Sun compiled perl
> > > which ships w/ Solaris 8), DBI 1.14 and DBD::Sybase .91.
> > > ----------Begin----------
> > > EXEC sp_configure 'identity burning set factor', 50
> > > EXEC sp_configure 'number of devices', 100
> > > EXEC sp_configure 'number of locks', 100000
> > > EXEC sp_configure 'number of user connections', 1024
> > > EXEC sp_configure 'number of remote connections', 100
> > > EXEC sp_configure 'number of open objects', 10000
> > > EXEC sp_configure 'number of open indexes', 10000
> > > go
> > > -----------End-----------
OK - the following will correctly fail after the "number of user
connections" call:
#!/usr/bin/perl -w
use strict;
use DBI;
my $dbh = DBI->connect('dbi:Sybase:troll', 'sa', '');
$dbh->{RaiseError} = 1;
#DBI->trace(3);
$dbh->{syb_do_proc_status} = 1;
$dbh->do("
EXEC sp_configure 'identity burning set factor', 1
EXEC sp_configure 'number of devices', 100
EXEC sp_configure 'number of locks', 100000
EXEC sp_configure 'number of user connections', 1024
EXEC sp_configure 'number of remote connections', 100
EXEC sp_configure 'number of open objects', 1000
EXEC sp_configure 'number of open indexes', 10000
");
If you want to catch the error you wrap the do() call in an eval {};
block and check $@ for any errors.
Note that any successful sp_configure calls preceding the failure will
remain at their new value.
Michael
--
Michael Peppler Data Migrations, Inc.
mpeppler@peppler.org *or* mpeppler@mbay.net
http://www.mbay.net/~mpeppler
International Sybase User Group: http://www.isug.com
|