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: "Scott Zetlan" <scottzetlan at aol dot com>
Subject: RE: blk_drop
Date: Mar 11 2002 2:32PM

I ran into this same error while writing Sybase::BLK.  It's a basic state
issue: once the connection is created and a bulk-copy descriptor allocated
and initialized, the descriptor can't be dropped until the operation is
executed or canceled (which changes the state to completed).  Looks to me
like your code is running blk_init, and I'm guessing you expect that will
execute the bulk copy operation for you.  It won't; you'll have to read
data, run call blk_rowxfer(), call blk_done(), then you can call blk_drop.

Or you could just use Sybase::BLK, which does it for you :)

If you really mean to drop the connection following an init, you'll have to
call blk_done() to signify the end of the operation (i.e., change the state
of the blk descriptor).

Scott

> -----Original Message-----
> From: owner-SYBPERL-L@list.cren.net
> [mailto:owner-SYBPERL-L@list.cren.net]On Behalf Of
> Stephen.Sprague@MorganStanley.com
> Sent: Monday, March 04, 2002 4:11 PM
> To: SybPerl Discussion List
> Subject: Re: blk_drop
>
>
> michael,
> Okay. Sounds good. For now, i'm just letting letting $dbh go out of scope.
>
> cheers,
> Steve
>
>
>
> On Mon, 4 Mar 2002 @ 12:52pm, an entity claiming to be Michael Peppler...:
>
> mpeppl :Stephen.Sprague@MorganStanley.com writes:
> mpeppl : > Getting the error below on blk_drop. The obvious must
> be  avoiding  me.
> mpeppl : > What am I doing wrong? I'm using 2.14 of Sybase::CTlib
> mpeppl : >
> mpeppl : > code:
> mpeppl : >   use Sybase::CTlib;
> mpeppl : >   my ( $u, $p, $s, $a ) = qw/user pwd server app/;
> mpeppl : >   $dbh = Sybase::CTlib->new( $u, $p, $s, $a . '_T', {
> CON_PROPS => { CS_BULK_LOGIN => CS_TRUE } } );
> mpeppl : >   $dbh->blk_init( 'db..table', 1, undef, undef );
> mpeppl : >   $dbh->blk_drop();
> mpeppl : >
> mpeppl : > error:
> mpeppl : >   Open Client Message:
> mpeppl : >   Message number: LAYER = (0) ORIGIN = (0) SEVERITY =
> (0) NUMBER = (0)
> mpeppl : >   Message String: STATE EVENT: blk layer: user error:
> Cannot call API blkdrop() from this state: initialized
> mpeppl : >
> mpeppl :
> mpeppl :That may be a bug in the sybperl code... The C API says
> that you call
> mpeppl :blk_drop() to free the BLK descriptor. However I took a couple of
> mpeppl :shortcuts, and I suspect that in the code above there is no BLK
> mpeppl :descriptor that can be dropped.
> mpeppl :
> mpeppl :There may also be some other state issues that aren't
> handled quite
> mpeppl :right here because of the shortcuts...
> mpeppl :
> mpeppl :I'll try to look at the code later and see if I can see what is
> mpeppl :missing from the internal sybperl code that causes the error.
> mpeppl :
> mpeppl :Michael
> mpeppl :
>
>