Skip to content
Permalink
Browse files

Use mysql_optionsv to tell newer MySQL servers HeidiSQL's program_nam…

…e, visible then in performance_schema.session_connect_attrs
  • Loading branch information...
ansgarbecker committed Jun 19, 2019
1 parent 59e3ba4 commit c844032197c0ef8ac74bef0957b3a92bafbdfc42
Showing with 6 additions and 0 deletions.
  1. +4 −0 source/dbconnection.pas
  2. +2 −0 source/mysql_structures.pas
@@ -1787,6 +1787,10 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
if Parameters.CleartextPluginEnabled then
FLib.mysql_options(FHandle, Integer(MYSQL_ENABLE_CLEARTEXT_PLUGIN), PAnsiChar('1'));

// Tell server who we are
if Assigned(FLib.mysql_optionsv) then
FLib.mysql_optionsv(FHandle, Integer(MYSQL_OPT_CONNECT_ATTR_ADD), 'program_name', APPNAME);

Connected := FLib.mysql_real_connect(
FHandle,
PAnsiChar(Utf8Encode(FinalHost)),
@@ -341,6 +341,7 @@ TMySQLLib = class(TDbLib)
mysql_num_fields: function(Result: PMYSQL_RES): Integer; stdcall;
mysql_num_rows: function(Result: PMYSQL_RES): Int64; stdcall;
mysql_options: function(Handle: PMYSQL; Option: Integer; arg: PAnsiChar): Integer; stdcall;
mysql_optionsv: function(Handle: PMYSQL; Option: Integer; arg, val: 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;
@@ -7675,6 +7676,7 @@ procedure TMySQLLib.AssignProcedures;
AssignProc(@mysql_num_rows, 'mysql_num_rows');
AssignProc(@mysql_ping, 'mysql_ping');
AssignProc(@mysql_options, 'mysql_options');
AssignProc(@mysql_optionsv, 'mysql_optionsv', False);
AssignProc(@mysql_real_connect, 'mysql_real_connect');
AssignProc(@mysql_real_query, 'mysql_real_query');
AssignProc(@mysql_ssl_set, 'mysql_ssl_set');

0 comments on commit c844032

Please sign in to comment.
You can’t perform that action at this time.