Open anton-kotenko opened 12 years ago
This is goes from MySQL C API: there is two ways to set connection settings: via flags on mysql_real_connect
and via call mysql_options
. So I prefer to keep this API on bindings level.
By the way, I agree with your arguments, so I can build consistent api for options as argument of MysqlHighlevelConnection@connect()
.
Thank you, That would be great, but It seems to me that there are no way, to set options (not client flags, even it is acceptable solution of my problem), when connecting in asynchronous mode without notable change of api at bindings level. Or there will be need to create asynchronous version of realConnect, and make obligatory call of initSync at JavaScript level, or need to pass options argument through chain MysqlConnection::Connect(Args&)->EIO_Connect->Connect, and execute mysql_options call there just after mysql_init.
I need a closer look at the code to decide between this choices.
Or there will be need to create asynchronous version of realConnect, and make obligatory call of initSync at JavaScript level, or need to pass options argument through chain MysqlConnection::Connect(Args&)->EIO_Connect->Connect, and execute mysql_options call there just after mysql_init.
Do you plan to implement CLIENT_LOCAL_FILES?
I'm working on "Load data infile" feature. It's work requires to set MYSQL_OPT_LOCAL_INFILE option. But i've found that it's impossible to set options if using ConnectSync or Connect methods and that the only way to set options is like this:
As for me, it make's api inconsistent (i can not set options, if i want to connect in asyncronous mode), and introduces additional difficulties (at least 2 methods initSync, and realConnectSync). So my proposal is to have _conn structrure initialized in constructor, (and every time when it closed, like when mysql_real_connect fails). This makes possible to use setOptionSync between new MysqlConnection and any form of Connect method. and makes possible to remove initSync and realConnectSync (and also remove RealConnect method from mysql_bindings_connection.cc, as it's almost copy&paste of Connect method)