From: <sr...@us...> - 2006-03-13 21:43:03
|
Revision: 647 Author: srmitch Date: 2006-03-13 13:42:42 -0800 (Mon, 13 Mar 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=647&view=rev Log Message: ----------- Update to NexusDB Broker. The modifications mainly apply to the connection dialog of the Remote server version. Modifications to the Embedded version were due to resource string renaming and some extra connection dialog button hints. Main changes: 1. The default Servername 'NexusDB@localhost' has been removed. The default is now an empty string; 2. There is no longer an initial delay when launching the connection dialog as there is no checking of available NexusDB servers until requested via the 'Load Servers' button; 3. The 'Load Servers' speed button has been enlarged and has a caption to make its function more obvious; 4. There is more user feedback in the entry combo boxes to indicate current status. Popup hints are also available on the speed buttons; 5. A bug fix for enablement of the OK button when using alias as path entries. Modified Paths: -------------- trunk/Source/Brokers/NexusDb/InstantNexusDB.pas trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.dfm trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.pas trunk/Source/Brokers/NexusDb/InstantNexusDBConsts.pas trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.dfm trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.pas Modified: trunk/Source/Brokers/NexusDb/InstantNexusDB.pas =================================================================== --- trunk/Source/Brokers/NexusDb/InstantNexusDB.pas 2006-03-12 21:47:50 UTC (rev 646) +++ trunk/Source/Brokers/NexusDb/InstantNexusDB.pas 2006-03-13 21:42:42 UTC (rev 647) @@ -44,7 +44,7 @@ Windows, {$ENDIF} Classes, DB, InstantPersistence, InstantCommand, - nxllTransport, nxsdServerEngine, nxdb, nxsdDataDictionary; + nxptBasePooledTransport, nxsdServerEngine, nxdb, nxsdDataDictionary type TNexusDBTable = class(TnxTable) @@ -55,7 +55,8 @@ procedure SetRecNo(Value: Integer); override; end; - TInstantNexusDBProtocolType = (ptTCPIP, ptNamedPipes); + TInstantNexusDBProtocolType = (ptTCPIP, ptNamedPipes + {$IFNDEF NX1}, ptSharedMemory{$ENDIF}); TInstantNexusDBBaseConnectionDef = class(TInstantRelationalConnectionDef) private @@ -83,10 +84,10 @@ FServerName: string; protected class function CreateServerEngine(aOwner: TComponent; const aServerName: - string; aTransport: TnxBaseTransport): TnxBaseServerEngine; + string; aTransport: TnxBasePooledTransport): TnxBaseServerEngine; class function CreateTransport(aOwner: TComponent; aProtocolType: TInstantNexusDBProtocolType; const aServerName: string; aPort: Integer): - TnxBaseTransport; + TnxBasePooledTransport; procedure InitConnector(Connector: TInstantConnector); override; public constructor Create(Collection: TCollection); override; @@ -177,7 +178,9 @@ protected function GetDelimiters: string; override; function GetQuote: Char; override; +{$IFDEF NX1} function IncludeOrderFields: Boolean; override; +{$ENDIF} end; TInstantNexusDBQuery = class(TInstantSQLQuery) @@ -209,6 +212,10 @@ nxdbBase, nxtwWinsockTransport, nxtnNamedPipeTransport, +{$IFNDEF NX1} + nxpvPlatformImplementation, + nxtmSharedMemoryTransport, +{$ENDIF} nxreRemoteServerEngine, InstantNexusDBCatalog; @@ -279,14 +286,13 @@ constructor TInstantNexusDBConnectionDef.Create(Collection: TCollection); begin inherited; - FServerName := 'NexusDB@localhost'; FPort := 16000; FProtocolType := ptTCPIP; end; { SQL Based ------------------------------------------------------------------ } -{ TInstantNexusDBSQLConnectionDef } +{ TInstantNexusDBConnectionDef } class function TInstantNexusDBConnectionDef.ConnectionTypeName: string; begin @@ -300,7 +306,7 @@ end; class function TInstantNexusDBConnectionDef.CreateServerEngine(aOwner: - TComponent; const aServerName: string; aTransport: TnxBaseTransport): + TComponent; const aServerName: string; aTransport: TnxBasePooledTransport): TnxBaseServerEngine; begin Result := TnxRemoteServerEngine.Create(aOwner); @@ -315,40 +321,27 @@ end; end; -class function TInstantNexusDBConnectionDef.CreateTransport(aOwner: - TComponent; aProtocolType: TInstantNexusDBProtocolType; const aServerName: - string; aPort: Integer): TnxBaseTransport; +class function TInstantNexusDBConnectionDef.CreateTransport(aOwner: TComponent; + aProtocolType: TInstantNexusDBProtocolType; const aServerName: string; + aPort: Integer): TnxBasePooledTransport; begin case aProtocolType of - ptTCPIP: - begin - Result := TnxWinsockTransport.Create(aOwner); - with TnxWinsockTransport(Result) do - try - ServerName := aServerName; - Port := aPort; - Active := True; - except - if Assigned(Result) then - FreeAndNil(Result); - raise; - end; - end; + ptTCPIP : Result := TnxWinsockTransport.Create(aOwner); + ptNamedPipes : Result := TnxNamedPipeTransport.Create(aOwner); + {$IFNDEF NX1} + ptSharedMemory: Result := TnxSharedMemoryTransport.Create(aOwner); + {$ENDIF} + end; - ptNamedPipes: - begin - Result := TnxNamedPipeTransport.Create(aOwner); - with TnxNamedPipeTransport(Result) do - try - ServerName := aServerName; - Port := aPort; - Active := True; - except - if Assigned(Result) then - FreeAndNil(Result); - raise; - end; - end; + with Result do + try + ServerName := aServerName; + Port := aPort; + Active := True; + except + if Assigned(Result) then + FreeAndNil(Result); + raise; end; end; @@ -369,7 +362,7 @@ TInstantConnector); var SavedCursor: TCursor; - Transport: TnxBaseTransport; + Transport: TnxBasePooledTransport; ServerEngine: TnxBaseServerEngine; Session: TnxSession; Database: TnxDatabase; @@ -413,7 +406,7 @@ TInstantNexusDBProtocolType; const aServerName: string; aPort: Integer; aList: TStrings); var - Transport: TnxBaseTransport; + Transport: TnxBasePooledTransport; ServerEngine: TnxBaseServerEngine; Session: TnxSession; begin @@ -439,7 +432,7 @@ class procedure TInstantNexusDBConnectionDef.LoadServerList(aProtocolType: TInstantNexusDBProtocolType; aPort: Integer; aList: TStrings); var - Transport: TnxBaseTransport; + Transport: TnxBasePooledTransport; begin Transport := CreateTransport(nil, aProtocolType, '', aPort); try @@ -450,7 +443,7 @@ end; end; -{ TInstantNexusDBSQLConnector } +{ TInstantNexusDBConnector } procedure TInstantNexusDBConnector.SetSession(Value: TnxSession); begin @@ -693,7 +686,7 @@ Database.Close; end; -{ TInstantNexusDBSQLBroker } +{ TInstantNexusDBBroker } function TInstantNexusDBBroker.GetConnector: TInstantNexusDBConnector; begin @@ -842,10 +835,12 @@ Result := ''''; end; +{$IFDEF NX1} function TInstantNexusDBTranslator.IncludeOrderFields: Boolean; begin Result := True; end; +{$ENDIF} { TInstantNexusDBSQLQuery } Modified: trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.dfm =================================================================== --- trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.dfm 2006-03-12 21:47:50 UTC (rev 646) +++ trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.dfm 2006-03-13 21:42:42 UTC (rev 647) @@ -1,9 +1,9 @@ object InstantNexusDBConnectionDefEditForm: TInstantNexusDBConnectionDefEditForm - Left = 360 - Top = 384 + Left = 246 + Top = 288 BorderStyle = bsDialog Caption = 'NexusDB Connection' - ClientHeight = 340 + ClientHeight = 368 ClientWidth = 506 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -18,7 +18,7 @@ TextHeight = 13 object BottomBevel: TBevel Left = 0 - Top = 303 + Top = 331 Width = 506 Height = 2 Align = alBottom @@ -28,21 +28,22 @@ Left = 0 Top = 0 Width = 506 - Height = 303 + Height = 331 Align = alClient BevelOuter = bvNone BorderWidth = 4 TabOrder = 0 object AliasesLabel: TLabel Left = 8 - Top = 222 + Top = 255 Width = 36 Height = 13 Caption = '&Aliases:' + FocusControl = AliasesCbx end object PathLabel: TLabel Left = 8 - Top = 250 + Top = 283 Width = 25 Height = 13 Caption = '&Path:' @@ -50,7 +51,7 @@ end object ServerLabel: TLabel Left = 8 - Top = 108 + Top = 141 Width = 34 Height = 13 Caption = '&Server:' @@ -58,16 +59,16 @@ end object PortLabel: TLabel Left = 8 - Top = 80 + Top = 113 Width = 70 Height = 13 - Caption = 'Transport Port:' + Caption = 'Transport P&ort:' FocusControl = PortEdit end object NexusDBLogo: TImage - Left = 344 + Left = 348 Top = 8 - Width = 153 + Width = 149 Height = 81 Center = True Picture.Data = { @@ -1149,11 +1150,11 @@ C3D4CBC3D4CBC3D4CBC3F5F3F1FFFFFFE172} end object LoadServersButton: TSpeedButton - Left = 312 - Top = 108 - Width = 23 + Left = 348 + Top = 141 + Width = 149 Height = 21 - Flat = True + Caption = '&Load Servers' Glyph.Data = { 36060000424D3606000000000000360400002800000020000000100000000100 0800000000000002000000000000000000000001000000000000000000000000 @@ -1206,11 +1207,14 @@ FD07F609090909EDFDFDFDFDFDFDFDFDFD08F6F6F6F6F607FDFDFDFDFDFDFDFD FDFDEDED0909FDFDFDFDFDFDFDFDFDFDFDFD07070808FDFDFDFD} NumGlyphs = 2 + ParentShowHint = False + ShowHint = True + Spacing = 8 OnClick = LoadServersButtonClick end object LoadAliasesButton: TSpeedButton Left = 312 - Top = 220 + Top = 253 Width = 23 Height = 21 Flat = True @@ -1266,11 +1270,13 @@ FD07F609090909EDFDFDFDFDFDFDFDFDFD08F6F6F6F6F607FDFDFDFDFDFDFDFD FDFDEDED0909FDFDFDFDFDFDFDFDFDFDFDFD07070808FDFDFDFD} NumGlyphs = 2 + ParentShowHint = False + ShowHint = True OnClick = LoadAliasesButtonClick end object BrowseButton: TSpeedButton Left = 312 - Top = 268 + Top = 301 Width = 23 Height = 21 Flat = True @@ -1326,11 +1332,13 @@ FD07F609090909EDFDFDFDFDFDFDFDFDFD08F6F6F6F6F607FDFDFDFDFDFDFDFD FDFDEDED0909FDFDFDFDFDFDFDFDFDFDFDFD07070808FDFDFDFD} NumGlyphs = 2 + ParentShowHint = False + ShowHint = True OnClick = BrowseButtonClick end object StreamFormatLabel: TLabel Left = 348 - Top = 140 + Top = 173 Width = 56 Height = 13 Caption = 'Blob &format:' @@ -1338,7 +1346,7 @@ end object DatabaseRadGrp: TRadioGroup Left = 8 - Top = 138 + Top = 171 Width = 329 Height = 73 Caption = '&Database Access Type' @@ -1347,18 +1355,19 @@ 'Alias' 'Path (NOTE: This is a path on the server!)') TabOrder = 4 + TabStop = True end object ServersCbx: TComboBox Left = 96 - Top = 108 - Width = 217 + Top = 141 + Width = 241 Height = 21 ItemHeight = 13 TabOrder = 3 end object PathEdit: TEdit Left = 8 - Top = 268 + Top = 301 Width = 305 Height = 21 TabOrder = 6 @@ -1367,17 +1376,19 @@ Left = 8 Top = 8 Width = 329 - Height = 65 - Caption = 'Transport Type' + Height = 81 + Caption = '&Transport Type' ItemIndex = 0 Items.Strings = ( 'TCP/IP' - 'Named Pipes (Windows NT and higher only)') + 'Named Pipes (Windows NT and higher only)' + 'Shared Memory') TabOrder = 0 + TabStop = True end object PortEdit: TEdit Left = 96 - Top = 80 + Top = 113 Width = 49 Height = 21 TabOrder = 1 @@ -1385,7 +1396,7 @@ end object PortUpDown: TUpDown Left = 145 - Top = 80 + Top = 113 Width = 16 Height = 21 Associate = PortEdit @@ -1393,11 +1404,13 @@ Max = 32767 Position = 16000 TabOrder = 2 + TabStop = True Thousands = False + Wrap = False end object AliasesCbx: TComboBox Left = 96 - Top = 220 + Top = 253 Width = 217 Height = 21 ItemHeight = 13 @@ -1405,7 +1418,7 @@ end object StreamFormatComboBox: TComboBox Left = 348 - Top = 156 + Top = 189 Width = 149 Height = 21 Style = csDropDownList @@ -1415,17 +1428,17 @@ end object IDGroupBox: TGroupBox Left = 348 - Top = 188 + Top = 221 Width = 149 Height = 103 - Caption = 'Object ID' + Caption = 'Object &ID' TabOrder = 8 object lblIdDataType: TLabel Left = 13 Top = 24 Width = 53 Height = 13 - Caption = 'Data Type:' + Caption = 'Data T&ype:' FocusControl = IdDataTypeComboBox end object lblIdSize: TLabel @@ -1433,8 +1446,8 @@ Top = 72 Width = 23 Height = 13 - Caption = 'Size:' - FocusControl = IdDataTypeComboBox + Caption = 'Si&ze:' + FocusControl = IdSizeEdit end object IdDataTypeComboBox: TComboBox Left = 13 @@ -1456,15 +1469,12 @@ end object BottomPanel: TPanel Left = 0 - Top = 305 + Top = 333 Width = 506 Height = 35 Align = alBottom BevelOuter = bvNone TabOrder = 1 - DesignSize = ( - 506 - 35) object OkButton: TButton Left = 348 Top = 6 Modified: trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.pas =================================================================== --- trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.pas 2006-03-12 21:47:50 UTC (rev 646) +++ trunk/Source/Brokers/NexusDb/InstantNexusDBConnectionDefEdit.pas 2006-03-13 21:42:42 UTC (rev 647) @@ -135,14 +135,14 @@ begin inherited; LoadServersButton.Enabled := TransportTypeRadGrp.Enabled; - AliasesCbx.Enabled := not AliasIsPath; + AliasesCbx.Enabled := not AliasIsPath and ServersCbx.Enabled; LoadAliasesButton.Enabled := AliasesCbx.Enabled; - PathEdit.Enabled := AliasIsPath; + PathEdit.Enabled := AliasIsPath and ServersCbx.Enabled; BrowseButton.Enabled := PathEdit.Enabled; OkButton.Enabled := - (not AliasIsPath or (AliasIsPath and DirectoryExists(Alias))) and - (ServerName > '') and - (Alias > ''); + (ServerName <> '') and + ((not AliasIsPath and (Alias <> '')) or + (AliasIsPath and DirectoryExists(Alias))); end; type @@ -267,6 +267,9 @@ var SavedCursor: TCursor; begin + if ServerName = '' then + Exit; + try SavedCursor := Screen.Cursor; try @@ -295,22 +298,28 @@ Self.ProtocolType := ProtocolType; Self.Port := Port; - Self.LoadServers(ServersCbx.Items); + Self.ServerName := ServerName; if ServerName <> '' then begin - Self.ServerName := ServerName; + ServersCbx.Items.Add(ServerName); + ServersCbx.ItemIndex := ServersCbx.Items.IndexOf(ServerName); + Self.LoadAliases(AliasesCbx.Items); Self.AliasIsPath := AliasIsPath; Self.Alias := Alias; + end + else + begin + ServersCbx.Text := SNone; + ServersCbx.Enabled := False; + AliasesCbx.Text := SNone; end; - // Begin SRM - 14 Mar 2005 StreamFormatComboBox.ItemIndex := Ord(ConnectionDef.BlobStreamFormat); IdDataTypeComboBox.ItemIndex := Ord(ConnectionDef.IdDataType); IdSizeEdit.Text := IntToStr(ConnectionDef.IdSize); - // End SRM - 14 Mar 2005 end; finally Screen.Cursor := SavedCursor; @@ -328,29 +337,55 @@ Alias := Self.Alias; AliasIsPath := Self.AliasIsPath; - // Begin SRM - 14 Mar 2005 ConnectionDef.BlobStreamFormat := TInstantStreamFormat(StreamFormatComboBox.ItemIndex); ConnectionDef.IdDataType := TInstantDataType(IdDataTypeComboBox.ItemIndex); ConnectionDef.IdSize := StrToInt(IdSizeEdit.Text); - // End SRM - 14 Mar 2005 end; end; procedure TInstantNexusDBConnectionDefEditForm.LoadServersButtonClick( Sender: TObject); begin + ServersCbx.Clear; + ServersCbx.Text := SLoadingServers; + ServersCbx.Refresh; + LoadServers(ServersCbx.Items); - with ServersCbx, Items do - ItemIndex := IndexOf(ServerName); + + AliasesCbx.Clear; + AliasesCbx.Text := SNone; + AliasesCbx.Refresh; + + ServersCbx.Enabled := True; + if (ServerName <> '') then + ServersCbx.ItemIndex := ServersCbx.Items.IndexOf(ServerName); + + if (ServersCbx.Items.Count > 0) and (ServersCbx.ItemIndex < 0) then + ServersCbx.Text := SSelectServerFromList + else + begin + ServersCbx.Text := SNone; + ServersCbx.Enabled := False; + end; end; procedure TInstantNexusDBConnectionDefEditForm.LoadAliasesButtonClick( Sender: TObject); begin + AliasesCbx.Clear; + AliasesCbx.Text := SLoadingAliases; + AliasesCbx.Refresh; + LoadAliases(AliasesCbx.Items); - with AliasesCbx, Items do - ItemIndex := IndexOf(Alias); + + if (Alias <> '') then + AliasesCbx.ItemIndex := AliasesCbx.Items.IndexOf(Alias); + + if (AliasesCbx.Items.Count > 0) and (AliasesCbx.ItemIndex < 0) then + AliasesCbx.Text := SSelectAliasFromList + else + AliasesCbx.Text := SNone; end; procedure TInstantNexusDBConnectionDefEditForm.BrowseButtonClick( @@ -359,18 +394,24 @@ AliasDir: string; begin AliasDir := Alias; - if SelectDirectory(SSelectAnAliasPathPlease, '', AliasDir) then + if SelectDirectory(SSelectAnAliasPath, '', AliasDir) then Alias := AliasDir; end; procedure TInstantNexusDBConnectionDefEditForm.FormCreate(Sender: TObject); begin - // Begin SRM - 14 Mar 2005 + LoadServersButton.Hint := SLoadAvailableNexusDBServers; + LoadAliasesButton.Hint := SLoadAvailableAliases; + BrowseButton.Hint := SSelectAnAliasPath; + AssignInstantStreamFormat(StreamFormatComboBox.Items); AssignInstantDataTypeStrings(IdDataTypeComboBox.Items); IdDataTypeComboBox.ItemIndex := Ord(dtString); IdSizeEdit.Text := IntToStr(InstantDefaultFieldSize); - // End SRM - 14 Mar 2005 + + {$IFDEF NX1} + TransportTypeRadGrp.Items.Delete(Pred(TransportTypeRadGrp.Items.Count)); + {$ENDIF} end; end. Modified: trunk/Source/Brokers/NexusDb/InstantNexusDBConsts.pas =================================================================== --- trunk/Source/Brokers/NexusDb/InstantNexusDBConsts.pas 2006-03-12 21:47:50 UTC (rev 646) +++ trunk/Source/Brokers/NexusDb/InstantNexusDBConsts.pas 2006-03-13 21:42:42 UTC (rev 647) @@ -24,8 +24,8 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Steven Mitchell * - * * ***** END LICENSE BLOCK ***** *) unit InstantNexusDBConsts; @@ -40,7 +40,14 @@ interface resourcestring - SSelectAnAliasPathPlease = 'Select an alias path please ...'; + SLoadAvailableAliases = 'Load available aliases'; + SLoadAvailableNexusDBServers = 'Load available NexusDB servers'; + SLoadingAliases = 'Loading Aliases ...'; + SLoadingServers = 'Loading Servers ...'; + SNone = '[None]'; + SSelectAliasFromList = '[Select an alias from the list]'; + SSelectAnAliasPath = 'Select an alias path'; + SSelectServerFromList = '[Select a server from the list]'; implementation Modified: trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.dfm =================================================================== --- trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.dfm 2006-03-12 21:47:50 UTC (rev 646) +++ trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.dfm 2006-03-13 21:42:42 UTC (rev 647) @@ -1,6 +1,6 @@ object InstantNexusDBEmbeddedConnectionDefEditForm: TInstantNexusDBEmbeddedConnectionDefEditForm - Left = 1633 - Top = 436 + Left = 475 + Top = 389 BorderStyle = bsDialog Caption = 'NexusDB Embedded Connection' ClientHeight = 275 Modified: trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.pas =================================================================== --- trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.pas 2006-03-12 21:47:50 UTC (rev 646) +++ trunk/Source/Brokers/NexusDb/InstantNexusDBEmbeddedConnectionDefEdit.pas 2006-03-13 21:42:42 UTC (rev 647) @@ -191,11 +191,9 @@ Self.AliasIsPath := AliasIsPath; Self.Alias := Alias; - // Begin SRM - 14 Mar 2005 StreamFormatComboBox.ItemIndex := Ord(ConnectionDef.BlobStreamFormat); IdDataTypeComboBox.ItemIndex := Ord(ConnectionDef.IdDataType); IdSizeEdit.Text := IntToStr(ConnectionDef.IdSize); - // End SRM - 14 Mar 2005 end; finally Screen.Cursor := SavedCursor; @@ -210,12 +208,10 @@ Alias := Self.Alias; AliasIsPath := Self.AliasIsPath; - // Begin SRM - 14 Mar 2005 ConnectionDef.BlobStreamFormat := TInstantStreamFormat(StreamFormatComboBox.ItemIndex); ConnectionDef.IdDataType := TInstantDataType(IdDataTypeComboBox.ItemIndex); ConnectionDef.IdSize := StrToInt(IdSizeEdit.Text); - // End SRM - 14 Mar 2005 end; end; @@ -233,19 +229,20 @@ AliasDir: string; begin AliasDir := Alias; - if SelectDirectory(SSelectAnAliasPathPlease, '', AliasDir) then + if SelectDirectory(SSelectAnAliasPath, '', AliasDir) then Alias := AliasDir; end; procedure TInstantNexusDBEmbeddedConnectionDefEditForm.FormCreate(Sender: TObject); begin - // Begin SRM - 14 Mar 2005 + LoadAliasesButton.Hint := SLoadAvailableAliases; + BrowseButton.Hint := SSelectAnAliasPath; + AssignInstantStreamFormat(StreamFormatComboBox.Items); AssignInstantDataTypeStrings(IdDataTypeComboBox.Items); IdDataTypeComboBox.ItemIndex := Ord(dtString); IdSizeEdit.Text := IntToStr(InstantDefaultFieldSize); - // End SRM - 14 Mar 2005 end; end. |