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: Robert Lang <rlang at lincap dot com>
Subject: RE: Sybperl error messages
Date: Aug 9 1999 3:32PM

The DBlib bug that I found only affected NT, so I consider it a perl port
bug more that anything else.  Essentially, the last column of the last row
from the previous query is added to the result set.  The example that I use
uses the sql function wrapper, but if you trace it, it goes all the way down
to the core calls.  Destroying and creating a new handle between calls
"fixes" the problem.  (The example code is at the end of this mail.)

Your problem seems to be a more classic sql programming problem. Usually
your error happens when you are spinning through a result set, processing
results and another sql statement (usually in some "helper" type function)
gets executed.  

Suppose you employ a lazy caching strategy for some static choice type
table.  You get your initial result set and start processing records one by
one.  In the act of processing them, you ask for your "static" cache of
choice items.  Since they haven't been read in, you try to read them from
the database.  Boom.  

To find out where this is happening to you, put your code in the debugger,
get your initial set then put a breakpoint on sqlexec.  When that trips,
follow the stack backwards to find the culprit.

As for DBlib vs. CTlib, DBlib is old and CTlib is new.  Support for DBlib
will end at some point, so if you can, you're better off with CTlib.

Regards,

Robert Lang
rlang@lincap.com

# Sample code to trip the NT Only DBlib bug.

#!perl

use Sybase::DBlib;
use Data::Dumper;

$DB = new Sybase::DBlib "user","password","server";

@rows = $DB->sql("select 2 + 2 from master..sysusers",undef,1);
print Dumper(@rows);
@rows = $DB->sql("select uid from master..sysusers",undef,1);
print Dumper(@rows);
@rows = $DB->sql("select max(name) from master..sysusers",undef,1);
print Dumper(@rows);



# Here are the results from the above.  (Trimmed to save space)

$VAR1 = {
          'Col 1' => 4
        };
[$VAR2 through $VAR10 deleted]...

$VAR11 = {
           'Col 1' => 4
         };
$VAR1 = {
          'uid' => '0',
          'Col 1' => 4
        };
[$VAR2 through $VAR10 deleted]...
$VAR11 = {
           'uid' => 16389,
           'Col 1' => 4
         };
$VAR1 = {
          'uid' => 16389,
          'Col 1' => 'System'
        };



-----Original Message-----
From: Brad Morrison [mailto:brad@neosoft.com]
Sent: Sunday, August 08, 1999 1:05 PM
To: SybPerl Discussion List
Subject: RE: Sybperl error messages


At 12:49 PM 8/6/99 -0500, Robert Lang  wrote:
>I've been using [SybPerl] for about a
>year, with the exception of one heinous DBlib bug, it's been working well.

What was the bug?????  I inherited a SybPerl program a couple of months ago,
and I'm just getting the hang of it.  I don't quite understand the
difference
(advantages, trade-offs) of DBlib vs. CTlib.

The app I inherited was working great, then suddenly I started getting
"attempt
to issue another request with results pending" messages.  I've been dinking 
with
(DBlib) dbsqlexec, trying dbsubmit(forgive my memory) and dbpoll, with mixed
success.  Hints, anyone?  Heck, I'll settle for a clue.
"Nothing succeeds like success."
Brad Morrison, brad@neosoft.com
"Press to test."
(click)
"Release to detonate."