Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/ext/tiny_tds/result.c b/ext/tiny_tds/result.c
- index 3f6b0eb..f62c8cd 100644
- --- a/ext/tiny_tds/result.c
- +++ b/ext/tiny_tds/result.c
- @@ -89,7 +89,7 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
- val = INT2NUM(*(DBINT *)data);
- break;
- case SYBINT8:
- - val = LONG2NUM(*(long *)data);
- + val = LL2NUM(*(DBBIGINT *)data);
- break;
- case SYBBIT:
- val = *(int *)data ? Qtrue : Qfalse;
- @@ -116,8 +116,8 @@ static VALUE rb_tinytds_result_fetch_row(VALUE self, ID timezone, int symbolize_
- case SYBMONEY: {
- DBMONEY *money = (DBMONEY *)data;
- char converted_money[25];
- - long money_value = ((long)money->mnyhigh << 32) | money->mnylow;
- - sprintf(converted_money, "%ld", money_value);
- + long long money_value = ((long long)money->mnyhigh << 32) | money->mnylow;
- + sprintf(converted_money, "%lld", money_value);
- val = rb_funcall(cBigDecimal, intern_new, 2, rb_str_new2(converted_money), opt_four);
- val = rb_funcall(val, intern_divide, 1, opt_tenk);
- break;
- diff --git a/ext/tiny_tds/result.h b/ext/tiny_tds/result.h
- index 2e5a2e1..6c59172 100644
- --- a/ext/tiny_tds/result.h
- +++ b/ext/tiny_tds/result.h
- @@ -2,6 +2,8 @@
- #ifndef TINYTDS_RESULT_H
- #define TINYTDS_RESULT_H
- +typedef tds_sysdep_int64_type DBBIGINT; /* Missing in sybdb.h ?!?! */
- +
- void init_tinytds_result();
- VALUE rb_tinytds_new_result_obj(DBPROCESS *c);
- diff --git a/test/client_test.rb b/test/client_test.rb
- index 4680ae8..940531b 100644
- --- a/test/client_test.rb
- +++ b/test/client_test.rb
- @@ -33,7 +33,7 @@ class ClientTest < TinyTds::TestCase
- end
- should 'allow valid iconv character set' do
- - ['CP1251', 'ISO-8859-1'].each do |encoding|
- + ['CP850', 'CP1252', 'ISO-8859-1'].each do |encoding|
- client = TinyTds::Client.new(connection_options.merge(:encoding => encoding))
- assert_equal encoding, client.charset
- assert_equal Encoding.find(encoding), client.encoding if ruby19?
- @@ -52,10 +52,9 @@ class ClientTest < TinyTds::TestCase
- options = connection_options.merge :login_timeout => 1, :dataserver => '127.0.0.2'
- action = lambda { TinyTds::Client.new(options) }
- assert_raise_tinytds_error(action) do |e|
- - assert_match(/unable to (open|connect)/i, e.message)
- - assert_equal 9, e.severity
- assert [20008,20009].include?(e.db_error_number)
- - assert_equal 36, e.os_error_number
- + assert_equal 9, e.severity
- + assert_match %r{unable to (open|connect)}i, e.message, 'ignore if non-english test run'
- end
- end
- @@ -63,10 +62,9 @@ class ClientTest < TinyTds::TestCase
- options = connection_options.merge :username => 'willnotwork'
- action = lambda { TinyTds::Client.new(options) }
- assert_raise_tinytds_error(action) do |e|
- - assert_match(/login failed/i, e.message)
- - assert_equal 14, e.severity
- assert_equal 18456, e.db_error_number
- - assert_equal 1, e.os_error_number
- + assert_equal 14, e.severity
- + assert_match %r{login failed}i, e.message, 'ignore if non-english test run'
- end
- end
- @@ -74,9 +72,9 @@ class ClientTest < TinyTds::TestCase
- options = connection_options.merge :encoding => 'ISO-WTF'
- action = lambda { TinyTds::Client.new(options) }
- assert_raise_tinytds_error(action) do |e|
- - assert_match(/unexpected eof from the server/i, e.message)
- - assert_equal 9, e.severity
- assert_equal 20017, e.db_error_number
- + assert_equal 9, e.severity
- + assert_match %r{unexpected eof from the server}i, e.message, 'ignore if non-english test run'
- end
- end
Add Comment
Please, Sign In to add comment