From: <na...@us...> - 2010-09-17 07:46:08
|
Revision: 922 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=922&view=rev Author: nandod Date: 2010-09-17 07:45:58 +0000 (Fri, 17 Sep 2010) Log Message: ----------- * Database evolution: changed VARCHAR to VARCHAR2 for Oracle through DBX. + Support for Oracle and SQLServer Devart DBX drivers. Modified Paths: -------------- trunk/Source/Brokers/DBX/InstantDBX.pas Modified: trunk/Source/Brokers/DBX/InstantDBX.pas =================================================================== --- trunk/Source/Brokers/DBX/InstantDBX.pas 2010-09-17 07:34:46 UTC (rev 921) +++ trunk/Source/Brokers/DBX/InstantDBX.pas 2010-09-17 07:45:58 UTC (rev 922) @@ -172,7 +172,7 @@ function GetDBMSName: string; override; end; - { Firebird through the native D2010 driver } + { Firebird through the native D2010+ driver } TInstantDBXFirebirdBroker = class(TInstantDBXInterBaseFirebirdBroker) protected @@ -209,7 +209,7 @@ class function TranslatorClass: TInstantRelationalTranslatorClass; override; end; - { Oracle } + { Oracle through the native driver } TInstantDBXOracleBroker = class(TInstantDBXBroker) protected @@ -219,6 +219,14 @@ function GetSQLQuote: Char; override; end; + { Oracle through the Devart dbX driver } + + TInstantDBXDevartOracleBroker = class(TInstantDBXOracleBroker) + protected + procedure AssignParam(SourceParam, TargetParam: TParam); override; + function ColumnTypeByDataType(DataType: TInstantDataType): string; override; + end; + { IBM DB2 } TInstantDBXDB2Broker = class(TInstantDBXBroker) @@ -328,10 +336,14 @@ Result := TInstantDBXMySQLBroker.Create(Self) else if SameText(Connection.DriverName, 'FirebirdUIB') then Result := TInstantDBXFirebirdUIBBroker.Create(Self) - else if SameText(Connection.DriverName, 'FIREBIRD') then - Result := TInstantDBXFirebirdBroker.Create(Self) else if SameText(Connection.DriverName, 'DevartInterbase') then Result := TInstantDBXDevartInterbaseBroker.Create(Self) + else if SameText(Connection.DriverName, 'DevartOracle') then + Result := TInstantDBXDevartOracleBroker.Create(Self) + else if SameText(Connection.DriverName, 'DevartSQLServer') then + Result := TInstantDBXMSSQLBroker.Create(Self) + else if SameText(Connection.DriverName, 'Firebird') then + Result := TInstantDBXFirebirdBroker.Create(Self) else raise Exception.CreateFmt('dbExpress driver "%s" not supported', [Connection.DriverName]); @@ -787,7 +799,7 @@ 'FLOAT', 'DECIMAL(14,4)', 'NUMBER(1)', - 'VARCHAR', + 'VARCHAR2', 'CLOB', 'DATE', 'BLOB', @@ -808,6 +820,42 @@ Result := ''''; end; +{ TInstantDBXDevartOracleBroker } + +procedure TInstantDBXDevartOracleBroker.AssignParam(SourceParam, + TargetParam: TParam); +begin + { TODO : This may vary depending on DBX driver parameters. } + case SourceParam.DataType of + ftInteger: + TargetParam.AsInteger := SourceParam.AsInteger; + ftCurrency: + TargetParam.AsBCD := SourceParam.AsCurrency; + else + inherited; + end; +end; + +function TInstantDBXDevartOracleBroker.ColumnTypeByDataType( + DataType: TInstantDataType): string; +const + { TODO : This may vary depending on DBX driver parameters. } + Types: array[TInstantDataType] of string = ( + 'INTEGER', + 'NUMBER', + 'DECIMAL(14,4)', + 'NUMBER(1)', + 'VARCHAR', + 'CLOB', + 'DATE', + 'BLOB', + 'DATE', + 'DATE', + 'INTEGER'); +begin + Result := Types[DataType]; +end; + { TInstantDBXDB2Broker } function TInstantDBXDB2Broker.ColumnTypeByDataType( |