fireruby 0.3.2-mswin32 → 0.4.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/CVS/Entries +3 -2
- data/doc/CVS/Repository +1 -1
- data/doc/README +86 -34
- data/doc/classes/CVS/Entries +1 -1
- data/doc/classes/CVS/Repository +1 -1
- data/doc/classes/FireRuby/CVS/Entries +7 -1
- data/doc/classes/FireRuby/CVS/Repository +1 -1
- data/doc/classes/FireRuby/Connection.src/CVS/Repository +1 -1
- data/doc/classes/FireRuby/Database.src/CVS/Repository +1 -1
- data/doc/classes/FireRuby/FireRubyError.src/CVS/Repository +1 -1
- data/doc/classes/FireRuby/Generator.src/CVS/Repository +1 -1
- data/doc/classes/FireRuby/ResultSet.src/CVS/Repository +1 -1
- data/doc/classes/FireRuby/Statement.src/CVS/Repository +1 -1
- data/doc/classes/FireRuby/Transaction.src/CVS/Repository +1 -1
- data/doc/files/CVS/Repository +1 -1
- data/examples/CVS/Entries +1 -1
- data/examples/CVS/Repository +1 -1
- data/examples/example01.rb +9 -4
- data/lib/CVS/Entries +3 -1
- data/lib/CVS/Repository +1 -1
- data/lib/SQLType.rb +228 -0
- data/lib/fireruby.rb +22 -0
- data/lib/fr_lib.so +0 -0
- data/lib/src.rb +53 -7
- data/test/AddRemoveUserTest.rb +7 -2
- data/test/BackupRestoreTest.rb +3 -1
- data/test/CVS/Entries +19 -16
- data/test/CVS/Repository +1 -1
- data/test/CharacterSetTest.rb +5 -2
- data/test/ConnectionTest.rb +3 -1
- data/test/DDLTest.rb +3 -1
- data/test/DatabaseTest.rb +3 -1
- data/test/GeneratorTest.rb +3 -1
- data/test/KeyTest.rb +140 -0
- data/test/ResultSetTest.rb +34 -3
- data/test/RowCountTest.rb +3 -1
- data/test/RowTest.rb +90 -24
- data/test/SQLTest.rb +4 -1
- data/test/SQLTypeTest.rb +101 -0
- data/test/ServiceManagerTest.rb +10 -2
- data/test/StatementTest.rb +18 -7
- data/test/TestSetup.rb +1 -0
- data/test/TransactionTest.rb +4 -1
- data/test/TypeTest.rb +92 -0
- data/test/UnitTest.rb +61 -15
- metadata +59 -57
- data/doc/CVS/Entries.Log +0 -2
- data/doc/classes/CVS/Entries.Log +0 -1
- data/doc/classes/FireRuby/CVS/Entries.Log +0 -7
- data/lib/fireruby.so +0 -0
data/doc/CVS/Entries
CHANGED
data/doc/CVS/Repository
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc
|
data/doc/README
CHANGED
@@ -1,27 +1,65 @@
|
|
1
|
-
== FireRuby Version 0.
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
particular, database character sets.
|
8
|
-
|
9
|
-
Once again I would like to thank Ken Kunz for his support and input to the
|
10
|
-
FireRuby project. Ken performs the unit testing and creates the gem file for the
|
11
|
-
Linux version of the FireRuby library. Thanks also to Art Fedorov for input on
|
12
|
-
handling and testing character sets.
|
1
|
+
== FireRuby Version 0.4.0
|
2
|
+
Its been a while but I'm glad to release version 0.4.0 of the FireRuby library.
|
3
|
+
FireRuby is an extension for the Ruby programming language that provides access
|
4
|
+
to the Firebird open source RDBMS. There aren't a great deal of changes for this
|
5
|
+
release but some of the alterations may have an impact on existing code, so
|
6
|
+
please read the enhancements and alterations section to see what has been done.
|
13
7
|
|
14
8
|
== Enhancements & Alterations
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
10
|
+
This release contains some changes that are part of a suite of suggestion put
|
11
|
+
forward by Ken Kunz to enhancement support for the Firebird ActiveRecord
|
12
|
+
adapter he developed. The first of these changes involved switching the keying
|
13
|
+
of Row objects away from using the column name to using the column alias. This
|
14
|
+
is a logical change as the alias is more likely to be unique. I realise that
|
15
|
+
change has the potential to break existing code so I've included a work around
|
16
|
+
that can be used to have the library behave as it used to. To use keying on
|
17
|
+
columns insert the following line into your code after you've loaded the
|
18
|
+
FireRuby library and before you've done any database work...
|
19
|
+
|
20
|
+
$FireRubySettings[:ALIAS_KEYS] = false
|
21
|
+
|
22
|
+
This will cause the library to use column names as keys on rows. A second change
|
23
|
+
I've made that could impact existing code is for the retrieval of data from
|
24
|
+
columns of SQL type DATE. These were being returned as a Time object but are now
|
25
|
+
being returned as a Date object, again a fairly logical change. If this causes
|
26
|
+
problems for your code then you can add the following line to get the library to
|
27
|
+
return Times by adding the following line...
|
28
|
+
|
29
|
+
$FireRubySettings[:DATE_AS_DATE] = false
|
30
|
+
|
31
|
+
The final change I've made for this release from Ken's wish list is that I have
|
32
|
+
incorporated Enumerable into the Row and ResultSet classes. Your code may
|
33
|
+
already do this and, unfortunately, I'm not providing any sort of work around
|
34
|
+
other than you remove this from your own code.
|
35
|
+
|
36
|
+
I've also added functionality to the library to aid in determining type
|
37
|
+
information in relation to database tables and query results. As far as I can
|
38
|
+
determine the Firebird data structures used to return data from the database
|
39
|
+
provide no means of determining exact type specifics (please correct me if I'm
|
40
|
+
wrong). This means that for queries all I can return are details of the
|
41
|
+
underlying type but not the specifics (so I can tell you that a result column is
|
42
|
+
NUMERIC but I can't give you the precision and scale for example).
|
43
|
+
|
44
|
+
I have provided a new class called SQLType. This defines constants for the basic
|
45
|
+
types supported by FireRuby. It also allows for querying of table types. In this
|
46
|
+
case, as I'm referring to the actual database, I can provide more specific
|
47
|
+
details (so I can tell you that a column is NUMERIC, has a precision of 5 and a
|
48
|
+
scale or 2 for example). See the API documentation for this class for more
|
49
|
+
information.
|
50
|
+
|
51
|
+
Finally I have added some new unit tests and updated existing ones to cover the
|
52
|
+
changes I have made.
|
21
53
|
|
22
54
|
== Bug Fixes
|
23
55
|
|
24
|
-
|
56
|
+
I've made a few cosmetic and minor bug fixes that were unlikely to have had an
|
57
|
+
impact on anyone (but its nice that they're fixed anyway).
|
58
|
+
|
59
|
+
I received some feedback with regards to FireRuby not working with Firebird
|
60
|
+
database aliases but, as this has been successfully tested via the use of the
|
61
|
+
Rails adapter based on FireRuby, I have to assume that this was a user set up
|
62
|
+
problem.
|
25
63
|
|
26
64
|
== Issues
|
27
65
|
|
@@ -35,7 +73,21 @@ exist as of this release.
|
|
35
73
|
know.
|
36
74
|
|
37
75
|
- The library currently does not support array columns. This may be implemented
|
38
|
-
for a later release depending on demand.
|
76
|
+
for a later release depending on demand. No-one has asked for this so far so
|
77
|
+
I'm starting to think that people don't make much use of array columns.
|
78
|
+
|
79
|
+
- The library can be a bit touchy if you don't clean up after yourself. This
|
80
|
+
can result in a segmentation violation whenever your program stops if you've
|
81
|
+
left a ResultSet or Statement object unclosed. Check through your code to
|
82
|
+
insure that this isn't the case before contacting me about problems in this
|
83
|
+
line.
|
84
|
+
|
85
|
+
- The unit tests are currently set up on the assumption that the password for
|
86
|
+
your sysdba account is 'masterkey'. If this is not the case, or if you wish
|
87
|
+
to use an alternative user for testing, edit the TestSetup.rb file in the
|
88
|
+
unit test directory and update the entries there as appropriate. I should also
|
89
|
+
note that you may need to alter permissions on the test directory to run the
|
90
|
+
actual unit tests on Linux/Unix.
|
39
91
|
|
40
92
|
== Installation & Usage
|
41
93
|
|
@@ -45,32 +97,32 @@ the Ruby Gems package to be installed. Assuming that these installation criteria
|
|
45
97
|
have been met the library can be installed on Windows by executing a command
|
46
98
|
such as the following...
|
47
99
|
|
48
|
-
gem install fireruby-0.
|
100
|
+
gem install fireruby-0.4.0-mswin32.gem
|
49
101
|
|
50
102
|
On the Mac OS X platform you may require super user privilege if your Ruby is
|
51
103
|
installed to the default location (i.e. /usr/local/lib). In this case you can
|
52
104
|
use the sudo command to make the installation like this...
|
53
105
|
|
54
|
-
sudo gem install fireruby-0.
|
106
|
+
sudo gem install fireruby-0.4.0-powerpc-darwin.gem
|
55
107
|
|
56
108
|
Once the gem installation is complete the FireRuby functionality can be accessed
|
57
109
|
in code with the usual gem style requires...
|
58
110
|
|
59
111
|
require 'rubygems'
|
60
|
-
|
112
|
+
require 'fireruby'
|
61
113
|
|
62
114
|
== Build Details
|
63
115
|
|
64
|
-
The FireRuby library is an extension of the Ruby language written in C.
|
65
|
-
OS X
|
66
|
-
installed as a framework, version 1.5.1, and with Ruby version
|
67
|
-
Windows platform the library is built on Windows XP and against
|
68
|
-
installation created using the one-click installer, version 1.8.2. The
|
69
|
-
build was created using the freely available Microsoft compilers and
|
70
|
-
built against a standard installation of Firebird, version 1.5.2. On
|
71
|
-
library
|
72
|
-
|
73
|
-
|
116
|
+
The FireRuby library is an extension of the Ruby language written in C. The Mac
|
117
|
+
OS X version was built by my brother John (thanks!) using Mac OS X 10.4.3
|
118
|
+
against Firebird installed as a framework, version 1.5.1, and with Ruby version
|
119
|
+
1.8.2. For the Windows platform the library is built on Windows XP and against
|
120
|
+
a Ruby installation created using the one-click installer, version 1.8.2. The
|
121
|
+
Windows build was created using the freely available Microsoft compilers and
|
122
|
+
SDKs and built against a standard installation of Firebird, version 1.5.2. On
|
123
|
+
Linux the library is built using an Ubuntu system (Breezy Badger release) using
|
124
|
+
Firebird installed through the Synaptic package manager and version 1.8.2 of
|
125
|
+
Ruby installed using the same tool.
|
74
126
|
|
75
127
|
== So How Do I Use It?
|
76
128
|
|
@@ -90,7 +142,7 @@ and connecting to database instances. For example, to obtain a connection to a
|
|
90
142
|
database you would use something like the following...
|
91
143
|
|
92
144
|
require 'rubygems'
|
93
|
-
|
145
|
+
require 'fireruby'
|
94
146
|
|
95
147
|
include FireRuby
|
96
148
|
|
@@ -322,7 +374,7 @@ database administrator you might do the following...
|
|
322
374
|
|
323
375
|
Assuming that this succeeds you are now ready to execute tasks through your
|
324
376
|
ServiceManager object. Within the FireRuby library individual task are broken
|
325
|
-
out into separate classes. For this release (0.
|
377
|
+
out into separate classes. For this release (0.4.0) there are four task classes
|
326
378
|
provided in the library - Backup, Restore, AddUser and RemoveUser. I think the
|
327
379
|
class names are relatively self explanatory but if you want more information
|
328
380
|
consult the API documentation for a class.
|
data/doc/classes/CVS/Entries
CHANGED
@@ -1 +1 @@
|
|
1
|
-
D
|
1
|
+
D/FireRuby////
|
data/doc/classes/CVS/Repository
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/Connection.src
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/Database.src
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/FireRubyError.src
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/Generator.src
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/ResultSet.src
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/Statement.src
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/classes/FireRuby/Transaction.src
|
data/doc/files/CVS/Repository
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/doc/files
|
data/examples/CVS/Entries
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/example01.rb/1.
|
1
|
+
/example01.rb/1.2/Tue Jun 14 09:50:30 2005//
|
2
2
|
D
|
data/examples/CVS/Repository
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/examples
|
data/examples/example01.rb
CHANGED
@@ -5,6 +5,11 @@ require_gem 'fireruby'
|
|
5
5
|
|
6
6
|
include FireRuby
|
7
7
|
|
8
|
+
# Database details constants.
|
9
|
+
DB_FILE = "localhost:#{File.expand_path('.')}#{File::SEPARATOR}example.fdb"
|
10
|
+
DB_USER_NAME = "sysdba"
|
11
|
+
DB_PASSWORD = "masterkey"
|
12
|
+
|
8
13
|
# SQL constants.
|
9
14
|
CREATE_TABLE_SQL = 'CREATE TABLE TESTTABLE (TESTID INTEGER NOT NULL PRIMARY '\
|
10
15
|
'KEY, TESTTEXT VARCHAR(100), TESTFLOAT NUMERIC(6,2), '\
|
@@ -16,16 +21,16 @@ SELECT_SQL = 'SELECT * FROM TESTTABLE'
|
|
16
21
|
begin
|
17
22
|
# Check if the database file exists.
|
18
23
|
db = nil
|
19
|
-
if File.exist?(
|
24
|
+
if File.exist?(DB_FILE) == false
|
20
25
|
# Create the database file.
|
21
|
-
db = Database.create(
|
26
|
+
db = Database.create(DB_FILE, DB_USER_NAME, DB_PASSWORD, 1024, 'ASCII')
|
22
27
|
else
|
23
28
|
# Create the databse object.
|
24
|
-
db = Database.new(
|
29
|
+
db = Database.new(DB_FILE)
|
25
30
|
end
|
26
31
|
|
27
32
|
# Obtain a connection to the database.
|
28
|
-
db.connect(
|
33
|
+
db.connect(DB_USER_NAME, DB_PASSWORD) do |cxn|
|
29
34
|
# Create the database table.
|
30
35
|
cxn.execute_immediate(CREATE_TABLE_SQL)
|
31
36
|
|
data/lib/CVS/Entries
CHANGED
data/lib/CVS/Repository
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fireruby/lib
|
data/lib/SQLType.rb
ADDED
@@ -0,0 +1,228 @@
|
|
1
|
+
#-------------------------------------------------------------------------------
|
2
|
+
# SQLType.rb
|
3
|
+
#-------------------------------------------------------------------------------
|
4
|
+
# Copyright � Peter Wood, 2005
|
5
|
+
#
|
6
|
+
# The contents of this file are subject to the Mozilla Public License Version
|
7
|
+
# 1.1 (the "License"); you may not use this file except in compliance with the
|
8
|
+
# License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.mozilla.org/MPL/
|
11
|
+
#
|
12
|
+
# Software distributed under the License is distributed on an "AS IS" basis,
|
13
|
+
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
14
|
+
# the specificlanguage governing rights and limitations under the License.
|
15
|
+
#
|
16
|
+
# The Original Code is the FireRuby extension for the Ruby language.
|
17
|
+
#
|
18
|
+
# The Initial Developer of the Original Code is Peter Wood. All Rights
|
19
|
+
# Reserved.
|
20
|
+
|
21
|
+
module FireRuby
|
22
|
+
# This class is used to represent SQL table column tables.
|
23
|
+
class SQLType
|
24
|
+
# A definition for a base SQL type.
|
25
|
+
BIGINT = :BIGINT
|
26
|
+
|
27
|
+
# A definition for a base SQL type.
|
28
|
+
BLOB = :BLOB
|
29
|
+
|
30
|
+
# A definition for a base SQL type.
|
31
|
+
CHAR = :CHAR
|
32
|
+
|
33
|
+
# A definition for a base SQL type.
|
34
|
+
DATE = :DATE
|
35
|
+
|
36
|
+
# A definition for a base SQL type.
|
37
|
+
DECIMAL = :DECIMAL
|
38
|
+
|
39
|
+
# A definition for a base SQL type.
|
40
|
+
DOUBLE = :DOUBLE
|
41
|
+
|
42
|
+
# A definition for a base SQL type.
|
43
|
+
FLOAT = :FLOAT
|
44
|
+
|
45
|
+
# A definition for a base SQL type.
|
46
|
+
INTEGER = :INTEGER
|
47
|
+
|
48
|
+
# A definition for a base SQL type.
|
49
|
+
NUMERIC = :NUMERIC
|
50
|
+
|
51
|
+
# A definition for a base SQL type.
|
52
|
+
SMALLINT = :SMALLINT
|
53
|
+
|
54
|
+
# A definition for a base SQL type.
|
55
|
+
TIME = :TIME
|
56
|
+
|
57
|
+
# A definition for a base SQL type.
|
58
|
+
TIMESTAMP = :TIMESTAMP
|
59
|
+
|
60
|
+
# A definition for a base SQL type.
|
61
|
+
VARCHAR = :VARCHAR
|
62
|
+
|
63
|
+
# Attribute accessor.
|
64
|
+
attr_reader :type, :length, :precision, :scale, :subtype
|
65
|
+
|
66
|
+
|
67
|
+
# This is the constructor for the SQLType class.
|
68
|
+
#
|
69
|
+
# ==== Parameters
|
70
|
+
# type:: The base type for the SQLType object. Must be one of the
|
71
|
+
# base types defined within the class.
|
72
|
+
# length:: The length setting for the type. Defaults to nil.
|
73
|
+
# precision:: The precision setting for the type. Defaults to nil.
|
74
|
+
# scale:: The scale setting for the type. Defaults to nil.
|
75
|
+
# subtype:: The SQL sub-type setting. Defaults to nil.
|
76
|
+
def initialize(type, length=nil, precision=nil, scale=nil, subtype=nil)
|
77
|
+
@type = type
|
78
|
+
@length = length
|
79
|
+
@precision = precision
|
80
|
+
@scale = scale
|
81
|
+
@subtype = subtype
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
# This class method fetches the type details for a named table. The
|
86
|
+
# method returns a hash that links column names to SQLType objects.
|
87
|
+
#
|
88
|
+
# ==== Parameters
|
89
|
+
# table:: A string containing the name of the table.
|
90
|
+
# connection:: A reference to the connection to be used to determine
|
91
|
+
# the type information.
|
92
|
+
#
|
93
|
+
# ==== Exception
|
94
|
+
# FireRubyException:: Generated if an invalid table name is specified
|
95
|
+
# or an SQL error occurs.
|
96
|
+
def SQLType.for_table(table, connection)
|
97
|
+
# Check for naughty table names.
|
98
|
+
if /\s+/ =~ table
|
99
|
+
raise FireRubyException.new("'#{table}' is not a valid table name.")
|
100
|
+
end
|
101
|
+
|
102
|
+
types = {}
|
103
|
+
begin
|
104
|
+
sql = "SELECT RF.RDB$FIELD_NAME, F.RDB$FIELD_TYPE, "\
|
105
|
+
"F.RDB$FIELD_LENGTH, F.RDB$FIELD_PRECISION, "\
|
106
|
+
"F.RDB$FIELD_SCALE * -1, F.RDB$FIELD_SUB_TYPE "\
|
107
|
+
"FROM RDB$RELATION_FIELDS RF, RDB$FIELDS F "\
|
108
|
+
"WHERE RF.RDB$RELATION_NAME = UPPER('#{table}') "\
|
109
|
+
"AND RF.RDB$FIELD_SOURCE = F.RDB$FIELD_NAME"
|
110
|
+
|
111
|
+
connection.start_transaction do |tx|
|
112
|
+
tx.execute(sql) do |row|
|
113
|
+
sql_type = SQLType.to_base_type(row[1], row[5])
|
114
|
+
type = nil
|
115
|
+
case sql_type
|
116
|
+
when BLOB
|
117
|
+
type = SQLType.new(sql_type, nil, nil, nil, row[5])
|
118
|
+
|
119
|
+
when CHAR, VARCHAR
|
120
|
+
type = SQLType.new(sql_type, row[2])
|
121
|
+
|
122
|
+
when DECIMAL, NUMERIC
|
123
|
+
type = SQLType.new(sql_type, nil, row[3], row[4])
|
124
|
+
|
125
|
+
else
|
126
|
+
type = SQLType.new(sql_type)
|
127
|
+
end
|
128
|
+
types[row[0].strip] = type
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
end
|
133
|
+
types
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
# This method overloads the equivalence test operator for the SQLType
|
138
|
+
# class.
|
139
|
+
#
|
140
|
+
# ==== Parameters
|
141
|
+
# object:: A reference to the object to be compared with.
|
142
|
+
def ==(object)
|
143
|
+
result = false
|
144
|
+
if object.instance_of?(SQLType)
|
145
|
+
result = (@type == object.type &&
|
146
|
+
@length == object.length &&
|
147
|
+
@precision == object.precision &&
|
148
|
+
@scale == object.scale &&
|
149
|
+
@subtype == object.subtype)
|
150
|
+
end
|
151
|
+
result
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
# This method generates a textual description for a SQLType object.
|
156
|
+
def to_s
|
157
|
+
if @type == SQLType::DECIMAL or @type == SQLType::NUMERIC
|
158
|
+
"#{@type.id2name}(#{@precision},#{@scale})"
|
159
|
+
elsif @type == SQLType::BLOB
|
160
|
+
"#{@type.id2name} SUB TYPE #{@subtype}"
|
161
|
+
elsif @type == SQLType::CHAR or @type == SQLType::VARCHAR
|
162
|
+
"#{@type.id2name}(#{@length})"
|
163
|
+
else
|
164
|
+
@type.id2name
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
# This class method converts a Firebird internal type to a SQLType base
|
170
|
+
# type.
|
171
|
+
#
|
172
|
+
# ==== Parameters
|
173
|
+
# type:: A reference to the Firebird field type value.
|
174
|
+
# subtype:: A reference to the Firebird field subtype value.
|
175
|
+
def SQLType.to_base_type(type, subtype)
|
176
|
+
case type
|
177
|
+
when 16 # BIGINT, DECIMAL, NUMERIC
|
178
|
+
if subtype
|
179
|
+
subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
|
180
|
+
else
|
181
|
+
SQLType::BIGINT
|
182
|
+
end
|
183
|
+
|
184
|
+
when 261 # BLOB
|
185
|
+
SQLType::BLOB
|
186
|
+
|
187
|
+
when 14 # CHAR
|
188
|
+
SQLType::CHAR
|
189
|
+
|
190
|
+
when 12 # DATE
|
191
|
+
SQLType::DATE
|
192
|
+
|
193
|
+
when 27 # DOUBLE, DECIMAL, NUMERIC
|
194
|
+
if subtype
|
195
|
+
subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
|
196
|
+
else
|
197
|
+
SQLType::DOUBLE
|
198
|
+
end
|
199
|
+
|
200
|
+
when 10 # FLOAT
|
201
|
+
SQLType::FLOAT
|
202
|
+
|
203
|
+
when 8 # INTEGER, DECIMAL, NUMERIC
|
204
|
+
if subtype
|
205
|
+
subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
|
206
|
+
else
|
207
|
+
SQLType::INTEGER
|
208
|
+
end
|
209
|
+
|
210
|
+
when 7 # SMALLINT, DECIMAL, NUMERIC
|
211
|
+
if subtype
|
212
|
+
subtype == 1 ? SQLType::NUMERIC : SQLType::DECIMAL
|
213
|
+
else
|
214
|
+
SQLType::SMALLINT
|
215
|
+
end
|
216
|
+
|
217
|
+
when 13 # TIME
|
218
|
+
SQLType::TIME
|
219
|
+
|
220
|
+
when 35 # TIMESTAMP
|
221
|
+
SQLType::TIMESTAMP
|
222
|
+
|
223
|
+
when 37 # VARCHAR
|
224
|
+
SQLType::VARCHAR
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end # End of the SQLType class.
|
228
|
+
end # End of the FireRuby module.
|
data/lib/fireruby.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#-------------------------------------------------------------------------------
|
2
|
+
# fireruby.rb
|
3
|
+
#-------------------------------------------------------------------------------
|
4
|
+
# Copyright � Peter Wood, 2005
|
5
|
+
#
|
6
|
+
# The contents of this file are subject to the Mozilla Public License Version
|
7
|
+
# 1.1 (the "License"); you may not use this file except in compliance with the
|
8
|
+
# License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.mozilla.org/MPL/
|
11
|
+
#
|
12
|
+
# Software distributed under the License is distributed on an "AS IS" basis,
|
13
|
+
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
|
14
|
+
# the specificlanguage governing rights and limitations under the License.
|
15
|
+
#
|
16
|
+
# The Original Code is the FireRuby extension for the Ruby language.
|
17
|
+
#
|
18
|
+
# The Initial Developer of the Original Code is Peter Wood. All Rights
|
19
|
+
# Reserved.
|
20
|
+
|
21
|
+
require 'fr_lib'
|
22
|
+
require 'SQLType'
|
data/lib/fr_lib.so
ADDED
Binary file
|