1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
Index: /Users/duff/Library/Application Support/TextMate/Bundles/SQL.tmbundle/Support/lib/connectors/mysql.rb
===================================================================
@@ -98,6 +98,9 @@
if args[0] != :INIT then
real_connect(*args)
end
+
+ encoding = query('SELECT @@character_set_database AS server').fetch_hash
+ query('SET NAMES utf8;') if encoding["server"] != 'latin1'
end
def real_connect(host=nil, user=nil, passwd=nil, db=nil, port=nil, socket=nil, flag=nil)
@@ -514,8 +517,9 @@
a = @net.read
if a[0] == 255 then
if a.length > 3 then
- @errno = a[1]+a[2]*256
- @error = a[3 .. -1]
+ @errno = a[1]+a[2]*256
+ msg_start = a[3] == ?# ? 9 : 3
+ @error = a[msg_start .. -1]
else
@errno = Error::CR_UNKNOWN_ERROR
@error = Error::err @errno
|