SYNOPSIS

\*(T<#include <opendbx/api.h>\*(T>

\*(T<int odbx_set_option\*(T> \kx \*(T<(odbx_t* handle, unsigned int option, void* value);\*(T>

DESCRIPTION

Changes the value of the specified option in the backend module or the native database library associated to handle by \*(T<odbx_init\*(T>(). Before trying to set an option, it should be tested with \*(T<odbx_get_option\*(T>() first to ensure that it is supported by the backend. Almost all options need to be set before connecting to the database server using \*(T<odbx_bind\*(T>() to take any effect.

The first parameter \*(T<handle\*(T> is the connection object created and returned by \*(T<odbx_init\*(T>() which becomes invalid as soon as it was supplied to \*(T<odbx_finish\*(T>().

There are several \*(T<option\*(T> values defined as named constants in the odbx.h header file. The available options whose values can be changed are:

\*(T<ODBX_OPT_TLS\*(T>

Use encryption to transmit all data securely over the network via SSL or TLS. This option can be set to \*(T<ODBX_TLS_NEVER\*(T> (the default value) to prevent encrpytion, \*(T<ODBX_TLS_ALWAYS\*(T> to enforce encryption and to fail if it can't be used between the client library and the server or \*(T<ODBX_TLS_TRY\*(T> to use encryption if possible with the option to fall back to a connection which isn't encrypted.

\*(T<ODBX_OPT_MULTI_STATEMENTS\*(T>

Enables the database server to accept multiple statements in one query string sent via \*(T<odbx_query\*(T>() if the value of value is set to \*(T<ODBX_ENABLE\*(T>. Although, it might be possible to disable it by setting it to \*(T<ODBX_DISABLE\*(T>.

\*(T<ODBX_OPT_PAGED_RESULTS\*(T>

All database servers and client libraries are able to transfer the records row by row. Some of them can also transfer multiple rows or even all at once to minimize server load, network traffic and latency. The downside of this is an increased memory consumption. If paged results are supported by the backend, passing positive values will fetch the specified number of records at once from the database server. The value of zero ("0") is special in this case because it asks the backend module to retrieve all records at once

\*(T<ODBX_OPT_COMPRESS\*(T>

Enable compressed network traffic between database client and server. This can maximize the throughput if the network is the bottleneck. Pass an integer variable with \*(T<ODBX_ENABLE\*(T> to enable compression or with \*(T<ODBX_DISABLE\*(T> to disable it for this connection

\*(T<ODBX_OPT_MODE\*(T>

Some database servers support different modes of operation, e.g. modes for compliance to other SQL implementations or completely different query languages. This option is available since OpenDBX 1.1.4. \*(T<value\*(T> must point to a zero terminated string and for a detailed description of the MySQL modes look at their \$2 \(la\$1\(ra\$3

If not stated otherwise, the type of the variable passed to the third parameter \*(T<value\*(T> must be an integer pointer. Its values should be in the range specified by the option being changed.

RETURN VALUE

\*(T<odbx_set_option\*(T>() returns \*(T<ODBX_ERR_SUCCESS\*(T>, or an error code whose value is less than zero if one of the operations couldn't be completed successfully. Possible error codes are listed in the error section and they can be feed to \*(T<odbx_error\*(T>() and \*(T<odbx_error_type\*(T>() to get further details.

ERRORS

-\*(T<ODBX_ERR_PARAM\*(T>

One of the supplied parameters is invalid or is NULL and this isn't allowed in the used backend module or in the native database client library

-\*(T<ODBX_ERR_OPTION\*(T>

The value passed to the \*(T<option\*(T> parameter isn't one of the values listed in this manual. The content of \*(T<value\*(T> remains unchanged if this error occurs

-\*(T<ODBX_ERR_OPTRO\*(T>

The option isn't intended for being changed and could only be read via \*(T<odbx_get_option\*(T>()

-\*(T<ODBX_ERR_OPTWR\*(T>

Setting the option failed for various reasons. It's most likely that the value passed via \*(T<value\*(T> didn't match the range of values expected by the backend or the native database library

RELATED TO odbx_set_option…

\*(T<odbx_bind\*(T>(), \*(T<odbx_error\*(T>(), \*(T<odbx_get_option\*(T>()