Update of /cvsroot/instantobjects/Source/Brokers/UIB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17610/Brokers/UIB Added Files: InstantUIB.dcr InstantUIB.pas InstantUIBConnection.pas InstantUIBConnectionDefEdit.dfm InstantUIBConnectionDefEdit.pas InstantUIBReg.pas Log Message: UIB broker --- NEW FILE: InstantUIBConnectionDefEdit.pas --- (* * InstantObjects * UIB Support *) (* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is: Andrea Petrelli * * The Initial Developer of the Original Code is: Andrea Petrelli * * ***** END LICENSE BLOCK ***** *) unit InstantUIBConnectionDefEdit; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, InstantUIB; type TInstantUIBConnectionDefEditForm = class(TForm) ClientPanel: TPanel; ServerLabel: TLabel; ProtocolLabel: TLabel; DatabaseLabel: TLabel; LocalRadioButton: TRadioButton; RemoteRadioButton: TRadioButton; ServerEdit: TEdit; ProtocolEdit: TComboBox; DatabaseEdit: TEdit; DatabaseButton: TButton; BottomPanel: TPanel; OkButton: TButton; CancelButton: TButton; BottomBevel: TBevel; StreamFormatLabel: TLabel; StreamFormatComboBox: TComboBox; UseDelimitedIdentsCheckBox: TCheckBox; LoginPromptCheckBox: TCheckBox; ParamsLabel: TLabel; ParamsEditor: TMemo; IdDataTypeComboBox: TComboBox; Label1: TLabel; IdSizeEdit: TEdit; Label2: TLabel; procedure LocalRemoteChange(Sender: TObject); procedure DatabaseButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); private function GetIsValid: Boolean; procedure UpdateControls; public procedure LoadData(ConnectionDef: TInstantUIBConnectionDef); procedure SaveData(ConnectionDef: TInstantUIBConnectionDef); property IsValid: Boolean read GetIsValid; end; implementation {$R *.DFM} uses InstantPersistence, InstantClasses, InstantConsts; { TInstantUIBConnectionDefEditForm } procedure TInstantUIBConnectionDefEditForm.DatabaseButtonClick( Sender: TObject); begin with TOpenDialog.Create(nil) do try Filter := 'FireBird Database (*.fdb)|*.fdb|' + 'InterBase Database (*.gdb)|*.gdb|' + 'All Files (*.*)|*.*'; if Execute then DatabaseEdit.Text := FileName; finally Free; end; end; procedure TInstantUIBConnectionDefEditForm.FormCreate(Sender: TObject); begin AssignInstantStreamFormat(StreamFormatComboBox.Items); AssignInstantDataTypeStrings(IdDataTypeComboBox.Items); IdDataTypeComboBox.ItemIndex := Ord(dtString); IdSizeEdit.Text := IntToStr(InstantDefaultFieldSize); UpdateControls; end; function TInstantUIBConnectionDefEditForm.GetIsValid: Boolean; begin Result := (LocalRadioButton.Checked or (ServerEdit.Text <> '')) and (DatabaseEdit.Text <> ''); end; procedure TInstantUIBConnectionDefEditForm.LoadData( ConnectionDef: TInstantUIBConnectionDef); begin with ConnectionDef do begin ProtocolEdit.ItemIndex := Ord(NetType) - 1; ServerEdit.Text := ServerName; DatabaseEdit.Text := Path; StreamFormatComboBox.ItemIndex := Ord(BlobStreamFormat); UseDelimitedIdentsCheckBox.Checked := UIBUseDelimitedIdents in Options; LoginPromptCheckBox.Checked := LoginPrompt; ParamsEditor.Lines.Text := ConnectionDef.Params; IdDataTypeComboBox.ItemIndex := Ord(IdDataType); IdSizeEdit.Text := IntToStr(IdSize); end; UpdateControls; end; procedure TInstantUIBConnectionDefEditForm.LocalRemoteChange( Sender: TObject); begin UpdateControls; end; procedure TInstantUIBConnectionDefEditForm.SaveData( ConnectionDef: TInstantUIBConnectionDef); begin with ConnectionDef do begin if LocalRadioButton.Checked then NetType := ntLocal else NetType := TUIBNetType(ProtocolEdit.ItemIndex + 1); ServerName := ServerEdit.Text; Path := DatabaseEdit.Text; BlobStreamFormat := TInstantStreamFormat(StreamFormatComboBox.ItemIndex); Options := []; if UseDelimitedIdentsCheckBox.Checked then Options := Options + [UIBUseDelimitedIdents]; LoginPrompt := LoginPromptCheckBox.Checked; ConnectionDef.Params := ParamsEditor.Lines.Text; IdDataType := TInstantDataType(IdDataTypeComboBox.ItemIndex); IdSize := StrToInt(IdSizeEdit.Text); end; end; procedure TInstantUIBConnectionDefEditForm.UpdateControls; const Colors: array[Boolean] of TColor = (clBtnFace, clWindow); var UseRemote: Boolean; begin UseRemote := RemoteRadioButton.Checked; ServerLabel.Enabled := UseRemote; ServerEdit.Enabled := UseRemote; ServerEdit.Color := Colors[UseRemote]; ProtocolLabel.Enabled := UseRemote; ProtocolEdit.Enabled := UseRemote; ProtocolEdit.Color := Colors[UseRemote]; DatabaseButton.Enabled := not UseRemote; with ProtocolEdit do if ItemIndex = -1 then ItemIndex := 0; end; end. --- NEW FILE: InstantUIB.pas --- (* * InstantObjects * UIB Support *) (* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is: Andrea Petrelli * * The Initial Developer of the Original Code is: Andrea Petrelli * * ***** END LICENSE BLOCK ***** *) unit InstantUIB; {$I ..\..\Core\InstantDefines.inc} {$IFDEF D7+} {$WARN UNSAFE_TYPE OFF} {$WARN UNSAFE_CAST OFF} {$WARN UNSAFE_CODE OFF} {$ENDIF} interface uses Classes, Db, jvuib, jvuibdataset, jvuiblib, SysUtils, InstantUIBConnection, InstantPersistence, InstantClasses, InstantCommand, TypInfo; type TInstantUIBOption = (uibUseDelimitedIdents); TInstantUIBOptions = set of TInstantUIBOption; const DefaultInstantUIBOptions = [uibUseDelimitedIdents]; type TUIBNetType = (ntLocal, ntTCP, ntNetBEUI, ntSPX); TInstantUIBConnectionDef = class(TInstantConnectionBasedConnectionDef) private FPath: string; FServerName: string; FNetType: TUIBNetType; FOptions: TInstantUIBOptions; FParams: string; function GetDatabaseName: string; function GetServerName: string; protected function CreateConnection(AOwner: TComponent): TCustomConnection; override; procedure InitConnector(Connector: TInstantConnector); override; public class function ConnectionTypeName: string; override; class function ConnectorClass: TInstantConnectorClass; override; constructor Create(Collection: TCollection); override; function Edit: Boolean; override; property DatabaseName: string read GetDatabaseName; published property Path: string read FPath write FPath; property NetType: TUIBNetType read FNetType write FNetType; property ServerName: string read GetServerName write FServerName; property Options: TInstantUIBOptions read FOptions write FOptions; property Params: string read FParams write FParams; end; TInstantUIBConnector = class(TInstantConnectionBasedConnector) private FTransaction: TJvUIBTransaction; FOptions: TInstantUIBOptions; function GetConnection: TInstantUIBConnection; function GetTransaction: TJvUIBTransaction; procedure SetConnection(const Value: TInstantUIBConnection); protected function CreateBroker: TInstantBroker; override; procedure InternalBuildDatabase(Scheme: TInstantScheme); override; procedure InternalCommitTransaction; override; procedure InternalRollbackTransaction; override; procedure InternalStartTransaction; override; procedure InternalCreateDatabase; override; function GetDatabaseExists: Boolean; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; class function ConnectionDefClass: TInstantConnectionDefClass; override; property Transaction: TJvUIBTransaction read GetTransaction; published property Connection: TInstantUIBConnection read GetConnection write SetConnection; property Options: TInstantUIBOptions read FOptions write FOptions default DefaultInstantUIBOptions; end; TInstantUIBBroker= class(TInstantSQLBroker) private function GetDialect: Integer; function GetConnector: TInstantUIBConnector; function DelimitedIdentsEnabled: Boolean; protected function CreateResolver(Map: TInstantAttributeMap): TInstantSQLResolver; override; function GetDatabaseName: string; override; function GetDBMSName: string; override; function GetSQLDelimiters: string; override; function GetSQLQuote: Char; override; function InternalCreateQuery: TInstantQuery; override; procedure PrepareQuery(DataSet : TDataSet); override; procedure UnprepareQuery(DataSet : TDataSet); override; function ExecuteQuery(DataSet : TDataSet) : integer; override; procedure AssignDataSetParams(DataSet : TDataSet; AParams: TParams); override; public function CreateDataSet(const AStatement: string; AParams: TParams = nil): TDataSet; override; function DataTypeToColumnType(DataType: TInstantDataType; Size: Integer): string; override; function Execute(const AStatement: string; AParams: TParams = nil): Integer; override; property Connector: TInstantUIBConnector read GetConnector; property Dialect: Integer read GetDialect; end; TInstantUIBResolver = class(TInstantSQLResolver) protected function ReadBooleanField(DataSet: TDataSet; const FieldName: string): Boolean; override; end; TInstantUIBTranslator = class(TInstantRelationalTranslator) protected function TranslateConstant(Constant: TInstantIQLConstant; Writer: TInstantIQLWriter): Boolean; override; end; TInstantUIBQuery = class(TInstantSQLQuery) protected class function TranslatorClass: TInstantRelationalTranslatorClass; override; procedure InternalOpen; override; end; procedure Register; implementation uses Controls, InstantConsts, InstantUIBConnectionDefEdit, InstantUtils, IB, IBHeader, IBIntf; procedure Register; begin RegisterComponents('InstantObjects', [TInstantUIBConnector]); end; { TInstantUIBConnectionDef } class function TInstantUIBConnectionDef.ConnectionTypeName: string; begin Result := 'UIB'; end; class function TInstantUIBConnectionDef.ConnectorClass: TInstantConnectorClass; begin Result := TInstantUIBConnector; end; constructor TInstantUIBConnectionDef.Create(Collection: TCollection); begin inherited; FOptions := DefaultInstantUIBOptions; end; function TInstantUIBConnectionDef.CreateConnection( AOwner: TComponent): TCustomConnection; var Connection: TInstantUIBConnection; begin Connection := TInstantUIBConnection.Create(AOwner); try Connection.Database.DatabaseName := DatabaseName; Connection.Database.SQLDialect := 3; Connection.Database.Params.Text := Params; except Connection.Free; raise; end; Result := Connection; end; function TInstantUIBConnectionDef.Edit: Boolean; begin with TInstantUIBConnectionDefEditForm.Create(nil) do try LoadData(Self); Result := ShowModal = mrOk; if Result then SaveData(Self); finally Free; end; end; function TInstantUIBConnectionDef.GetDatabaseName: string; var Fmt: string; begin if NetType = ntLocal then Result := Path else begin case NetType of ntTCP: Fmt := '%s:%s'; ntNetBEUI: Fmt := '\\%s\%s'; ntSPX: Fmt := '%s@%s'; end; Result := Format(Fmt, [ServerName, Path]); end; end; function TInstantUIBConnectionDef.GetServerName: string; begin if NetType = ntLocal then Result := '' else Result := FServerName; end; procedure TInstantUIBConnectionDef.InitConnector(Connector: TInstantConnector); begin inherited; (Connector as TInstantUIBConnector).Options := FOptions; end; { TInstantUIBConnector } class function TInstantUIBConnector.ConnectionDefClass: TInstantConnectionDefClass; begin Result := TInstantUIBConnectionDef; end; constructor TInstantUIBConnector.Create(AOwner: TComponent); begin inherited; FOptions := DefaultInstantUIBOptions; end; function TInstantUIBConnector.CreateBroker: TInstantBroker; begin Result := TInstantUIBBroker.Create(Self); end; destructor TInstantUIBConnector.Destroy; begin FTransaction.Free; inherited; end; function TInstantUIBConnector.GetConnection: TInstantUIBConnection; begin Result := inherited Connection as TInstantUIBConnection; end; function TInstantUIBConnector.GetTransaction: TJvUIBTransaction; begin if not Assigned(FTransaction) then begin CheckConnection; FTransaction := TJvUIBTransaction.Create(nil); try FTransaction.Database := Connection.Database; FTransaction.AutoStart := True; FTransaction.AutoStop := True; FTransaction.DefaultAction := etmRollback; FTransaction.Options := [tpReadCommitted]; except FTransaction.Free; raise; end end; Result := FTransaction; end; procedure TInstantUIBConnector.InternalBuildDatabase( Scheme: TInstantScheme); begin StartTransaction; try inherited; CommitTransaction; except RollbackTransaction; raise; end; end; procedure TInstantUIBConnector.InternalCommitTransaction; begin Transaction.Commit; end; procedure TInstantUIBConnector.InternalRollbackTransaction; begin Transaction.Rollback; end; procedure TInstantUIBConnector.InternalStartTransaction; begin if not Transaction.InTransaction then Transaction.StartTransaction; end; procedure TInstantUIBConnector.SetConnection(const Value: TInstantUIBConnection); begin inherited Connection := Value; end; procedure TInstantUIBConnector.InternalCreateDatabase; begin inherited; Connection.Close; try Connection.Database.CreateDatabase(4096); finally Connection.Close; end; end; function TInstantUIBConnector.GetDatabaseExists: Boolean; begin AssignLoginOptions; try Connection.Open; try Result := True; finally Connection.Close; end; except Result := False end; end; { TInstantUIBBroker} procedure TInstantUIBBroker.AssignDataSetParams(DataSet : TDataSet; AParams: TParams); var I: Integer; BlobContent: String; SourceParam: TParam; TargetParams : TSQLParams; begin //don't call inherited! TargetParams := TJvUIBDataset(DataSet).Params; for I := 0 to Pred(AParams.Count) do begin SourceParam := AParams[I]; case SourceParam.DataType of ftString: TargetParams.ByNameAsString[SourceParam.Name] := SourceParam.AsString; ftInteger: TargetParams.ByNameAsInteger[SourceParam.Name] := SourceParam.AsInteger; ftFloat: TargetParams.ByNameAsDouble[SourceParam.Name] := SourceParam.AsFloat; ftDateTime: TargetParams.ByNameAsDateTime[SourceParam.Name] := SourceParam.AsDateTime; ftBoolean: TargetParams.ByNameAsBoolean[SourceParam.Name] := SourceParam.AsBoolean; ftBlob: begin BlobContent := SourceParam.AsBlob; TJvUIBDataset(DataSet).ParamsSetBlob(SourceParam.Name, BlobContent); end; else raise Exception.Create('Parameter data type not supported : ' + GetEnumName(TypeInfo(TFieldType), Ord(SourceParam.DataType))); end; end; end; function TInstantUIBBroker.CreateDataSet(const AStatement: string; AParams: TParams): TDataSet; var Query: TJvUIBDataSet; begin Query := TJvUIBDataSet.Create(NIl); with Query do begin Database := Connector.Connection.Database; FetchBlobs := True; OnError := etmStayIn; OnClose := etmStayIn; SQL.Text := AStatement; Transaction := Connector.Transaction; UniDirectional := True; if Assigned(AParams) then AssignDataSetParams(Query, AParams); end; Result := Query; end; function TInstantUIBBroker.CreateResolver( Map: TInstantAttributeMap): TInstantSQLResolver; begin Result := TInstantUIBResolver.Create(Self, Map); 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 Result := UIBUseDelimitedIdents in Connector.Options; end; function TInstantUIBBroker.Execute(const AStatement: string; AParams: TParams): Integer; begin with CreateDataSet(AStatement, AParams) as TJvUIBDataSet do try Execute; Result := RowsAffected; finally Free; end; end; function TInstantUIBBroker.ExecuteQuery(DataSet: TDataSet) : integer; begin //don't call inherited! with TJvUIBDataSet(DataSet) do begin Execute; Result := RowsAffected; end; end; function TInstantUIBBroker.GetConnector: TInstantUIBConnector; begin Result := inherited Connector as TInstantUIBConnector; end; function TInstantUIBBroker.GetDatabaseName: string; begin Result := Connector.Connection.Database.DatabaseName; end; function TInstantUIBBroker.GetDBMSName: string; begin Result := 'InterBase'; end; function TInstantUIBBroker.GetDialect: Integer; begin Result := Connector.Connection.Database.SQLDialect; end; function TInstantUIBBroker.GetSQLDelimiters: string; begin if (Dialect = 3) and DelimitedIdentsEnabled() then Result := '""' else Result := inherited GetSQLDelimiters; end; function TInstantUIBBroker.GetSQLQuote: Char; begin Result := ''''; end; function TInstantUIBBroker.InternalCreateQuery: TInstantQuery; begin Result := TInstantUIBQuery.Create(Connector); end; procedure TInstantUIBBroker.PrepareQuery(DataSet: TDataSet); begin inherited; end; procedure TInstantUIBBroker.UnprepareQuery(DataSet: TDataSet); begin inherited; end; { TInstantUIBTranslator } function TInstantUIBTranslator.TranslateConstant( Constant: TInstantIQLConstant; Writer: TInstantIQLWriter): Boolean; begin if SameText(Constant.Value, InstantTrueString) then begin Writer.WriteChar('1'); Result := True; end else if SameText(Constant.Value, InstantFalseString) then begin Writer.WriteChar('0'); Result := True; end else Result := inherited TranslateConstant(Constant, Writer); end; { TInstantUIBQuery } procedure TInstantUIBQuery.InternalOpen; begin inherited; end; class function TInstantUIBQuery.TranslatorClass: TInstantRelationalTranslatorClass; begin Result := TInstantUIBTranslator; end; { TInstantUIBResolver } function TInstantUIBResolver.ReadBooleanField(DataSet: TDataSet; const FieldName: string): Boolean; begin Result := Boolean(DataSet.FieldByName(FieldName).AsInteger); end; initialization RegisterClass(TInstantUIBConnectionDef); TInstantUIBConnector.RegisterClass; finalization TInstantUIBConnector.UnregisterClass; end. --- NEW FILE: InstantUIBReg.pas --- (* * InstantObjects * UIB Support *) (* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is: Andrea Petrelli * * The Initial Developer of the Original Code is: Andrea Petrelli * * ***** END LICENSE BLOCK ***** *) unit InstantUIBReg; interface procedure Register; implementation uses Classes, InstantUIB, InstantUIBConnection; procedure Register; begin RegisterComponents('InstantObjects', [TInstantUIBConnector]); RegisterComponents('InstantObjects', [TInstantUIBConnection]); end; end. --- NEW FILE: InstantUIBConnectionDefEdit.dfm --- object InstantUIBConnectionDefEditForm: TInstantUIBConnectionDefEditForm Left = 914 Top = 281 BorderStyle = bsDialog Caption = 'InterBase Connection' ClientHeight = 399 ClientWidth = 362 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = True Position = poScreenCenter OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object BottomBevel: TBevel Left = 0 Top = 362 Width = 362 Height = 2 Align = alBottom Shape = bsBottomLine end object ClientPanel: TPanel Left = 0 Top = 0 Width = 362 Height = 362 Align = alClient BevelOuter = bvNone TabOrder = 0 object ServerLabel: TLabel Left = 16 Top = 36 Width = 31 Height = 13 Caption = '&Server' FocusControl = ServerEdit end object ProtocolLabel: TLabel Left = 235 Top = 36 Width = 39 Height = 13 Caption = '&Protocol' FocusControl = ProtocolEdit end object DatabaseLabel: TLabel Left = 16 Top = 76 Width = 46 Height = 13 Caption = '&Database' FocusControl = DatabaseEdit end object StreamFormatLabel: TLabel Left = 16 Top = 312 Width = 53 Height = 13 Caption = 'Blob &format' FocusControl = StreamFormatComboBox end object ParamsLabel: TLabel Left = 16 Top = 140 Width = 95 Height = 13 Caption = 'Connection &Settings' FocusControl = ParamsEditor end object Label1: TLabel Left = 136 Top = 312 Width = 62 Height = 13 Caption = 'Id Data Type' FocusControl = IdDataTypeComboBox end object Label2: TLabel Left = 256 Top = 312 Width = 32 Height = 13 Caption = 'Id Size' FocusControl = IdDataTypeComboBox end object LocalRadioButton: TRadioButton Left = 16 Top = 16 Width = 57 Height = 17 Caption = '&Local' Checked = True TabOrder = 0 TabStop = True OnClick = LocalRemoteChange end object RemoteRadioButton: TRadioButton Left = 86 Top = 16 Width = 65 Height = 17 Caption = '&Remote' TabOrder = 1 OnClick = LocalRemoteChange end object ServerEdit: TEdit Left = 16 Top = 52 Width = 209 Height = 21 TabOrder = 2 end object ProtocolEdit: TComboBox Left = 235 Top = 52 Width = 110 Height = 21 Style = csDropDownList ItemHeight = 13 TabOrder = 3 Items.Strings = ( 'TCP/IP' 'NetBEUI' 'SPX') end object DatabaseEdit: TEdit Left = 16 Top = 92 Width = 305 Height = 21 TabOrder = 4 end object DatabaseButton: TButton Left = 321 Top = 92 Width = 21 Height = 21 Caption = '...' TabOrder = 5 OnClick = DatabaseButtonClick end object StreamFormatComboBox: TComboBox Left = 16 Top = 328 Width = 113 Height = 21 Style = csDropDownList ItemHeight = 13 Sorted = True TabOrder = 9 end object UseDelimitedIdentsCheckBox: TCheckBox Left = 16 Top = 118 Width = 150 Height = 17 Caption = '&Use delimited identifiers' TabOrder = 6 end object LoginPromptCheckBox: TCheckBox Left = 196 Top = 118 Width = 150 Height = 17 Caption = '&Login Prompt' TabOrder = 7 end object ParamsEditor: TMemo Left = 17 Top = 160 Width = 328 Height = 149 TabOrder = 8 end object IdDataTypeComboBox: TComboBox Left = 136 Top = 328 Width = 113 Height = 21 Style = csDropDownList ItemHeight = 13 TabOrder = 10 end object IdSizeEdit: TEdit Left = 256 Top = 328 Width = 89 Height = 21 TabOrder = 11 end end object BottomPanel: TPanel Left = 0 Top = 364 Width = 362 Height = 35 Align = alBottom BevelOuter = bvNone TabOrder = 1 DesignSize = ( 362 35) object OkButton: TButton Left = 204 Top = 6 Width = 75 Height = 25 Anchors = [akTop, akRight] Caption = 'OK' Default = True ModalResult = 1 TabOrder = 0 end object CancelButton: TButton Left = 284 Top = 6 Width = 75 Height = 25 Anchors = [akTop, akRight] Cancel = True Caption = 'Cancel' ModalResult = 2 TabOrder = 1 end end end --- NEW FILE: InstantUIBConnection.pas --- (* * InstantObjects * UIB Connection *) (* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is: Andrea Petrelli * * The Initial Developer of the Original Code is: Andrea Petrelli * * ***** END LICENSE BLOCK ***** *) unit InstantUIBConnection; interface uses Classes, DB, jvuib; type TInstantUIBConnection = class(TCustomConnection) private FDatabase: TJvUIBDataBase; protected procedure DoConnect; override; procedure DoDisconnect; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; published property Database: TJvUIBDataBase read FDatabase; end; implementation { TInstantUIBConnection } constructor TInstantUIBConnection.Create(AOwner: TComponent); begin inherited; FDatabase := TJvUIBDataBase.Create(Self); FDatabase.Name := 'Database'; end; destructor TInstantUIBConnection.Destroy; begin FDatabase.Free; inherited; end; procedure TInstantUIBConnection.DoConnect; begin inherited; FDatabase.Connected := True; end; procedure TInstantUIBConnection.DoDisconnect; begin inherited; FDatabase.Connected := False; end; end. --- NEW FILE: InstantUIB.dcr --- (This appears to be a binary file; contents omitted.) |