Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2006.07.02;
Скачать: [xml.tar.bz2];

Вниз

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 вся ветка

Форум: "KOL";
Текущий архив: 2006.07.02;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.016 c
6-1140525744
AlexEgorov
2006-02-21 15:42
2006.07.02
Почему не получается получить адрес хоста для TCP/IP порта


1-1148213533
Windows
2006-05-21 16:12
2006.07.02
Работа с CD-RW


2-1149755228
VitV
2006-06-08 12:27
2006.07.02
Хранение паролей в Базе


6-1139673511
Перископ
2006-02-11 18:58
2006.07.02
отправка SMS


15-1149290299
SergProger
2006-06-03 03:18
2006.07.02
Посоветуйте язык





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский