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: Bulk-Loading routines in DBD::Sybase
Date: Jul 13 2004 2:06PM

On Tue, 2004-07-13 at 15:52, Avis, Ed wrote:
> Michael Peppler wrote:
> 
> >my $sth = $dbh->prepare('insert the_table values(?, ?, ?, ?, ?)",
> >                        syb_bcp_attribs => { identity_flag => 0,
> >                                             identity_column => 0 });
> 
> >The number of placeholders *MUST* be the same as the number of
> >columns in the target table. The *order* of the columns must be the
> >same as the physical order of the columns on the server (i.e. any
> >column list in the INSERT statement will be ignored).
> 
> This seems dangerous.  Can you enforce that no column list is given?

Probably. For now I just wanted the minimal parsing needed to get the
table name...

> >The "identity_flag" attribute should be set to 1 if your source data
> >includes values to be inserted to an IDENTITY column (i.e. similar to
> >the -E flag for bcp).
> 
> What happens if this or identity_column is incorrect?

If identity_flag is set but no identity column exists on the target
table the bulk load operation fails.
If identity_column is set to the wrong column then the most likely
result is that the bulk load operation will fail as well (there is one
situation where it could succeed - if the value for the real identity
column is NULL, and if the incorrectly specified identity column accepts
NULL data.)

> >AutoCommit is ignored for this operation (it is always off).
> 
> It might be safer to require AutoCommit to be off.  OTOH, I suppose it
> is possible to have an open transaction for 'normal' updates but to do
> an autocommitted bcp operation in the middle?

Not on the same connection, no. And you *can't* do an autocommitted bcp
operation - all bcp operations require an explicit call to
$dbh->commit() in order to work.

Michael
-- 
Michael Peppler                              Data Migrations, Inc.
mpeppler@peppler.org                       http://www.peppler.org/
Sybase T-SQL/OpenClient/OpenServer/C/Perl developer available for short
or long term contract positions - http://www.peppler.org/resume.html