-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Below is the rough draft of savepoint support in DBI (v1).
Comments and questions welcome.


In the DBI.pm Database Handle Methods section:

=item C<savepoint_set>

  $rc  = $dbh->savepoint_set($savepoint_name)  or die $dbh->errstr;

Create a named savepoint if the database supports them and
C<AutoCommit> is off. Using the same savepoint name more than once
in a single transaction is database-dependent and thus not recommended.


=item C<savepoint_rollback_to>

  $rc  = $dbh->savepoint_rollback_to($savepoint_name)  or die $dbh->errstr;

Rollback (undo) any changes made since the named savepoint, if the database
supports savepoints and C<AutoCommit> is off.


=item C<savepoint_remove>

  $rc  = $dbh->savepoint_remove($savepoint_name)  or die $dbh->errstr;

Removes the named savepoints, if the database supports savepoints and
C<AutoCommit> is off.



The way it currently works in DBD::Pg internally is a new array is created at
the database handle level to track the savepoints:

imp_dbh->savepoints = newAV();

savepoint_set pushes the name onto this array. Rollback and remove go backwards
through the array and pop things off until a matching name is found.
Any rollback or commit will clear the array, and the dbh destructor calls 
av_undef.

The DBD::Pg implementation uses "savepoint", "rollback_to", and "release" for
those trying to find them in the source.


- --
Greg Sabino Mullane [EMAIL PROTECTED]
PGP Key: 0x14964AC8 200507131007
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEARECAAYFAkLVIWkACgkQvJuQZxSWSsg9KgCgsX/lO94mwxs6uXaTDyTp9jCb
+bkAnihncQNX4UOhA7rJSizulMg4MG9y
=XwY6
-----END PGP SIGNATURE-----


Reply via email to