Browse files

Modify declaration of mysql_options() API method, so its second param…

…eter is guaranteed to be a 32bit integer. Fixes failures when setting MYSQL_PLUGIN_DIR in 64bit mode. Closes #163.
  • Loading branch information...
ansgarbecker committed Dec 28, 2018
1 parent 07a0c30 commit 7417cf003f2630730771378d8ee825237f256040
Showing with 11 additions and 4 deletions.
  1. +4 −1 out/locale/en/LC_MESSAGES/default.po
  2. +7 −3 source/dbconnection.pas
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: HeidiSQL\n"
"POT-Creation-Date: 2012-11-05 21:40\n"
"PO-Revision-Date: 2018-12-26 19:28+0100\n"
"PO-Revision-Date: 2018-12-28 20:11+0100\n"
"Last-Translator: Ansgar Becker <>\n"
"Language-Team: English (\n"
"MIME-Version: 1.0\n"
@@ -6330,3 +6330,6 @@ msgstr "%s characters (max: %s), %s lines, cursor at %s"

msgid "Credits"
msgstr "Credits"

msgid "Plugin directory %s could not be set."
msgstr "Plugin directory %s could not be set."
@@ -737,7 +737,7 @@ function mysql_authentication_dialog_ask(
mysql_init: function(Handle: PMYSQL): PMYSQL; stdcall;
mysql_num_fields: function(Result: PMYSQL_RES): Integer; stdcall;
mysql_num_rows: function(Result: PMYSQL_RES): Int64; stdcall;
mysql_options: function(Handle: PMYSQL; Option: TMySQLOption; arg: PAnsiChar): Integer; stdcall;
mysql_options: function(Handle: PMYSQL; Option: Integer; arg: PAnsiChar): Integer; stdcall;
mysql_ping: function(Handle: PMYSQL): Integer; stdcall;
mysql_real_connect: function(Handle: PMYSQL; const Host, User, Passwd, Db: PAnsiChar; Port: Cardinal; const UnixSocket: PAnsiChar; ClientFlag: Cardinal): PMYSQL; stdcall;
mysql_real_query: function(Handle: PMYSQL; const Query: PAnsiChar; Length: Cardinal): Integer; stdcall;
@@ -1681,6 +1681,7 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
PluginDir: AnsiString;
Vars, Status: TDBQuery;
PasswordChangeDialog: TfrmPasswordChange;
SetOptionResult: Integer;
if Value and (FHandle = nil) then begin

@@ -1747,8 +1748,11 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
ClientFlags := ClientFlags or CLIENT_SSL;

// Point libmysql to the folder with client plugins
PluginDir := AnsiString(ExtractFilePath(ParamStr(0))+'plugins\');
mysql_options(FHandle, MYSQL_PLUGIN_DIR, PAnsiChar(PluginDir));
PluginDir := AnsiString(ExtractFilePath(ParamStr(0))+'plugins');
SetOptionResult := mysql_options(FHandle, Integer(MYSQL_PLUGIN_DIR), PAnsiChar(PluginDir));
if SetOptionResult <> 0 then begin
raise EDatabaseError.Create(f_('Plugin directory %s could not be set.', [PluginDir]));

Connected := mysql_real_connect(

0 comments on commit 7417cf0

Please sign in to comment.