Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What hard is find info...

0 views
Skip to first unread message

juanma

unread,
Sep 3, 2007, 9:55:40 AM9/3/07
to
Hi,
For the people that need transactions this work (how many try and error!!)
( kCn is a TSQLConnection)

TTransactionDesc Tr;
Tr.TransactionID = 1;
Tr.IsolationLevel = Sqlexpr::xilREADCOMMITTED; //the problem, i found
SqlExpr in some help!
kCn->StartTransaction(Tr);

//.... your updates / insert / deletes...

kCn->Commit(Tr);

That is all.


Bob Swart

unread,
Sep 3, 2007, 10:25:59 AM9/3/07
to
Hi juanma,

> For the people that need transactions this work (how many try and error!!)

Note that your code shows the pre-DBX4 way (the deprecated way) of using
transactions in dbExpress...

Prior to DBX4, we had to call the StartTransaction, Commit, and RollBack
methods of TSQConnection. However, these methods are now deprecated, and
we should now use the new (DBX4) methods called BeginTransaction,
CommitFreeAndNil, and RollBackFreeAndNil of the TSQLConnection component
instead of the deprecated methods.

And you need to use DBXCommon and SqlExpr now instead of the dbExpress unit.

Groetjes,
Bob Swart

--
Bob Swart Training & Consultancy (eBob42.com) Forever Loyal to Delphi
CodeGear Technology Partner -- CodeGear RAD Studio Reseller (BeNeLux)
Blog: http://www.drbob42.com/blog - RSS: http://eBob42.com/weblog.xml

juanma

unread,
Sep 5, 2007, 4:30:22 AM9/5/07
to
Hi Bob,
Thak you very much for the info.
I have a class that interface between the object DBX (before and still in
many aplications i do with ADO through odbc) and my code, that allowe me to
change this class without touch my code...

now:
// resto cmoddb5
//---------------------------------------------------------------------------
__fastcall XTDM::XTDM()
{
//MLG.NameMLg(ExtractFileName(Application->ExeName).Sub
// String(1, cFN.Pos(".")-1));
kCn = new TSQLConnection(0);

kCn->DriverName = "MySQL";
kCn->LibraryName = "dbxmys30.dll";
kCn->VendorLib = "libmysql.dll";
kCn->GetDriverFunc = "getSQLDriverMYSQL";
kCn->LoginPrompt = false;

Rs = NULL;
lOk = nLG = 0; //nlr = 0;
}

//---------------------------------------------------------------------------
__fastcall XTDM::~XTDM()
{
if (Rs) { //nlr>0)
Rs->Close();
delete Rs;
}
if (kCn->Connected)
kCn->Close();

lOk = nLG = 0;
delete kCn;
}
//---------------------------------------------------------------------------

void XTDM::OpenCn()
{
kCn->Open();
}
//---------------------------------------------------------------------------

void XTDM::BeginTrans()
{
//TDBXTransaction *Tr private to XTDM
Tr = kCn->BeginTransaction();
}
void XTDM::CloseCn()
{
if (kCn->Connected)
kCn->Close();
}
void XTDM::CommitTrans()
{
kCn->CommitFreeAndNil(Tr);
}
void XTDM::RollbackTrans()
{
kCn->RollbackFreeAndNil(Tr);
}
//...more metod...

I tried that code and work ok (like before but...)

Thank again

Juanma

"Bob Swart" <B...@BobSwart.com> escribió en el mensaje
news:46DC1977...@BobSwart.com...

0 new messages