Article View: borland.public.cppbuilder.database.dbexpress
Article #170Re: What hard is find info...
From: 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
Technical Details
Message-ID:
<46de6923@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46dc125a@newsgroups.borland.com> <46DC1977.3050509@BobSwart.com>Show Full Headers
Complete Article Headers
X-Google-Thread: fb4e2,38bfd6ce5e95b55c X-Google-Attributes: gidfb4e2,public,usenet X-Google-Language: ENGLISH,ASCII From: "juanma" <juanmmm@cajamar.es> Newsgroups: borland.public.cppbuilder.database.dbexpress References: <46dc125a@newsgroups.borland.com> <46DC1977.3050509@BobSwart.com> Subject: Re: What hard is find info... Date: Wed, 5 Sep 2007 10:30:22 +0200 Lines: 102 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138 NNTP-Posting-Host: 195.57.121.132 Message-ID: <46de6923@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1188981027 195.57.121.132 (5 Sep 2007 01:30:27 -0700) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail