Hi Sander

> It's probably a bit tricky to let jOOQ wrap this in a transaction, as
> it's possible that a transaction was already started by the user. If
> you want to do this, you'll have to make sure that you only start (and
> commit) a transaction when you're not already in one.

True, I didn't mean to start handling transactions in jOOQ (except
maybe in the new loader API). The problem will be, however, that if I
expect transactional integrity from client code across several
statements executed internally by jOOQ, it may (and will) go wrong, as
you stated in #802 concerning lastID().

> In PostgreSQL, when you're not using explicit transactions, every user
> executed statement runs in its own transaction.

I've noticed this. This was especially painful when handling cursors
from stored procedures. Unfortunately, the Postgres JDBC driver will
execute two queries for that, even if you issue only one to the
PreparedStatement...

> In PostgreSQL 9 the 'DO' statement was added, which allows executing
> code without storing it in a function first, see
> http://www.postgresql.org/docs/9.0/static/sql-do.html . This probably
> allows you to implement this kind of logic in jOOQ, without having to
> add stored functions in PostgreSQL. But it won't work in older
> versions of PostgreSQL.

Thank you for that hint. That's precisely what I was looking for. This
is similar to Oracle's PL/SQL DECLARE/BEGIN/END blocks.

Cheers
Lukas

Reply via email to