aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2005-12-10 21:38:28 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2005-12-10 21:38:28 +0000
commit809dd8e87ec1e0c28c7a063a70bc5e8d4c5817e1 (patch)
treee34daf95753263ba6ee6a7ba8740b4a5aa2fedad /activerecord
parent4695133d8de6422ef2c7b80ab0c6166a183a1dc3 (diff)
downloadrails-809dd8e87ec1e0c28c7a063a70bc5e8d4c5817e1.tar.gz
rails-809dd8e87ec1e0c28c7a063a70bc5e8d4c5817e1.tar.bz2
rails-809dd8e87ec1e0c28c7a063a70bc5e8d4c5817e1.zip
MySQL: fixes for the bundled mysql.rb driver. References #3160.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3274 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rw-r--r--activerecord/lib/active_record/vendor/mysql.rb17
2 files changed, 11 insertions, 8 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index d80a8af16d..394d9ddf1e 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* MySQL: fixes for the bundled mysql.rb driver. #3160 [Justin Forder]
+
* SQLServer: fix obscure optimistic locking bug. #3068 [kajism@yahoo.com]
* SQLServer: support uniqueidentifier columns. #2930 [keithm@infused.org]
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