Thread View: borland.public.cppbuilder.database.dbexpress
3 messages
3 total messages
Started by juanma
Mon, 03 Sep 2007 13:55
What hard is find info...
Author: juanma
Date: Mon, 03 Sep 2007 13:55
Date: Mon, 03 Sep 2007 13:55
15 lines
1167 bytes
1167 bytes
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.
Re: What hard is find info...
Author: Bob Swart
Date: Mon, 03 Sep 2007 14:25
Date: Mon, 03 Sep 2007 14:25
22 lines
1798 bytes
1798 bytes
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
Re: What hard is find info...
Author: juanma
Date: Wed, 05 Sep 2007 08:30
Date: Wed, 05 Sep 2007 08:30
100 lines
3531 bytes
3531 bytes
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" <Bob@BobSwart.com> escribi๏ฟฝ en el mensaje
news:46DC1977.3050509@BobSwart.com...
> 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads