PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: DBlib->dbpoll() behaving differently for ASE 12.5.3 w/ Sybperl-2.17 and ASE 15.0.1 w/ Sybperl-2.18
Date: Nov 22 2006 5:17PM

Sam.Storie@EmersonProcess.com wrote:
> Hello. I have an issue I've noticed when trying to migrate a backup
> script I wrote to work with ASE 15.0.1. In my script I use the dbpoll()
> function within Sybase::DBlib to monitor the results from a dbcc command
> and report if it takes longer than I expect. What's happening is that
> when I use sybperl 2.18 built against ASE 15.0.1, the call to dbpoll()
> never returns with a result like it's supposed to. To help demonstrate
> this I broke this down into a simple perl script:
> 
> -----8<-----8<-----8<------
> dbpoll_test.pl:
> 
> #!/usr/bin/perl -w
> 
> use strict;
> use Sybase::DBlib;
> 
> my (
> 	$dbh,
> 	$dbh2,
> 	$result,
> 	$elapsed
> );
> 
> $dbh = Sybase::DBlib->dblogin("LOGIN", "PASSWD", "SERVER");
> 
> $dbh->dbcmd("waitfor delay '00:00:03'\nselect \@\@version");
> $dbh->dbsqlsend();
> 
> $elapsed = 0;
> 
> while($elapsed < 10) {
> 	sleep(1);
> 	$elapsed++;
> 
> 	($dbh2, $result) = $dbh->dbpoll(100);
> 
> 	if($dbh2 && $result == DBRESULT) {
> 		print "Result completed successfully: $elapsed\n";
> 		$elapsed = 100;
> 	}
> 
> }
> 
> print "Script done: $elapsed\n";
> -----8<-----8<-----8<------
> 
> This script should issue a query that waits for 3 seconds, then selects
> the version of the server. To monitor the query, I use the dbpoll call
> to wait up to 10 seconds and based on the output I can verify that
> dbpoll behaved as I expected.
> 
>    --------------------------
>    Here's the output when run on my ASE 12.5.3 server.
> 
>    $ /usr/bin/perl -MSybase::DBlib -e 'print
> "$Sybase::DBlib::Version\n"'
>    This is sybperl, version 2.17
> 
>    Sybase::DBlib $Revision: 1.59 $ $Date: 2004/06/11 13:04:09 $
> 
>    Copyright (c) 1991-2001 Michael Peppler
> 
>    DB-Library version: Sybase DB-Library/12.5.1/P-EBF11758 ESD
> #2/DRV.12.5.1.0/SPARC/Solaris 2.8/BUILD1251-002/OPT/Tue Mar  9 18:42:24
> 2004
> 
>    $ ./dbpoll_test.pl
>    Result completed successfully: 3
>    Script done: 100
>    --------------------------
> 
> The output is telling me that my loop only needed to wait 3 seconds for
> the result to appear, which is good. If I run this script, using this
> environment, against my 15.0.1 server I *also* get these results (which
> is also good).
> 
> Now if I change and run the script from within my 15.0.1 environment
> against both servers I get results like this:
> 
>    --------------------------
>    Here's the output when run on my 15.0.1 server:
> 
>    $ perl -MSybase::DBlib -e 'print "$Sybase::DBlib::Version\n"'
>    This is sybperl, version 2.18
> 
>    Sybase::DBlib $Revision: 1.61 $ $Date: 2005/03/20 19:50:59 $
> 
>    Copyright (c) 1991-2001 Michael Peppler
> 
>    DB-Library version: Sybase DB-Library/15.0/P-EBF13716 ESD
> #4/DRV.15.0.1/SPARC/Solaris 8/BUILD1500-074/OPT/Mon Jun  5 01:23:01 2006
> 
>    $ ./dbpoll_test.pl
>    Script done: 10
>    --------------------------
> 
> As with the first test, I get this same result when I run it against my
> 15.0.1 and 12.5.3 servers. From what I can tell, all the other aspects
> of Sybperl I use work correctly, but dbpoll() isn't. 

dbpoll() in sybperl is just a thin wrapper around Sybase's dbpoll() (in 
dblibrary). I would contact Sybase about the difference in behavior 
(although Sybase is likely to ask for a C program repro)

Michael
-- 
Michael Peppler           -                 Peppler Consulting SaRL
mpeppler@peppler.org      -                  http://www.peppler.org
Sybase DBA/Developer      -   TeamSybase: http://www.teamsybase.com
Sybase on Linux FAQ       -   http://www.peppler.org/FAQ/linux.html