Connection.Options (gb.db)

Property Options As Collection

Поскольку 3.18

Return or set the connection options.

These options are specific to the database type.

This property must be set before opening the connection.

Modifying an option after the connection has been opened has no effect.

At the moment, all MySQL and PostgreSQL connection options should be supported. Other database drivers have no options at the moment.

Unknown options are silently ignored.

MySQL options

The list of MySQL options is described here: https://dev.mysql.com/doc/c-api/8.0/en/mysql-options.html

The name of the option is its MySQL name, with the MYSQL_ or MYSQL_OPT_ prefix removed.

The name is case insensitive.

The value of the PROTOCOL, SSL_MODE and SSL_FIPS_MODE options, that take their value among integer constants, is defined by a string corresponding to the value part of the constant symbol.

Example

MyConnection.Options["PROTOCOL"] = "TCP"
MyConnection.Options["READ_TIMEOUT"] = 30
MyConnection.Options["SSL_MODE"] = "REQUIRED"
MyConnection.Options["SSL_FIPS_MODE"] = "OFF"

PostgreSQL options

The list of PostgreSQL options is described here: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS

The name of the option is its PostgreSQL name unmodified.

The name is case insensitive.

All options values are converted to string before being sent to the PostgreSQL API.

Example

MyConnection.Options["connect_timeout"] = 15
MyConnection.Options["keepalive"] = 0
MyConnection.Options["sslmode"] = "required"