agora inbox for pljava-dev@postgresql.org  
help / color / mirror / Atom feed
Subject: [Pljava-dev] Savepoints and PL/Java
Date: Tue, 3 Oct 2006 20:13:00 -0400
Message-ID: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com> (raw)

Perhaps an easy one...

I'd like to drop a Savepoint to be committed or rolled-back,  
depending upon the results of a function call, i.e.:

int something()
{
   Database db = DriverManager.getConnection("jdbc:default:connection");
   Savepoint savePoint = db.setSavepoint();

   int result;

   try
   {
     result = trySomethingWithSQL(db);
   }
   catch (Exception e)
   {
     db.rollback(savePoint);
     return -1;
   }

   db.commit(savePoint);
   return result;
};

I see that, although setSavepoint and releaseSavepoint are available,  
commit and rollback are not.  What is the point of set/ 
releaseSavepoint if I cannot commit or rollback from a Savepoint?  Is  
there any other way to accomplish the above?

Thanks in advance,

Jeff Lyon





view thread (5+ messages)  latest in thread

Message-ID: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com>
Permalink:  ../54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com/
Also on:    postgresql.org/message-id/54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pljava-dev@postgresql.org
  Subject: Re: [Pljava-dev] Savepoints and PL/Java
  In-Reply-To: <54C58E85-14CF-43F9-8B4A-A0EC5DF468A1@mac.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox