Главная страница
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.039 c
1-1148288513
TSa
2006-05-22 13:01
2006.07.02
Узнать путь к общей папке


11-1129729491
Dmitry Galin
2005-10-19 17:44
2006.07.02
KOL & BDS 2005?


15-1149513475
infom
2006-06-05 17:17
2006.07.02
Компоненты для работы с большими целыми числами.


15-1149708868
Kolan
2006-06-07 23:34
2006.07.02
Помогите скомпилить проект на C++


2-1150125729
AlexanderMS
2006-06-12 19:22
2006.07.02
Отличие Packed Record от просто Record.