Jeremy K. wrote:
driver + mysql411 is more compatible, but clearly isn’t good enough.
Use the C bindings.
The problem in connecting is not in the AR adapter (I have checked the
parameters being passed in to the real_connect call) - it happens within
the real_connect method of the mysql.rb driver.
Looking harder at this, it is clear that the problem is not with the
driver in its original form (version 0.2.6) from
but with the patch applied to it to make it work with MySQL 4.1.1 and
Whereas the mysql411.rb overlay that you used in the previous release
candidate did a check based on the MySQL version string, the patch looks
at flags in the @server_capabilities. The flags themselves look
sensible; for me, on first connection to MySQL 4.0.13, they are:
Server capabilities: 8236
Long password: false
Found rows: false
Long flag: true
Connect with db: true
No schema: false
Local files: false
Ignore space: false
Protocol 41: false
Ignore SIGPIPE: false
Secure connection: false
but the way they are being used to switch between old and new (4.1.1+)
behaviour is totally broken:
CLIENT_PROTOCOL_41 = 1 << 9
CLIENT_SECURE_CONNECTION = 1 << 15
PROTO_AUTH41 = CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION
if !@server_capabilities & PROTO_AUTH41 # ***** !!!
# old behaviour
# new behaviour
This broken condition (which always evaluates to false, because
@server_capabilities is a Fixnum, so !@server_capabilities is false)
appears in lines 130, 208, 273, 287, 405 and 419.
At line 144, there’s even:
(and the preceding line, from the original code:
if db and @server_capabilities & CLIENT_CONNECT_WITH_DB != 0 then
shows how to express these conditions properly).
So… it looks as if this patch was never tested with MySQL 4.0. Given
the elementary nature of the errors, the whole patch needs very careful