-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Session Initialization SQL for Shared Hosting #519
Comments
If ADO.NET exposed a connection pooling API (dotnet/corefx#26714), setting a property on the pool could be a natural to specify this information. For now, it seems like the connection string would have to be used, since that's the only piece of information passed to
This should be done by using a property on |
There is a good suggestion in this SO answer: add an event handler to I think this can be solved adequately in user code and doesn't need to be part of this library. |
A user of a shared hosting MySQL service may wish to set default values in their session that are different than the default values of the server. A shared hosting user permission level typically will only allow them to run a
SET @@session
command, which must be run on every sessionMySqlConnector could support this by adding either:
a. If the option was a string of SQL, putting
SET @@session.sql_mode = 'TRADITIONAL
in the string would look odd and we'd need to come up with an easy way to escape the stringb. Creating an option for every
@@session
variable in the connection string would be quite work intensivea. This would look something like
SessionInitUtil.setSessionInitSql(connectionString, "SET @@session.sql_mode = 'TRADITIONAL")
b. This seems cleaner than putting it in the connection string, but still feels kind of hacky
The initialization code could go right after the session is created:
MySqlConnector/src/MySqlConnector/MySql.Data.MySqlClient/MySqlConnection.cs
Line 171 in d35322f
The text was updated successfully, but these errors were encountered: