mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #1482: activate some more code in apphelpers, and testwise load libmariadb on Linux and Windows
This commit is contained in:
BIN
out/libmariadb.so.3
Normal file
BIN
out/libmariadb.so.3
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -260,7 +260,6 @@ type
|
||||
end;
|
||||
PMYSQL_RES = ^MYSQL_RES;
|
||||
|
||||
Tmgci = function: PAnsiChar; stdcall;
|
||||
TMySQLLib = class(TDbLib)
|
||||
mysql_affected_rows: function(Handle: PMYSQL): Int64; stdcall;
|
||||
mysql_character_set_name: function(Handle: PMYSQL): PAnsiChar; stdcall;
|
||||
@ -317,7 +316,7 @@ type
|
||||
SSL_MODE_REQUIRED,
|
||||
SSL_MODE_VERIFY_CA,
|
||||
SSL_MODE_VERIFY_IDENTITY: Integer;
|
||||
constructor Create(DllFile_, DefaultDll: String); override;
|
||||
constructor Create(UsedDllFile, HintDefaultDll: String); override;
|
||||
end;
|
||||
var
|
||||
MySQLKeywords: TStringList;
|
||||
@ -325,8 +324,7 @@ var
|
||||
|
||||
|
||||
// MySQL Data Type List and Properties
|
||||
MySQLDatatypes: array of TDBDatatype;
|
||||
{MySQLDatatypes: array [0..41] of TDBDatatype =
|
||||
MySQLDatatypes: array [0..41] of TDBDatatype =
|
||||
(
|
||||
(
|
||||
Index: dbdtUnknown;
|
||||
@ -1012,7 +1010,7 @@ var
|
||||
Category: dtcSpatial;
|
||||
)
|
||||
|
||||
);}
|
||||
);
|
||||
|
||||
|
||||
MySQLVariables: array [0..417] of TServerVariable =
|
||||
@ -3134,9 +3132,7 @@ implementation
|
||||
uses apphelpers;
|
||||
|
||||
|
||||
constructor TMySQLLib.Create(DllFile_, DefaultDll: String);
|
||||
var
|
||||
BaseDll: String;
|
||||
constructor TMySQLLib.Create(UsedDllFile, HintDefaultDll: String);
|
||||
begin
|
||||
inherited;
|
||||
// MYSQL_OPT_* constants
|
||||
@ -3159,8 +3155,7 @@ begin
|
||||
SSL_MODE_REQUIRED := 3;
|
||||
SSL_MODE_VERIFY_CA := 4;
|
||||
SSL_MODE_VERIFY_IDENTITY := 5;
|
||||
BaseDll := ExtractFileName(FDllFile);
|
||||
if BaseDLL.StartsWith('libmariadb', True) then begin
|
||||
if String(ExtractFileName(FDllFile)).StartsWith('libmariadb', True) then begin
|
||||
// Differences in libmariadb
|
||||
MYSQL_OPT_SSL_VERIFY_SERVER_CERT := 21;
|
||||
MARIADB_OPT_TLS_VERSION := 7005;
|
||||
|
@ -88,7 +88,7 @@ type
|
||||
public
|
||||
property Handle: TLibHandle read FHandle;
|
||||
property DllFile: String read FDllFile;
|
||||
constructor Create(DllFile_, DefaultDll: String); virtual;
|
||||
constructor Create(UsedDllFile, HintDefaultDll: String); virtual;
|
||||
destructor Destroy; override;
|
||||
end;
|
||||
|
||||
@ -148,13 +148,13 @@ end;
|
||||
|
||||
{ TDbLib }
|
||||
|
||||
constructor TDbLib.Create(DllFile_, DefaultDll: String);
|
||||
constructor TDbLib.Create(UsedDllFile, HintDefaultDll: String);
|
||||
var
|
||||
msg, ErrorHint: String;
|
||||
begin
|
||||
// Load DLL as is (with or without path)
|
||||
inherited Create;
|
||||
FDllFile := DllFile_;
|
||||
FDllFile := UsedDllFile;
|
||||
if not FileExists(FDllFile) then begin
|
||||
msg := f_('File does not exist: %s', [FDllFile]) +
|
||||
sLineBreak + sLineBreak +
|
||||
@ -171,9 +171,9 @@ begin
|
||||
if GetLastOSError <> 0 then begin
|
||||
msg := msg + sLineBreak + sLineBreak + f_('Internal error %d: %s', [GetLastOSError, SysErrorMessage(GetLastOSError)]);
|
||||
end;
|
||||
if (DefaultDll <> '') and (ExtractFileName(FDllFile) <> DefaultDll) then begin
|
||||
if (HintDefaultDll <> '') and (ExtractFileName(FDllFile) <> HintDefaultDll) then begin
|
||||
ErrorHint := f_('You could try the default library %s in your session settings. (Current: %s)',
|
||||
[DefaultDll, ExtractFileName(FDllFile)]
|
||||
[HintDefaultDll, ExtractFileName(FDllFile)]
|
||||
);
|
||||
end else begin
|
||||
ErrorHint := '';
|
||||
|
109
source/main.lfm
109
source/main.lfm
@ -627,8 +627,15 @@ object MainForm: TMainForm
|
||||
Align = alClient
|
||||
DefaultText = 'Node'
|
||||
Header.AutoSizeIndex = 0
|
||||
Header.Columns = <>
|
||||
Header.MainColumn = -1
|
||||
Header.Columns = <
|
||||
item
|
||||
Position = 0
|
||||
Text = 'Name'
|
||||
end
|
||||
item
|
||||
Position = 1
|
||||
Text = 'Size'
|
||||
end>
|
||||
TabOrder = 3
|
||||
end
|
||||
end
|
||||
@ -669,7 +676,105 @@ object MainForm: TMainForm
|
||||
TabOrder = 1
|
||||
object tabHost: TTabSheet
|
||||
Caption = 'Host'
|
||||
ClientHeight = 283
|
||||
ClientWidth = 772
|
||||
ImageIndex = 1
|
||||
object PageControlHost: TPageControl
|
||||
Left = 0
|
||||
Height = 283
|
||||
Top = 0
|
||||
Width = 772
|
||||
ActivePage = tabDatabases
|
||||
Align = alClient
|
||||
Images = ImageListIcons8
|
||||
TabIndex = 0
|
||||
TabOrder = 0
|
||||
object tabDatabases: TTabSheet
|
||||
Caption = 'Databases'
|
||||
ClientHeight = 250
|
||||
ClientWidth = 764
|
||||
object ListDatabases: TLazVirtualStringTree
|
||||
Left = 0
|
||||
Height = 250
|
||||
Top = 0
|
||||
Width = 764
|
||||
Align = alClient
|
||||
DefaultText = 'Node'
|
||||
Header.AutoSizeIndex = 0
|
||||
Header.Columns = <
|
||||
item
|
||||
Position = 0
|
||||
Text = 'Database'
|
||||
Width = 150
|
||||
end
|
||||
item
|
||||
Position = 1
|
||||
Text = 'Size'
|
||||
Width = 80
|
||||
end
|
||||
item
|
||||
Position = 2
|
||||
Text = 'Items'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 3
|
||||
Text = 'Last modification'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 4
|
||||
Text = 'Tables'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 5
|
||||
Text = 'Views'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 6
|
||||
Text = 'Functions'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 7
|
||||
Text = 'Procedures'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 8
|
||||
Text = 'Triggers'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 9
|
||||
Text = 'Events'
|
||||
Width = 50
|
||||
end
|
||||
item
|
||||
Position = 10
|
||||
Text = 'Default collation'
|
||||
Width = 120
|
||||
end>
|
||||
Header.Options = [hoColumnResize, hoDblClickResize, hoDrag, hoHotTrack, hoShowSortGlyphs, hoVisible, hoDisableAnimatedResize]
|
||||
Images = ImageListIcons8
|
||||
TabOrder = 0
|
||||
end
|
||||
end
|
||||
object tabVariables: TTabSheet
|
||||
Caption = 'Variables'
|
||||
end
|
||||
object tabStatus: TTabSheet
|
||||
Caption = 'Status'
|
||||
end
|
||||
object tabProcesses: TTabSheet
|
||||
Caption = 'Processes'
|
||||
end
|
||||
object tabCommandStats: TTabSheet
|
||||
Caption = 'Command-Statistics'
|
||||
end
|
||||
end
|
||||
end
|
||||
object tabDatabase: TTabSheet
|
||||
Caption = 'Database'
|
||||
|
155
source/main.pas
155
source/main.pas
@ -7,7 +7,7 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Menus, ActnList,
|
||||
ComCtrls, ExtCtrls, SynEdit, SynHighlighterSQL, laz.VirtualTrees,
|
||||
RegExpr,
|
||||
RegExpr, Buttons, StdCtrls,
|
||||
Generics.Collections, Generics.Defaults,
|
||||
dbconnection, dbstructures, dbstructures.mysql;
|
||||
|
||||
@ -183,12 +183,16 @@ type
|
||||
function SetThumbnailClip(hwnd: HWND; var prcClip: TRect): HRESULT; stdcall;
|
||||
end;}
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
actGotoDbTree: TAction;
|
||||
actSessionManager: TAction;
|
||||
ActionList1: TActionList;
|
||||
actExitApplication: TAction;
|
||||
ImageListIcons8: TImageList;
|
||||
DBtree: TLazVirtualStringTree;
|
||||
ListDatabases: TLazVirtualStringTree;
|
||||
MainMenu1: TMainMenu;
|
||||
MenuItem1: TMenuItem;
|
||||
MenuItem2: TMenuItem;
|
||||
@ -198,6 +202,7 @@ type
|
||||
MenuItem6: TMenuItem;
|
||||
MenuItem7: TMenuItem;
|
||||
MenuItem8: TMenuItem;
|
||||
PageControlHost: TPageControl;
|
||||
PageControlMain: TPageControl;
|
||||
Panel1: TPanel;
|
||||
Panel2: TPanel;
|
||||
@ -212,6 +217,11 @@ type
|
||||
SynSQLSynUsed: TSynSQLSyn;
|
||||
tabHost: TTabSheet;
|
||||
tabDatabase: TTabSheet;
|
||||
tabDatabases: TTabSheet;
|
||||
tabVariables: TTabSheet;
|
||||
tabStatus: TTabSheet;
|
||||
tabProcesses: TTabSheet;
|
||||
tabCommandStats: TTabSheet;
|
||||
tabTable: TTabSheet;
|
||||
tabData: TTabSheet;
|
||||
tabQuery: TTabSheet;
|
||||
@ -638,65 +648,65 @@ type
|
||||
FLastTabNumberOnMouseUp: Integer;
|
||||
FLastMouseDownCloseButton: TObject;
|
||||
//FJumpList: TJumpList;
|
||||
//// Filter text per tab for filter panel
|
||||
//FFilterTextDatabases,
|
||||
//FFilterTextEditor,
|
||||
//FFilterTextVariables,
|
||||
//FFilterTextStatus,
|
||||
//FFilterTextProcessList,
|
||||
//FFilterTextCommandStats,
|
||||
//FFilterTextDatabase,
|
||||
//FFilterTextData: String;
|
||||
//FTreeRefreshInProgress: Boolean;
|
||||
//FRefreshActionDisabledAt: Cardinal;
|
||||
//FDataGridColumnWidthsCustomized: Boolean;
|
||||
//FDataGridLastClickedColumnHeader: Integer;
|
||||
//FDataGridLastClickedColumnLeftPos: Integer;
|
||||
// Filter text per tab for filter panel
|
||||
FFilterTextDatabases,
|
||||
FFilterTextEditor,
|
||||
FFilterTextVariables,
|
||||
FFilterTextStatus,
|
||||
FFilterTextProcessList,
|
||||
FFilterTextCommandStats,
|
||||
FFilterTextDatabase,
|
||||
FFilterTextData: String;
|
||||
FTreeRefreshInProgress: Boolean;
|
||||
FRefreshActionDisabledAt: Cardinal;
|
||||
FDataGridColumnWidthsCustomized: Boolean;
|
||||
FDataGridLastClickedColumnHeader: Integer;
|
||||
FDataGridLastClickedColumnLeftPos: Integer;
|
||||
//FDataGridSortItems: TSortItems;
|
||||
//FSnippetFilenames: TStringList;
|
||||
FSnippetFilenames: TStringList;
|
||||
//FConnections: TDBConnectionList;
|
||||
//FTreeClickHistory: TNodeArray;
|
||||
//FOperationTicker: Cardinal;
|
||||
//FOperatingGrid: TBaseVirtualTree;
|
||||
FTreeClickHistory: TNodeArray;
|
||||
FOperationTicker: Cardinal;
|
||||
FOperatingGrid: TBaseVirtualTree;
|
||||
//FActiveDbObj: TDBObject;
|
||||
//FActiveObjectGroup: TListNodeType;
|
||||
//FBtnAddTab: TSpeedButton;
|
||||
//FDBObjectsMaxSize: Int64;
|
||||
//FDBObjectsMaxRows: Int64;
|
||||
FBtnAddTab: TSpeedButton;
|
||||
FDBObjectsMaxSize: Int64;
|
||||
FDBObjectsMaxRows: Int64;
|
||||
//FSearchReplaceDialog: TfrmSearchReplace;
|
||||
//FCreateDatabaseDialog: TCreateDatabaseForm;
|
||||
//FTableToolsDialog: TfrmTableTools;
|
||||
//FGridEditFunctionMode: Boolean;
|
||||
//FClipboardHasNull: Boolean;
|
||||
FGridEditFunctionMode: Boolean;
|
||||
FClipboardHasNull: Boolean;
|
||||
FTimeZoneOffset: Integer;
|
||||
//FGridCopying: Boolean;
|
||||
//FGridPasting: Boolean;
|
||||
FGridCopying: Boolean;
|
||||
FGridPasting: Boolean;
|
||||
//FHasDonatedDatabaseCheck: TThreeStateBoolean;
|
||||
//FFocusedTables: TDBObjectList;
|
||||
FLastCaptionChange: Cardinal;
|
||||
//FListTablesSorted: Boolean;
|
||||
FListTablesSorted: Boolean;
|
||||
FLastPortableSettingsSave: Cardinal;
|
||||
FLastAppSettingsWrites: Integer;
|
||||
FFormatSettings: TFormatSettings;
|
||||
FDefaultHintFontName: String;
|
||||
//FActionList1DefaultCaptions: TStringList;
|
||||
//FActionList1DefaultHints: TStringList;
|
||||
//FEditorCommandStrings: TStringList;
|
||||
//FLastSelWordInEditor: String;
|
||||
//FMatchingBraceForegroundColor: TColor;
|
||||
//FMatchingBraceBackgroundColor: TColor;
|
||||
//FSynEditInOnPaintTransient: Boolean;
|
||||
//FExactRowCountMode: Boolean;
|
||||
////FHelpData: TSimpleKeyValuePairs;
|
||||
//
|
||||
//// Host subtabs backend structures
|
||||
FActionList1DefaultCaptions: TStringList;
|
||||
FActionList1DefaultHints: TStringList;
|
||||
FEditorCommandStrings: TStringList;
|
||||
FLastSelWordInEditor: String;
|
||||
FMatchingBraceForegroundColor: TColor;
|
||||
FMatchingBraceBackgroundColor: TColor;
|
||||
FSynEditInOnPaintTransient: Boolean;
|
||||
FExactRowCountMode: Boolean;
|
||||
//FHelpData: TSimpleKeyValuePairs;
|
||||
|
||||
// Host subtabs backend structures
|
||||
//FHostListResults: TDBQueryList;
|
||||
//FStatusServerUptime: Integer;
|
||||
//FProcessListMaxTime: Int64;
|
||||
//FCommandStatsQueryCount: Int64;
|
||||
//FCommandStatsServerUptime: Integer;
|
||||
//FVariableNames, FSessionVars, FGlobalVars: TStringList;
|
||||
//
|
||||
FStatusServerUptime: Integer;
|
||||
FProcessListMaxTime: Int64;
|
||||
FCommandStatsQueryCount: Int64;
|
||||
FCommandStatsServerUptime: Integer;
|
||||
FVariableNames, FSessionVars, FGlobalVars: TStringList;
|
||||
|
||||
procedure SetDelimiter(Value: String);
|
||||
//procedure DisplayRowCountStats(Sender: TBaseVirtualTree);
|
||||
//procedure insertFunction(Sender: TObject);
|
||||
@ -733,25 +743,25 @@ type
|
||||
public
|
||||
//QueryTabs: TQueryTabList;
|
||||
//ActiveObjectEditor: TDBObjectEditor;
|
||||
//FileEncodings: TStringList;
|
||||
//ImportSettingsDone: Boolean;
|
||||
//
|
||||
FileEncodings: TStringList;
|
||||
ImportSettingsDone: Boolean;
|
||||
|
||||
//// Data grid related stuff
|
||||
//DataGridHiddenColumns: TStringList;
|
||||
//DataGridWantedRowCount: Int64;
|
||||
DataGridHiddenColumns: TStringList;
|
||||
DataGridWantedRowCount: Int64;
|
||||
//DataGridTable: TDBObject;
|
||||
//DataGridFocusedCell: TStringList;
|
||||
//DataGridFocusedNodeIndex: Int64;
|
||||
//DataGridFocusedColumnName: String;
|
||||
DataGridFocusedCell: TStringList;
|
||||
DataGridFocusedNodeIndex: Int64;
|
||||
DataGridFocusedColumnName: String;
|
||||
//DataGridResult: TDBQuery;
|
||||
//DataGridFullRowMode: Boolean;
|
||||
//DataLocalNumberFormat: Boolean;
|
||||
DataGridFullRowMode: Boolean;
|
||||
DataLocalNumberFormat: Boolean;
|
||||
//SelectedTableColumns: TTableColumnList;
|
||||
//SelectedTableKeys: TTableKeyList;
|
||||
//SelectedTableForeignKeys: TForeignKeyList;
|
||||
//SelectedTableTimestampColumns: TStringList;
|
||||
//FilterPanelManuallyOpened: Boolean;
|
||||
//
|
||||
FilterPanelManuallyOpened: Boolean;
|
||||
|
||||
//// Task button interface
|
||||
//TaskbarList: ITaskbarList;
|
||||
//TaskbarList2: ITaskbarList2;
|
||||
@ -1330,7 +1340,7 @@ var
|
||||
//EditorCommand: TSynEditorCommand;
|
||||
CmdCap: String;
|
||||
Lib: TMySQLLib;
|
||||
test: String;
|
||||
LibFile: String;
|
||||
begin
|
||||
{***
|
||||
OnCreate Event
|
||||
@ -1592,20 +1602,14 @@ begin
|
||||
FConnections := TDBConnectionList.Create;
|
||||
FConnections.OnNotify := ConnectionsNotify;}
|
||||
|
||||
{FTreeRefreshInProgress := False;
|
||||
FTreeRefreshInProgress := False;
|
||||
FGridCopying := False;
|
||||
FGridPasting := False;}
|
||||
FGridPasting := False;
|
||||
|
||||
{FileEncodings := Explode(',', _('Auto detect (may fail)')+',ANSI,ASCII,Unicode,Unicode Big Endian,UTF-8,UTF-7,UTF-8-BOM');}
|
||||
|
||||
{// Detect timezone offset in seconds, once
|
||||
case GetTimeZoneInformation(TZI) of
|
||||
TIME_ZONE_ID_STANDARD: FTimeZoneOffset := (TZI.Bias + TZI.StandardBias);
|
||||
TIME_ZONE_ID_DAYLIGHT: FTimeZoneOffset := (TZI.Bias + TZI.DaylightBias);
|
||||
TIME_ZONE_ID_UNKNOWN: FTimeZoneOffset := TZI.Bias;
|
||||
else RaiseLastOSError;
|
||||
end;
|
||||
FTimeZoneOffset := FTimeZoneOffset * 60;}
|
||||
// Detect timezone offset in seconds, once
|
||||
FTimeZoneOffset := GetLocalTimeOffset * 60;
|
||||
|
||||
// Set noderoot for query helpers box
|
||||
{treeQueryHelpers.RootNodeCount := 7;}
|
||||
@ -1632,14 +1636,19 @@ begin
|
||||
LogSQL(f_('Pixels per inch on current monitor: %d', [Monitor.PixelsPerInch]), lcDebug);
|
||||
LogSQL(f_('Timezone offset: %d', [FTimeZoneOffset]), lcDebug);
|
||||
|
||||
{Lib := TMySQLLib.Create(ExtractFilePath(Application.ExeName)+'libmariadb.dll', 'libmariadb.dll');
|
||||
// Testwise load libmariadb on Linux and Windows
|
||||
{$IfDef LINUX}
|
||||
LibFile := 'libmariadb.so.3';
|
||||
{$EndIf}
|
||||
{$IfDef WINDOWS}
|
||||
LibFile := 'libmariadb.dll';
|
||||
{$EndIf}
|
||||
Lib := TMySQLLib.Create(ExtractFilePath(Application.ExeName) + LibFile, LibFile);
|
||||
try
|
||||
test := Lib.mysql_get_client_info;
|
||||
LogSQL(test);
|
||||
//ShowMessage(String(Lib.mysql_get_client_info));
|
||||
LogSQL(Lib.DllFile + ' v'+Lib.mysql_get_client_info() + ' loaded');
|
||||
except on E:Exception do
|
||||
ShowMessage('Wrong error: '+E.Message);
|
||||
end;}
|
||||
ShowMessage(E.Message);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user