I have been debugging a lot.
The CS_OPT_CHAINXACTS error message comes from DBD::Sybase dbdimp.c.
Turning DBI_TRACE on additionally gives me:
Message String: ct_send(): user api layer: external error: This routine cannot be called because another command structure has results pending.
It turns out that turning off prepare_cached helps. Then I get
the expected "Attempt to insert duplicate key" in both transactions,
and transaction_depth is set to 0.
So it seems that the $sth is not really "finished", when rollback is
called after the first transaction.
This is probably because of the INSERT command. To retrieve the
insert id the command is actually an INSERT plus SELECT MAX(id)...
(The error does not happen with an UPDATE, for example)
I've been debugging in DBIC::Storage::DBI::_dbh_execute mainly.
If I do two transactions/rollbacks with plain DBI and prepare_cached,
I get this error at the end of the script:
DBD::Sybase::st DESTROY failed: OpenClient message: LAYER = (1) ORIGIN = (1) SEVERITY = (1) NUMBER = (159)
Server server, database
Message String: ct_cmd_drop(): user api layer: external error: This routine can be called only if the command structure is idle.
This also confirms that there might be a statement handle which
is not finished.
Although this points to DBD::Sybase I thought I ask here, since
it looks like there is a lot of magic in Storage::DBI::* and the
author(s) maybe know about the problem.
I'm glad for any hints. The current workarounds could be to
turn of prepare_cached, or to disconnect dbh after a rollback
Re: Problem with Sybase, Rollbacks and prepare_cached
On Sat, 14 Mar 2015, Peter Rabbitson wrote:
> On 03/13/2015 06:23 PM, Tina Müller wrote:
>> I am working with Sybase Open Client libs and the latest
> Before we go further with "remote debugging" - is this something I can
> potentially recreate on a local install of Sybase? What sort of free/dev
> versions are there available? If nothing like this exists - would it be
> possible to get me a personal temporary accunt on your RDBMS so I can
> determine its behavior?
For the record: We are discussing this (possibility of
local debugging) further on IRC.
As far as I was told one should be able to get a free Sybase developer
version which includes the Sybase Open Client libraries.
Installing it independently from the Sybase server seems
to be more complicated.
We are working on a fresh test instance that can reproduce