Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
Ubuntu
Description
I have a mysql.h supplied by MariaDB and Connector C version = 3.4.0.
The manual for mysql_get_optionv() https://mariadb.com/docs/connectors/mariadb-connector-c/api-functions/mysql_get_optionv mentions 18 character values.
There are two spelling errors: MARIADB_OPT_SSL_FPLIST should be MARIADB_OPT_SSL_FP_LIST and MARIADB_OPT_SSL_PASSPHRASE should be MARIADB_OPT_TLS_PASSPHRASE.
However, that's not the bug.
After I correct the spelling, 17 of the 18 character values work, that is, mysql_get_optionv returns what I put in with mysql_options.
However, MYSQL_INIT_COMMAND does not work, that is, I put in "X" with mysql_options and the result is: mysql_get_optionv does not return an error, the result is not NULL, but it is garbage. This is more important because something is clearly wrong with the pointer and in a larger program I saw a segmentation fault.
The smallest program example I can make is
#include <mysql.h>
|
#include <stdio.h>
|
int main() |
{
|
MYSQL *mysql;
|
char *text= NULL; |
mysql= mysql_init(NULL);
|
if (mysql == NULL) return 1; |
if (mysql_options(mysql, MYSQL_INIT_COMMAND, "X") != 0) return 1; |
if ((mysql_get_optionv(mysql, MYSQL_INIT_COMMAND, &text, NULL) == 0) |
&& (text != NULL))
|
printf("text MYSQL_INIT_COMMAND=%s.\n", text); |
mysql_close(mysql);
|
return 0; |
}
|
And a sample run is
pgulutzan@pgulutzan-VirtualBox:~$ ./init_command
text MYSQL_INIT_COMMAND=p�V.