Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.07.02;
Скачать: CL | DM;

Вниз

KOL oledb   Найти похожие ветки 

 
Brandys   (2005-10-19 15:04) [0]

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


 
Boguslaw   (2005-10-19 15:15) [1]

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;



 
ECM ©   (2005-10-19 15:18) [2]

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) [3]

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:20) [4]

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:24) [5]


> 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:29) [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)


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

ECm,where i can find isoLevel values for Starttransaction?


 
ECM ©   (2005-10-19 15:43) [8]


> 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:58) [9]

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

ISOLATIONLEVEL_SERIALIZABLE = ?


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

ok.found something but not sure:

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

could someone confirm that ?


 
ECM ©   (2005-10-19 16:16) [11]

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;



Страницы: 1 вся ветка

Текущий архив: 2006.07.02;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.028 c
2-1150014942
Mozgan
2006-06-11 12:35
2006.07.02
TreeView - сломать голову или как правильно работать


2-1150186618
Nikolaich
2006-06-13 12:16
2006.07.02
Как написать такое условие красиво и короче по возможности?


15-1149672449
Карелин Артем
2006-06-07 13:27
2006.07.02
Полный перенос дельфи 7 с одного компа на другой.Что посоветуете?


2-1150390279
T54
2006-06-15 20:51
2006.07.02
Надо проиграть avi- файл


9-1131483653
Кефир87
2005-11-09 00:00
2006.07.02
Текстурные... фейсы?!