From: Nando D. <na...@us...> - 2005-06-17 20:07:00
|
Update of /cvsroot/instantobjects/Source/Brokers/UIB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12970/Brokers/UIB Modified Files: InstantUIB.pas Log Message: support for IB/Fb database evolution; redundant Register procedure removed. Index: InstantUIB.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Brokers/UIB/InstantUIB.pas,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** InstantUIB.pas 5 Jun 2005 20:29:59 -0000 1.8 --- InstantUIB.pas 17 Jun 2005 20:06:51 -0000 1.9 *************** *** 21,28 **** * The Initial Developer of the Original Code is: Andrea Petrelli * ! * Contributor(s): ! * Carlo Barazzetta: ! * - OnLogin event support ! * - TInstantCurrency support * * ***** END LICENSE BLOCK ***** *) --- 21,25 ---- * The Initial Developer of the Original Code is: Andrea Petrelli * ! * Contributor(s): Carlo Barazzetta, Nando Dessena * * ***** END LICENSE BLOCK ***** *) *************** *** 114,117 **** --- 111,115 ---- function DelimitedIdentsEnabled: Boolean; protected + function CreateCatalog(const AScheme: TInstantScheme): TInstantCatalog; override; function CreateResolver(Map: TInstantAttributeMap): TInstantSQLResolver; override; function GetDatabaseName: string; override; *************** *** 122,125 **** --- 120,125 ---- procedure AssignDataSetParams(DataSet : TDataSet; AParams: TParams); override; public + function CreateDBBuildCommand( + const CommandType: TInstantDBBuildCommandType): TInstantDBBuildCommand; override; function CreateDataSet(const AStatement: string; AParams: TParams = nil): TDataSet; override; function DataTypeToColumnType(DataType: TInstantDataType; Size: Integer): string; override; *************** *** 145,160 **** end; - procedure Register; - implementation uses Controls, InstantConsts, InstantUIBConnectionDefEdit, InstantUtils, ! TypInfo; ! ! procedure Register; ! begin ! RegisterComponents('InstantObjects', [TInstantUIBConnector]); ! end; { TInstantUIBConnectionDef } --- 145,153 ---- end; implementation uses Controls, InstantConsts, InstantUIBConnectionDefEdit, InstantUtils, ! TypInfo, InstantDBBuild, InstantIBFbCatalog; { TInstantUIBConnectionDef } *************** *** 401,404 **** --- 394,416 ---- end; + const + Types: array[TInstantDataType] of string = ( + 'INTEGER', + 'DOUBLE PRECISION', + 'DECIMAL(14,4)', + 'SMALLINT', + 'VARCHAR', + 'BLOB SUB_TYPE 1', + 'TIMESTAMP', + 'BLOB'); + + function TInstantUIBBroker.DataTypeToColumnType( + DataType: TInstantDataType; Size: Integer): string; + begin + Result := Types[DataType]; + if (DataType = dtString) and (Size > 0) then + Result := Result + InstantEmbrace(IntToStr(Size), '()'); + end; + function TInstantUIBBroker.CreateDataSet(const AStatement: string; AParams: TParams): TDataSet; *************** *** 430,451 **** end; - function TInstantUIBBroker.DataTypeToColumnType( - DataType: TInstantDataType; Size: Integer): string; - const - Types: array[TInstantDataType] of string = ( - 'INTEGER', - 'DOUBLE PRECISION', - 'DECIMAL(14,4)', - 'SMALLINT', - 'VARCHAR', - 'BLOB SUB_TYPE 1', - 'TIMESTAMP', - 'BLOB'); - begin - Result := Types[DataType]; - if (DataType = dtString) and (Size > 0) then - Result := Result + InstantEmbrace(IntToStr(Size), '()'); - end; - function TInstantUIBBroker.DelimitedIdentsEnabled: Boolean; begin --- 442,445 ---- *************** *** 505,508 **** --- 499,529 ---- end; + function TInstantUIBBroker.CreateDBBuildCommand( + const CommandType: TInstantDBBuildCommandType): TInstantDBBuildCommand; + begin + if CommandType = ctAddTable then + Result := TInstantDBBuildAddTableSQLCommand.Create(CommandType) + else if CommandType = ctDropTable then + Result := TInstantDBBuildDropTableSQLCommand.Create(CommandType) + else if CommandType = ctAddField then + Result := TInstantDBBuildAddFieldSQLCommand.Create(CommandType) + else if CommandType = ctAlterField then + Result := TInstantDBBuildAlterFieldSQLCommand.Create(CommandType) + else if CommandType = ctDropField then + Result := TInstantDBBuildDropFieldSQLCommand.Create(CommandType) + else if CommandType = ctAddIndex then + Result := TInstantDBBuildAddIndexSQLCommand.Create(CommandType) + else if CommandType = ctDropIndex then + Result := TInstantDBBuildDropIndexSQLCommand.Create(CommandType) + else + Result := inherited CreateDBBuildCommand(CommandType); + end; + + function TInstantUIBBroker.CreateCatalog( + const AScheme: TInstantScheme): TInstantCatalog; + begin + Result := TInstantIBFbCatalog.Create(AScheme, Self); + end; + { TInstantUIBTranslator } |