odbx_set_option(3)
π odbx_set_option(3) β the OpenDBX glow-up page
okay bestie, so this is odbx_set_option(3) from the OpenDBX manual family β like, it's the page where you get to change the vibes of your database backend. Let's go π
β¨ NAME β¨
odbx_set_option β change behaviour of the database backend π
β¨ SYNOPSIS β¨
#include <opendbx/api.h>
int odbx_set_option (odbx_t* handle, unsigned int option, void* value);
β¨ DESCRIPTION β¨
So basically this function changes the value of whatever option you name β either in the backend module or in the native database library that's associated with handle by odbx_init(). Simple β¨
But listen π β before you even try to set an option, you should test it with odbx_get_option() first, just to make sure your backend actually supports it. No point setting a vibe the backend doesn't have, yk? And heads up: almost all options need to be set before you connect to the database server using odbx_bind() for them to have any effect at all. Timing matters, periodt π
The first parameter, handle, is the connection object created and returned by odbx_init() β and it becomes invalid as soon as it's supplied to odbx_finish(). So like, don't be using a dead handle, that's not the move π
There are several option values defined as named constants in the odbx.h header file. The available options whose values can be changed are:
ODBX_OPT_TLSβ use encryption to transmit all data securely over the network via SSL or TLS π¦ This option can be set toODBX_TLS_NEVER(the default value) to prevent encryption,ODBX_TLS_ALWAYSto enforce encryption and to fail if it can't be used between the client library and the server, orODBX_TLS_TRYto use encryption if possible with the option to fall back to a connection which isn't encrypted.ODBX_OPT_MULTI_STATEMENTSβ enables the database server to accept multiple statements in one query string sent viaodbx_query()if the value ofvalueis set toODBX_ENABLE. Although, it might be possible to disable it by setting it toODBX_DISABLE. (yes, "might" β read that twice, bestie π«Ά)ODBX_OPT_PAGED_RESULTSβ 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.ODBX_OPT_COMPRESSβ enable compressed network traffic between database client and server π₯ This can maximize the throughput if the network is the bottleneck. Pass an integer variable withODBX_ENABLEto enable compression or withODBX_DISABLEto disable it for this connection.ODBX_OPT_MODEβ 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 OpenDBX1.1.4.valuemust point to a zero terminated string, and for a detailed description of the MySQL modes look at their website β¨http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.htmlβ©.
If not stated otherwise, the type of the variable passed to the third parameter value must be an integer pointer β Its values should be in the range specified by the option being changed.
β¨ RETURN VALUE β¨
odbx_set_option() returns ODBX_ERR_SUCCESS, 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 odbx_error() and odbx_error_type() to get further details. iykyk π
β¨ ERRORS β¨
-ODBX_ERR_PARAMβ one of the supplied parameters is invalid or isNULLand this isn't allowed in the used backend module or in the native database client library π-ODBX_ERR_OPTIONβ the value passed to theoptionparameter isn't one of the values listed in this manual. The content ofvalueremains unchanged if this error occurs π§-ODBX_ERR_OPTROβ the option isn't intended for being changed and could only be read viaodbx_get_option(). read-only, bestie, hands off π-ODBX_ERR_OPTWRβ setting the option failed for various reasons. It's most likely that the value passed viavaluedidn't match the range of values expected by the backend or the native database library π
fr fr, if you get one of these, don't just shrug β feed it toodbx_error()andodbx_error_type()and actually find out what happened π
β¨ SEE ALSO β¨
odbx_bind(), odbx_error(), odbx_get_option()
and that's the whole page, bestie, you ate that π
sign-off time: this little icon was brought to you by OpenDBX, dated 6 February 2026 β periodt, no cap, go set some options ππ¦
π¦ where this page comes from
- ubuntu resolute: libopendbx1-dev 1.4.6-18build2
- ubuntu stonking: libopendbx1-dev 1.4.6-18build2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms