On Tue, 8 Mar 2005 12:12:23 -0800, Jonathan Leffler
<[EMAIL PROTECTED]> wrote:

> I'm keeping this on dbi-dev pro tem.  Greg - I suggest you ask the
> question on dbi-users.
> 
> 
> On Tue, 8 Mar 2005 11:01:48 +0000, Tim Bunce <[EMAIL PROTECTED]> wrote:
> > On Mon, Mar 07, 2005 at 11:47:32PM -0000, Greg Sabino Mullane wrote:
> > > > While I don't have any particular objections, doesn't
> > > > Pg (and most other DBMSs supporting savepoints) have
> > > > SQL syntax to implement them ? If so, isn't just
> > > >
> > > > $dbh->do(<savepoint-sql>)
> > > >
> > > > sufficient ?
> > >
> > > Sure, but they also have syntax to implement BEGIN and ROLLBACK.
> 
> It isn't wholly clear why we have $dbh->commit an $dbh->rollback; both
> could be simulated with $dbh->do on most databases.  However, there is
> some minor performance advantage on some systems.  For example, IBM
> Informix Dynamic Server (IDS) recognizes those statements in ESQL/C
> and the SQLI protocol used to transfer commands between client code
> (such as Perl + DBI) and the server sends a two byte command for
> ROLLBACK instead of sending the string.  Further, the two byte command
> does not have to be parsed and executed - so there is a small, but
> barely measurable, performance benefit to using the $dbh->rollback
> statement.

Uhh, there is much more difference!
I can workaround a lot of database problems in the commit/rollback calls in my
E/SQL code that I could not do unless I would be analyzing every do call

> > > I see the savepoints as an extension of the same sort of
> > > transaction processing the DBI dos there. Certainly, drivers are
> > > welcome to implementit any way they want (including allowing
> > > savepoints via "do") but the advantages include being able to
> > > track the savepoints closely, even allowing things like returning
> > > an array of the current savepoints to the application. It also
> > > abstracts the savepoint manipulation away from knowing the exact
> > > SQL for your particular DBMS, one of the goals of DBI after all. :)
> > 
> > I'd be interested to see how varied the syntax is between databases.

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using Perl 5.6.2, 5.8.0, 5.8.3, & 5.9.2  on HP-UX 10.20, 11.00 & 11.11,
  AIX 4.3, SuSE 9.0 pro 2.4.21 & Win2k.     http://www.cmve.net/~merijn
Smoking perl: [email protected],             perl QA: http://qa.perl.org
  reports to: [EMAIL PROTECTED],                [email protected]

Reply via email to