|
|
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:35PM
On Tue, 2004-07-13 at 16:14, Avis, Ed wrote:
> Michael Peppler wrote:
>
> >>>my $sth = $dbh->prepare('insert the_table values(?, ?, ?, ?, ?)",
> >>> syb_bcp_attribs => { identity_flag => 0,
> >>> identity_column => 0 });
>
> >>Can you enforce that no column list is given?
> >
> >Probably. For now I just wanted the minimal parsing needed to get the
> >table name...
>
> I don't know how DBI handles these things but I wonder if
>
> $sth = $dbh->prepare(syb_bcp('the_table'), ...)
>
> might not be better. syb_bcp() can return some kind of magic string
> or blessed reference which is recognized by DBD::Sybase as a bcp
> operation. This gets you away from pretend SQL parsing.
The idea was to make it as transparent as possible - and I suspect that
DBI might not like it if we pass a reference as the first item to
prepare(). Still, doing the remaining parsing of the INSERT string
shouldn't be too hard.
> >>>AutoCommit is ignored for this operation (it is always off).
>
> >And you *can't* do an autocommitted bcp
> >operation - all bcp operations require an explicit call to
> >$dbh->commit() in order to work.
>
> In that case why not give an error if AutoCommit is on?
I could, I suppose, but my feeling is that this feature is for people
who know what they are doing. The thing is also that I wanted users to
be able to do other things with the database handle (for example running
a "create table" command, which will normally fail with AutoCommit off),
and flipping the AutoCommit flag generates a bunch of side effects that
I wanted to avoid.
Still, I'll keep your comments in mind :-)
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
|