mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 16:09:25 +02:00
* Implemented transaction-support, based on patch from Inoussa Ouedraogo,
bug #13420 * Explicetely cast error-buffer to pchar * Allocate and de-allocate statement handles while preparing and unpreparing a statement, because when an error occurs and the transaction is closed, OCI automatically frees all bound statement handles. Which results in a second try to free the handle if that is done in DeAllocateCursorHandle * Oracle supports escaping quotes by repeating them git-svn-id: trunk@13002 -
This commit is contained in:
parent
934a6b159f
commit
3509008c60
@ -15,6 +15,9 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
oratypes;
|
oratypes;
|
||||||
|
|
||||||
|
const
|
||||||
|
DefaultTimeOut = 60;
|
||||||
|
|
||||||
type
|
type
|
||||||
EOraDatabaseError = class(EDatabaseError)
|
EOraDatabaseError = class(EDatabaseError)
|
||||||
public
|
public
|
||||||
@ -22,7 +25,12 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
TOracleTrans = Class(TSQLHandle)
|
TOracleTrans = Class(TSQLHandle)
|
||||||
protected
|
protected
|
||||||
|
FOciSvcCtx : POCISvcCtx;
|
||||||
|
FOciTrans : POCITrans;
|
||||||
|
FOciFlags : ub4;
|
||||||
|
public
|
||||||
|
destructor Destroy(); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TOraFieldBuf = record
|
TOraFieldBuf = record
|
||||||
@ -43,7 +51,8 @@ type
|
|||||||
private
|
private
|
||||||
FOciEnvironment : POciEnv;
|
FOciEnvironment : POciEnv;
|
||||||
FOciError : POCIError;
|
FOciError : POCIError;
|
||||||
FOciSvcCtx : POCISvcCtx;
|
FOciServer : POCIServer;
|
||||||
|
FOciUserSession : POCISession;
|
||||||
FUserMem : pointer;
|
FUserMem : pointer;
|
||||||
procedure HandleError;
|
procedure HandleError;
|
||||||
procedure SetParameters(cursor : TSQLCursor;AParams : TParams);
|
procedure SetParameters(cursor : TSQLCursor;AParams : TParams);
|
||||||
@ -59,6 +68,7 @@ type
|
|||||||
procedure PrepareStatement(cursor:TSQLCursor; ATransaction:TSQLTransaction; buf:string; AParams:TParams); override;
|
procedure PrepareStatement(cursor:TSQLCursor; ATransaction:TSQLTransaction; buf:string; AParams:TParams); override;
|
||||||
procedure UnPrepareStatement(cursor:TSQLCursor); override;
|
procedure UnPrepareStatement(cursor:TSQLCursor); override;
|
||||||
// - Transaction handling
|
// - Transaction handling
|
||||||
|
procedure InternalStartDBTransaction(trans:TOracleTrans);
|
||||||
function GetTransactionHandle(trans:TSQLHandle):pointer; override;
|
function GetTransactionHandle(trans:TSQLHandle):pointer; override;
|
||||||
function StartDBTransaction(trans:TSQLHandle; AParams:string):boolean; override;
|
function StartDBTransaction(trans:TSQLHandle; AParams:string):boolean; override;
|
||||||
function Commit(trans:TSQLHandle):boolean; override;
|
function Commit(trans:TSQLHandle):boolean; override;
|
||||||
@ -86,7 +96,8 @@ type
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses math;
|
uses
|
||||||
|
math, StrUtils;
|
||||||
|
|
||||||
ResourceString
|
ResourceString
|
||||||
SErrEnvCreateFailed = 'The creation of an Oracle environment failed.';
|
SErrEnvCreateFailed = 'The creation of an Oracle environment failed.';
|
||||||
@ -103,9 +114,9 @@ begin
|
|||||||
OCIErrorGet(FOciError,1,nil,errcode,@buf[0],1024,OCI_HTYPE_ERROR);
|
OCIErrorGet(FOciError,1,nil,errcode,@buf[0],1024,OCI_HTYPE_ERROR);
|
||||||
|
|
||||||
if (Self.Name <> '') then
|
if (Self.Name <> '') then
|
||||||
E := EOraDatabaseError.CreateFmt('%s : %s',[Self.Name,buf])
|
E := EOraDatabaseError.CreateFmt('%s : %s',[Self.Name,pchar(buf)])
|
||||||
else
|
else
|
||||||
E := EOraDatabaseError.Create(buf);
|
E := EOraDatabaseError.Create(pchar(buf));
|
||||||
|
|
||||||
E.ORAErrorCode := errcode;
|
E.ORAErrorCode := errcode;
|
||||||
Raise E;
|
Raise E;
|
||||||
@ -113,7 +124,9 @@ end;
|
|||||||
|
|
||||||
procedure TOracleConnection.DoInternalConnect;
|
procedure TOracleConnection.DoInternalConnect;
|
||||||
|
|
||||||
var ConnectString : string;
|
var
|
||||||
|
ConnectString : string;
|
||||||
|
TempServiceContext : POCISvcCtx;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{$IfDef LinkDynamically}
|
{$IfDef LinkDynamically}
|
||||||
@ -121,30 +134,77 @@ begin
|
|||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
|
||||||
inherited DoInternalConnect;
|
inherited DoInternalConnect;
|
||||||
|
//todo: get rid of FUserMem, as it isn't used
|
||||||
FUserMem := nil;
|
FUserMem := nil;
|
||||||
|
|
||||||
|
// Create environment handle
|
||||||
if OCIEnvCreate(FOciEnvironment,oci_default,nil,nil,nil,nil,0,FUserMem) <> OCI_SUCCESS then
|
if OCIEnvCreate(FOciEnvironment,oci_default,nil,nil,nil,nil,0,FUserMem) <> OCI_SUCCESS then
|
||||||
DatabaseError(SErrEnvCreateFailed,self);
|
DatabaseError(SErrEnvCreateFailed,self);
|
||||||
|
// Create error handle
|
||||||
if OciHandleAlloc(FOciEnvironment,FOciError,OCI_HTYPE_ERROR,0,FUserMem) <> OCI_SUCCESS then
|
if OciHandleAlloc(FOciEnvironment,FOciError,OCI_HTYPE_ERROR,0,FUserMem) <> OCI_SUCCESS then
|
||||||
DatabaseError(SErrHandleAllocFailed,self);
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
// Create Server handle
|
||||||
|
if OciHandleAlloc(FOciEnvironment,FOciServer,OCI_HTYPE_SERVER,0,FUserMem) <> OCI_SUCCESS then
|
||||||
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
// Initialize Server handle
|
||||||
if hostname='' then connectstring := databasename
|
if hostname='' then connectstring := databasename
|
||||||
else connectstring := '//'+hostname+'/'+databasename;
|
else connectstring := '//'+hostname+'/'+databasename;
|
||||||
|
if OCIServerAttach(FOciServer,FOciError,@(ConnectString[1]),Length(ConnectString),OCI_DEFAULT) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
|
||||||
if OCILogon2(FOciEnvironment,FOciError,FOciSvcCtx,@username[1],length(username),@password[1],length(password),@connectstring[1],length(connectstring),OCI_DEFAULT) = OCI_ERROR then
|
// Create temporary service-context handle for user-authentication
|
||||||
HandleError;
|
if OciHandleAlloc(FOciEnvironment,TempServiceContext,OCI_HTYPE_SVCCTX,0,FUserMem) <> OCI_SUCCESS then
|
||||||
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
|
||||||
|
// Create user-session handle
|
||||||
|
if OciHandleAlloc(FOciEnvironment,FOciUserSession,OCI_HTYPE_SESSION,0,FUserMem) <> OCI_SUCCESS then
|
||||||
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
// Set the server-handle in the service-context handle
|
||||||
|
if OCIAttrSet(TempServiceContext,OCI_HTYPE_SVCCTX,FOciServer,0,OCI_ATTR_SERVER,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Set username and password in the user-session handle
|
||||||
|
if OCIAttrSet(FOciUserSession,OCI_HTYPE_SESSION,@(Self.UserName[1]),Length(Self.UserName),OCI_ATTR_USERNAME,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
if OCIAttrSet(FOciUserSession,OCI_HTYPE_SESSION,@(Self.Password[1]),Length(Self.Password),OCI_ATTR_PASSWORD,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Authenticate
|
||||||
|
if OCISessionBegin(TempServiceContext,FOciError,FOcIUserSession,OCI_CRED_RDBMS,OCI_DEFAULT) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Free temporary service-context handle
|
||||||
|
OCIHandleFree(TempServiceContext,OCI_HTYPE_SVCCTX);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOracleConnection.DoInternalDisconnect;
|
procedure TOracleConnection.DoInternalDisconnect;
|
||||||
|
var
|
||||||
|
TempServiceContext : POCISvcCtx;
|
||||||
begin
|
begin
|
||||||
inherited DoInternalDisconnect;
|
inherited DoInternalDisconnect;
|
||||||
|
|
||||||
if OCILogoff(FOciSvcCtx,FOciError)<> OCI_SUCCESS then
|
// Create temporary service-context handle for user-disconnect
|
||||||
HandleError;
|
if OciHandleAlloc(FOciEnvironment,TempServiceContext,OCI_HTYPE_SVCCTX,0,FUserMem) <> OCI_SUCCESS then
|
||||||
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
|
||||||
OCIHandleFree(FOciSvcCtx,OCI_HTYPE_SVCCTX);
|
// Set the server handle in the service-context handle
|
||||||
|
if OCIAttrSet(TempServiceContext,OCI_HTYPE_SVCCTX,FOciServer,0,OCI_ATTR_SERVER,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Set the user session handle in the service-context handle
|
||||||
|
if OCIAttrSet(TempServiceContext,OCI_HTYPE_SVCCTX,FOciUserSession,0,OCI_ATTR_SESSION,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Disconnect uses-session handle
|
||||||
|
if OCISessionEnd(TempServiceContext,FOciError,FOcIUserSession,OCI_DEFAULT) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Free user-session handle
|
||||||
|
OCIHandleFree(FOciUserSession,OCI_HTYPE_SESSION);
|
||||||
|
// Free temporary service-context handle
|
||||||
|
OCIHandleFree(TempServiceContext,OCI_HTYPE_SVCCTX);
|
||||||
|
|
||||||
|
// Disconnect server handle
|
||||||
|
if OCIServerDetach(FOciServer,FOciError,OCI_DEFAULT) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
|
||||||
|
// Free connection handles
|
||||||
|
OCIHandleFree(FOciServer,OCI_HTYPE_SERVER);
|
||||||
OCIHandleFree(FOciError,OCI_HTYPE_ERROR);
|
OCIHandleFree(FOciError,OCI_HTYPE_ERROR);
|
||||||
|
|
||||||
OCIHandleFree(FOciEnvironment,OCI_HTYPE_ENV);
|
OCIHandleFree(FOciEnvironment,OCI_HTYPE_ENV);
|
||||||
{$IfDef LinkDynamically}
|
{$IfDef LinkDynamically}
|
||||||
ReleaseOCI;
|
ReleaseOCI;
|
||||||
@ -158,7 +218,6 @@ var Cursor : TOracleCursor;
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Cursor:=TOracleCursor.Create;
|
Cursor:=TOracleCursor.Create;
|
||||||
OciHandleAlloc(FOciEnvironment,Cursor.FOciStmt,OCI_HTYPE_STMT,0,FUserMem);
|
|
||||||
Result := cursor;
|
Result := cursor;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -169,7 +228,6 @@ var tel : word;
|
|||||||
begin
|
begin
|
||||||
with cursor as TOracleCursor do
|
with cursor as TOracleCursor do
|
||||||
begin
|
begin
|
||||||
OCIHandleFree(FOciStmt,OCI_HTYPE_STMT);
|
|
||||||
if Length(FieldBuffers) > 0 then
|
if Length(FieldBuffers) > 0 then
|
||||||
for tel := 0 to high(FieldBuffers) do freemem(FieldBuffers[tel].buffer);
|
for tel := 0 to high(FieldBuffers) do freemem(FieldBuffers[tel].buffer);
|
||||||
end;
|
end;
|
||||||
@ -177,8 +235,32 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TOracleConnection.AllocateTransactionHandle: TSQLHandle;
|
function TOracleConnection.AllocateTransactionHandle: TSQLHandle;
|
||||||
|
var
|
||||||
|
locRes : TOracleTrans;
|
||||||
begin
|
begin
|
||||||
Result:=nil;
|
locRes := TOracleTrans.Create();
|
||||||
|
try
|
||||||
|
// Allocate service-context handle
|
||||||
|
if OciHandleAlloc(FOciEnvironment,locRes.FOciSvcCtx,OCI_HTYPE_SVCCTX,0,FUserMem) <> OCI_SUCCESS then
|
||||||
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
// Set the server-handle in the service-context handle
|
||||||
|
if OCIAttrSet(locRes.FOciSvcCtx,OCI_HTYPE_SVCCTX,FOciServer,0,OCI_ATTR_SERVER,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
// Set the user-session handle in the service-context handle
|
||||||
|
if OCIAttrSet(locRes.FOciSvcCtx,OCI_HTYPE_SVCCTX,FOciUserSession,0,OCI_ATTR_SESSION,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
|
||||||
|
// Allocate transaction handle
|
||||||
|
if OciHandleAlloc(FOciEnvironment,locRes.FOciTrans,OCI_HTYPE_TRANS,0,FUserMem) <> OCI_SUCCESS then
|
||||||
|
DatabaseError(SErrHandleAllocFailed,self);
|
||||||
|
// Set the transaction handle in the service-context handle
|
||||||
|
if OCIAttrSet(locRes.FOciSvcCtx,OCI_HTYPE_SVCCTX,locRes.FOciTrans,0,OCI_ATTR_TRANS,FOciError) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
except
|
||||||
|
locRes.Free();
|
||||||
|
raise;
|
||||||
|
end;
|
||||||
|
Result := locRes;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOracleConnection.PrepareStatement(cursor: TSQLCursor;
|
procedure TOracleConnection.PrepareStatement(cursor: TSQLCursor;
|
||||||
@ -193,7 +275,8 @@ var tel : integer;
|
|||||||
begin
|
begin
|
||||||
with cursor as TOracleCursor do
|
with cursor as TOracleCursor do
|
||||||
begin
|
begin
|
||||||
if OCIStmtPrepare(FOciStmt,FOciError,@buf[1],length(buf),OCI_NTV_SYNTAX,OCI_DEFAULT) = OCI_ERROR then
|
OciHandleAlloc(FOciEnvironment,FOciStmt,OCI_HTYPE_STMT,0,FUserMem);
|
||||||
|
if OCIStmtPrepare2(TOracleTrans(ATransaction.Handle).FOciSvcCtx,FOciStmt,FOciError,@buf[1],length(buf),nil,0,OCI_NTV_SYNTAX,OCI_DEFAULT) = OCI_ERROR then
|
||||||
HandleError;
|
HandleError;
|
||||||
if assigned(AParams) then
|
if assigned(AParams) then
|
||||||
begin
|
begin
|
||||||
@ -218,6 +301,7 @@ begin
|
|||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
FPrepared := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -269,37 +353,75 @@ end;
|
|||||||
|
|
||||||
procedure TOracleConnection.UnPrepareStatement(cursor: TSQLCursor);
|
procedure TOracleConnection.UnPrepareStatement(cursor: TSQLCursor);
|
||||||
begin
|
begin
|
||||||
//
|
OCIHandleFree(TOracleCursor(cursor).FOciStmt,OCI_HTYPE_STMT);
|
||||||
|
cursor.FPrepared:=False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TOracleConnection.InternalStartDBTransaction(trans : TOracleTrans);
|
||||||
|
begin
|
||||||
|
if OCITransStart(trans.FOciSvcCtx,FOciError,DefaultTimeOut,trans.FOciFlags) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOracleConnection.GetTransactionHandle(trans: TSQLHandle): pointer;
|
function TOracleConnection.GetTransactionHandle(trans: TSQLHandle): pointer;
|
||||||
begin
|
begin
|
||||||
// Transactions not implemented yet
|
Result := trans;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOracleConnection.StartDBTransaction(trans: TSQLHandle; AParams: string): boolean;
|
function TOracleConnection.StartDBTransaction(trans: TSQLHandle; AParams: string): boolean;
|
||||||
|
var
|
||||||
|
x_flags : ub4;
|
||||||
|
i : Integer;
|
||||||
|
s : string;
|
||||||
|
locTrans : TOracleTrans;
|
||||||
begin
|
begin
|
||||||
// Transactions not implemented yet
|
locTrans := TOracleTrans(trans);
|
||||||
|
if ( Length(AParams) = 0 ) then begin
|
||||||
|
x_flags := OCI_TRANS_NEW or OCI_TRANS_READWRITE;
|
||||||
|
end else begin
|
||||||
|
x_flags := OCI_DEFAULT;
|
||||||
|
i := 1;
|
||||||
|
s := ExtractSubStr(AParams,i,StdWordDelims);
|
||||||
|
while ( s <> '' ) do begin
|
||||||
|
if ( s = 'readonly' ) then
|
||||||
|
x_flags := x_flags and OCI_TRANS_READONLY
|
||||||
|
else if ( s = 'serializable' ) then
|
||||||
|
x_flags := x_flags and OCI_TRANS_SERIALIZABLE
|
||||||
|
else if ( s = 'readwrite' ) then
|
||||||
|
x_flags := x_flags and OCI_TRANS_READWRITE;
|
||||||
|
s := ExtractSubStr(AParams,i,StdWordDelims);
|
||||||
|
end;
|
||||||
|
x_flags := x_flags and OCI_TRANS_NEW;
|
||||||
|
end;
|
||||||
|
locTrans.FOciFlags := x_flags;
|
||||||
|
InternalStartDBTransaction(locTrans);
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOracleConnection.Commit(trans: TSQLHandle): boolean;
|
function TOracleConnection.Commit(trans: TSQLHandle): boolean;
|
||||||
begin
|
begin
|
||||||
// Transactions not implemented yet
|
if OCITransCommit(TOracleTrans(trans).FOciSvcCtx,FOciError,OCI_DEFAULT) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TOracleConnection.Rollback(trans: TSQLHandle): boolean;
|
function TOracleConnection.Rollback(trans: TSQLHandle): boolean;
|
||||||
begin
|
begin
|
||||||
// Transactions not implemented yet
|
if OCITransRollback(TOracleTrans(trans).FOciSvcCtx,FOciError,OCI_DEFAULT) <> OCI_SUCCESS then
|
||||||
|
HandleError();
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOracleConnection.CommitRetaining(trans: TSQLHandle);
|
procedure TOracleConnection.CommitRetaining(trans: TSQLHandle);
|
||||||
begin
|
begin
|
||||||
// Transactions not implemented yet
|
Commit(trans);
|
||||||
|
InternalStartDBTransaction(TOracleTrans(trans));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOracleConnection.RollbackRetaining(trans: TSQLHandle);
|
procedure TOracleConnection.RollbackRetaining(trans: TSQLHandle);
|
||||||
begin
|
begin
|
||||||
// Transactions not implemented yet
|
Rollback(trans);
|
||||||
|
InternalStartDBTransaction(TOracleTrans(trans));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TOracleConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
|
procedure TOracleConnection.Execute(cursor: TSQLCursor; ATransaction: TSQLTransaction; AParams: TParams);
|
||||||
@ -307,12 +429,12 @@ begin
|
|||||||
if Assigned(APArams) and (AParams.count > 0) then SetParameters(cursor, AParams);
|
if Assigned(APArams) and (AParams.count > 0) then SetParameters(cursor, AParams);
|
||||||
if cursor.FStatementType = stSelect then
|
if cursor.FStatementType = stSelect then
|
||||||
begin
|
begin
|
||||||
if OCIStmtExecute(FOciSvcCtx,(cursor as TOracleCursor).FOciStmt,FOciError,0,0,nil,nil,OCI_DEFAULT) = OCI_ERROR then
|
if OCIStmtExecute(TOracleTrans(ATransaction.Handle).FOciSvcCtx,(cursor as TOracleCursor).FOciStmt,FOciError,0,0,nil,nil,OCI_DEFAULT) = OCI_ERROR then
|
||||||
HandleError;
|
HandleError;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if OCIStmtExecute(FOciSvcCtx,(cursor as TOracleCursor).FOciStmt,FOciError,1,0,nil,nil,OCI_DEFAULT) = OCI_ERROR then
|
if OCIStmtExecute(TOracleTrans(ATransaction.Handle).FOciSvcCtx,(cursor as TOracleCursor).FOciStmt,FOciError,1,0,nil,nil,OCI_DEFAULT) = OCI_ERROR then
|
||||||
HandleError;
|
HandleError;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -412,7 +534,7 @@ begin
|
|||||||
setlength(Fieldname,OFNameLength);
|
setlength(Fieldname,OFNameLength);
|
||||||
move(OFieldName^,Fieldname[1],OFNameLength);
|
move(OFieldName^,Fieldname[1],OFNameLength);
|
||||||
|
|
||||||
TFieldDef.Create(FieldDefs, FieldName, FieldType, FieldSize, False, tel);
|
TFieldDef.Create(FieldDefs, FieldDefs.MakeNameUnique(FieldName), FieldType, FieldSize, False, tel);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -502,6 +624,7 @@ end;
|
|||||||
constructor TOracleConnection.Create(AOwner: TComponent);
|
constructor TOracleConnection.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
FConnOptions := FConnOptions + [sqEscapeRepeat];
|
||||||
FUserMem := nil;
|
FUserMem := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -522,6 +645,15 @@ begin
|
|||||||
Result:='Connect to an Oracle database directly via the client library';
|
Result:='Connect to an Oracle database directly via the client library';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TOracleTrans }
|
||||||
|
|
||||||
|
destructor TOracleTrans.Destroy();
|
||||||
|
begin
|
||||||
|
OCIHandleFree(FOciTrans,OCI_HTYPE_TRANS);
|
||||||
|
OCIHandleFree(FOciSvcCtx,OCI_HTYPE_SVCCTX);
|
||||||
|
inherited Destroy();
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterConnection(TOracleConnectionDef);
|
RegisterConnection(TOracleConnectionDef);
|
||||||
finalization
|
finalization
|
||||||
|
Loading…
Reference in New Issue
Block a user