
Set sql_auto_is_null and sql_mode for jdbc do_mysql
Reported by Dan Kubb (dkubb) | May 15th, 2009 @ 02:00 AM
Currently the jdbc version of do_mysql has different behavior than the C version of do_mysql in that it doesn't send the same commands to configure the session.
With the C version of do_mysql we opted to send over settings that would cause MySQL to act in as strict a mode as possible. MySQL is notorious for silently truncating, transforming and otherwise accepting invalid data that it should be preventing.
Our approach is to have it be as strict as possible now and then scale back if there are problems because it is really difficult to go the other way. In the last few years of developing with MySQL I've found this approach to be quite useful in catching common errors.
On connect the following commands are issued:
SET sql_auto_is_null = 0
SET SESSION sql_mode = 'ANSI,NO_AUTO_VALUE_ON_ZERO,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION,NO_UNSIGNED_SUBTRACTION,TRADITIONAL'
The do_mysql jdbc driver should send the same commands each time it connects to the server.
Comments and changes to this ticket
-
Alex Coles May 20th, 2009 @ 09:53 AM
- State changed from unconfirmed to accepted
-
Dan Kubb (dkubb) June 27th, 2009 @ 04:54 PM
- State changed from accepted to resolved
(from [0603626880b9111f83fe0026c54a208286b9a969]) [do_mysql] Set sql_auto_is_null and sql_mode
- Use same session variables as C driver.
- Session should use ANSI mode, which should also obviate the need for additional sanitization of quotation marks in previous commit 3cd69b3.
[#852 state:resolved]
Signed-off-by: Alex Coles alex@alexcolesportfolio.com
http://github.com/datamapper/do/commit/0603626880b9111f83fe0026c54a...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »