Whoops, you're right.  I missed that.

If it were my job to make this code work (and thank God it's not :-)  ), I
would first try to make it less complicated.  I don't see any reason to be
mucking with the data object inside the block that begins and commits the
transaction.  I would set up the data object based on the runtime
condition, and only then try to create and execute the transaction.

Just from seeing these statements repeated just downstream from the first
occurrence:
doLabTestReqAll.setSqlTextFullUpdate(strSqlStmt);
                       tranMainLabReq.executeUpdate(doLabTestReqAll);

I would say that there has got to be a way to streamline this.

-- Curt Springer, Team ND



At 09:11 AM 6/11/99 -0700, Mark Bean wrote:
>Curt -
>
>Doesn't the second line of the 'try' execute 'begin' on the just created
>transaction?
>
>Mark (facing an identical situation...)
>
>Curt Springer wrote:
>
>> You need to execute 'begin' on your CSpTransaction to begin the
transaction.
>>
>> -- Curt Springer, Team ND
>>
>> At 08:26 PM 6/11/99 +0530, Deepak Kumar Adhikary wrote:
>> >Hi,
>> >
>> >I am doing a full manual CspTransaction using CSpMultiSQL  in the foll.
>> >fashion :
>> >
>> >CSpTransaction tranMainLabReq = null;
>> >CSpMultiSQL doLabTestReqAll = (CSpMultiSQL) CSpider.getDataObject
>> >("doLabTestReqAll");
>> >CSpMultiSQL doLabTestCellAll = (CSpMultiSQL) CSpider.getDataObject
>> >("doLabTestCellAll");
>> >
>> >try
>> >{
>> >       tranMainLabReq = new CSpTransaction();
>> >       if (tranMainLabReq.begin ("dsLtrs"))
>> >       {
>> >       if ( strMode.equals("TRUE"))
>> >               {
>> >
>> >doLabTestReqAll.setSqlTextOverrideInsert(CSpSQLObject.FULL_TEXT_OVERRIDE
>> >);
>> >
>> >doLabTestReqAll.setSqlTextFullInsert(strSqlStmt);
>> >                       tranMainLabReq.executeInsert(doLabTestReqAll);
>> >               }
>> >               else
>> >               {
>> >
>> >doLabTestReqAll.setSqlTextOverrideUpdate(CSpSQLObject.FULL_TEXT_OVERRIDE
>> >);
>> >
>> >doLabTestReqAll.setSqlTextFullUpdate(strSqlStmt);
>> >                       tranMainLabReq.executeUpdate(doLabTestReqAll);
>> >
>> >               }
>> >
>> >               if (tranMainLabReq.succeeded())
>> >               {
>> >               Some more processing goes on and some dataobjects for
>> >this transaction get executed.
>> >               ------
>> >               ------
>> >               ------
>> >
>> >               At the end for the last
>> >               if (tranMainLabReq.succeeded ())
>> >               {
>> >
>> >                               if (tranMainLabReq.isActive())
>> >                               CSpLog.send(this, CSpLog.CRITICAL, "
>> >TRANSACTION ACTIVE 10");
>> >
>> >                               tranMainLabReq.commit ();
>> >
>> >                               if ( tranMainLabReq.commit() )
>> >                               CSpLog.send(this, CSpLog.CRITICAL,
>> >"Transaction commited");
>> >               }
>> >               else Rollback.
>> >
>> >}
>> >
>> >Now the problem I am facing is it comes all the way to the log
>> >"TRANSACTION ACTIVE 10" ( meaning the transaction is active ) but as
>> >soon as it encounters the commit statement it gives the following
>> >message :
>> >
>> >spider.database.CSpTransaction.commit: Called when database transaction
>> >is NOT 'active'. Call has been ignored
>> >
>> >And thereafter the log "Transaction commited" is not shown. As a result
>> >the tables are not getting updated. This is quite weird as the
>> >transaction is showing up as active till the end but actually not
>> >committing. I have put a log
>> >" TRANSACTION ACTIVE n " at each tranMainLabReq.executeUpdate/Insert(
>> >dataobject ). The flow of logic goes on after checking
>> >(tranMainLabReq.succeeded()) .
>> >

>> >I am not able to understand why this strange thing is happening. Are the
>> >setSqlTextOverrideUpdate( ) or setSqlTextFullUpdate(strSqlStmt) are
>> >failing or is there any thing else to be done which I am missing out ?
>> >
>> >Any help would be highly appreciated.
>> >
>> >Regards
>> >Deepak
>> >_________________________________________________________________________
>> >
>> >For help in using, subscribing, and unsubscribing to the discussion
>> >forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>> >
>> >For dire need help, email: [EMAIL PROTECTED]
>> >
>> _________________________________________________________________________
>>
>> For help in using, subscribing, and unsubscribing to the discussion
>> forums, please go to: http://www.netdynamics.com/support/visitdevfor.html
>>
>> For dire need help, email: [EMAIL PROTECTED]
> 
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to