Главная страница
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.033 c
2-1150180812
tvik
2006-06-13 10:40
2006.07.02
работа с Word


1-1148406755
Juice
2006-05-23 21:52
2006.07.02
Вывести в меню список окон моего приложения


2-1150180566
Тимофей Юрьевич
2006-06-13 10:36
2006.07.02
передача файлов по сети


15-1149281702
тт
2006-06-03 00:55
2006.07.02
Как сделать чтобы при наведении мушки на слово в RichEdit, оно выделялось другим цветом?


2-1150301668
VitV
2006-06-14 20:14
2006.07.02
настройка транзакции