118 lines
3.6 KiB
ObjectPascal
118 lines
3.6 KiB
ObjectPascal
unit uDAOracleInterfaces;
|
|
|
|
{----------------------------------------------------------------------------}
|
|
{ Data Abstract Library - Core Library }
|
|
{ }
|
|
{ compiler: Delphi 6 and up, Kylix 3 and up }
|
|
{ platform: Win32, Linux }
|
|
{ }
|
|
{ (c)opyright RemObjects Software. all rights reserved. }
|
|
{ }
|
|
{ Using this code requires a valid license of the Data Abstract }
|
|
{ which can be obtained at http://www.remobjects.com. }
|
|
{----------------------------------------------------------------------------}
|
|
|
|
{$I DataAbstract.inc}
|
|
|
|
interface
|
|
|
|
uses
|
|
uDAInterfaces, uDAEngine;
|
|
|
|
type
|
|
{ IDAOracleConnection
|
|
For identification purposes Implemented by all Oracle connections }
|
|
IDAOracleConnection = interface(IDAConnection)
|
|
['{C7C88680-12BF-402A-8843-80016429BAC1}']
|
|
end;
|
|
IOracleConnection = IDAOracleConnection;
|
|
|
|
TDAOracleLockMode = (olmNone, olmLockImmediate, olmLockDelayed);
|
|
|
|
TDAOracleOption = (opAutoClose,
|
|
opDefaultValues,
|
|
opLongStrings,
|
|
opQueryRecCount,
|
|
opCacheLobs,
|
|
opDeferredLobRead,
|
|
opKeepPrepared);
|
|
TDAOracleOptions = set of TDAOracleOption;
|
|
|
|
{ IOracleDataset
|
|
Provides access to features of ODAC mostly which might or might not be mappable
|
|
to other drivers for Oracle. }
|
|
IDAOracleDataset = interface
|
|
['{D555E209-0ED7-40D4-B97B-7C2044453E70}']
|
|
function GetLockMode: TDAOracleLockMode;
|
|
procedure SetLockMode(Value: TDAOracleLockMode);
|
|
|
|
function GetOptions: TDAOracleOptions;
|
|
procedure SetOptions(Value: TDAOracleOptions);
|
|
|
|
property LockMode: TDAOracleLockMode read GetLockMode write SetLockMode;
|
|
property Options: TDAOracleOptions read GetOptions write SetOptions;
|
|
end;
|
|
IOracleDataset = IDAOracleDataset;
|
|
|
|
TDAOracleDriver = class(TDAEDriver)
|
|
protected
|
|
function GetDefaultConnectionType(const AuxDriver: string): string; override; safecall;
|
|
end;
|
|
|
|
function Oracle_CreateMacroProcessor: TDASQLMacroProcessor;
|
|
function Oracle_GetSPSelectSyntax(HasArguments: Boolean): String;
|
|
function Oracle_DoGetLastAutoInc(const GeneratorName: string;Query: IDADataset): integer;
|
|
function Oracle_GetNextAutoinc(const GeneratorName: string;Query: IDADataset): integer;
|
|
|
|
const
|
|
Oracle_DriverType = 'Oracle';
|
|
|
|
implementation
|
|
uses
|
|
uDAMacroProcessors;
|
|
|
|
function Oracle_CreateMacroProcessor: TDASQLMacroProcessor;
|
|
begin
|
|
Result := TDAOracleMacroProcessor.Create;
|
|
end;
|
|
|
|
function Oracle_GetSPSelectSyntax(HasArguments: Boolean): String;
|
|
begin
|
|
if HasArguments then
|
|
Result := 'CALL {0}({1})'
|
|
else
|
|
Result := 'CALL {0}';
|
|
end;
|
|
|
|
function Oracle_DoGetLastAutoInc(const GeneratorName: string;Query: IDADataset): integer;
|
|
begin
|
|
try
|
|
Query.SQL := 'SELECT ' + GeneratorName + '.Currval FROM dual';
|
|
Query.Open;
|
|
result := Query.Fields[0].Value;
|
|
finally
|
|
Query := nil;
|
|
end;
|
|
end;
|
|
|
|
function Oracle_GetNextAutoinc(const GeneratorName: string;Query: IDADataset): integer;
|
|
begin
|
|
try
|
|
Query.SQL := 'SELECT ' + GeneratorName + '.Nextval FROM dual';
|
|
Query.Open;
|
|
result := Query.Fields[0].Value;
|
|
finally
|
|
Query := nil;
|
|
end;
|
|
end;
|
|
{ TDAOracleDriver }
|
|
|
|
function TDAOracleDriver.GetDefaultConnectionType(
|
|
const AuxDriver: string): string;
|
|
begin
|
|
Result := Oracle_DriverType;
|
|
end;
|
|
|
|
end.
|
|
|