ruby-mysql 2.9.5 → 2.9.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby-mysql might be problematic. Click here for more details.

data/README.rdoc CHANGED
@@ -64,5 +64,5 @@ MySQL connector for Ruby.
64
64
  == Copyright
65
65
 
66
66
  Author :: TOMITA Masahiro <tommy@tmtm.org>
67
- Copyright :: Copyright (c) 2009-2010 TOMITA Masahiro
67
+ Copyright :: Copyright (c) 2009-2012 TOMITA Masahiro
68
68
  License :: Ruby's
data/lib/mysql.rb CHANGED
@@ -16,7 +16,7 @@ class Mysql
16
16
  require "#{dir}/mysql/charset"
17
17
  require "#{dir}/mysql/protocol"
18
18
 
19
- VERSION = 20904 # Version number of this library
19
+ VERSION = 20906 # Version number of this library
20
20
  MYSQL_UNIX_PORT = "/tmp/mysql.sock" # UNIX domain socket filename
21
21
  MYSQL_TCP_PORT = 3306 # TCP socket port number
22
22
 
@@ -93,7 +93,15 @@ class Mysql
93
93
  return data.slice!(0,4).unpack("e").first
94
94
  when Field::TYPE_DOUBLE
95
95
  return data.slice!(0,8).unpack("E").first
96
- when Field::TYPE_DATE, Field::TYPE_DATETIME, Field::TYPE_TIMESTAMP
96
+ when Field::TYPE_DATE
97
+ len = data.slice!(0).ord
98
+ y, m, d = data.slice!(0,len).unpack("vCC")
99
+ t = Mysql::Time.new(y, m, d)
100
+ def t.to_s
101
+ sprintf "%04d-%02d-%02d", year, mon ,day
102
+ end
103
+ return t
104
+ when Field::TYPE_DATETIME, Field::TYPE_TIMESTAMP
97
105
  len = data.slice!(0).ord
98
106
  y, m, d, h, mi, s, bs = data.slice!(0,len).unpack("vCCCCCV")
99
107
  return Mysql::Time.new(y, m, d, h, mi, s, bs)
@@ -572,10 +580,10 @@ class Mysql
572
580
  len = (len2 << 8) + len1
573
581
  raise ProtocolError, "invalid packet: sequence number mismatch(#{seq} != #{@seq}(expected))" if @seq != seq
574
582
  @seq = (@seq + 1) % 256
575
- buf = ''.force_encoding('ASCII-8BIT')
576
583
  l = len
577
584
  while l > 0
578
- ret.concat @sock.sysread(l, buf)
585
+ buf = @sock.sysread l
586
+ ret.concat buf
579
587
  l -= buf.bytesize
580
588
  end
581
589
  end
data/spec/mysql_spec.rb CHANGED
@@ -15,7 +15,7 @@ MYSQL_SOCKET = ENV['MYSQL_SOCKET']
15
15
 
16
16
  describe 'Mysql::VERSION' do
17
17
  it 'returns client version' do
18
- Mysql::VERSION.should == 20904
18
+ Mysql::VERSION.should == 20906
19
19
  end
20
20
  end
21
21
 
@@ -1266,9 +1266,15 @@ describe 'Mysql::Stmt' do
1266
1266
  @m.query "insert into t values ('0000-00-00'),('1000-01-01'),('9999-12-31')"
1267
1267
  @s.prepare 'select i from t'
1268
1268
  @s.execute
1269
- @s.fetch.should == [Mysql::Time.new]
1270
- @s.fetch.should == [Mysql::Time.new(1000,1,1)]
1271
- @s.fetch.should == [Mysql::Time.new(9999,12,31)]
1269
+ cols = @s.fetch
1270
+ cols.should == [Mysql::Time.new]
1271
+ cols.first.to_s.should == '0000-00-00'
1272
+ cols = @s.fetch
1273
+ cols.should == [Mysql::Time.new(1000,1,1)]
1274
+ cols.first.to_s.should == '1000-01-01'
1275
+ cols = @s.fetch
1276
+ cols.should == [Mysql::Time.new(9999,12,31)]
1277
+ cols.first.to_s.should == '9999-12-31'
1272
1278
  end
1273
1279
 
1274
1280
  it '#fetch datetime column' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.5
4
+ version: 2.9.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-16 00:00:00.000000000 Z
12
+ date: 2012-04-19 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This is pure Ruby MySQL connector.
15
15
  email: tommy@tmtm.org