datamapper / do

DataObjects
147 stars 73 forks source link

Does not work with MySQL 5.7 #88

Closed stephankaag closed 8 years ago

stephankaag commented 8 years ago
schermafbeelding 2015-11-16 om 10 45 47
dbussink commented 8 years ago

Do you have a way to reproduce this just with DO without DataMapper involved? Right now it's not possible to see if the problem is somewhere in DataMapper or on DO.

stephankaag commented 8 years ago

Lots of the MySQL tests in this project are failing under MySQL 5.7.

tiagocasanovapt commented 8 years ago

This may not be exclusive to DO.

Tiagos-Mac-mini:Downloads casanova$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.9 Homebrew

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
Tiagos-Mac-mini:Downloads casanova$ irb
2.2.3 :001 > require 'do_mysql'
 => true 
2.2.3 :002 > @connection = DataObjects::Connection.new("mysql://127.0.0.1/vendder_test")
 => #<DataObjects::Mysql::Connection:0x007fd97c2a6180 @using_socket=false, @ssl_cipher="DHE-RSA-AES256-SHA", @host="127.0.0.1", @path="/vendder_test", @query=nil, @encoding="UTF-8", @encoding_id=1, @my_encoding="utf8", @connection=#<Object:0x007fd97c2a5cd0>, @uri=#<DataObjects::URI:0x007fd97c2a68d8 @scheme="mysql", @subscheme=nil, @user=nil, @password=nil, @host="127.0.0.1", @port=nil, @path="/vendder_test", @query=nil, @fragment=nil, @relative=true>, @__pool=#<DataObjects::Pooling::Pool<DataObjects::Mysql::Connection> available=0 used=1 size=8>, @__allocated_in_pool=2015-11-16 16:32:43 +0000> 
2.2.3 :003 > @reader = @connection.create_command('SELECT * FROM locales').execute_reader
 => #<DataObjects::Mysql::Reader:0x007fd97c2950d8 @connection=#<DataObjects::Mysql::Connection:0x007fd97c2a6180 @using_socket=false, @ssl_cipher="DHE-RSA-AES256-SHA", @host="127.0.0.1", @path="/vendder_test", @query=nil, @encoding="UTF-8", @encoding_id=1, @my_encoding="utf8", @connection=#<Object:0x007fd97c2a5cd0>, @uri=#<DataObjects::URI:0x007fd97c2a68d8 @scheme="mysql", @subscheme=nil, @user=nil, @password=nil, @host="127.0.0.1", @port=nil, @path="/vendder_test", @query=nil, @fragment=nil, @relative=true>, @__pool=#<DataObjects::Pooling::Pool<DataObjects::Mysql::Connection> available=0 used=1 size=8>, @__allocated_in_pool=2015-11-16 16:32:43 +0000>, @reader=#<Object:0x007fd97c2950b0>, @opened=false, @field_count=2, @fields=["tag", "name"], @field_types=[String, String]> 
2.2.3 :004 > @reader.next!
 => true 
2.2.3 :005 > 

However, I do have a project with Padrino & Datamapper and it can't boot due to an error on 'dm-do-adapter', causing a SQL Syntax error just like the OP posted. Perhaps the error comes from that gem.

stephankaag commented 8 years ago

Any idea where to look @dbussink?

dbussink commented 8 years ago

@stephankaag Not really without looking myself. You mentioned the do_mysql tests failing on 5.7, but I don't have 5.7 setup yet so I'd have to first do that to see what is going on.

dbussink commented 8 years ago

I just tried running the CI suite against 5.7 and it seems to pass without issues. @stephankaag Do you have the output for the failures you saw running the specs for DO?

stephankaag commented 8 years ago

@dbussink Sure. See https://gist.github.com/stephankaag/77dd188b163c2ae4c719

dbussink commented 8 years ago

@stephankaag Do you have additional details of your setup? Like what exact versions are you running? (MySQL, Ruby etc). I haven't been able to reproduce this with 5.7 myself yet so I'm kind of shooting in the dark. Another thing to know is which version do_mysql.dylib is linked to?

$ find . -name do_mysql.bundle
./lib/do_mysql/do_mysql.bundle
./tmp/x86_64-darwin14.0/do_mysql/2.1.6/do_mysql.bundle
./tmp/x86_64-darwin14.0/stage/lib/do_mysql/do_mysql.bundle
$ otool -L ./lib/do_mysql/do_mysql.bundle
./lib/do_mysql/do_mysql.bundle:
    /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/openssl/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/opt/mysql/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
stephankaag commented 8 years ago

MySQL 5.7.9 Ruby 2.2.3

$ find . -name do_mysql.bundle
./lib/do_mysql/do_mysql.bundle
./tmp/x86_64-darwin15/do_mysql/2.2.3/do_mysql.bundle
./tmp/x86_64-darwin15/stage/lib/do_mysql/do_mysql.bundle

$ otool -L ./lib/do_mysql/do_mysql.bundle
./lib/do_mysql/do_mysql.bundle:
    /usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
    /usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
    /usr/local/opt/mysql/lib/libmysqlclient.20.dylib (compatibility version 20.0.0, current version 20.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1225.1.1)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
stephankaag commented 8 years ago

@dbussink Is there anything I can do to help?

dbussink commented 8 years ago

@stephankaag I've been able to reproduce the problem in a test environment, but haven't had time to further dig into the issue.

dbussink commented 8 years ago

Opened #92 which solves this issue. Plan to release a new version after fixing a few more bugs.

stephankaag commented 8 years ago

Hero! :-)

XCM-jj commented 6 years ago

with do_mysql 0.10.17 and mysql 5.7 will error :sql_mode=only_full_group_by but my DB set not have only_full_group_by mode.

@reader = @connection.create_command('SELECT signature FROM event GROUP BY signature ORDER BY timestamp DESC LIMIT 5').execute_reader DataObjects::SQLError: Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregated column 'snorby.event.timestamp' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (code: 1055, sql state: 42000, query: SELECT signature FROM event GROUP BY signature ORDER BY timestamp DESC LIMIT 5, uri: mysql://snort@127.0.0.1/snorby) from (irb):37:in execute_reader' from (irb):37 from /usr/local/rvm/rubies/ruby-2.0.0-p648-install/bin/irb:12:in

'