|
|
sybperl-l Archive
Up Prev Next
From: "Kiriakos Georgiou (Contractor)" <kiriakos dot georgiou at nrl dot navy dot mil>
Subject: Re: Bulk insert/load API access from DBI
Date: Jul 6 2004 4:25PM
Yes, it makes sense. I find the BULK INSERT as you described it a
little sexier than implementing new calls.
K
Michael Peppler wrote:
> [ also posted to dbi-dev for comments there ]
>
> I've been asked to investigate the feasibility of adding access to
> Sybase's bulk-load API in DBD::Sybase. This is an API that allows you to
> load table rows in a minimally logged manner, and is of course much
> faster than normal INSERT statements.
>
> I have this API available in Sybase::CTlib, and there are a number of users
> who mix DBI and Sybase::CTlib to get the necessary functionality.
>
> I can implement this as a bunch of private DBD::Sybase calls,
> but after thinking about this a little I thought that it might be
> possible to integrate this to the prepare()/execute()/commit() sequence.
>
> Maybe something like:
>
> $sth = $dbh->prepare("BULK INSERT -- attributes to be
> defined");
> while(<>) {
> @row = split('\|'); # or whatever...
> $sth->execute(@row);
> }
> $sth->commit;
>
> Obviously the driver (or DBI) would have to recognize the BULK INSERT
> statement and switch to the bulk load API. That's similar to what I do
> now with the "EXEC ..." statement that generates RPC calls instead of
> SQL language commands to the server.
>
> Does this make sense?
>
> Comments?
>
> Michael
|