Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Content Management (Extended ECM)
CSIDE and OScript
EndTrans(false) rolls back updates made before its StartTrans?
Kevin_Lin
I noticed a transaction issue with the following source code: // log indicates the following update is not in any transaction CAPI.EXEC(dbconn,"update mytable set status='OK' where ID=123") // open transaction prgCtx.fDbConnect.StartTrans() retval = dosomething() // close transaction prgCtx.fDbConnect.EndTrans(retVal.ok) When retval.ok=false returned, the EndTrans statement rolled back my status update as well as changes made in dosomething(). Looks like a EndTrans(false) can roll back an uncommitted update that is made before its StartTrans statement.
Find more posts tagged with
Comments
Kevin_Lin
Sorry for the funny '@'I noticed a transaction issue with the following source code: // log indicates the following update is not in any transaction CAPI.EXEC(dbconn,"update mytable set status='OK' where ID=123") // open transaction prgCtx.fDbConnect.StartTrans() retval = dosomething() // close transaction prgCtx.fDbConnect.EndTrans(retVal.ok) When retval.ok=false returned, the EndTrans statement rolled back my status update as well as changes made in dosomething(). Looks like a EndTrans(false) can roll back an uncommitted update that is made before its StartTrans statement.
sıɹɥɔ
Message from Chris Webster <
cwebster@opentext.com
> via eLink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
Hi Kevin,
EndTrans(false) is not explicitly rolling back your uncommitted update, but it is happening as a side-effect by the underlying database. Livelink is rolling back everything between StartTrans/EndTrans; it's just that the database has implicitly included an earlier statement in the transaction.
The log message you saw from the earlier statement is Livelink saying the statement is not in its Livelink transaction. The database didn't tell you that it was in
its
transaction though. :-)
-chris
From:
eLink Discussion: Livelink Builder Discussion [mailto:componentbuilder@elinkkc.opentext.com]
Sent:
Wednesday, August 29, 2007 5:08 AM
To:
eLink Recipient
Subject:
Source code not posted properly, try again
Source code not posted properly, try again
Posted by
kvlin
(Lin, Kevin) on 08/29/2007 05:57 AM
In reply to:
EndTrans(false) rolls back updates made before its StartTrans?
Posted by
kvlin
(Lin, Kevin) on 08/29/2007 05:54 AM
Sorry for the funny '@'
I noticed a transaction issue with the following source code:
// log indicates the following update is not in any transaction
CAPI.EXEC(dbconn,"update mytable set status='OK' where ID=123")
// open transaction
prgCtx.fDbConnect.StartTrans()
retval = dosomething()
// close transaction
prgCtx.fDbConnect.EndTrans(retVal.ok)
When retval.ok=false returned, the EndTrans statement rolled back my status update as well as changes made in dosomething(). Looks like a EndTrans(false) can roll back an uncommitted update that is made before its StartTrans statement.
Kevin_Lin
Message from Kevin Lin via eLinkSo the DB's implicit transaction will get committed/rolled back by an explicit LL transaction close?Are my following assumptions correct?- A Livelink update without LL transaction will trigger an implicit DB transaction- A LL transaction close statement will commit/rollback updates between its start/end as well as any implicit DB transactions- Implicit DB transaction will be closed and committed automatically if no explicit LL transaction close is encounteredeLink Discussion: Livelink Builder Discussion wrote:>> ------------------------------------------------------------------------>> *RE Source code not posted properly, try again > * > Posted by cwebster (Webster, Chris) on > 08/29/2007 12:47 PM> In reply to: Source code not posted properly, try again > > Posted by kvlin (Lin, Kevin) on 08/29/2007 > 05:57 AM>> > /Message from Chris Webster > via eLink/>> Hi Kevin,> > EndTrans(false) is not explicitly rolling back your uncommitted > update, but it is happening as a side-effect by the underlying > database. Livelink is rolling back everything between > StartTrans/EndTrans; it's just that the database has implicitly > included an earlier statement in the transaction. > > The log message you saw from the earlier statement is Livelink saying > the statement is not in its Livelink transaction. The database didn't > tell you that it was in *its* transaction though. :-)> > -chris>> > ------------------------------------------------------------------------> *From:* eLink Discussion: Livelink Builder Discussion > [mailto:componentbuilder@elinkkc.opentext.com]> *Sent:* Wednesday, August 29, 2007 5:08 AM> *To:* eLink Recipient> *Subject:* Source code not posted properly, try again>> >> *Source code not posted properly, try again > * > Posted by kvlin (Lin, Kevin) on 08/29/2007 > 05:57 AM> In reply to: EndTrans(false) rolls back updates made before its > StartTrans? > > Posted by kvlin (Lin, Kevin) on 08/29/2007 > 05:54 AM>> > Sorry for the funny '@'>> I noticed a transaction issue with the following source code:>> // log indicates the following update is not in any transaction> CAPI.EXEC(dbconn,"update mytable set status='OK' where ID=123")>> // open transaction> prgCtx.fDbConnect.StartTrans()>> retval = dosomething()>> // close transaction> prgCtx.fDbConnect.EndTrans(retVal.ok)>> When retval.ok=false returned, the EndTrans statement rolled back my > status update as well as changes made in dosomething(). Looks like a > EndTrans(false) can roll back an uncommitted update that is made > before its StartTrans statement.>> ------------------------------------------------------------------------> /[To reply to this thread, use your normal E-mail reply function.]/> Topic: EndTrans(false) rolls back updates made before its StartTrans? > > Discussion: Livelink Builder Discussion > > Livelink Server: Knowledge Center > >> To Unsubscribe from this Discussion, send an e-mail to > unsubscribe.componentbuilder@elinkkc.opentext.com > . >>
sıɹɥɔ
Message from Chris Webster <
cwebster@opentext.com
> via eLink
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">eLink
Livelink doesn't implement transactions directly: it uses the underlying database system. The behavior you'd see when mixing database calls inside and outside Livelink transactions is dependent on the database system in use.
To answer your questions:
- No process can talk to a database without a transaction being in place (either implicit or explicit). If you don't use Livelink transactions then the database system will create a db transaction implicitly, and behave according to how it has been defined/setup.
- If you're asking about the "topmost" Livelink transaction then yes, a Livelink close transaction will commit/rollback the database transaction. If you've submitted statements outside of the Livelink transaction though, then it's undefined (by Livelink) as to whether the database system will include them in the transaction. A database may be setup to automatically commit the previous statement (as you expected) or be included in the db transaction (as you experienced).
Without knowing any details of what you're trying to implement I'd suggest you include your first update in a Livelink transaction; either its own, or with the subsequent statements, depending on the desired logic. This avoids having to understand implicit transactions or being dependent on the details of the specific database that your Livelink is running on.
-chris
From:
eLink Discussion: Livelink Builder Discussion [mailto:componentbuilder@elinkkc.opentext.com]
Sent:
Wednesday, August 29, 2007 2:13 PM
To:
eLink Recipient
Subject:
Re RE Source code not posted properly, try again
Re RE Source code not posted properly, try again
Posted by
kvlin
(Lin, Kevin) on 08/29/2007 03:12 PM
In reply to:
RE Source code not posted properly, try again
Posted by
cwebster
(Webster, Chris) on 08/29/2007 12:47 PM
Message from Kevin Lin <kevin@linkecm.com> via eLink
So the DB's implicit transaction will get committed/rolled back by an
explicit LL transaction close?
Are my following assumptions correct?
- A Livelink update without LL transaction will trigger an implicit DB
transaction
- A LL transaction close statement will commit/rollback updates between
its start/end as well as any implicit DB transactions
- Implicit DB transaction will be closed and committed automatically if
no explicit LL transaction close is encountered
eLink Discussion: Livelink Builder Discussion wrote:
>
> ------------------------------------------------------------------------
>
>
> /Message from Chris Webster <cwebster@opentext.com
> <
mailto:cwebster@opentext.com
>> via eLink/
>
> Hi Kevin,
>
> EndTrans(false) is not explicitly rolling back your uncommitted
> update, but it is happening as a side-effect by the underlying
> database. Livelink is rolling back everything between
> StartTrans/EndTrans; it's just that the database has implicitly
> included an earlier statement in the transaction.
>
> The log message you saw from the earlier statement is Livelink saying
> the statement is not in its Livelink transaction. The database didn't
> tell you that it was in *its* transaction though. :-)
>
> -chris
>
>
> ------------------------------------------------------------------------
> *From:* eLink Discussion: Livelink Builder Discussion
> [
mailto:componentbuilder@elinkkc.opentext.com
]
> *Sent:* Wednesday, August 29, 2007 5:08 AM
> *To:* eLink Recipient
> *Subject:* Source code not posted properly, try again
>
>
> Sorry for the funny '@'
>
> I noticed a transaction issue with the following source code:
>
> // log indicates the following update is not in any transaction
> CAPI.EXEC(dbconn,"update mytable set status='OK' where ID=123")
>
> // open transaction
> prgCtx.fDbConnect.StartTrans()
>
> retval = dosomething()
>
> // close transaction
> prgCtx.fDbConnect.EndTrans(retVal.ok)
>
> When retval.ok=false returned, the EndTrans statement rolled back my
> status update as well as changes made in dosomething(). Looks like a
> EndTrans(false) can roll back an uncommitted update that is made
> before its StartTrans statement.
>
> ------------------------------------------------------------------------
>
>
Kevin_Lin
Message from Kevin Lin via eLinkThanks, that helps.eLink Discussion: Livelink Builder Discussion wrote:>> ------------------------------------------------------------------------>> *RE Re RE Source code not posted properly, try again > * > Posted by cwebster (Webster, Chris) on > 08/29/2007 04:50 PM> In reply to: Re RE Source code not posted properly, try again > > Posted by kvlin (Lin, Kevin) on 08/29/2007 > 03:12 PM>> > /Message from Chris Webster > via eLink/>> Livelink doesn't implement transactions directly: it uses the > underlying database system. The behavior you'd see when mixing > database calls inside and outside Livelink transactions is dependent > on the database system in use.> > To answer your questions:> > - No process can talk to a database without a transaction being in > place (either implicit or explicit). If you don't use Livelink > transactions then the database system will create a db transaction > implicitly, and behave according to how it has been defined/setup.> > - If you're asking about the "topmost" Livelink transaction then yes, > a Livelink close transaction will commit/rollback the database > transaction. If you've submitted statements outside of the Livelink > transaction though, then it's undefined (by Livelink) as to whether > the database system will include them in the transaction. A database > may be setup to automatically commit the previous statement (as you > expected) or be included in the db transaction (as you experienced).> > > Without knowing any details of what you're trying to implement I'd > suggest you include your first update in a Livelink transaction; > either its own, or with the subsequent statements, depending on the > desired logic. This avoids having to understand implicit transactions > or being dependent on the details of the specific database that your > Livelink is running on.> > -chris> >> ------------------------------------------------------------------------> *From:* eLink Discussion: Livelink Builder Discussion > [mailto:componentbuilder@elinkkc.opentext.com]> *Sent:* Wednesday, August 29, 2007 2:13 PM> *To:* eLink Recipient> *Subject:* Re RE Source code not posted properly, try again>> >> *Re RE Source code not posted properly, try again > * > Posted by kvlin (Lin, Kevin) on 08/29/2007 > 03:12 PM> In reply to: RE Source code not posted properly, try again > > Posted by cwebster (Webster, Chris) on > 08/29/2007 12:47 PM>> > Message from Kevin Lin via eLink>> So the DB's implicit transaction will get committed/rolled back by an> explicit LL transaction close?>> Are my following assumptions correct?>> - A Livelink update without LL transaction will trigger an implicit DB> transaction> - A LL transaction close statement will commit/rollback updates between> its start/end as well as any implicit DB transactions> - Implicit DB transaction will be closed and committed automatically if> no explicit LL transaction close is encountered>>>> eLink Discussion: Livelink Builder Discussion wrote:> >> > > ------------------------------------------------------------------------> > > >> > /Message from Chris Webster > > via eLink/> >> > Hi Kevin,> >> > EndTrans(false) is not explicitly rolling back your uncommitted> > update, but it is happening as a side-effect by the underlying> > database. Livelink is rolling back everything between> > StartTrans/EndTrans; it's just that the database has implicitly> > included an earlier statement in the transaction.> >> > The log message you saw from the earlier statement is Livelink saying> > the statement is not in its Livelink transaction. The database didn't> > tell you that it was in *its* transaction though. :-)> >> > -chris> >> >> > > ------------------------------------------------------------------------> > *From:* eLink Discussion: Livelink Builder Discussion> > [mailto:componentbuilder@elinkkc.opentext.com]> > *Sent:* Wednesday, August 29, 2007 5:08 AM> > *To:* eLink Recipient> > *Subject:* Source code not posted properly, try again> > > >> > Sorry for the funny '@'> >> > I noticed a transaction issue with the following source code:> >> > // log indicates the following update is not in any transaction> > CAPI.EXEC(dbconn,"update mytable set status='OK' where ID=123")> >> > // open transaction> > prgCtx.fDbConnect.StartTrans()> >> > retval = dosomething()> >> > // close transaction> > prgCtx.fDbConnect.EndTrans(retVal.ok)> >> > When retval.ok=false returned, the EndTrans statement rolled back my> > status update as well as changes made in dosomething(). Looks like a> > EndTrans(false) can roll back an uncommitted update that is made> > before its StartTrans statement.> >> > > ------------------------------------------------------------------------> >> >>> ------------------------------------------------------------------------> /[To reply to this thread, use your normal E-mail reply function.]/> Topic: EndTrans(false) rolls back updates made before its StartTrans? > > Discussion: Livelink Builder Discussion > > Livelink Server: Knowledge Center > >> To Unsubscribe from this Discussion, send an e-mail to > unsubscribe.componentbuilder@elinkkc.opentext.com > . >>