Chapter 3. Driver options

Your application has to initialize libdbi drivers by setting some driver options with the dbi_conn_set_option() and the dbi_conn_set_option_numeric() library functions. The mysql driver supports the following options:

host

The hostname or IP address of the MySQL database server. Use an empty string or "localhost" to connect to a MySQL server running on the local machine.

port (numeric)

The port used to remotely connect to the MySQL database server over TCP. Use "0" (zero) to accept the default socket.

username

The name of the user accessing the database.

password

The password of the user accessing the database.

dbname

The name of the database used for the initial connection. If your program must be able to connect to a fresh MySQL installation, use the system database mysql.

timeout (numeric)

The connection timeout in seconds.

encoding

The IANA name of a character encoding which is to be used as the connection encoding. Input and output data will be silently converted from and to this character encoding, respectively. The list of available character encodings depends on your local MySQL installation. If you set this option to "auto", the connection encoding will be the same as the default encoding of the database.

mysql_include_trailing_null (numeric)

This item will tell the driver whether or not to include trailing null values ('\0') at the end of binary strings. This applies to the types BLOB, MEDIUMBLOB, LARGEBLOB etc. A numeric value of 0 will tell the driver to leave off the NULL value. A value of 1 will tell the driver to include the trailing NULL character.

mysql_unix_socket

The filename of the Unix socket used to connect to a MySQL database server running on the local machine. Provide an empty string to use the default socket.

mysql_client_compress (numeric)

A value larger than zero causes the client/server communication to be compressed. Set this to zero to use no data compression.

mysql_client_found_rows (numeric)

A value larger than zero causes the server to return the number of matched rows, not the number of affected rows.

mysql_client_ignore_space (numeric)

A value larger than zero causes the server to accept spaces after function names.

mysql_client_interactive (numeric)

A value larger than zero causes the client/server communication to use interactive_timeout instead of wait_timeout before closing an inactive connection.

mysql_client_local_files (numeric)

A value larger than zero enables LOAD DATA LOCAL handling.

mysql_client_multi_statements (numeric)

A value larger than zero causes server to accept multiple SQL statements in a single string, separated by semicolons (requires MySQL 4.1 or later).

mysql_client_multi_results (numeric)

A value larger than zero tells the server that the client can handle multiple result sets from multiple statements. This flag is automatically set if you use mysql_client_multi_statements (requires MySQL 4.1 or later).

mysql_client_no_schema (numeric)

A value larger than zero tells the server not to accept the db_name.tbl_name.col_name syntax..

mysql_client_odbc (numeric)

A value larger than zero causes the server to behave more ODBC-friendly.