[CONC-185] Provide a callback function to set per-process defaults for various client params Created: 2016-05-20  Updated: 2020-05-04

Status: Open
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Vladislav Vaintroub Assignee: Georg Richter
Resolution: Unresolved Votes: 0
Labels: None


 Description   

This is specifically required for server (which includes a mysql client used by replication, and also federated, spider,connect engines).
currently server-wide defaults are set in my_net_local_init() here
https://github.com/MariaDB/server/blob/10.1/sql/sql_client.cc

The library-global callback in Connector/C should not operate on NET structure, instead it should operate on MYSQL.

if user callback set, it should be called at the end of mysql_init(). Users are supposed to use it to set some mysql_options()

Proposed prototype

mariadb_set_init_callback( void (init_callback)(MYSQL *mysql))



 Comments   
Comment by Georg Richter [ 2016-05-21 ]

I'd like to avoid introduction of new api function. There was some discussion at Amsterdam developer meeting about having 3 option functions (similiar to ODBC standard):

mariadb_global_attr_set: which sets global options (not dedicated to a specific connection)
mariadb_conn_attr_set: which is mostly identical to mysql_options/mysql_optionsv
mariadb_stmt_attr_set: which is mostly identical to mysql_stmt_attr_set

So registering callback function could b

mariadb_global_attr_set(MARIADB_INIT_CALLBACK, callback_function);

Comment by Vladislav Vaintroub [ 2016-05-21 ]

sounds good, even if it also does not avoid introduction of a new API function, as mariadb_global_set does not exist

Generated at Thu Feb 08 03:03:29 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.