fireruby 0.1.0-powerpc-darwin
Sign up to get free protection for your applications and to get access to all the features.
- data/doc/CVS/Entries +10 -0
- data/doc/CVS/Repository +1 -0
- data/doc/CVS/Root +1 -0
- data/doc/README +39 -0
- data/doc/classes/CVS/Entries +2 -0
- data/doc/classes/CVS/Entries.Log +1 -0
- data/doc/classes/CVS/Repository +1 -0
- data/doc/classes/CVS/Root +1 -0
- data/doc/classes/FireRuby/CVS/Entries +8 -0
- data/doc/classes/FireRuby/CVS/Entries.Log +7 -0
- data/doc/classes/FireRuby/CVS/Repository +1 -0
- data/doc/classes/FireRuby/CVS/Root +1 -0
- data/doc/classes/FireRuby/Connection.html +364 -0
- data/doc/classes/FireRuby/Connection.src/CVS/Entries +10 -0
- data/doc/classes/FireRuby/Connection.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/Connection.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/Connection.src/M000046.html +17 -0
- data/doc/classes/FireRuby/Connection.src/M000047.html +17 -0
- data/doc/classes/FireRuby/Connection.src/M000048.html +17 -0
- data/doc/classes/FireRuby/Connection.src/M000049.html +17 -0
- data/doc/classes/FireRuby/Connection.src/M000050.html +17 -0
- data/doc/classes/FireRuby/Connection.src/M000051.html +17 -0
- data/doc/classes/FireRuby/Connection.src/M000052.html +18 -0
- data/doc/classes/FireRuby/Connection.src/M000053.html +18 -0
- data/doc/classes/FireRuby/Connection.src/M000054.html +18 -0
- data/doc/classes/FireRuby/Database.html +292 -0
- data/doc/classes/FireRuby/Database.src/CVS/Entries +7 -0
- data/doc/classes/FireRuby/Database.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/Database.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/Database.src/M000035.html +17 -0
- data/doc/classes/FireRuby/Database.src/M000036.html +17 -0
- data/doc/classes/FireRuby/Database.src/M000037.html +17 -0
- data/doc/classes/FireRuby/Database.src/M000038.html +18 -0
- data/doc/classes/FireRuby/Database.src/M000039.html +17 -0
- data/doc/classes/FireRuby/Database.src/M000040.html +17 -0
- data/doc/classes/FireRuby/FireRubyError.html +221 -0
- data/doc/classes/FireRuby/FireRubyError.src/CVS/Entries +6 -0
- data/doc/classes/FireRuby/FireRubyError.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/FireRubyError.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/FireRubyError.src/M000041.html +17 -0
- data/doc/classes/FireRuby/FireRubyError.src/M000042.html +17 -0
- data/doc/classes/FireRuby/FireRubyError.src/M000043.html +17 -0
- data/doc/classes/FireRuby/FireRubyError.src/M000044.html +17 -0
- data/doc/classes/FireRuby/FireRubyError.src/M000045.html +17 -0
- data/doc/classes/FireRuby/Generator.html +343 -0
- data/doc/classes/FireRuby/Generator.src/CVS/Entries +9 -0
- data/doc/classes/FireRuby/Generator.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/Generator.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/Generator.src/M000001.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000002.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000003.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000004.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000005.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000006.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000007.html +17 -0
- data/doc/classes/FireRuby/Generator.src/M000008.html +17 -0
- data/doc/classes/FireRuby/ResultSet.html +343 -0
- data/doc/classes/FireRuby/ResultSet.src/CVS/Entries +10 -0
- data/doc/classes/FireRuby/ResultSet.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/ResultSet.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/ResultSet.src/M000026.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000027.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000028.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000029.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000030.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000031.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000032.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000033.html +17 -0
- data/doc/classes/FireRuby/ResultSet.src/M000034.html +17 -0
- data/doc/classes/FireRuby/Statement.html +349 -0
- data/doc/classes/FireRuby/Statement.src/CVS/Entries +10 -0
- data/doc/classes/FireRuby/Statement.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/Statement.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/Statement.src/M000017.html +17 -0
- data/doc/classes/FireRuby/Statement.src/M000018.html +17 -0
- data/doc/classes/FireRuby/Statement.src/M000019.html +17 -0
- data/doc/classes/FireRuby/Statement.src/M000020.html +17 -0
- data/doc/classes/FireRuby/Statement.src/M000021.html +17 -0
- data/doc/classes/FireRuby/Statement.src/M000022.html +17 -0
- data/doc/classes/FireRuby/Statement.src/M000023.html +18 -0
- data/doc/classes/FireRuby/Statement.src/M000024.html +18 -0
- data/doc/classes/FireRuby/Statement.src/M000025.html +17 -0
- data/doc/classes/FireRuby/Transaction.html +484 -0
- data/doc/classes/FireRuby/Transaction.src/CVS/Entries +9 -0
- data/doc/classes/FireRuby/Transaction.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/Transaction.src/CVS/Root +1 -0
- data/doc/classes/FireRuby/Transaction.src/M000009.html +17 -0
- data/doc/classes/FireRuby/Transaction.src/M000010.html +17 -0
- data/doc/classes/FireRuby/Transaction.src/M000011.html +17 -0
- data/doc/classes/FireRuby/Transaction.src/M000012.html +17 -0
- data/doc/classes/FireRuby/Transaction.src/M000013.html +17 -0
- data/doc/classes/FireRuby/Transaction.src/M000014.html +17 -0
- data/doc/classes/FireRuby/Transaction.src/M000015.html +18 -0
- data/doc/classes/FireRuby/Transaction.src/M000016.html +17 -0
- data/doc/classes/FireRuby.html +116 -0
- data/doc/created.rid +1 -0
- data/doc/files/CVS/Entries +2 -0
- data/doc/files/CVS/Repository +1 -0
- data/doc/files/CVS/Root +1 -0
- data/doc/files/src_rb.html +119 -0
- data/doc/fr_class_index.html +34 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +80 -0
- data/doc/index.html +24 -0
- data/doc/license.txt +411 -0
- data/doc/rdoc-style.css +175 -0
- data/lib/CVS/Entries +4 -0
- data/lib/CVS/Repository +1 -0
- data/lib/CVS/Root +1 -0
- data/lib/fireruby.bundle +0 -0
- data/lib/mkdoc +1 -0
- data/lib/src.rb +736 -0
- data/test/CVS/Entries +17 -0
- data/test/CVS/Repository +1 -0
- data/test/CVS/Root +1 -0
- data/test/ConnectionTest.rb +91 -0
- data/test/DDLTest.rb +49 -0
- data/test/DatabaseTest.rb +84 -0
- data/test/GeneratorTest.rb +47 -0
- data/test/ResultSetTest.rb +96 -0
- data/test/SQLTest.rb +154 -0
- data/test/StatementTest.rb +101 -0
- data/test/TestSetup.rb +10 -0
- data/test/TransactionTest.rb +107 -0
- data/test/UnitTest.rb +10 -0
- data/test/example.c +91 -0
- data/test/fb.c +297 -0
- data/test/mfb +1 -0
- data/test/sql_unit_test.fdb +0 -0
- data/test/test.fdb +0 -0
- metadata +190 -0
data/lib/src.rb
ADDED
@@ -0,0 +1,736 @@
|
|
1
|
+
#
|
2
|
+
# This file is a stand-in that allows for the generation of rdoc documentation
|
3
|
+
# for the FireRuby extension for the Ruby programming language. The extension
|
4
|
+
# is coded in C and documented with Doxygen comments, so this file is used to
|
5
|
+
# generate the native Ruby documentation instead.
|
6
|
+
#
|
7
|
+
|
8
|
+
#
|
9
|
+
# This module contains all of the classes and definitions relating to the
|
10
|
+
# FireRuby extension for the Ruby language.
|
11
|
+
#
|
12
|
+
module FireRuby
|
13
|
+
#
|
14
|
+
# This class provides the exception type used by the FireRuby library.
|
15
|
+
#
|
16
|
+
class FireRubyError
|
17
|
+
#
|
18
|
+
# This is the constructor for the FireRubyError class.
|
19
|
+
#
|
20
|
+
# ==== Parameters
|
21
|
+
# message:: A string containing the error message for the object.
|
22
|
+
#
|
23
|
+
def initialize(message)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
#
|
28
|
+
# This is the accessor for the error message attribute
|
29
|
+
#
|
30
|
+
def message
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
#
|
35
|
+
# This is the accessor for the SQL code attribute.
|
36
|
+
#
|
37
|
+
def sql_code
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
#
|
42
|
+
# This is the accessor for the database code attribute.
|
43
|
+
#
|
44
|
+
def db_code
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
#
|
49
|
+
# This function generates a simple description string for a FireRubyError
|
50
|
+
# object.
|
51
|
+
#
|
52
|
+
def to_s
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
#
|
58
|
+
# This class represents an existing database that can be connected to.
|
59
|
+
#
|
60
|
+
class Database
|
61
|
+
#
|
62
|
+
# This is the constructor for the Database class.
|
63
|
+
#
|
64
|
+
# ==== Parameters
|
65
|
+
# user:: A string containing the user name that will be used to
|
66
|
+
# connect to the database.
|
67
|
+
# password:: A string containing the user password that will be used to
|
68
|
+
# connect to the database.
|
69
|
+
# file:: A string containing the database file specifier. This can
|
70
|
+
# include details for a remote server if needed.
|
71
|
+
#
|
72
|
+
def initialize(user, password, file)
|
73
|
+
end
|
74
|
+
|
75
|
+
#
|
76
|
+
# This is the accessor for the user database attribute.
|
77
|
+
#
|
78
|
+
def user
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
#
|
83
|
+
# This is the accessor for the database file specification attribute.
|
84
|
+
#
|
85
|
+
def file
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
#
|
90
|
+
# This method attempts to establish a connection to a database. If
|
91
|
+
# successful then a Connection instance is returned. If a block is
|
92
|
+
# provided to the method then the connection is closed after the
|
93
|
+
# block completes. If a block is specified the connection is provided
|
94
|
+
# as a parameter to the block.
|
95
|
+
#
|
96
|
+
# ==== Exceptions
|
97
|
+
# Exception:: Thrown whenever a problem occurs connecting with the
|
98
|
+
# database.
|
99
|
+
#
|
100
|
+
def connect
|
101
|
+
yield(connection)
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
#
|
106
|
+
# This method attempts to drop the database referred to by the details
|
107
|
+
# in a Database object.
|
108
|
+
#
|
109
|
+
# ==== Exceptions
|
110
|
+
# FireRubyError:: Thrown whenever a problem occurs dropping the database
|
111
|
+
# instance.
|
112
|
+
#
|
113
|
+
def drop
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
#
|
118
|
+
# This method can be used to programmatically created a database file.
|
119
|
+
# If successful this method returns a Database object.
|
120
|
+
#
|
121
|
+
# ==== Parameters
|
122
|
+
# file:: A string containing the path and name of the database file
|
123
|
+
# to be created.
|
124
|
+
# user:: A string containing the user name that will be used in
|
125
|
+
# creating the file.
|
126
|
+
# password:: A string containing the user password that will be used in
|
127
|
+
# creating the file.
|
128
|
+
# size:: The page size setting to be used with the new database file.
|
129
|
+
# This should be 1024, 2048, 4096 or 8192.
|
130
|
+
# set:: The name of the default character set to be assigned to the
|
131
|
+
# new database file.
|
132
|
+
#
|
133
|
+
# ==== Exceptions
|
134
|
+
# Exception:: Generated whenever an invalid parameter is specified or a
|
135
|
+
# problem occurs creating the database file.
|
136
|
+
#
|
137
|
+
def Database.create(file, user, password, size, set)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
#
|
143
|
+
# This class represents a connection with a Firebird database.
|
144
|
+
#
|
145
|
+
class Connection
|
146
|
+
#
|
147
|
+
# This is the constructor for the Connection class.
|
148
|
+
#
|
149
|
+
# ==== Parameters
|
150
|
+
# database:: A reference to the Database object to be connected to.
|
151
|
+
#
|
152
|
+
# ==== Exceptions
|
153
|
+
# Exception:: Generated whenever an invalid database is specified to
|
154
|
+
# the method or an issue occurs establishing the database
|
155
|
+
# connection.
|
156
|
+
#
|
157
|
+
def initialize(database)
|
158
|
+
end
|
159
|
+
|
160
|
+
|
161
|
+
#
|
162
|
+
# This method is used to determine whether a Connection object represents
|
163
|
+
# an active database connection.
|
164
|
+
#
|
165
|
+
def open?
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
#
|
170
|
+
# This method is used to determine whether a Connection object represents
|
171
|
+
# an inactive database connection.
|
172
|
+
#
|
173
|
+
def closed?
|
174
|
+
end
|
175
|
+
|
176
|
+
|
177
|
+
#
|
178
|
+
# This method detaches a Connection object from a database. The object
|
179
|
+
# may not be used for database functionality following a successful call
|
180
|
+
# to this method. The close method will fail if there are outstanding
|
181
|
+
# transactions for a connection.
|
182
|
+
#
|
183
|
+
# ==== Exceptions
|
184
|
+
# Exception:: Generated whenever the connection has at least one open
|
185
|
+
# transaction or an error occurs closing the connection.
|
186
|
+
#
|
187
|
+
def close
|
188
|
+
end
|
189
|
+
|
190
|
+
|
191
|
+
#
|
192
|
+
# This is the accessor method for the database attribute.
|
193
|
+
#
|
194
|
+
def database
|
195
|
+
end
|
196
|
+
|
197
|
+
|
198
|
+
#
|
199
|
+
# This method generates a simple descriptive string for a Connection
|
200
|
+
# object.
|
201
|
+
#
|
202
|
+
def to_s
|
203
|
+
end
|
204
|
+
|
205
|
+
|
206
|
+
#
|
207
|
+
# This method starts a new transaction against a connection. A successful
|
208
|
+
# call to this method returns a Transaction object. The transaction that
|
209
|
+
# is started relates to the Connection it was called upon only. To start
|
210
|
+
# a transaction that covers multiple connections use the Transaction
|
211
|
+
# class. This method accepts a block, taking a single parameter which
|
212
|
+
# will be the transaction created. This transaction is committed if the
|
213
|
+
# block completes normally or rolls back if an exception is thrown from
|
214
|
+
# the block.
|
215
|
+
#
|
216
|
+
# ==== Exceptions
|
217
|
+
# Exception:: Thrown whenever a problem occurs starting the transaction.
|
218
|
+
#
|
219
|
+
def start_transaction
|
220
|
+
yield transaction
|
221
|
+
end
|
222
|
+
|
223
|
+
|
224
|
+
#
|
225
|
+
# This function executes a SQL statement against a connection. If the
|
226
|
+
# statement represented a SQL query then a result set is returned. If
|
227
|
+
# the statement wasn't a query then nil is returned. The method also
|
228
|
+
# accepts a block that takes a single parameter. This block will be
|
229
|
+
# executed once for each row in any result set generated.
|
230
|
+
#
|
231
|
+
# ==== Parameters
|
232
|
+
# sql:: The SQL statement to be executed.
|
233
|
+
# transaction:: The transaction to execute the SQL statement within.
|
234
|
+
#
|
235
|
+
# ==== Exceptions
|
236
|
+
# Exception:: Generated if an error occurs executing the SQL statement.
|
237
|
+
#
|
238
|
+
def execute(sql, transaction)
|
239
|
+
yield(row)
|
240
|
+
end
|
241
|
+
|
242
|
+
|
243
|
+
#
|
244
|
+
# This function executes a SQL statement against a connection. This
|
245
|
+
# differs from the execute method in that an anonymous transaction is
|
246
|
+
# used in executing the statement. The output from this method is the
|
247
|
+
# same as for the execute method. The method also accepts a block that
|
248
|
+
# takes a single parameter. This block will be executed once for each
|
249
|
+
# row in any result set generated.
|
250
|
+
#
|
251
|
+
# ==== Parameters
|
252
|
+
# sql:: The SQL statement to be executed.
|
253
|
+
#
|
254
|
+
# ==== Exceptions
|
255
|
+
# Exception:: Generated whenever a problem occurs executing the SQL
|
256
|
+
# statement.
|
257
|
+
#
|
258
|
+
def execute_immediate(sql)
|
259
|
+
yield(row)
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
|
264
|
+
#
|
265
|
+
# This class represents a Firebird database transaction. There may be
|
266
|
+
# multiple transaction outstanding against a connection at any one time.
|
267
|
+
#
|
268
|
+
class Transaction
|
269
|
+
TPB_VERSION_1 = 1
|
270
|
+
TPB_VERSION_3 = 3
|
271
|
+
TPB_CONSISTENCY = 1
|
272
|
+
TPB_CONCURRENCY = 2
|
273
|
+
TPB_SHARED = 3
|
274
|
+
TPB_PROTECTED = 4
|
275
|
+
TPB_EXCLUSIVE = 5
|
276
|
+
TPB_WAIT = 6
|
277
|
+
TPB_NO_WAIT = 7
|
278
|
+
TPB_READ = 8
|
279
|
+
TPB_WRITE = 9
|
280
|
+
TPB_LOCK_READ = 10
|
281
|
+
TPB_LOCK_WRITE = 11
|
282
|
+
TPB_VERB_TIME = 12
|
283
|
+
TPB_COMMIT_TIME = 13
|
284
|
+
TPB_IGNORE_LIMBO = 14
|
285
|
+
TPB_READ_COMMITTED = 15
|
286
|
+
TPB_AUTO_COMMIT = 16
|
287
|
+
TPB_REC_VERSION = 17
|
288
|
+
TPB_NO_REC_VERSION = 18
|
289
|
+
TPB_RESTART_REQUESTS = 19
|
290
|
+
# Transaction parameter buffer value constants.
|
291
|
+
TPB_NO_AUTO_UNDO = 20
|
292
|
+
|
293
|
+
|
294
|
+
#
|
295
|
+
# This is the constructor for the Transaction class.
|
296
|
+
#
|
297
|
+
# ==== Parameters
|
298
|
+
# connections:: Either a single instance of the Connection class or
|
299
|
+
# an array of Connection instances to specify a
|
300
|
+
# multi-database transaction.
|
301
|
+
#
|
302
|
+
# ==== Exceptions
|
303
|
+
# Exception:: Generated whenever the method is passed an invalid
|
304
|
+
# parameter or a problem occurs creating the transaction.
|
305
|
+
#
|
306
|
+
def initialize(connections)
|
307
|
+
end
|
308
|
+
|
309
|
+
|
310
|
+
#
|
311
|
+
# This method is used to determine whether a Transaction object is still
|
312
|
+
# valid for use (i.e. commit or rollback has not been called for the
|
313
|
+
# Transaction).
|
314
|
+
#
|
315
|
+
def active?
|
316
|
+
end
|
317
|
+
|
318
|
+
|
319
|
+
#
|
320
|
+
# This is the accessor for the connections attribute. This method returns
|
321
|
+
# an array of the connections that the transaction applies to.
|
322
|
+
#
|
323
|
+
def connections
|
324
|
+
end
|
325
|
+
|
326
|
+
|
327
|
+
#
|
328
|
+
# This method is used to determine whether a given Transaction applies to
|
329
|
+
# a specified Connection.
|
330
|
+
#
|
331
|
+
# ==== Parameters
|
332
|
+
# connection:: A reference to the Connection object to perform the test
|
333
|
+
# for.
|
334
|
+
#
|
335
|
+
def for_connection?(connection)
|
336
|
+
end
|
337
|
+
|
338
|
+
|
339
|
+
#
|
340
|
+
# This method commits the details outstanding against a Transaction
|
341
|
+
# object. The Transaction object may not be reused after a successful
|
342
|
+
# call to this method.
|
343
|
+
#
|
344
|
+
# ==== Exceptions
|
345
|
+
# Exception:: Generated whenever a problem occurs committing the details
|
346
|
+
# of the transaction.
|
347
|
+
#
|
348
|
+
def commit
|
349
|
+
end
|
350
|
+
|
351
|
+
|
352
|
+
#
|
353
|
+
# This method rolls back the details outstanding against a Transaction
|
354
|
+
# object. The Transaction object may not be reused after a successful
|
355
|
+
# call to this method.
|
356
|
+
#
|
357
|
+
# ==== Exceptions
|
358
|
+
# Exception:: Generated whenever a problem occurs rolling back the
|
359
|
+
# details of the transaction.
|
360
|
+
#
|
361
|
+
def rollback
|
362
|
+
end
|
363
|
+
|
364
|
+
|
365
|
+
#
|
366
|
+
# This method executes a SQL statement using a Transaction object. This
|
367
|
+
# method will only work whenever a Transaction object applies to a
|
368
|
+
# single Connection as it would otherwise be impossible to determine
|
369
|
+
# which connection to execute against. If the statement executed was a
|
370
|
+
# SQL query then the method returns a ResultSet object, otherwise it
|
371
|
+
# returns nil. The method also accepts a block that takes a single
|
372
|
+
# parameter. If the SQL statement was a query the block will be invoked
|
373
|
+
# and passed each row retrieved.
|
374
|
+
#
|
375
|
+
# ==== Parameters
|
376
|
+
# sql:: A string containing the SQL statement to be executed.
|
377
|
+
#
|
378
|
+
# ==== Exceptions
|
379
|
+
# Exception:: Generated whenever the Transaction object represents more
|
380
|
+
# than one connection or a problem occurs executing the SQL
|
381
|
+
# statement.
|
382
|
+
#
|
383
|
+
def execute(sql)
|
384
|
+
yield(row)
|
385
|
+
end
|
386
|
+
|
387
|
+
|
388
|
+
#
|
389
|
+
# This method allows for the creation of a Transaction object with
|
390
|
+
# non-standard settings.
|
391
|
+
#
|
392
|
+
# ==== Parameters
|
393
|
+
# connections:: Either a single Connection object or an array of
|
394
|
+
# Connection objects that the new Transaction will
|
395
|
+
# be associated with.
|
396
|
+
# parameters:: An array of the parameters to be used in creating
|
397
|
+
# the new constants. Populate this from the TPB
|
398
|
+
# constants defined within the class.
|
399
|
+
#
|
400
|
+
# ==== Exceptions
|
401
|
+
# FireRubyError:: Generated whenever a problem occurs creating the
|
402
|
+
# transaction.
|
403
|
+
#
|
404
|
+
def Transaction.create(connections, parameters)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
|
409
|
+
#
|
410
|
+
# This class represents a prepared SQL statement that may be executed more
|
411
|
+
# than once.
|
412
|
+
#
|
413
|
+
class Statement
|
414
|
+
#
|
415
|
+
# This is the constructor for the Statement class.
|
416
|
+
#
|
417
|
+
# ==== Parameters
|
418
|
+
# connection:: The Connection object that the SQL statement will be
|
419
|
+
# executed through.
|
420
|
+
# transaction:: The Transaction object that the SQL statement will be
|
421
|
+
# executed under.
|
422
|
+
# sql:: The SQL statement to be prepared for execution.
|
423
|
+
# dialect:: The Firebird dialect to be used in preparing the SQL
|
424
|
+
# statement.
|
425
|
+
#
|
426
|
+
def initialize(connection, transaction, sql, dialect)
|
427
|
+
end
|
428
|
+
|
429
|
+
|
430
|
+
#
|
431
|
+
# This is the accessor for the connection attribute.
|
432
|
+
#
|
433
|
+
def connection
|
434
|
+
end
|
435
|
+
|
436
|
+
|
437
|
+
#
|
438
|
+
# This is the accessor for the transaction attribute.
|
439
|
+
#
|
440
|
+
def transaction
|
441
|
+
end
|
442
|
+
|
443
|
+
|
444
|
+
#
|
445
|
+
# This is the accessor for the SQL statement attribute.
|
446
|
+
#
|
447
|
+
def sql
|
448
|
+
end
|
449
|
+
|
450
|
+
|
451
|
+
#
|
452
|
+
# This is the accessor for the dialect attribute.
|
453
|
+
#
|
454
|
+
def dialect
|
455
|
+
end
|
456
|
+
|
457
|
+
|
458
|
+
#
|
459
|
+
# This method is used to determine whether a Statement object represents
|
460
|
+
# a SQL query.
|
461
|
+
#
|
462
|
+
def is_query?
|
463
|
+
end
|
464
|
+
|
465
|
+
|
466
|
+
#
|
467
|
+
# This method executes the SQL statement within a Statement object. This
|
468
|
+
# method returns a ResultSet object if the statement executed was a SQL
|
469
|
+
# query, otherwise it returns nil. This method accepts a block taking a
|
470
|
+
# single parameter. If this block is provided and the statement is a
|
471
|
+
# query then the rows returned by the query will be passed, one at a
|
472
|
+
# time, to the block.
|
473
|
+
#
|
474
|
+
# ==== Exception
|
475
|
+
# Exception:: Generated if the Statement object actual requires some
|
476
|
+
# parameters or a problem occurs executing the SQL statement.
|
477
|
+
#
|
478
|
+
def execute
|
479
|
+
yield row
|
480
|
+
end
|
481
|
+
|
482
|
+
|
483
|
+
#
|
484
|
+
# This method executes the SQL statement within a Statement object and
|
485
|
+
# passes it a set of parameters. Parameterized statements use question
|
486
|
+
# marks as place holders for values that may change between calls to
|
487
|
+
# execute the statement. This method returns a ResultSet object if the
|
488
|
+
# statement executed was a SQL query, otherwise it returns nil. This
|
489
|
+
# method accepts a block taking a single parameter. If this block is
|
490
|
+
# provided and the statement is a query then the rows returned by the
|
491
|
+
# query will be passed, one at a time, to the block.
|
492
|
+
#
|
493
|
+
# ==== Parameters
|
494
|
+
# parameters:: An array of the parameters for the statement. An effort
|
495
|
+
# will be made to convert the values passed in to the
|
496
|
+
# appropriate types but no guarantees are made (especially
|
497
|
+
# in the case of text fields, which will simply use to_s
|
498
|
+
# if the object passed is not a String).
|
499
|
+
#
|
500
|
+
# ==== Exception
|
501
|
+
# Exception:: Generated whenever a problem occurs translating one of the
|
502
|
+
# input parameters or executing the SQL statement.
|
503
|
+
#
|
504
|
+
def execute_for(parameters)
|
505
|
+
yield row
|
506
|
+
end
|
507
|
+
|
508
|
+
|
509
|
+
#
|
510
|
+
# This method releases the database resources associated with a Statement
|
511
|
+
# object and should be explicitly called when a Statement object is of
|
512
|
+
# no further use.
|
513
|
+
#
|
514
|
+
# ==== Exceptions
|
515
|
+
# FireRubyError:: Generated whenever a problem occurs closing the
|
516
|
+
# statement object.
|
517
|
+
#
|
518
|
+
def close
|
519
|
+
end
|
520
|
+
end
|
521
|
+
|
522
|
+
|
523
|
+
#
|
524
|
+
# This class represents the results of a SQL query executed against a
|
525
|
+
# database.
|
526
|
+
#
|
527
|
+
class ResultSet
|
528
|
+
#
|
529
|
+
# This is the constructor for the ResultSet object.
|
530
|
+
#
|
531
|
+
# ==== Parameters
|
532
|
+
# statement:: A reference to the Statement object that the ResultSet
|
533
|
+
# will be based on.
|
534
|
+
#
|
535
|
+
def initialize(statement)
|
536
|
+
end
|
537
|
+
|
538
|
+
|
539
|
+
#
|
540
|
+
# This is the accessor for the statement attribute.
|
541
|
+
#
|
542
|
+
def statement
|
543
|
+
end
|
544
|
+
|
545
|
+
|
546
|
+
#
|
547
|
+
# This method fetches a count of the number of columns in a row of data
|
548
|
+
# that the ResultSet can fetch.
|
549
|
+
#
|
550
|
+
def column_count
|
551
|
+
end
|
552
|
+
|
553
|
+
|
554
|
+
#
|
555
|
+
# This method fetches the name associated with a specified column for a
|
556
|
+
# ResultSet object.
|
557
|
+
#
|
558
|
+
# ==== Parameters
|
559
|
+
# column:: A reference to the column number to fetch the details for.
|
560
|
+
# Column numbers start at zero.
|
561
|
+
#
|
562
|
+
def column_name(column)
|
563
|
+
end
|
564
|
+
|
565
|
+
|
566
|
+
#
|
567
|
+
# This method fetches the alias associated with a specified column for a
|
568
|
+
# ResultSet object.
|
569
|
+
#
|
570
|
+
# ==== Parameters
|
571
|
+
# column:: A reference to the column number to fetch the details for.
|
572
|
+
# Column numbers start at zero.
|
573
|
+
#
|
574
|
+
def column_alias(column)
|
575
|
+
end
|
576
|
+
|
577
|
+
|
578
|
+
#
|
579
|
+
# This method fetches the table name associated with a specified column
|
580
|
+
# for a ResultSet object.
|
581
|
+
#
|
582
|
+
# ==== Parameters
|
583
|
+
# column:: A reference to the column number to fetch the details for.
|
584
|
+
# Column numbers start at zero.
|
585
|
+
#
|
586
|
+
def column_table(column)
|
587
|
+
end
|
588
|
+
|
589
|
+
|
590
|
+
#
|
591
|
+
# This method fetches a single rows worth of data from the ResultSet
|
592
|
+
# object. If the set contains more rows then an array containing the
|
593
|
+
# row data will be retrieved. If the ResultSet is exhausted (i.e. all
|
594
|
+
# rows have been fetched) then nil is returned. Translation of the row
|
595
|
+
# data into an appropriate Ruby type is performed on the row data that
|
596
|
+
# is extracted.
|
597
|
+
#
|
598
|
+
def fetch
|
599
|
+
end
|
600
|
+
|
601
|
+
|
602
|
+
#
|
603
|
+
# This method provides an iterator for the (remaining) rows contained in
|
604
|
+
# a ResultSet object.
|
605
|
+
#
|
606
|
+
# ==== Parameters
|
607
|
+
# block:: A block that takes a single parameter. This will be called for
|
608
|
+
# and passed each remaining row (as per the fetch method) from
|
609
|
+
# the ResultSet.
|
610
|
+
#
|
611
|
+
def each(&block)
|
612
|
+
end
|
613
|
+
|
614
|
+
|
615
|
+
#
|
616
|
+
# This method releases the database resources associated with a ResultSet
|
617
|
+
# object and should be explicitly called when a ResultSet object is of
|
618
|
+
# no further use. The method is implicitly called if the rows available
|
619
|
+
# from a ResultSet are exhausted but calling this method at that time
|
620
|
+
# will not cause an error.
|
621
|
+
#
|
622
|
+
# ==== Exceptions
|
623
|
+
# FireRubyError:: Generated whenever a problem occurs closing the result
|
624
|
+
# set object.
|
625
|
+
#
|
626
|
+
def close
|
627
|
+
end
|
628
|
+
end
|
629
|
+
|
630
|
+
|
631
|
+
#
|
632
|
+
# This class represents a Firebird generator entity.
|
633
|
+
#
|
634
|
+
class Generator
|
635
|
+
#
|
636
|
+
# This is the constructor for the Generator class. Note, this method
|
637
|
+
# assumes that the named generator already exists. If it doesn't then
|
638
|
+
# the object will be constructed but will fail during use.
|
639
|
+
#
|
640
|
+
# ==== Parameters
|
641
|
+
# name:: A string containing the generator name.
|
642
|
+
# connection:: A reference to the Connection object that will be used
|
643
|
+
# to access the generator.
|
644
|
+
#
|
645
|
+
def initialize(name, connection)
|
646
|
+
end
|
647
|
+
|
648
|
+
|
649
|
+
#
|
650
|
+
# This is the accessor for the name attribute.
|
651
|
+
#
|
652
|
+
def name
|
653
|
+
end
|
654
|
+
|
655
|
+
|
656
|
+
#
|
657
|
+
# This is the accessor for the connection attribute.
|
658
|
+
#
|
659
|
+
def connection
|
660
|
+
end
|
661
|
+
|
662
|
+
|
663
|
+
#
|
664
|
+
# This method fetches the last value generator from a generator.
|
665
|
+
#
|
666
|
+
# ==== Exceptions
|
667
|
+
# Exception:: Generated whenever a problem occurs accessing the
|
668
|
+
# database generator.
|
669
|
+
#
|
670
|
+
def last
|
671
|
+
end
|
672
|
+
|
673
|
+
|
674
|
+
#
|
675
|
+
# This method drops a generator from the database. After a successful
|
676
|
+
# call to this method the Generator object may not be used to obtain
|
677
|
+
# values unless it is recreated.
|
678
|
+
#
|
679
|
+
# ==== Exceptions
|
680
|
+
# Exception:: Generated whenever a problem occurs dropping the generator
|
681
|
+
# from the database.
|
682
|
+
#
|
683
|
+
def drop
|
684
|
+
end
|
685
|
+
|
686
|
+
|
687
|
+
#
|
688
|
+
# This method fetches the next value, depending on a specified increment,
|
689
|
+
# from a generator.
|
690
|
+
#
|
691
|
+
# ==== Parameters
|
692
|
+
# step:: The step interval to be applied to the generator to obtain the
|
693
|
+
# next value.
|
694
|
+
#
|
695
|
+
# ==== Exceptions
|
696
|
+
# Exception:: Generated whenever a problem occurs accessing the
|
697
|
+
# database generator.
|
698
|
+
#
|
699
|
+
def next(step)
|
700
|
+
end
|
701
|
+
|
702
|
+
|
703
|
+
#
|
704
|
+
# This method is used to determine whether a named generator exists
|
705
|
+
# within a database.
|
706
|
+
#
|
707
|
+
# ==== Parameters
|
708
|
+
# name:: A string containing the generator name to check for.
|
709
|
+
# connection:: A reference to the Connection object to be used in
|
710
|
+
# performing the check.
|
711
|
+
#
|
712
|
+
# ==== Exceptions
|
713
|
+
# Exception:: Generated whenever a problem occurs determining the
|
714
|
+
# existence of the generator.
|
715
|
+
#
|
716
|
+
def Generator.exists?(name, connection)
|
717
|
+
end
|
718
|
+
|
719
|
+
|
720
|
+
#
|
721
|
+
# This method creates a new generator within a database. This method
|
722
|
+
# returns a Generator object is successful.
|
723
|
+
#
|
724
|
+
# ==== Parameters
|
725
|
+
# name:: A string containing the name for the new generator.
|
726
|
+
# connection:: A reference to the Connection object that will be used to
|
727
|
+
# create the generator.
|
728
|
+
#
|
729
|
+
# ==== Exceptions
|
730
|
+
# Exception:: Generated whenever a problem occurs creating the new
|
731
|
+
# generator in the database.
|
732
|
+
#
|
733
|
+
def Generator.create(name, connection)
|
734
|
+
end
|
735
|
+
end
|
736
|
+
end
|