mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Bind session parameter object to session manager list nodes, to be able to show the right vendor icon in that list.
This commit is contained in:
@ -111,6 +111,8 @@ object connform: Tconnform
|
||||
OnFocusChanging = ListSessionsFocusChanging
|
||||
OnGetText = ListSessionsGetText
|
||||
OnGetImageIndex = ListSessionsGetImageIndex
|
||||
OnGetNodeDataSize = ListSessionsGetNodeDataSize
|
||||
OnInitNode = ListSessionsInitNode
|
||||
OnNewText = ListSessionsNewText
|
||||
Columns = <
|
||||
item
|
||||
|
@ -10,7 +10,7 @@ interface
|
||||
|
||||
uses
|
||||
Windows, SysUtils, Classes, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
|
||||
VirtualTrees, Menus, Graphics,
|
||||
VirtualTrees, Menus, Graphics, Contnrs, Generics.Collections,
|
||||
dbconnection;
|
||||
|
||||
type
|
||||
@ -113,17 +113,18 @@ type
|
||||
procedure comboDatabasesDropDown(Sender: TObject);
|
||||
procedure chkLoginPromptClick(Sender: TObject);
|
||||
procedure comboNetTypeChange(Sender: TObject);
|
||||
procedure ListSessionsInitNode(Sender: TBaseVirtualTree; ParentNode,
|
||||
Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
|
||||
procedure ListSessionsGetNodeDataSize(Sender: TBaseVirtualTree;
|
||||
var NodeDataSize: Integer);
|
||||
private
|
||||
{ Private declarations }
|
||||
FLoaded: Boolean;
|
||||
FSessionNames: TStringlist;
|
||||
FSessions: TObjectList<TConnectionParameters>;
|
||||
FSessionModified, FOnlyPasswordModified, FSessionAdded: Boolean;
|
||||
FOrgParams: TConnectionParameters;
|
||||
FWidthListSessions: Byte; // Percentage values
|
||||
function SelectedSession: String;
|
||||
function CurrentParams: TConnectionParameters;
|
||||
procedure SessionNamesChange(Sender: TObject);
|
||||
procedure RefreshSessionList;
|
||||
procedure FinalizeModifications(var CanProceed: Boolean);
|
||||
procedure SaveCurrentValues(Session: String; IsNew: Boolean);
|
||||
procedure ValidateControls;
|
||||
@ -144,10 +145,13 @@ uses Main, helpers, grideditlinks;
|
||||
procedure Tconnform.FormCreate(Sender: TObject);
|
||||
var
|
||||
LastActiveSession: String;
|
||||
LastSessions: TStringList;
|
||||
SessionNames, LastSessions: TStringList;
|
||||
Sess: TConnectionParameters;
|
||||
PSess: PConnectionParameters;
|
||||
hSysMenu: THandle;
|
||||
idx: Integer;
|
||||
i: Integer;
|
||||
nt: TNetType;
|
||||
Node: PVirtualNode;
|
||||
begin
|
||||
// Fix GUI stuff
|
||||
InheritFont(Font);
|
||||
@ -163,21 +167,30 @@ begin
|
||||
for nt:=Low(nt) to High(nt) do
|
||||
comboNetType.Items.Add(TConnectionParameters.NetTypeName(nt, True));
|
||||
|
||||
FSessionNames := TStringList.Create;
|
||||
FSessionNames.OnChange := SessionNamesChange;
|
||||
RefreshSessionList;
|
||||
FSessions := TObjectList<TConnectionParameters>.Create;
|
||||
SessionNames := TStringList.Create;
|
||||
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
|
||||
MainReg.GetKeyNames(SessionNames);
|
||||
for i:=0 to SessionNames.Count-1 do begin
|
||||
Sess := LoadConnectionParams(SessionNames[i]);
|
||||
FSessions.Add(Sess);
|
||||
end;
|
||||
ListSessions.RootNodeCount := FSessions.Count;
|
||||
|
||||
// Focus last session
|
||||
LastSessions := Explode(DELIM, GetRegValue(REGNAME_LASTSESSIONS, ''));
|
||||
LastActiveSession := GetRegValue(REGNAME_LASTACTIVESESSION, '');
|
||||
idx := FSessionNames.IndexOf(LastActiveSession);
|
||||
if idx = -1 then begin
|
||||
if LastSessions.Count > 0 then
|
||||
idx := FSessionNames.IndexOf(LastSessions[0]);
|
||||
if idx = -1 then
|
||||
idx := 0;
|
||||
if (LastActiveSession = '') and (LastSessions.Count > 0) then
|
||||
LastActiveSession := LastSessions[0];
|
||||
Node := ListSessions.GetFirst;
|
||||
while Assigned(Node) do begin
|
||||
PSess := ListSessions.GetNodeData(Node);
|
||||
if PSess.SessionName = LastActiveSession then
|
||||
SelectNode(ListSessions, Node);
|
||||
Node := ListSessions.GetNextSibling(Node);
|
||||
end;
|
||||
SelectNode(ListSessions, idx);
|
||||
ValidateControls;
|
||||
|
||||
// Add own menu items to system menu
|
||||
hSysMenu := GetSystemMenu(Handle, False);
|
||||
AppendMenu(hSysMenu, MF_SEPARATOR, 0, #0);
|
||||
@ -225,7 +238,7 @@ var
|
||||
begin
|
||||
// Connect to selected session
|
||||
Screen.Cursor := crHourglass;
|
||||
if Mainform.InitConnection(CurrentParams, SelectedSession, True, Connection) then
|
||||
if Mainform.InitConnection(CurrentParams, True, Connection) then
|
||||
ModalResult := mrOK
|
||||
else begin
|
||||
TimerStatistics.OnTimer(Sender);
|
||||
@ -236,6 +249,8 @@ end;
|
||||
|
||||
|
||||
procedure Tconnform.SaveCurrentValues(Session: String; IsNew: Boolean);
|
||||
var
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
OpenRegistry(Session);
|
||||
MainReg.WriteString(REGNAME_HOST, editHost.Text);
|
||||
@ -261,7 +276,29 @@ begin
|
||||
MainReg.WriteString(REGNAME_SESSIONCREATED, DateTimeToStr(Now));
|
||||
OpenRegistry;
|
||||
MainReg.WriteString(REGNAME_PLINKEXE, editSSHPlinkExe.Text);
|
||||
FOrgParams := LoadConnectionParams(Session);
|
||||
|
||||
// Overtake edited values for in-memory parameter object
|
||||
Sess := ListSessions.GetNodeData(ListSessions.FocusedNode);
|
||||
Sess.Hostname := editHost.Text;
|
||||
Sess.Username := editUsername.Text;
|
||||
Sess.Password := editPassword.Text;
|
||||
Sess.LoginPrompt := chkLoginPrompt.Checked;
|
||||
Sess.Port := updownPort.Position;
|
||||
Sess.NetType := TNetType(comboNetType.ItemIndex);
|
||||
Sess.Compressed := chkCompressed.Checked;
|
||||
Sess.AllDatabasesStr := comboDatabases.Text;
|
||||
Sess.StartupScriptFilename := editStartupScript.Text;
|
||||
Sess.SSHHost := editSSHhost.Text;
|
||||
Sess.SSHPort := MakeInt(editSSHport.Text);
|
||||
Sess.SSHUser := editSSHUser.Text;
|
||||
Sess.SSHPassword := editSSHPassword.Text;
|
||||
Sess.SSHTimeout := updownSSHTimeout.Position;
|
||||
Sess.SSHPrivateKey := editSSHPrivateKey.Text;
|
||||
Sess.SSHLocalPort := MakeInt(editSSHlocalport.Text);
|
||||
Sess.SSLPrivateKey := editSSLPrivateKey.Text;
|
||||
Sess.SSLCertificate := editSSLCertificate.Text;
|
||||
Sess.SSLCACertificate := editSSLCACertificate.Text;
|
||||
|
||||
FSessionModified := False;
|
||||
FSessionAdded := False;
|
||||
ListSessions.Invalidate;
|
||||
@ -295,7 +332,6 @@ begin
|
||||
// Create the key and save its values
|
||||
OpenRegistry(newName);
|
||||
SaveCurrentValues(newName, True);
|
||||
RefreshSessionList;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -303,9 +339,10 @@ end;
|
||||
|
||||
procedure Tconnform.btnNewClick(Sender: TObject);
|
||||
var
|
||||
i, NewIdx: Integer;
|
||||
NewName: String;
|
||||
i: Integer;
|
||||
CanProceed: Boolean;
|
||||
NewSess: TConnectionParameters;
|
||||
Node: PVirtualNode;
|
||||
begin
|
||||
// Create new session
|
||||
FinalizeModifications(CanProceed);
|
||||
@ -313,19 +350,19 @@ begin
|
||||
Exit;
|
||||
|
||||
i := 0;
|
||||
NewName := 'Unnamed';
|
||||
while MainReg.KeyExists(RegPath + REGKEY_SESSIONS + NewName) do begin
|
||||
NewSess := TConnectionParameters.Create;
|
||||
NewSess.SessionName := 'Unnamed';
|
||||
while MainReg.KeyExists(RegPath + REGKEY_SESSIONS + NewSess.SessionName) do begin
|
||||
inc(i);
|
||||
NewName := 'Unnamed-' + IntToStr(i);
|
||||
NewSess.SessionName := 'Unnamed-' + IntToStr(i);
|
||||
end;
|
||||
FSessionNames.Add(NewName);
|
||||
FSessionNames.Sort;
|
||||
NewIdx := FSessionNames.IndexOf(NewName);
|
||||
FSessions.Add(NewSess);
|
||||
Node := ListSessions.AddChild(nil, @NewSess);
|
||||
// Select it
|
||||
SelectNode(ListSessions, NewIdx);
|
||||
SelectNode(ListSessions, Node);
|
||||
FSessionAdded := True;
|
||||
ValidateControls;
|
||||
ListSessions.EditNode(ListSessions.FocusedNode, ListSessions.FocusedColumn);
|
||||
ListSessions.EditNode(Node, 0);
|
||||
end;
|
||||
|
||||
|
||||
@ -333,13 +370,16 @@ procedure Tconnform.btnDeleteClick(Sender: TObject);
|
||||
var
|
||||
SessionKey: String;
|
||||
Node: PVirtualNode;
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
if MessageDlg('Delete session "' + SelectedSession + '" ?', mtConfirmation, [mbYes, mbCancel], 0) = mrYes then
|
||||
Sess := ListSessions.GetNodeData(ListSessions.FocusedNode);
|
||||
if MessageDlg('Delete session "' + Sess.SessionName + '" ?', mtConfirmation, [mbYes, mbCancel], 0) = mrYes then
|
||||
begin
|
||||
SessionKey := RegPath + REGKEY_SESSIONS + SelectedSession;
|
||||
SessionKey := RegPath + REGKEY_SESSIONS + Sess.SessionName;
|
||||
if MainReg.KeyExists(SessionKey) then
|
||||
MainReg.DeleteKey(SessionKey);
|
||||
FSessionNames.Delete(FSessionNames.IndexOf(SelectedSession));
|
||||
ListSessions.DeleteSelectedNodes;
|
||||
FSessions.Remove(Sess^);
|
||||
if (not Assigned(ListSessions.FocusedNode)) and (ListSessions.RootNodeCount > 0) then
|
||||
SelectNode(ListSessions, ListSessions.RootNodeCount-1)
|
||||
else begin
|
||||
@ -352,8 +392,11 @@ end;
|
||||
|
||||
|
||||
function Tconnform.SelectedSession: String;
|
||||
var
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
Result := FSessionNames[ListSessions.FocusedNode.Index];
|
||||
Sess := ListSessions.GetNodeData(ListSessions.FocusedNode);
|
||||
Result := Sess.SessionName;
|
||||
end;
|
||||
|
||||
|
||||
@ -361,6 +404,7 @@ function Tconnform.CurrentParams: TConnectionParameters;
|
||||
begin
|
||||
// Return non-stored parameters
|
||||
Result := TConnectionParameters.Create;
|
||||
Result.SessionName := SelectedSession;
|
||||
Result.NetType := TNetType(comboNetType.ItemIndex);
|
||||
Result.Hostname := editHost.Text;
|
||||
Result.Username := editUsername.Text;
|
||||
@ -384,50 +428,61 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.SessionNamesChange(Sender: TObject);
|
||||
begin
|
||||
ListSessions.RootNodeCount := (Sender as TStringlist).Count;
|
||||
ListSessions.Invalidate;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.RefreshSessionList;
|
||||
begin
|
||||
// Refresh list of session names
|
||||
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
|
||||
FSessionNames.BeginUpdate;
|
||||
MainReg.GetKeyNames(FSessionNames);
|
||||
FSessionNames.EndUpdate;
|
||||
FSessionModified := False;
|
||||
FSessionAdded := False;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.ListSessionsGetImageIndex(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
|
||||
var Ghosted: Boolean; var ImageIndex: Integer);
|
||||
var
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
// A new session gets an additional plus symbol, editing gets a pencil
|
||||
if not (Kind in [ikNormal, ikSelected]) then Exit;
|
||||
ImageIndex := 36;
|
||||
if Node = Sender.FocusedNode then begin
|
||||
if FSessionAdded then ImageIndex := 72
|
||||
else if FSessionModified then ImageIndex := 135;
|
||||
end
|
||||
case Kind of
|
||||
ikNormal, ikSelected: begin
|
||||
Sess := Sender.GetNodeData(Node);
|
||||
ImageIndex := Sess.ImageIndex;
|
||||
end;
|
||||
|
||||
ikOverlay: if Node = Sender.FocusedNode then begin
|
||||
if FSessionAdded then
|
||||
ImageIndex := 163
|
||||
else if FSessionModified then
|
||||
ImageIndex := 162;
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.ListSessionsGetNodeDataSize(Sender: TBaseVirtualTree;
|
||||
var NodeDataSize: Integer);
|
||||
begin
|
||||
NodeDataSize := SizeOf(TConnectionParameters);
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.ListSessionsGetText(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
|
||||
var CellText: String);
|
||||
var
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
// Display session name cell
|
||||
CellText := FSessionNames[Node.Index];
|
||||
Sess := Sender.GetNodeData(Node);
|
||||
CellText := Sess.SessionName;
|
||||
if (FSessionModified or FSessionAdded) and (Node = Sender.FocusedNode) and (not Sender.IsEditing) then
|
||||
CellText := CellText + ' *';
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.ListSessionsInitNode(Sender: TBaseVirtualTree; ParentNode,
|
||||
Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
|
||||
var
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
Sess := Sender.GetNodeData(Node);
|
||||
Sess^ := FSessions[Node.Index];
|
||||
end;
|
||||
|
||||
|
||||
procedure Tconnform.ListSessionsCreateEditor(Sender: TBaseVirtualTree; Node: PVirtualNode;
|
||||
Column: TColumnIndex; out EditLink: IVTEditLink);
|
||||
begin
|
||||
@ -440,41 +495,36 @@ procedure Tconnform.ListSessionsFocusChanged(Sender: TBaseVirtualTree;
|
||||
Node: PVirtualNode; Column: TColumnIndex);
|
||||
var
|
||||
SessionFocused: Boolean;
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
// select one connection!
|
||||
Screen.Cursor := crHourglass;
|
||||
TimerStatistics.Enabled := False;
|
||||
OpenRegistry;
|
||||
SessionFocused := Assigned(Node);
|
||||
if SessionFocused then begin
|
||||
try
|
||||
FOrgParams := LoadConnectionParams(SelectedSession);
|
||||
except
|
||||
// Editing a new session, not saved yet
|
||||
FOrgParams := TConnectionParameters.Create;
|
||||
end;
|
||||
Sess := Sender.GetNodeData(Node);
|
||||
|
||||
FLoaded := False;
|
||||
comboNetType.ItemIndex := Integer(FOrgParams.NetType);
|
||||
editHost.Text := FOrgParams.Hostname;
|
||||
editUsername.Text := FOrgParams.Username;
|
||||
editPassword.Text := FOrgParams.Password;
|
||||
chkLoginPrompt.Checked := FOrgParams.LoginPrompt;
|
||||
updownPort.Position := FOrgParams.Port;
|
||||
chkCompressed.Checked := FOrgParams.Compressed;
|
||||
comboDatabases.Text := FOrgParams.AllDatabasesStr;
|
||||
editStartupScript.Text := FOrgParams.StartupScriptFilename;
|
||||
editSSHPlinkExe.Text := FOrgParams.SSHPlinkExe;
|
||||
editSSHHost.Text := FOrgParams.SSHHost;
|
||||
editSSHport.Text := IntToStr(FOrgParams.SSHPort);
|
||||
editSSHUser.Text := FOrgParams.SSHUser;
|
||||
editSSHPassword.Text := FOrgParams.SSHPassword;
|
||||
updownSSHTimeout.Position := FOrgParams.SSHTimeout;
|
||||
editSSHPrivateKey.Text := FOrgParams.SSHPrivateKey;
|
||||
editSSHlocalport.Text := IntToStr(FOrgParams.SSHLocalPort);
|
||||
editSSLPrivateKey.Text := FOrgParams.SSLPrivateKey;
|
||||
editSSLCertificate.Text := FOrgParams.SSLCertificate;
|
||||
editSSLCACertificate.Text := FOrgParams.SSLCACertificate;
|
||||
comboNetType.ItemIndex := Integer(Sess.NetType);
|
||||
editHost.Text := Sess.Hostname;
|
||||
editUsername.Text := Sess.Username;
|
||||
editPassword.Text := Sess.Password;
|
||||
chkLoginPrompt.Checked := Sess.LoginPrompt;
|
||||
updownPort.Position := Sess.Port;
|
||||
chkCompressed.Checked := Sess.Compressed;
|
||||
comboDatabases.Text := Sess.AllDatabasesStr;
|
||||
editStartupScript.Text := Sess.StartupScriptFilename;
|
||||
editSSHPlinkExe.Text := Sess.SSHPlinkExe;
|
||||
editSSHHost.Text := Sess.SSHHost;
|
||||
editSSHport.Text := IntToStr(Sess.SSHPort);
|
||||
editSSHUser.Text := Sess.SSHUser;
|
||||
editSSHPassword.Text := Sess.SSHPassword;
|
||||
updownSSHTimeout.Position := Sess.SSHTimeout;
|
||||
editSSHPrivateKey.Text := Sess.SSHPrivateKey;
|
||||
editSSHlocalport.Text := IntToStr(Sess.SSHLocalPort);
|
||||
editSSLPrivateKey.Text := Sess.SSLPrivateKey;
|
||||
editSSLCertificate.Text := Sess.SSLCertificate;
|
||||
editSSLCACertificate.Text := Sess.SSLCACertificate;
|
||||
FLoaded := True;
|
||||
end;
|
||||
|
||||
@ -547,23 +597,25 @@ procedure Tconnform.ListSessionsNewText(Sender: TBaseVirtualTree;
|
||||
var
|
||||
SessionKey: String;
|
||||
Connection: TDBConnection;
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
// Rename session
|
||||
Sess := Sender.GetNodeData(Node);
|
||||
OpenRegistry;
|
||||
if MainReg.KeyExists(REGKEY_SESSIONS + NewText) then begin
|
||||
MessageDLG('Session "'+NewText+'" already exists!', mtError, [mbCancel], 0);
|
||||
NewText := SelectedSession;
|
||||
NewText := Sess.SessionName;
|
||||
end else begin
|
||||
SessionKey := RegPath + REGKEY_SESSIONS + SelectedSession;
|
||||
SessionKey := RegPath + REGKEY_SESSIONS + Sess.SessionName;
|
||||
if MainReg.KeyExists(SessionKey) then
|
||||
MainReg.MoveKey(SessionKey, RegPath + REGKEY_SESSIONS + NewText, true);
|
||||
// Also fix internal session names in main form, which gets used to store e.g. "lastuseddb" later
|
||||
for Connection in MainForm.Connections do begin
|
||||
if Connection.SessionName = SelectedSession then
|
||||
Connection.SessionName := NewText;
|
||||
if Connection.Parameters.SessionName = Sess.SessionName then
|
||||
Connection.Parameters.SessionName := NewText;
|
||||
end;
|
||||
MainForm.SetWindowCaption;
|
||||
FSessionNames[FSessionNames.IndexOf(SelectedSession)] := NewText;
|
||||
Sess.SessionName := NewText;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -629,29 +681,31 @@ end;
|
||||
procedure Tconnform.Modification(Sender: TObject);
|
||||
var
|
||||
PasswordModified: Boolean;
|
||||
Sess: PConnectionParameters;
|
||||
begin
|
||||
// Some modification -
|
||||
if FLoaded then begin
|
||||
FSessionModified := (FOrgParams.Hostname <> editHost.Text)
|
||||
or (FOrgParams.Username <> editUsername.Text)
|
||||
or (FOrgParams.LoginPrompt <> chkLoginPrompt.Checked)
|
||||
or (FOrgParams.Port <> updownPort.Position)
|
||||
or (FOrgParams.Compressed <> chkCompressed.Checked)
|
||||
or (FOrgParams.NetType <> TNetType(comboNetType.ItemIndex))
|
||||
or (FOrgParams.StartupScriptFilename <> editStartupScript.Text)
|
||||
or (FOrgParams.AllDatabasesStr <> comboDatabases.Text)
|
||||
or (FOrgParams.SSHHost <> editSSHHost.Text)
|
||||
or (IntToStr(FOrgParams.SSHPort) <> editSSHPort.Text)
|
||||
or (FOrgParams.SSHPlinkExe <> editSSHPlinkExe.Text)
|
||||
or (IntToStr(FOrgParams.SSHLocalPort) <> editSSHlocalport.Text)
|
||||
or (FOrgParams.SSHUser <> editSSHUser.Text)
|
||||
or (FOrgParams.SSHPassword <> editSSHPassword.Text)
|
||||
or (FOrgParams.SSHTimeout <> updownSSHTimeout.Position)
|
||||
or (FOrgParams.SSHPrivateKey <> editSSHPrivateKey.Text)
|
||||
or (FOrgParams.SSLPrivateKey <> editSSLPrivateKey.Text)
|
||||
or (FOrgParams.SSLCertificate <> editSSLCertificate.Text)
|
||||
or (FOrgParams.SSLCACertificate <> editSSLCACertificate.Text);
|
||||
PasswordModified := FOrgParams.Password <> editPassword.Text;
|
||||
Sess := ListSessions.GetNodeData(ListSessions.FocusedNode);
|
||||
FSessionModified := (Sess.Hostname <> editHost.Text)
|
||||
or (Sess.Username <> editUsername.Text)
|
||||
or (Sess.LoginPrompt <> chkLoginPrompt.Checked)
|
||||
or (Sess.Port <> updownPort.Position)
|
||||
or (Sess.Compressed <> chkCompressed.Checked)
|
||||
or (Sess.NetType <> TNetType(comboNetType.ItemIndex))
|
||||
or (Sess.StartupScriptFilename <> editStartupScript.Text)
|
||||
or (Sess.AllDatabasesStr <> comboDatabases.Text)
|
||||
or (Sess.SSHHost <> editSSHHost.Text)
|
||||
or (IntToStr(Sess.SSHPort) <> editSSHPort.Text)
|
||||
or (Sess.SSHPlinkExe <> editSSHPlinkExe.Text)
|
||||
or (IntToStr(Sess.SSHLocalPort) <> editSSHlocalport.Text)
|
||||
or (Sess.SSHUser <> editSSHUser.Text)
|
||||
or (Sess.SSHPassword <> editSSHPassword.Text)
|
||||
or (Sess.SSHTimeout <> updownSSHTimeout.Position)
|
||||
or (Sess.SSHPrivateKey <> editSSHPrivateKey.Text)
|
||||
or (Sess.SSLPrivateKey <> editSSLPrivateKey.Text)
|
||||
or (Sess.SSLCertificate <> editSSLCertificate.Text)
|
||||
or (Sess.SSLCACertificate <> editSSLCACertificate.Text);
|
||||
PasswordModified := Sess.Password <> editPassword.Text;
|
||||
FOnlyPasswordModified := PasswordModified and (not FSessionModified);
|
||||
FSessionModified := FSessionModified or PasswordModified;
|
||||
|
||||
@ -670,7 +724,6 @@ begin
|
||||
CanProceed := True;
|
||||
end;
|
||||
mrNo: begin
|
||||
RefreshSessionList;
|
||||
CanProceed := True;
|
||||
end;
|
||||
mrCancel: CanProceed := False;
|
||||
@ -696,7 +749,7 @@ begin
|
||||
if not SessionFocused then begin
|
||||
PageControlDetails.Visible := False;
|
||||
lblHelp.Visible := True;
|
||||
if FSessionNames.Count = 0 then
|
||||
if FSessions.Count = 0 then
|
||||
lblHelp.Caption := 'New here? In order to connect to a MySQL server, you have to create a so called '+
|
||||
'"session" at first. Just click the "New" button on the bottom left to create your first session.'+CRLF+CRLF+
|
||||
'Give it a friendly name (e.g. "Local DB server") so you''ll recall it the next time you start '+APPNAME+'.'
|
||||
|
@ -272,7 +272,7 @@ begin
|
||||
AllDatabases[i] := editDBname.Text
|
||||
else
|
||||
AllDatabases.Add(editDBname.Text);
|
||||
OpenRegistry(FConnection.SessionName);
|
||||
OpenRegistry(FConnection.Parameters.SessionName);
|
||||
FConnection.Parameters.AllDatabasesStr := ImplodeStr(';', AllDatabases);
|
||||
MainReg.WriteString(REGNAME_DATABASES, FConnection.Parameters.AllDatabasesStr);
|
||||
end;
|
||||
|
@ -308,7 +308,7 @@ type
|
||||
strict private
|
||||
FNetType: TNetType;
|
||||
FHostname, FUsername, FPassword, FAllDatabases, FStartupScriptFilename,
|
||||
FSSLPrivateKey, FSSLCertificate, FSSLCACertificate,
|
||||
FSessionName, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate,
|
||||
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
||||
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout: Integer;
|
||||
FLoginPrompt, FCompressed: Boolean;
|
||||
@ -323,6 +323,7 @@ type
|
||||
published
|
||||
property NetType: TNetType read FNetType write FNetType;
|
||||
property NetTypeGroup: TNetTypeGroup read GetNetTypeGroup;
|
||||
property SessionName: String read FSessionName write FSessionName;
|
||||
property Hostname: String read FHostname write FHostname;
|
||||
property Port: Integer read FPort write FPort;
|
||||
property Username: String read FUsername write FUsername;
|
||||
@ -343,6 +344,7 @@ type
|
||||
property SSLCertificate: String read FSSLCertificate write FSSLCertificate;
|
||||
property SSLCACertificate: String read FSSLCACertificate write FSSLCACertificate;
|
||||
end;
|
||||
PConnectionParameters = ^TConnectionParameters;
|
||||
|
||||
|
||||
{ TDBConnection }
|
||||
@ -357,7 +359,6 @@ type
|
||||
FActive: Boolean;
|
||||
FConnectionStarted: Integer;
|
||||
FServerStarted: Integer;
|
||||
FSessionName: String;
|
||||
FParameters: TConnectionParameters;
|
||||
FLoginPromptDone: Boolean;
|
||||
FDatabase: String;
|
||||
@ -445,7 +446,6 @@ type
|
||||
var Deterministic: Boolean; var Definer, Returns, DataAccess, Security, Comment, Body: String);
|
||||
function GetDatatypeByName(Datatype: String): TDBDatatype;
|
||||
function ApplyLimitClause(QueryType, QueryBody: String; Limit, Offset: Cardinal): String;
|
||||
property SessionName: String read FSessionName write FSessionName;
|
||||
property Parameters: TConnectionParameters read FParameters write FParameters;
|
||||
property ThreadId: Cardinal read GetThreadId;
|
||||
property ConnectionUptime: Integer read GetConnectionUptime;
|
||||
@ -805,7 +805,6 @@ end;
|
||||
constructor TDBConnection.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FSessionName := 'Unnamed';
|
||||
FParameters := TConnectionParameters.Create;
|
||||
FRowsFound := 0;
|
||||
FRowsAffected := 0;
|
||||
|
@ -2691,6 +2691,7 @@ begin
|
||||
raise Exception.Create('Error: Session "'+Session+'" not found in registry.')
|
||||
else begin
|
||||
Result := TConnectionParameters.Create;
|
||||
Result.SessionName := Session;
|
||||
Result.NetType := TNetType(GetRegValue(REGNAME_NETTYPE, Integer(ntMySQL_TCPIP), Session));
|
||||
Result.Hostname := GetRegValue(REGNAME_HOST, '', Session);
|
||||
Result.Username := GetRegValue(REGNAME_USER, '', Session);
|
||||
|
@ -80,7 +80,7 @@ uses main, helpers;
|
||||
procedure TfrmInsertFiles.FormShow(Sender: TObject);
|
||||
begin
|
||||
FConnection := Mainform.ActiveConnection;
|
||||
Caption := FConnection.SessionName + ' - Insert files into table ...';
|
||||
Caption := FConnection.Parameters.SessionName + ' - Insert files into table ...';
|
||||
ComboBoxDBs.Items.Clear;
|
||||
ComboBoxDBs.Items.Assign(FConnection.AllDatabases);
|
||||
ComboBoxDBs.ItemIndex := ComboBoxDBs.Items.IndexOf(FConnection.Database);
|
||||
|
@ -865,7 +865,6 @@ type
|
||||
FTreeRefreshInProgress: Boolean;
|
||||
FCmdlineFilenames: TStringlist;
|
||||
FCmdlineConnectionParams: TConnectionParameters;
|
||||
FCmdlineSessionName: String;
|
||||
FSearchReplaceExecuted: Boolean;
|
||||
FDataGridColumnWidthsCustomized: Boolean;
|
||||
FSnippetFilenames: TStringList;
|
||||
@ -998,8 +997,7 @@ type
|
||||
procedure PopupQueryLoadRemoveAbsentFiles(Sender: TObject);
|
||||
procedure PopupQueryLoadRemoveAllFiles(Sender: TObject);
|
||||
procedure SessionConnect(Sender: TObject);
|
||||
function InitConnection(Params: TConnectionParameters; Session: String;
|
||||
ActivateMe: Boolean; var Connection: TDBConnection): Boolean;
|
||||
function InitConnection(Params: TConnectionParameters; ActivateMe: Boolean; var Connection: TDBConnection): Boolean;
|
||||
procedure ConnectionsNotify(Sender: TObject; const Item: TDBConnection; Action: TCollectionNotification);
|
||||
function ActiveGrid: TVirtualStringTree;
|
||||
function GridResult(Grid: TBaseVirtualTree): TDBQuery;
|
||||
@ -1221,11 +1219,11 @@ begin
|
||||
OpenRegistry;
|
||||
OpenSessions := '';
|
||||
for Connection in Connections do
|
||||
OpenSessions := OpenSessions + Connection.SessionName + DELIM;
|
||||
OpenSessions := OpenSessions + Connection.Parameters.SessionName + DELIM;
|
||||
Delete(OpenSessions, Length(OpenSessions)-Length(DELIM)+1, Length(DELIM));
|
||||
MainReg.WriteString(REGNAME_LASTSESSIONS, OpenSessions);
|
||||
if Assigned(ActiveConnection) then
|
||||
MainReg.WriteString(REGNAME_LASTACTIVESESSION, ActiveConnection.SessionName);
|
||||
MainReg.WriteString(REGNAME_LASTACTIVESESSION, ActiveConnection.Parameters.SessionName);
|
||||
|
||||
// Close database connections
|
||||
Connections.Clear;
|
||||
@ -1687,7 +1685,7 @@ begin
|
||||
ParseCommandLineParameters(CmdlineParameters);
|
||||
if Assigned(FCmdlineConnectionParams) then begin
|
||||
// Minimal parameter for command line mode is hostname
|
||||
Connected := InitConnection(FCmdlineConnectionParams, FCmdlineSessionName, True, Connection);
|
||||
Connected := InitConnection(FCmdlineConnectionParams, True, Connection);
|
||||
end else if GetRegValue(REGNAME_AUTORECONNECT, DEFAULT_AUTORECONNECT) then begin
|
||||
// Auto connection via preference setting
|
||||
// Do not autoconnect if we're in commandline mode and the connection was not successful
|
||||
@ -1703,7 +1701,7 @@ begin
|
||||
for i:=0 to LastSessions.Count-1 do begin
|
||||
try
|
||||
LoadedParams := LoadConnectionParams(LastSessions[i]);
|
||||
if InitConnection(LoadedParams, LastSessions[i], LastActiveSession=LastSessions[i], Connection) then
|
||||
if InitConnection(LoadedParams, LastActiveSession=LastSessions[i], Connection) then
|
||||
Connected := True;
|
||||
except on E:Exception do
|
||||
MessageDlg(E.Message, mtError, [mbOK], 0);
|
||||
@ -1740,7 +1738,7 @@ end;
|
||||
procedure TMainForm.ParseCommandLineParameters(Parameters: TStringlist);
|
||||
var
|
||||
rx: TRegExpr;
|
||||
AllParams, Host, User, Pass, Socket: String;
|
||||
AllParams, SessName, Host, User, Pass, Socket: String;
|
||||
i, Port: Integer;
|
||||
|
||||
function GetParamValue(ShortName, LongName: String): String;
|
||||
@ -1756,22 +1754,22 @@ begin
|
||||
if not Assigned(FCmdlineFilenames) then
|
||||
FCmdlineFilenames := TStringlist.Create;
|
||||
FCmdlineFilenames.Clear;
|
||||
FCmdlineSessionName := '';
|
||||
SessName := '';
|
||||
FreeAndNil(FCmdlineConnectionParams);
|
||||
|
||||
// Prepend a space, so the regular expression can request a mandantory space
|
||||
// before each param name including the first one
|
||||
AllParams := ' ' + ImplodeStr(' ', Parameters);
|
||||
rx := TRegExpr.Create;
|
||||
FCmdlineSessionName := GetParamValue('d', 'description');
|
||||
if FCmdlineSessionName <> '' then begin
|
||||
SessName := GetParamValue('d', 'description');
|
||||
if SessName <> '' then begin
|
||||
try
|
||||
FCmdlineConnectionParams := LoadConnectionParams(FCmdlineSessionName);
|
||||
FCmdlineConnectionParams := LoadConnectionParams(SessName);
|
||||
except
|
||||
on E:Exception do begin
|
||||
// Session params not found in registry
|
||||
LogSQL(E.Message);
|
||||
FCmdlineSessionName := '';
|
||||
SessName := '';
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1787,8 +1785,10 @@ begin
|
||||
// Leave out support for startup script, seems reasonable for command line connecting
|
||||
|
||||
if (Host <> '') or (User <> '') or (Pass <> '') or (Port <> 0) or (Socket <> '') then begin
|
||||
if not Assigned(FCmdlineConnectionParams) then
|
||||
if not Assigned(FCmdlineConnectionParams) then begin
|
||||
FCmdlineConnectionParams := TConnectionParameters.Create;
|
||||
FCmdlineConnectionParams.SessionName := SessName;
|
||||
end;
|
||||
if Host <> '' then FCmdlineConnectionParams.Hostname := Host;
|
||||
if User <> '' then FCmdlineConnectionParams.Username := User;
|
||||
if Pass <> '' then FCmdlineConnectionParams.Password := Pass;
|
||||
@ -1798,8 +1798,8 @@ begin
|
||||
FCmdlineConnectionParams.NetType := ntMySQL_NamedPipe;
|
||||
end;
|
||||
// Ensure we have a session name to pass to InitConnection
|
||||
if (FCmdlineSessionName = '') and (FCmdlineConnectionParams.Hostname <> '') then
|
||||
FCmdlineSessionName := FCmdlineConnectionParams.Hostname;
|
||||
if (FCmdlineConnectionParams.SessionName = '') and (FCmdlineConnectionParams.Hostname <> '') then
|
||||
FCmdlineConnectionParams.SessionName := FCmdlineConnectionParams.Hostname;
|
||||
end;
|
||||
|
||||
// Check for valid filename(s) in parameters
|
||||
@ -1871,7 +1871,7 @@ begin
|
||||
RefreshHelperNode(HELPERNODE_COLUMNS);}
|
||||
|
||||
// Last chance to access connection related properties before disconnecting
|
||||
OpenRegistry(Item.SessionName);
|
||||
OpenRegistry(Item.Parameters.SessionName);
|
||||
MainReg.WriteString(REGNAME_LASTUSEDDB, Item.Database);
|
||||
|
||||
// Disconnect
|
||||
@ -2070,7 +2070,7 @@ begin
|
||||
item.OnClick := SessionConnect;
|
||||
item.ImageIndex := 37;
|
||||
for Connection in Connections do begin
|
||||
if SessionNames[i] = Connection.SessionName then begin
|
||||
if SessionNames[i] = Connection.Parameters.SessionName then begin
|
||||
item.Checked := True;
|
||||
item.ImageIndex := -1;
|
||||
break;
|
||||
@ -2099,7 +2099,7 @@ begin
|
||||
menuConnectTo.Delete(i);
|
||||
ConnectedSessions := TStringList.Create;
|
||||
for i:=0 to Connections.Count-1 do
|
||||
ConnectedSessions.Add(Connections[i].SessionName);
|
||||
ConnectedSessions.Add(Connections[i].Parameters.SessionName);
|
||||
SessionNames := TStringList.Create;
|
||||
MainReg.GetKeyNames(SessionNames);
|
||||
for i:=0 to SessionNames.Count-1 do begin
|
||||
@ -2774,7 +2774,7 @@ begin
|
||||
for i:=High(FTreeClickHistory) downto Low(FTreeClickHistory) do begin
|
||||
if FTreeClickHistory[i] <> nil then begin
|
||||
DBObj := DBtree.GetNodeData(FTreeClickHistory[i]);
|
||||
if DBObj.Connection.SessionName = Session then begin
|
||||
if DBObj.Connection.Parameters.SessionName = Session then begin
|
||||
Node := FTreeClickHistory[i];
|
||||
break;
|
||||
end;
|
||||
@ -2785,7 +2785,7 @@ begin
|
||||
SessionNode := DBtree.GetFirstChild(nil);
|
||||
while Assigned(SessionNode) do begin
|
||||
DBObj := DBtree.GetNodeData(SessionNode);
|
||||
if DBObj.Connection.SessionName = Session then begin
|
||||
if DBObj.Connection.Parameters.SessionName = Session then begin
|
||||
Node := SessionNode;
|
||||
end;
|
||||
SessionNode := DBtree.GetNextSibling(SessionNode);
|
||||
@ -2796,7 +2796,7 @@ begin
|
||||
SelectNode(DBtree, Node)
|
||||
else begin
|
||||
Params := LoadConnectionParams(Session);
|
||||
InitConnection(Params, Session, True, Connection);
|
||||
InitConnection(Params, True, Connection);
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -2805,8 +2805,7 @@ end;
|
||||
Receive connection parameters and create a connection tree node
|
||||
Paremeters are either sent by connection-form or by commandline.
|
||||
}
|
||||
function TMainform.InitConnection(Params: TConnectionParameters; Session: String;
|
||||
ActivateMe: Boolean; var Connection: TDBConnection): Boolean;
|
||||
function TMainform.InitConnection(Params: TConnectionParameters; ActivateMe: Boolean; var Connection: TDBConnection): Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
SessionExists, RestoreLastActiveDatabase: Boolean;
|
||||
@ -2820,7 +2819,6 @@ begin
|
||||
Connection.OnDBObjectsCleared := DBObjectsCleared;
|
||||
Connection.OnDatabaseChanged := DatabaseChanged;
|
||||
Connection.ObjectNamesInSelectedDB := SynSQLSyn1.TableNames;
|
||||
Connection.SessionName := Session;
|
||||
try
|
||||
Connection.Active := True;
|
||||
except
|
||||
@ -2829,13 +2827,13 @@ begin
|
||||
end;
|
||||
|
||||
// attempt to establish connection
|
||||
SessionExists := MainReg.KeyExists(REGPATH + REGKEY_SESSIONS + Session);
|
||||
SessionExists := MainReg.KeyExists(REGPATH + REGKEY_SESSIONS + Params.SessionName);
|
||||
if not Connection.Active then begin
|
||||
// attempt failed
|
||||
if SessionExists then begin
|
||||
// Save "refused" counter
|
||||
OpenRegistry(Session);
|
||||
MainReg.WriteInteger(REGNAME_REFUSEDCOUNT, GetRegValue(REGNAME_REFUSEDCOUNT, 0, Session)+1);
|
||||
OpenRegistry(Params.SessionName);
|
||||
MainReg.WriteInteger(REGNAME_REFUSEDCOUNT, GetRegValue(REGNAME_REFUSEDCOUNT, 0, Params.SessionName)+1);
|
||||
end;
|
||||
Result := False;
|
||||
FreeAndNil(Connection);
|
||||
@ -2846,8 +2844,8 @@ begin
|
||||
|
||||
if SessionExists then begin
|
||||
// Save "connected" counter
|
||||
OpenRegistry(Session);
|
||||
MainReg.WriteInteger(REGNAME_CONNECTCOUNT, GetRegValue(REGNAME_CONNECTCOUNT, 0, Session)+1);
|
||||
OpenRegistry(Params.SessionName);
|
||||
MainReg.WriteInteger(REGNAME_CONNECTCOUNT, GetRegValue(REGNAME_CONNECTCOUNT, 0, Params.SessionName)+1);
|
||||
// Save server version
|
||||
Mainreg.WriteInteger(REGNAME_SERVERVERSION, Connection.ServerVersionInt);
|
||||
Mainreg.WriteString(REGNAME_LASTCONNECT, DateTimeToStr(Now));
|
||||
@ -2856,7 +2854,7 @@ begin
|
||||
if ActivateMe then begin
|
||||
// Set focus on last uses db. If not wanted or db is gone, go to root node at least
|
||||
RestoreLastActiveDatabase := GetRegValue(REGNAME_RESTORELASTUSEDDB, DEFAULT_RESTORELASTUSEDDB);
|
||||
LastActiveDatabase := GetRegValue(REGNAME_LASTUSEDDB, '', Session);
|
||||
LastActiveDatabase := GetRegValue(REGNAME_LASTUSEDDB, '', Params.SessionName);
|
||||
if RestoreLastActiveDatabase and (Connection.AllDatabases.IndexOf(LastActiveDatabase) >- 1) then begin
|
||||
SetActiveDatabase(LastActiveDatabase, Connection);
|
||||
DBNode := FindDBNode(DBtree, LastActiveDatabase);
|
||||
@ -3741,7 +3739,7 @@ begin
|
||||
cs.Dialog.Color := DBtree.Color;
|
||||
if cs.Execute then begin
|
||||
DBtree.Color := cs.Dialog.Color;
|
||||
OpenRegistry(ActiveConnection.SessionName);
|
||||
OpenRegistry(ActiveConnection.Parameters.SessionName);
|
||||
MainReg.WriteInteger(REGNAME_TREEBACKGROUND, cs.Dialog.Color);
|
||||
end;
|
||||
end;
|
||||
@ -3799,7 +3797,7 @@ begin
|
||||
try
|
||||
Sess := '';
|
||||
if Assigned(Connection) then
|
||||
Sess := Connection.SessionName;
|
||||
Sess := Connection.Parameters.SessionName;
|
||||
WriteLn(FileHandleSessionLog, Format('/* %s [%s] */ %s', [DateTimeToStr(Now), Sess, msg]));
|
||||
except
|
||||
on E:Exception do begin
|
||||
@ -6631,7 +6629,7 @@ begin
|
||||
DBObj := Sender.GetNodeData(Node);
|
||||
case Column of
|
||||
0: case DBObj.NodeType of
|
||||
lntNone: CellText := DBObj.Connection.SessionName;
|
||||
lntNone: CellText := DBObj.Connection.Parameters.SessionName;
|
||||
lntDb: CellText := DBObj.Database;
|
||||
lntTable..lntEvent: CellText := DBObj.Name;
|
||||
lntColumn: CellText := DBObj.Column;
|
||||
@ -6878,7 +6876,7 @@ begin
|
||||
TimerConnected.OnTimer(Sender);
|
||||
TimerHostUptime.OnTimer(Sender);
|
||||
DBObj.Connection.OnConnected(DBObj.Connection, DBObj.Connection.Database);
|
||||
DBTree.Color := GetRegValue(REGNAME_TREEBACKGROUND, clWindow, DBObj.Connection.SessionName);
|
||||
DBTree.Color := GetRegValue(REGNAME_TREEBACKGROUND, clWindow, DBObj.Connection.Parameters.SessionName);
|
||||
case DBObj.Connection.Parameters.NetTypeGroup of
|
||||
ngMySQL:
|
||||
SynSQLSyn1.SQLDialect := sqlMySQL;
|
||||
@ -7865,7 +7863,7 @@ end;
|
||||
function TMainForm.GetRegKeyTable: String;
|
||||
begin
|
||||
// Return the slightly complex registry path to \Servers\ThisServer\curdb|curtable
|
||||
Result := REGPATH + REGKEY_SESSIONS + ActiveDbObj.Connection.SessionName + '\' +
|
||||
Result := REGPATH + REGKEY_SESSIONS + ActiveDbObj.Connection.Parameters.SessionName + '\' +
|
||||
ActiveDatabase + DELIM + ActiveDbObj.Name;
|
||||
end;
|
||||
|
||||
@ -8854,15 +8852,15 @@ begin
|
||||
Keys := TStringList.Create;
|
||||
if (Sender = btnClearFilters) or (Sender = menuClearFiltersTable) then begin
|
||||
Screen.Cursor := crHourGlass;
|
||||
OpenRegistry(ActiveDbObj.Connection.SessionName);
|
||||
OpenRegistry(ActiveDbObj.Connection.Parameters.SessionName);
|
||||
MainReg.GetKeyNames(Keys);
|
||||
idx := Keys.IndexOf(ActiveDbObj.Database+'|'+ActiveDbObj.Name);
|
||||
if idx > -1 then
|
||||
MainReg.DeleteKey(Keys[idx]);
|
||||
end else if Sender = menuClearFiltersSession then begin
|
||||
if MessageDlg('Remove all filter stuff for this session ('+ActiveDbObj.Connection.SessionName+') ?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
|
||||
if MessageDlg('Remove all filter stuff for this session ('+ActiveDbObj.Connection.Parameters.SessionName+') ?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin
|
||||
Screen.Cursor := crHourGlass;
|
||||
OpenRegistry(ActiveDbObj.Connection.SessionName);
|
||||
OpenRegistry(ActiveDbObj.Connection.Parameters.SessionName);
|
||||
MainReg.GetKeyNames(Keys);
|
||||
for idx:=0 to Keys.Count-1 do
|
||||
MainReg.DeleteKey(Keys[idx])
|
||||
@ -9258,7 +9256,7 @@ begin
|
||||
// Set window caption and taskbar text
|
||||
Cap := '';
|
||||
if ActiveConnection <> nil then begin
|
||||
Cap := Cap + ActiveConnection.SessionName;
|
||||
Cap := Cap + ActiveConnection.Parameters.SessionName;
|
||||
if ActiveDatabase <> '' then
|
||||
Cap := Cap + ' /' + ActiveDatabase;
|
||||
if Assigned(ActiveDbObj) and (ActiveDbObj.Name <> '') then
|
||||
@ -9695,7 +9693,7 @@ begin
|
||||
QueryLoad(FCmdlineFilenames[i], True, True, nil);
|
||||
end;
|
||||
if Assigned(FCmdlineConnectionParams) then
|
||||
InitConnection(FCmdlineConnectionParams, FCmdlineSessionName, True, Connection);
|
||||
InitConnection(FCmdlineConnectionParams, True, Connection);
|
||||
end else
|
||||
// Not the right message id
|
||||
inherited;
|
||||
|
@ -284,7 +284,7 @@ begin
|
||||
MainReg.OpenKey(RegPath + REGKEY_SESSIONS, True);
|
||||
MainReg.GetKeyNames(SessionNames);
|
||||
for i:=0 to SessionNames.Count-1 do begin
|
||||
if SessionNames[i] <> Mainform.ActiveConnection.SessionName then
|
||||
if SessionNames[i] <> Mainform.ActiveConnection.Parameters.SessionName then
|
||||
comboExportOutputType.Items.Add(OUTPUT_SERVER+SessionNames[i]);
|
||||
end;
|
||||
if (idx > -1) and (idx < comboExportOutputType.Items.Count) then
|
||||
|
Reference in New Issue
Block a user