diff options
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/vendor/mysql.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/activerecord/lib/active_record/vendor/mysql.rb b/activerecord/lib/active_record/vendor/mysql.rb index 3000c7eb39..2599f4337b 100644 --- a/activerecord/lib/active_record/vendor/mysql.rb +++ b/activerecord/lib/active_record/vendor/mysql.rb @@ -127,7 +127,8 @@ class Mysql flag |= @client_flag | CLIENT_CAPABILITIES flag |= CLIENT_CONNECT_WITH_DB if db - if 0 == @server_capabilities & PROTO_AUTH41 + @pre_411 = (0 == @server_capabilities & PROTO_AUTH41) + if @pre_411 data = Net::int2str(flag)+Net::int3str(@max_allowed_packet)+ (user||"")+"\0"+ scramble(passwd, @scramble_buff, @protocol_version==9) @@ -141,7 +142,7 @@ class Mysql end if db and @server_capabilities & CLIENT_CONNECT_WITH_DB != 0 - data << "\0" if 0 == @server_capabilities & PROTO_AUTH41 + data << "\0" if @pre_411 data << db @db = db.dup end @@ -202,7 +203,7 @@ class Mysql end def change_user(user="", passwd="", db="") - if 0 == @server_capabilities & PROTO_AUTH41 + if @pre_411 data = user+"\0"+scramble(passwd, @scramble_buff, @protocol_version==9)+"\0"+db else data = user+"\0"+scramble41(passwd, @scramble_buff)+db @@ -267,7 +268,7 @@ class Mysql def list_fields(table, field=nil) command COM_FIELD_LIST, "#{table}\0#{field}", true - if 0 == @server_capabilities & PROTO_AUTH41 + if @pre_411 f = read_rows 6 else f = read_rows 7 @@ -281,7 +282,7 @@ class Mysql def list_processes() data = command COM_PROCESS_INFO @field_count = get_length data - if 0 == @server_capabilities & PROTO_AUTH41 + if @pre_411 fields = read_rows 5 else fields = read_rows 7 @@ -399,7 +400,7 @@ class Mysql end else @extra_info = get_length(data, true) - if 0 == @server_capabilities & PROTO_AUTH41 + if @pre_411 fields = read_rows(5) else fields = read_rows(7) @@ -413,7 +414,7 @@ class Mysql def unpack_fields(data, long_flag_protocol) ret = [] data.each do |f| - if 0 == @server_capabilities & PROTO_AUTH41 + if @pre_411 table = org_table = f[0] name = f[1] length = f[2][0]+f[2][1]*256+f[2][2]*256*256 @@ -440,8 +441,8 @@ class Mysql decimals = f[6][9] def_value = "" max_length = 0 - ret << Field::new(table, org_table, name, length, type, flags, decimals, def_value, max_length) end + ret << Field::new(table, org_table, name, length, type, flags, decimals, def_value, max_length) end ret end |