Dear Rao Sir,
May I request to share the example of Maria DB Rowset Batch Operation in which record add / Modify / Delete and finally save the data in batch mode. Thanks in advance..!
Thanks
Shridhar
oRs := oCn:RowSet( cSql )
oRs:SetBatchMode( .t. )
XBROWSER oRs FASTEDIT
if oRs:IsBatchEdited()
if MsgYesNo( "Save Changes?" )
oRs:SaveBatch()
else
oRs:CancelBatch()
endif
endif
XBROWSER oRs
aSql := { "UPDATE table1 ... WHERE ... ", ;
"UPDATE table2 ... WHERE ... ", ;
..more.., ;
}
if WriteAllOrNone( oCn, aSql )
? "Written"
else
? "fail"
endif
//-------------------------------
function WriteAllOrNone( oCn, aSql )
local cUpdateSql
oCn:BeginTransaction()
for each cUpdateSql IN aSql
oCn:Execute( cSql )
if oCn:nError != 0
oCn:RollBack()
return .f.
endif
next
oCn:CommmitTransaction()
return .t.
oRs := oCn:RowSet( cSql )
oRs:SetBatchMode( .t. )
oCn:SaveBatch() // write all changes
oCn:CancelBatch() // discard all changes
BEGIN SEQUENC
oCn:BeginTransaction()
oCn:Insert(...)
oCn:Insert(...)
oCn:Insert(...)
oCn:CommitTransaction()
RECOVER USING oError
oCn:RollBack()
END SEQUENC
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 84 guests