Top.Mail.Ru
Мастера DELPHI, Delphi programming community Титульная страница Поиск, карта сайта Написать письмо 
| Новости | Поиск | FAQ | Статьи | Книги | Новости VCL |
| Форумы ЧАТ | Орешник | KOL и MCK |
Форумы -» Основная («Начинающим»)/ Базы / WinAPI / Компоненты / Сети / Media / Игры / Corba и COM / KOL / FreePascal / .Net / Прочее / RSDN.ORG

« предыдущая ветвь | форум | следующая ветвь »

KOL oledb


Brandys ©   (2005-10-19 15:04:00) 

Is it possible to use transaction (commit/rollback) in KOl oledb object while connected to SQL Server ? I'd like to rollback changes on error


ECM   (2005-10-19 16:16:00) [1]

VC6
transact.h:
typedef
enum ISOLATIONLEVEL
   {   ISOLATIONLEVEL_UNSPECIFIED      = 0xffffffff,
       ISOLATIONLEVEL_CHAOS    = 0x10,
       ISOLATIONLEVEL_READUNCOMMITTED  = 0x100,
       ISOLATIONLEVEL_BROWSE   = 0x100,
       ISOLATIONLEVEL_CURSORSTABILITY  = 0x1000,
       ISOLATIONLEVEL_READCOMMITTED    = 0x1000,
       ISOLATIONLEVEL_REPEATABLEREAD   = 0x10000,
       ISOLATIONLEVEL_SERIALIZABLE     = 0x100000,
       ISOLATIONLEVEL_ISOLATED = 0x100000
   }   ISOLATIONLEVEL;


Boguslaw   (2005-10-19 16:04:00) [2]

ok.found something but not sure:

const
ISOLATIONLEVEL_READCOMMITTED  =  4096;
ISOLATIONLEVEL_REPEATABLEREAD =  65536;
ISOLATIONLEVEL_SERIALIZABLE   =  1048576;

could someone confirm that ?


Boguslaw   (2005-10-19 15:58:00) [3]

hmm,some consts would be helpful for KOL users .I can find these constants under MSDN buti cannot find each values

ISOLATIONLEVEL_SERIALIZABLE = ?


ECM   (2005-10-19 15:43:00) [4]


> ECm,where i can find isoLevel values for Starttransaction?

MSDN... :)

see ITransactionLocal

In local transactions, SQLOLEDB supports ISOLATIONLEVEL_READCOMMITTED, ISOLATIONLEVEL_REPEATABLEREAD, ISOLATIONLEVEL_ISOLATED, and the synonyms ISOLATIONLEVEL_CURSORSTABILITY and ISOLATIONLEVEL_SERIALIZABLE.


Boguslaw   (2005-10-19 15:36:00) [5]

ECm,where i can find isoLevel values for Starttransaction?


Boguslaw   (2005-10-19 15:29:00) [6]

Indeed.I will test it.
But my functions and changes are not added.
Vladimir, could you add those above ? (really useful - on error description occur)


ECM   (2005-10-19 15:24:00) [7]


> ECM,your changes are merged with koledb code available from
> KOL page ( http://xcl.cjb.net) ?

Yes...:)
http://bonanzas.rinet.ru/koledb.zip


Boguslaw   (2005-10-19 15:20:00) [8]

ECM,your changes are merged with koledb code available from KOL page ( http://xcl.cjb.net) ?
if no, could you send me your koledb object ?


ECM   (2005-10-19 15:18:00) [9]

I added these functions:

   function   StartTransaction(isoLevel: Integer): HRESULT;
   function   Commit(Retaining: BOOL): HRESULT;
   function   Rollback(Retaining: BOOL): HRESULT;

in TSesion one and a half year ago. All under the documentation from MSDN. On SQL-Server did not check. On idea should work.


Boguslaw   (2005-10-19 15:18:00) [10]

and my DummyOleerror looks now :
(it add description to message beacuse OLE explanation for error number is hard to find)
Vladimir,please add changes  if you want (i'm out of sync with KOL development currently ,maybe such changes are in place now?)


procedure DummyOleError( Result: HResult );
var
HR : HRESULT;
pIErrorInfo : IErrorInfo;
Source,Description : WideString;
begin
 hr := GetErrorInfo(0,pIErrorInfo);
       // We've got the IErrorInfo interface pointer on the Error object
       if (hr = 0) then
       begin
           pIErrorInfo.GetSource(Source);
           pIErrorInfo.GetDescription(Description);
       end;
//    if Assigned(pIErrorInfo) then  pIErrorInfo._Release;
   ShowMsg( 'OLE DB error ' + Int2Hex( Result, 8 ) + ' [' + Source + '] ' + Description,mb_iconhand);
   Halt;
end;


Boguslaw   (2005-10-19 15:15:00) [11]

by the way i added  two functions to koledb which are useful:
NoOleError simply save oleerror to log file


procedure ShowLastOleError;
var
hr : HRESULT;
pIErrorInfo : IErrorInfo;
Source,Description : WideString;
begin
 hr := GetErrorInfo(0,pIErrorInfo);
       // We've got the IErrorInfo interface pointer on the Error object
       if (hr = 0) then
       begin
           pIErrorInfo.GetSource(Source);
           pIErrorInfo.GetDescription(Description);
       end;
//    if Assigned(pIErrorInfo) then  pIErrorInfo._Release;
   ShowMsg('OLE DB error ' + ' [' + Source + '] ' + Description,mb_iconhand);
end;

procedure NoOleError( Result: HResult );
var
HR : HRESULT;
pIErrorInfo : IErrorInfo;
Source,Description : WideString;
begin
hr := GetErrorInfo(0,pIErrorInfo);
   if (hr = 0) then
   begin
     pIErrorInfo.GetSource(Source);
     pIErrorInfo.GetDescription(Description);
   end;
 LogFileOutput(GetStartDir + 'error.log','OLE DB error ' + Int2Hex( Result, 8 ) + ' [' + Source + '] ' + Description);

end;


Наверх

Титульная страница Поиск, карта сайта Написать письмо