rubyfb 0.5.5 → 0.5.6

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/ext/TypeMap.h CHANGED
@@ -3,20 +3,20 @@
3
3
  *----------------------------------------------------------------------------*/
4
4
  /**
5
5
  * Copyright � Peter Wood, 2005
6
- *
6
+ *
7
7
  * The contents of this file are subject to the Mozilla Public License Version
8
8
  * 1.1 (the "License"); you may not use this file except in compliance with the
9
- * License. You may obtain a copy of the License at
9
+ * License. You may obtain a copy of the License at
10
10
  *
11
11
  * http://www.mozilla.org/MPL/
12
- *
12
+ *
13
13
  * Software distributed under the License is distributed on an "AS IS" basis,
14
14
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
15
15
  * the specificlanguage governing rights and limitations under the License.
16
- *
16
+ *
17
17
  * The Original Code is the FireRuby extension for the Ruby language.
18
- *
19
- * The Initial Developer of the Original Code is Peter Wood. All Rights
18
+ *
19
+ * The Initial Developer of the Original Code is Peter Wood. All Rights
20
20
  * Reserved.
21
21
  *
22
22
  * @author Peter Wood
@@ -29,23 +29,23 @@
29
29
  #include "ibase.h"
30
30
  #define IBASE_H_INCLUDED
31
31
  #endif
32
-
32
+
33
33
  #ifndef RUBY_H_INCLUDED
34
34
  #include "ruby.h"
35
35
  #define RUBY_H_INCLUDED
36
36
  #endif
37
-
37
+
38
38
  #ifndef FIRERUBY_DATABASE_H
39
39
  #include "ResultSet.h"
40
40
  #endif
41
-
42
- /* Function prototypes. */
43
- VALUE toValue(XSQLVAR *, isc_db_handle *, isc_tr_handle *);
44
- VALUE toArray(VALUE);
45
- void setParameters(XSQLDA *, VALUE, VALUE);
46
- VALUE getModule(const char *);
47
- VALUE getClass(const char *);
48
- VALUE getClassInModule(const char *, VALUE);
49
- VALUE getModuleInModule(const char *, VALUE);
41
+
42
+ /* Function prototypes. */
43
+ VALUE toValue(XSQLVAR *, isc_db_handle *, isc_tr_handle *);
44
+ VALUE toArray(VALUE);
45
+ void setParameters(XSQLDA *, VALUE, VALUE);
46
+ VALUE getModule(const char *);
47
+ VALUE getClass(const char *);
48
+ VALUE getClassInModule(const char *, VALUE);
49
+ VALUE getModuleInModule(const char *, VALUE);
50
50
 
51
51
  #endif /* FIRERUBY_TYPE_MAP_H */
data/ext/rfbint.h CHANGED
@@ -5,9 +5,9 @@
5
5
  #include <inttypes.h>
6
6
  #else
7
7
  #ifndef __GNUC__
8
- typedef short int16_t;
9
- typedef long int32_t;
10
- typedef long long int64_t;
8
+ typedef short int16_t;
9
+ typedef long int32_t;
10
+ typedef long long int64_t;
11
11
  #endif
12
12
  #endif
13
13
 
@@ -12,7 +12,7 @@ module Rubyfb # :nodoc: all
12
12
  raise ArgumentError, "No database specified. Missing argument: database."
13
13
  end
14
14
  host_string = config.values_at(:host, :service, :port).compact.first(2).join("/") if config[:host]
15
- [host_string, config[:database]].join(":")
15
+ [host_string, config[:database]].compact.join(":")
16
16
  end
17
17
 
18
18
  def self.new_from_config(config)
data/lib/rubyfb_lib.so CHANGED
Binary file
data/lib/src.rb CHANGED
@@ -772,6 +772,26 @@ module Rubyfb
772
772
  end
773
773
 
774
774
 
775
+ #
776
+ # This method fetches the scale associated with a specified column for a
777
+ # ResultSet object. Firebird implements some floating point types with
778
+ # integral storage and a negative scale. For example, depending on
779
+ # your platform
780
+ #
781
+ # SELECT 1.003 FROM RDB$DATABASE
782
+ #
783
+ # may return a ResultSet, the first and only column of which has
784
+ # a base type of :BIGINT but a scale of -3. (Fetches of the actual
785
+ # value will correctly return a ruby Float.)
786
+ #
787
+ # ==== Parameters
788
+ # column:: A reference to the column number to fetch the details for.
789
+ # Column numbers start at zero.
790
+ #
791
+ def column_scale(column)
792
+ end
793
+
794
+
775
795
  #
776
796
  # This method fetches the table name associated with a specified column
777
797
  # for a ResultSet object.
@@ -910,6 +930,19 @@ module Rubyfb
910
930
  #
911
931
  def column_alias(index)
912
932
  end
933
+
934
+
935
+ #
936
+ # This method fetches the scale associated with a specified column
937
+ # within a row of data. See the documentation of
938
+ # ResultSet#column_scale for details.
939
+ #
940
+ # ==== Parameters
941
+ # column:: A reference to the column number to fetch the details for.
942
+ # Column numbers start at zero.
943
+ #
944
+ def column_scale(column)
945
+ end
913
946
 
914
947
 
915
948
  #
data/rubyfb.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{rubyfb}
5
- s.version = "0.5.5"
5
+ s.version = "0.5.6"
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 = %q{2011-01-06}
9
+ s.date = %q{2011-01-29}
10
10
  s.description = %q{Firebird SQL access library}
11
11
  s.email = %q{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/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", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/active_record/connection_adapters/rubyfb_adapter.rb", "lib/arel/visitors/rubyfb.rb", "lib/mkdoc", "lib/rubyfb.rb", "lib/rubyfb_lib.so", "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/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/TestSetup.rb", "test/TransactionTest.rb", "test/TypeTest.rb", "test/UnitTest.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", "lib/Connection.rb", "lib/ProcedureCall.rb", "lib/SQLType.rb", "lib/active_record/connection_adapters/rubyfb_adapter.rb", "lib/arel/visitors/rubyfb.rb", "lib/mkdoc", "lib/rubyfb.rb", "lib/rubyfb_lib.so", "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/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/TestSetup.rb", "test/TransactionTest.rb", "test/TypeTest.rb", "rubyfb.gemspec"]
15
15
  s.homepage = %q{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"]
@@ -159,4 +159,17 @@ class ResultSetTest < Test::Unit::TestCase
159
159
  results.close if results != nil
160
160
  end
161
161
  end
162
+ def test05
163
+ results = @transactions[0].execute(<<-EOSQL)
164
+ SELECT CAST(5.01 AS DECIMAL(6,5)) AS "COL01",
165
+ 2.2 AS "COL02",
166
+ CAST(3 AS INTEGER) AS "COL03"
167
+ FROM RDB$DATABASE
168
+ EOSQL
169
+ assert_equal(-5, results.column_scale(0))
170
+ assert_equal(-1, results.column_scale(1))
171
+ assert_equal(0, results.column_scale(2))
172
+ ensure
173
+ results.close if results
174
+ end
162
175
  end
data/test/RowTest.rb CHANGED
@@ -200,4 +200,20 @@ class RowTest < Test::Unit::TestCase
200
200
  results.close if results != nil
201
201
  end
202
202
  end
203
+
204
+ def test04
205
+ results = @transaction.execute(<<-EOSQL)
206
+ SELECT CAST(5.01 AS DECIMAL(6,5)) AS "COL01",
207
+ 2.2 AS "COL02",
208
+ CAST(3 AS INTEGER) AS "COL03"
209
+ FROM RDB$DATABASE
210
+ EOSQL
211
+ row = results.fetch
212
+
213
+ assert_equal(-5, row.column_scale(0))
214
+ assert_equal(-1, row.column_scale(1))
215
+ assert_equal(0, row.column_scale(2))
216
+ ensure
217
+ results.close if results
218
+ end
203
219
  end
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: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 5
10
- version: 0.5.5
9
+ - 6
10
+ version: 0.5.6
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-01-06 00:00:00 +02:00
18
+ date: 2011-01-29 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -118,7 +118,6 @@ files:
118
118
  - test/TestSetup.rb
119
119
  - test/TransactionTest.rb
120
120
  - test/TypeTest.rb
121
- - test/UnitTest.rb
122
121
  - rubyfb.gemspec
123
122
  has_rdoc: true
124
123
  homepage: http://rubyforge.org/projects/rubyfb
data/test/UnitTest.rb DELETED
@@ -1,65 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- #-------------------------------------------------------------------------------
4
- # Old Unit Test Suite
5
- #
6
- # This code has been dropped for two reasons. First, adding new tests requires
7
- # that this code be updated. Second, running the tests in a single Ruby
8
- # interpreter seems to cause issues as the tests create, use and drop a lot of
9
- # database files and this seems to cause intermittent problems with one or more
10
- # of the test scripts that doesn't occur when the script is run on its own.
11
- # Changing the number of scripts run also seemed to cause the problems to go
12
- # away. It didn't seem to matter which scripts where left out which leads me
13
- # to believe that the problem is related to timing issues.
14
- #
15
- # The new unit test suite, below, searches the directory for unit test files
16
- # and executes each in their own interpreter. I have left this code here for
17
- # reference purposes.
18
- #-------------------------------------------------------------------------------
19
- #require 'DatabaseTest'
20
- #require 'ConnectionTest'
21
- #require 'TransactionTest'
22
- #require 'StatementTest'
23
- #require 'ResultSetTest'
24
- #require 'RowCountTest'
25
- #require 'RowTest'
26
- #require 'GeneratorTest'
27
- #require 'DDLTest'
28
- #require 'SQLTest'
29
- #require 'ServiceManagerTest'
30
- #require 'CharacterSetTest'
31
- #require 'KeyTest'
32
- #require 'TypeTest'
33
- #require 'SQLTypeTest'
34
- #if PLATFORM.include?('powerpc-darwin') == false
35
- # require 'BackupRestoreTest'
36
- # require 'AddRemoveUserTest'
37
- #end
38
- #-------------------------------------------------------------------------------
39
- SPECIALS = ['AddRemoveUserTest',
40
- 'BackupRestoreTest',
41
- 'ServiceManagerTest',
42
- 'RoleTest']
43
- begin
44
- files = Dir.entries(".")
45
- files.reject! do |name|
46
- ['.', '..', 'UnitTest.rb'].include?(name) or
47
- name[-7,7] != 'Test.rb'
48
- end
49
- files.each do |name|
50
- execute = true
51
- if SPECIALS.include?(name)
52
- execute = !(PLATFORM.include?('powerpc-darwin'))
53
- end
54
-
55
- if execute
56
- system("ruby #{name}")
57
-
58
- if $? != 0
59
- raise StandardError.new("Error executing '#{name}'. Testing terminated.")
60
- end
61
- end
62
- end
63
- rescue => error
64
- puts "\n\nERROR: #{error.message}"
65
- end