On Tuesday, March 25, 2014 1:29:49 PM UTC-7, Tim Uckun wrote:
>
>
>> I'm not exactly sure what you mean.  If you aren't inside a transaction, 
>> PostgreSQL treats each statement as inside it's own transaction.  I'm 
>> guessing the answer to your question is to enclose the individual calls in 
>> a transaction block.
>>
>>
> I mean this...
>
> DB1['begin transaction']
> DB2['begin  transaction']
>
> ... Do some more stuff with DB1 and DB2.
>
> if (something or another)
>    DB1['rollback']
>    DB2['rollback']
> else
>    DB1['commit']
>   DB2['commit']
> end
>
>
> I think the only way this can work is if I am using the same connection 
> from the pool throughout the code.  Sometimes with AR I checkout a 
> connection from the pool, use it on multiple statements, and then either 
> commit or rollback.
>

As mentioned earlier, by design Sequel does not have a blockless 
transaction API.  You need do things inside a transaction block:

Sequel.transaction([db1, db2]) do
  # ... Do some more stuff with DB1 and DB2.
  raise Sequel::Rollback if (something or another)
end

For similar reasons, by design Sequel does not have a blockless 
connection-checkout API.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to