Name

mysql_options —

Synopsis

int mysql_options(MYSQL *mysql, enum mysql_option option, void *value)

Sets a connect option for an upcoming MySQL connection. This function must be called after a MYSQL structure has been initialized using mysql_init and before a connection has actually been established using mysql_real_connect. This function can be called multiple times to set more than one option. The options affect the upcoming connection. The value of the third argument depends on the type of option. Some options require a character string as an argument, while others take a pointer to an integer, or nothing at all. The options are as follows (the type of the third argument is given in parentheses after the option name):

MYSQL_INIT_COMMAND (char *)

Specifies an SQL query to execute as soon as the connection is established. This query is reexecuted if the connection is lost and automatically reconnected.

MYSQL_OPT_COMPRESS ()

Causes the connection to use a compressed protocol with the server to increase speed.

MYSQL_OPT_CONNECT_TIMEOUT (unsigned int *)

Specifies the number of seconds to wait before giving up on connecting to the server.

MYSQL_OPT_NAMED_PIPE ()

Causes the connection to use named pipes, as opposed to TCP, to connect to a local MySQL server running on Windows NT.

MYSQL_READ_DEFAULT_FILE (char *)

Specifies the name of the file to read for default options, in place of the default file my.cnf.

MYSQL_READ_DEFAULT_GROUP (char *)

Specifies the name of a section within ...

Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.