You are here : cpp0mysql_get_option

mysql_get_option() - 0

 Returns the current value of an option settable using
        mysql_options(). The value
        should be treated as read only. This function was added in MySQL
        5.7.3.mysql_options()mysql_options()The option argument is the option for which
        you want its value. The arg argument is a
        pointer to a variable in which to store the option value.
        arg must be a pointer to a variable of the
        type appropriate for the option argument. The
        following table shows which variable type to use for each
        option value.optionargargoptionoptionarg TypeApplicable option Valuesunsigned intMYSQL_OPT_CONNECT_TIMEOUT,
                MYSQL_OPT_PROTOCOL,
                MYSQL_OPT_READ_TIMEOUT,
                MYSQL_OPT_RETRY_COUNT,
                MYSQL_OPT_WRITE_TIMEOUTunsigned longMYSQL_OPT_MAX_ALLOWED_PACKET (added in MySQL 5.7.9),
                MYSQL_OPT_NET_BUFFER_LENGTH (added in
                MySQL 5.7.9)my_boolMYSQL_ENABLE_CLEARTEXT_PLUGIN,
                MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
                MYSQL_OPT_COMPRESS,
                MYSQL_OPT_GUESS_CONNECTION,
                MYSQL_OPT_LOCAL_INFILE,
                MYSQL_OPT_RECONNECT,
                MYSQL_OPT_SSL_ENFORCE,
                MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                MYSQL_OPT_USE_EMBEDDED_CONNECTION,
                MYSQL_OPT_USE_REMOTE_CONNECTION,
                MYSQL_REPORT_DATA_TRUNCATION,
                MYSQL_SECURE_AUTHconst char *MYSQL_DEFAULT_AUTH,
                MYSQL_OPT_BIND,
                MYSQL_OPT_SSL_CA,
                MYSQL_OPT_SSL_CAPATH ,
                MYSQL_OPT_SSL_CERT,
                MYSQL_OPT_SSL_CIPHER,
                MYSQL_OPT_SSL_CRL,
                MYSQL_OPT_SSL_CRLPATH,
                MYSQL_OPT_SSL_KEY,
                MYSQL_OPT_SSL_MODE,
                MYSQL_OPT_TLS_VERSION,
                MYSQL_PLUGIN_DIR,
                MYSQL_READ_DEFAULT_FILE,
                MYSQL_READ_DEFAULT_GROUP,
                MYSQL_SERVER_PUBLIC_KEY,
                MYSQL_SET_CHARSET_DIR,
                MYSQL_SET_CHARSET_NAME,
                MYSQL_SET_CLIENT_IP,
                MYSQL_SHARED_MEMORY_BASE_NAMEcannot be queried (error is returned)MYSQL_INIT_COMMAND,
                MYSQL_OPT_CONNECT_ATTR_DELETE,
                MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_NAMED_PIPEarg TypeApplicable option Valuesunsigned intMYSQL_OPT_CONNECT_TIMEOUT,
                MYSQL_OPT_PROTOCOL,
                MYSQL_OPT_READ_TIMEOUT,
                MYSQL_OPT_RETRY_COUNT,
                MYSQL_OPT_WRITE_TIMEOUTunsigned longMYSQL_OPT_MAX_ALLOWED_PACKET (added in MySQL 5.7.9),
                MYSQL_OPT_NET_BUFFER_LENGTH (added in
                MySQL 5.7.9)my_boolMYSQL_ENABLE_CLEARTEXT_PLUGIN,
                MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
                MYSQL_OPT_COMPRESS,
                MYSQL_OPT_GUESS_CONNECTION,
                MYSQL_OPT_LOCAL_INFILE,
                MYSQL_OPT_RECONNECT,
                MYSQL_OPT_SSL_ENFORCE,
                MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                MYSQL_OPT_USE_EMBEDDED_CONNECTION,
                MYSQL_OPT_USE_REMOTE_CONNECTION,
                MYSQL_REPORT_DATA_TRUNCATION,
                MYSQL_SECURE_AUTHconst char *MYSQL_DEFAULT_AUTH,
                MYSQL_OPT_BIND,
                MYSQL_OPT_SSL_CA,
                MYSQL_OPT_SSL_CAPATH ,
                MYSQL_OPT_SSL_CERT,
                MYSQL_OPT_SSL_CIPHER,
                MYSQL_OPT_SSL_CRL,
                MYSQL_OPT_SSL_CRLPATH,
                MYSQL_OPT_SSL_KEY,
                MYSQL_OPT_SSL_MODE,
                MYSQL_OPT_TLS_VERSION,
                MYSQL_PLUGIN_DIR,
                MYSQL_READ_DEFAULT_FILE,
                MYSQL_READ_DEFAULT_GROUP,
                MYSQL_SERVER_PUBLIC_KEY,
                MYSQL_SET_CHARSET_DIR,
                MYSQL_SET_CHARSET_NAME,
                MYSQL_SET_CLIENT_IP,
                MYSQL_SHARED_MEMORY_BASE_NAMEcannot be queried (error is returned)MYSQL_INIT_COMMAND,
                MYSQL_OPT_CONNECT_ATTR_DELETE,
                MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_NAMED_PIPEarg TypeApplicable option Valuesarg TypeApplicable option Valuesarg TypeargApplicable option Valuesoptionunsigned intMYSQL_OPT_CONNECT_TIMEOUT,
                MYSQL_OPT_PROTOCOL,
                MYSQL_OPT_READ_TIMEOUT,
                MYSQL_OPT_RETRY_COUNT,
                MYSQL_OPT_WRITE_TIMEOUTunsigned longMYSQL_OPT_MAX_ALLOWED_PACKET (added in MySQL 5.7.9),
                MYSQL_OPT_NET_BUFFER_LENGTH (added in
                MySQL 5.7.9)my_boolMYSQL_ENABLE_CLEARTEXT_PLUGIN,
                MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
                MYSQL_OPT_COMPRESS,
                MYSQL_OPT_GUESS_CONNECTION,
                MYSQL_OPT_LOCAL_INFILE,
                MYSQL_OPT_RECONNECT,
                MYSQL_OPT_SSL_ENFORCE,
                MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                MYSQL_OPT_USE_EMBEDDED_CONNECTION,
                MYSQL_OPT_USE_REMOTE_CONNECTION,
                MYSQL_REPORT_DATA_TRUNCATION,
                MYSQL_SECURE_AUTHconst char *MYSQL_DEFAULT_AUTH,
                MYSQL_OPT_BIND,
                MYSQL_OPT_SSL_CA,
                MYSQL_OPT_SSL_CAPATH ,
                MYSQL_OPT_SSL_CERT,
                MYSQL_OPT_SSL_CIPHER,
                MYSQL_OPT_SSL_CRL,
                MYSQL_OPT_SSL_CRLPATH,
                MYSQL_OPT_SSL_KEY,
                MYSQL_OPT_SSL_MODE,
                MYSQL_OPT_TLS_VERSION,
                MYSQL_PLUGIN_DIR,
                MYSQL_READ_DEFAULT_FILE,
                MYSQL_READ_DEFAULT_GROUP,
                MYSQL_SERVER_PUBLIC_KEY,
                MYSQL_SET_CHARSET_DIR,
                MYSQL_SET_CHARSET_NAME,
                MYSQL_SET_CLIENT_IP,
                MYSQL_SHARED_MEMORY_BASE_NAMEcannot be queried (error is returned)MYSQL_INIT_COMMAND,
                MYSQL_OPT_CONNECT_ATTR_DELETE,
                MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_NAMED_PIPEunsigned intMYSQL_OPT_CONNECT_TIMEOUT,
                MYSQL_OPT_PROTOCOL,
                MYSQL_OPT_READ_TIMEOUT,
                MYSQL_OPT_RETRY_COUNT,
                MYSQL_OPT_WRITE_TIMEOUTunsigned intunsigned intMYSQL_OPT_CONNECT_TIMEOUT,
                MYSQL_OPT_PROTOCOL,
                MYSQL_OPT_READ_TIMEOUT,
                MYSQL_OPT_RETRY_COUNT,
                MYSQL_OPT_WRITE_TIMEOUTMYSQL_OPT_CONNECT_TIMEOUTMYSQL_OPT_PROTOCOLMYSQL_OPT_READ_TIMEOUTMYSQL_OPT_RETRY_COUNTMYSQL_OPT_WRITE_TIMEOUTunsigned longMYSQL_OPT_MAX_ALLOWED_PACKET (added in MySQL 5.7.9),
                MYSQL_OPT_NET_BUFFER_LENGTH (added in
                MySQL 5.7.9)unsigned longunsigned longMYSQL_OPT_MAX_ALLOWED_PACKET (added in MySQL 5.7.9),
                MYSQL_OPT_NET_BUFFER_LENGTH (added in
                MySQL 5.7.9)MYSQL_OPT_MAX_ALLOWED_PACKETMYSQL_OPT_NET_BUFFER_LENGTHmy_boolMYSQL_ENABLE_CLEARTEXT_PLUGIN,
                MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
                MYSQL_OPT_COMPRESS,
                MYSQL_OPT_GUESS_CONNECTION,
                MYSQL_OPT_LOCAL_INFILE,
                MYSQL_OPT_RECONNECT,
                MYSQL_OPT_SSL_ENFORCE,
                MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                MYSQL_OPT_USE_EMBEDDED_CONNECTION,
                MYSQL_OPT_USE_REMOTE_CONNECTION,
                MYSQL_REPORT_DATA_TRUNCATION,
                MYSQL_SECURE_AUTHmy_boolmy_boolMYSQL_ENABLE_CLEARTEXT_PLUGIN,
                MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS,
                MYSQL_OPT_COMPRESS,
                MYSQL_OPT_GUESS_CONNECTION,
                MYSQL_OPT_LOCAL_INFILE,
                MYSQL_OPT_RECONNECT,
                MYSQL_OPT_SSL_ENFORCE,
                MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
                MYSQL_OPT_USE_EMBEDDED_CONNECTION,
                MYSQL_OPT_USE_REMOTE_CONNECTION,
                MYSQL_REPORT_DATA_TRUNCATION,
                MYSQL_SECURE_AUTHMYSQL_ENABLE_CLEARTEXT_PLUGINMYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDSMYSQL_OPT_COMPRESSMYSQL_OPT_GUESS_CONNECTIONMYSQL_OPT_LOCAL_INFILEMYSQL_OPT_RECONNECTMYSQL_OPT_SSL_ENFORCEMYSQL_OPT_SSL_VERIFY_SERVER_CERTMYSQL_OPT_USE_EMBEDDED_CONNECTIONMYSQL_OPT_USE_REMOTE_CONNECTIONMYSQL_REPORT_DATA_TRUNCATIONMYSQL_SECURE_AUTHconst char *MYSQL_DEFAULT_AUTH,
                MYSQL_OPT_BIND,
                MYSQL_OPT_SSL_CA,
                MYSQL_OPT_SSL_CAPATH ,
                MYSQL_OPT_SSL_CERT,
                MYSQL_OPT_SSL_CIPHER,
                MYSQL_OPT_SSL_CRL,
                MYSQL_OPT_SSL_CRLPATH,
                MYSQL_OPT_SSL_KEY,
                MYSQL_OPT_SSL_MODE,
                MYSQL_OPT_TLS_VERSION,
                MYSQL_PLUGIN_DIR,
                MYSQL_READ_DEFAULT_FILE,
                MYSQL_READ_DEFAULT_GROUP,
                MYSQL_SERVER_PUBLIC_KEY,
                MYSQL_SET_CHARSET_DIR,
                MYSQL_SET_CHARSET_NAME,
                MYSQL_SET_CLIENT_IP,
                MYSQL_SHARED_MEMORY_BASE_NAMEconst char *const char *MYSQL_DEFAULT_AUTH,
                MYSQL_OPT_BIND,
                MYSQL_OPT_SSL_CA,
                MYSQL_OPT_SSL_CAPATH ,
                MYSQL_OPT_SSL_CERT,
                MYSQL_OPT_SSL_CIPHER,
                MYSQL_OPT_SSL_CRL,
                MYSQL_OPT_SSL_CRLPATH,
                MYSQL_OPT_SSL_KEY,
                MYSQL_OPT_SSL_MODE,
                MYSQL_OPT_TLS_VERSION,
                MYSQL_PLUGIN_DIR,
                MYSQL_READ_DEFAULT_FILE,
                MYSQL_READ_DEFAULT_GROUP,
                MYSQL_SERVER_PUBLIC_KEY,
                MYSQL_SET_CHARSET_DIR,
                MYSQL_SET_CHARSET_NAME,
                MYSQL_SET_CLIENT_IP,
                MYSQL_SHARED_MEMORY_BASE_NAMEMYSQL_DEFAULT_AUTHMYSQL_OPT_BINDMYSQL_OPT_SSL_CAMYSQL_OPT_SSL_CAPATHMYSQL_OPT_SSL_CERTMYSQL_OPT_SSL_CIPHERMYSQL_OPT_SSL_CRLMYSQL_OPT_SSL_CRLPATHMYSQL_OPT_SSL_KEYMYSQL_OPT_SSL_MODEMYSQL_OPT_TLS_VERSIONMYSQL_PLUGIN_DIRMYSQL_READ_DEFAULT_FILEMYSQL_READ_DEFAULT_GROUPMYSQL_SERVER_PUBLIC_KEYMYSQL_SET_CHARSET_DIRMYSQL_SET_CHARSET_NAMEMYSQL_SET_CLIENT_IPMYSQL_SHARED_MEMORY_BASE_NAMEcannot be queried (error is returned)MYSQL_INIT_COMMAND,
                MYSQL_OPT_CONNECT_ATTR_DELETE,
                MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_NAMED_PIPEcannot be queried (error is returned)MYSQL_INIT_COMMAND,
                MYSQL_OPT_CONNECT_ATTR_DELETE,
                MYSQL_OPT_CONNECT_ATTR_RESET,
MYSQL_OPT_NAMED_PIPEMYSQL_INIT_COMMANDMYSQL_OPT_CONNECT_ATTR_DELETEMYSQL_OPT_CONNECT_ATTR_RESETMYSQL_OPT_NAMED_PIPE


Syntax

int mysql_get_option(MYSQL *mysql, enum mysql_option
        option, const void *arg)


Example

my_bool reconnect;

if (mysql_get_option(mysql, MYSQL_OPT_RECONNECT, &reconnect))
  fprintf(stderr, "mysql_get_options() failed\n");


Output / Return Value

 Zero for success. Nonzero if an error occurred; this occurs for
        option values that cannot be queried.option


Limitations


Alternatives / See Also


Reference