rubyfb 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ v0.6.2 ==
2
+ Update arel visitors
3
+ Use round() when scaling fixed parameter values
4
+
5
+ v0.6.1 ==
6
+ Fix incorrect parameter scaling for fixed precision decimals stored in int32, int16 fields
7
+ http://rubyforge.org/tracker/index.php?func=detail&aid=29406&group_id=9658&atid=37369
8
+ Restore pre 3.0.7 rails compatibility
9
+ http://rubyforge.org/tracker/index.php?func=detail&aid=29398&group_id=9658&atid=37369
10
+
1
11
  v0.6.0 ==
2
12
  API changes:
3
13
  !!WARNING!!
data/Manifest CHANGED
@@ -52,8 +52,8 @@ lib/Connection.rb
52
52
  lib/ProcedureCall.rb
53
53
  lib/SQLType.rb
54
54
  lib/active_record/connection_adapters/rubyfb_adapter.rb
55
+ lib/arel/visitors/fb15/rubyfb.rb
55
56
  lib/arel/visitors/rubyfb.rb
56
- lib/arel/visitors/rubyfb_15compat.rb
57
57
  lib/mkdoc
58
58
  lib/rubyfb.rb
59
59
  lib/rubyfb_lib.so
data/Rakefile CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'echoe'
2
- e = Echoe.new('rubyfb', '0.6.1') do |p|
2
+ e = Echoe.new('rubyfb', '0.6.2') do |p|
3
3
  p.description = "Firebird SQL access library"
4
4
  p.url = "http://rubyforge.org/projects/rubyfb"
5
5
  p.author = "George Georgiev"
data/ext/TypeMap.c CHANGED
@@ -58,15 +58,13 @@ void populateTimeField(VALUE, XSQLVAR *);
58
58
  void populateTimestampField(VALUE, XSQLVAR *);
59
59
 
60
60
  long long sql_scale(VALUE value, XSQLVAR *field) {
61
- if(field->sqlscale == 0) {
62
- value = rb_funcall(value, rb_intern("to_i"), 0);
63
- } else {
64
- value = rb_funcall(value, rb_intern("to_f"), 0);
61
+ value = rb_funcall(value, rb_intern("to_f"), 0);
62
+ if(field->sqlscale) {
65
63
  // this requires special care - decimal point shift can cause type overflow
66
64
  // the easyest way is to use ruby arithmetics (although it's not the fastes)
67
65
  value = rb_funcall(value, rb_intern("*"), 1, LONG2NUM((long)pow(10, abs(field->sqlscale))));
68
66
  }
69
- return NUM2LL(value);
67
+ return NUM2LL(rb_funcall(value, rb_intern("round"), 0));
70
68
  }
71
69
 
72
70
  VALUE sql_unscale(VALUE value, XSQLVAR *field) {
@@ -6,10 +6,11 @@ require 'rubyfb_options'
6
6
 
7
7
  if defined?(Arel) then
8
8
  if Rubyfb::Options.fb15_compat
9
- require 'arel/visitors/rubyfb_15compat'
9
+ require 'arel/visitors/fb15/rubyfb'
10
10
  else
11
11
  require 'arel/visitors/rubyfb'
12
12
  end
13
+ Arel::Visitors::VISITORS['rubyfb'] = Arel::Visitors::RubyFB if defined?(Arel::Visitors::VISITORS)
13
14
  end
14
15
 
15
16
  module Rubyfb # :nodoc: all
@@ -333,6 +334,10 @@ module ActiveRecord
333
334
  @statements = {}
334
335
  end
335
336
 
337
+ def self.visitor_for(pool) # :nodoc:
338
+ Arel::Visitors::RubyFB.new(pool)
339
+ end
340
+
336
341
  ADAPTER_NAME = 'Rubyfb'.freeze
337
342
 
338
343
  def adapter_name #:nodoc:
@@ -1,7 +1,6 @@
1
1
  module Arel
2
2
  module Visitors
3
- class RubyFB_15Compat < Arel::Visitors::ToSql
4
- Arel::Visitors::VISITORS['rubyfb'] = Arel::Visitors::RubyFB_15Compat
3
+ class RubyFB < Arel::Visitors::ToSql
5
4
  private
6
5
  def visit_Arel_Nodes_Limit o
7
6
  end
@@ -1,7 +1,6 @@
1
1
  module Arel
2
2
  module Visitors
3
3
  class RubyFB < Arel::Visitors::ToSql
4
- Arel::Visitors::VISITORS['rubyfb'] = Arel::Visitors::RubyFB
5
4
  private
6
5
  def visit_Arel_Nodes_Limit o
7
6
  end
data/lib/rubyfb_lib.so CHANGED
Binary file
data/rubyfb.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rubyfb"
5
- s.version = "0.6.1"
5
+ s.version = "0.6.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["George Georgiev"]
9
- s.date = "2011-10-16"
9
+ s.date = "2012-01-04"
10
10
  s.description = "Firebird SQL access library"
11
11
  s.email = "georgiev@heatbs.com"
12
12
  s.extensions = ["ext/extconf.rb"]
13
13
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "examples/example01.rb", "ext/extconf.rb", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/rubyfb.rb", "lib/rubyfb_options.rb", "lib/src.rb"]
14
- s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "examples/example01.rb", "ext/AddUser.c", "ext/AddUser.h", "ext/Backup.c", "ext/Backup.h", "ext/Blob.c", "ext/Blob.h", "ext/Common.c", "ext/Common.h", "ext/Connection.c", "ext/Connection.h", "ext/DataArea.c", "ext/DataArea.h", "ext/Database.c", "ext/Database.h", "ext/FireRuby.c", "ext/FireRuby.h", "ext/FireRubyException.c", "ext/FireRubyException.h", "ext/Generator.c", "ext/Generator.h", "ext/RemoveUser.c", "ext/RemoveUser.h", "ext/Restore.c", "ext/Restore.h", "ext/ResultSet.c", "ext/ResultSet.h", "ext/Row.c", "ext/Row.h", "ext/ServiceManager.c", "ext/ServiceManager.h", "ext/Services.c", "ext/Services.h", "ext/Statement.c", "ext/Statement.h", "ext/Transaction.c", "ext/Transaction.h", "ext/TypeMap.c", "ext/TypeMap.h", "ext/extconf.rb", "ext/rfbint.h", "ext/rfbsleep.h", "ext/rfbstr.c", "ext/rfbstr.h", "ext/uncrustify.cfg", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/active_record/connection_adapters/rubyfb_adapter.rb", "lib/arel/visitors/rubyfb.rb", "lib/arel/visitors/rubyfb_15compat.rb", "lib/mkdoc", "lib/rubyfb.rb", "lib/rubyfb_lib.so", "lib/rubyfb_options.rb", "lib/src.rb", "mswin32fb/fbclient_mingw.def", "mswin32fb/fbclient_mingw.lib", "mswin32fb/fbclient_ms.lib", "mswin32fb/ibase.h", "mswin32fb/iberror.h", "test/AddRemoveUserTest.rb", "test/BackupRestoreTest.rb", "test/BlobTest.rb", "test/CharacterSetTest.rb", "test/ConnectionTest.rb", "test/DDLTest.rb", "test/DatabaseTest.rb", "test/FieldCharacterSetTest.rb", "test/GeneratorTest.rb", "test/KeyTest.rb", "test/ResultSetTest.rb", "test/RoleTest.rb", "test/RowCountTest.rb", "test/RowTest.rb", "test/SQLTest.rb", "test/SQLTypeTest.rb", "test/ServiceManagerTest.rb", "test/StatementTest.rb", "test/StoredProcedureTest.rb", "test/TestSetup.rb", "test/TransactionTest.rb", "test/TypeTest.rb", "rubyfb.gemspec"]
14
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "examples/example01.rb", "ext/AddUser.c", "ext/AddUser.h", "ext/Backup.c", "ext/Backup.h", "ext/Blob.c", "ext/Blob.h", "ext/Common.c", "ext/Common.h", "ext/Connection.c", "ext/Connection.h", "ext/DataArea.c", "ext/DataArea.h", "ext/Database.c", "ext/Database.h", "ext/FireRuby.c", "ext/FireRuby.h", "ext/FireRubyException.c", "ext/FireRubyException.h", "ext/Generator.c", "ext/Generator.h", "ext/RemoveUser.c", "ext/RemoveUser.h", "ext/Restore.c", "ext/Restore.h", "ext/ResultSet.c", "ext/ResultSet.h", "ext/Row.c", "ext/Row.h", "ext/ServiceManager.c", "ext/ServiceManager.h", "ext/Services.c", "ext/Services.h", "ext/Statement.c", "ext/Statement.h", "ext/Transaction.c", "ext/Transaction.h", "ext/TypeMap.c", "ext/TypeMap.h", "ext/extconf.rb", "ext/rfbint.h", "ext/rfbsleep.h", "ext/rfbstr.c", "ext/rfbstr.h", "ext/uncrustify.cfg", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/active_record/connection_adapters/rubyfb_adapter.rb", "lib/arel/visitors/fb15/rubyfb.rb", "lib/arel/visitors/rubyfb.rb", "lib/mkdoc", "lib/rubyfb.rb", "lib/rubyfb_lib.so", "lib/rubyfb_options.rb", "lib/src.rb", "mswin32fb/fbclient_mingw.def", "mswin32fb/fbclient_mingw.lib", "mswin32fb/fbclient_ms.lib", "mswin32fb/ibase.h", "mswin32fb/iberror.h", "test/AddRemoveUserTest.rb", "test/BackupRestoreTest.rb", "test/BlobTest.rb", "test/CharacterSetTest.rb", "test/ConnectionTest.rb", "test/DDLTest.rb", "test/DatabaseTest.rb", "test/FieldCharacterSetTest.rb", "test/GeneratorTest.rb", "test/KeyTest.rb", "test/ResultSetTest.rb", "test/RoleTest.rb", "test/RowCountTest.rb", "test/RowTest.rb", "test/SQLTest.rb", "test/SQLTypeTest.rb", "test/ServiceManagerTest.rb", "test/StatementTest.rb", "test/StoredProcedureTest.rb", "test/TestSetup.rb", "test/TransactionTest.rb", "test/TypeTest.rb", "rubyfb.gemspec"]
15
15
  s.homepage = "http://rubyforge.org/projects/rubyfb"
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Rubyfb", "--main", "README"]
17
17
  s.require_paths = ["lib", "ext"]
data/test/TypeTest.rb CHANGED
@@ -23,15 +23,15 @@ class TypeTest < Test::Unit::TestCase
23
23
  tx.execute("create table types_table (COL01 integer, "\
24
24
  "COL02 float, COL03 decimal(10,2), "\
25
25
  "COL04 numeric(5,3), COL05 date, COL06 timestamp, "\
26
- "COL07 char(10), COL08 time, COL09 varchar(30))")
26
+ "COL07 char(10), COL08 time, COL09 varchar(30), COL10 decimal(9,2))")
27
27
  end
28
28
 
29
29
  cxn.start_transaction do |tx|
30
30
  stmt = cxn.create_statement("insert into types_table values "\
31
- "(?, ?, ?, ?, ?, ?, ?, ?, ?)")
31
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
32
32
  stmt.exec([10, 100.2, 2378.65, 192.345,
33
33
  Date.new(2005, 10, 21), Time.new, 'La la la',
34
- Time.new, "Oobly Joobly"], tx)
34
+ Time.new, "Oobly Joobly", "2530.70".to_f], tx)
35
35
  stmt.close
36
36
  end
37
37
  cxn.close
@@ -59,6 +59,7 @@ class TypeTest < Test::Unit::TestCase
59
59
  assert(row[6].instance_of?(String))
60
60
  assert(row[7].instance_of?(Time))
61
61
  assert(row[8].instance_of?(String))
62
+ assert_equal("2530.70".to_f, row[9])
62
63
  ensure
63
64
  rows.close if rows != nil
64
65
  cxn.close if cxn != nil
@@ -81,6 +82,7 @@ class TypeTest < Test::Unit::TestCase
81
82
  assert(row[6].instance_of?(String))
82
83
  assert(row[7].instance_of?(Time))
83
84
  assert(row[8].instance_of?(String))
85
+ assert_equal("2530.70".to_f, row[9])
84
86
  ensure
85
87
  rows.close if rows != nil
86
88
  cxn.close if cxn != nil
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyfb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 1
10
- version: 0.6.1
9
+ - 2
10
+ version: 0.6.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - George Georgiev
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-16 00:00:00 Z
18
+ date: 2012-01-04 00:00:00 Z
19
19
  dependencies: []
20
20
 
21
21
  description: Firebird SQL access library
@@ -91,8 +91,8 @@ files:
91
91
  - lib/ProcedureCall.rb
92
92
  - lib/SQLType.rb
93
93
  - lib/active_record/connection_adapters/rubyfb_adapter.rb
94
+ - lib/arel/visitors/fb15/rubyfb.rb
94
95
  - lib/arel/visitors/rubyfb.rb
95
- - lib/arel/visitors/rubyfb_15compat.rb
96
96
  - lib/mkdoc
97
97
  - lib/rubyfb.rb
98
98
  - lib/rubyfb_lib.so