rubyfb 0.5.2-x86-mswin32-60

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.
Files changed (77) hide show
  1. data/CHANGELOG +6 -0
  2. data/LICENSE +411 -0
  3. data/Manifest +75 -0
  4. data/README +460 -0
  5. data/Rakefile +21 -0
  6. data/examples/example01.rb +65 -0
  7. data/ext/AddUser.c +464 -0
  8. data/ext/AddUser.h +37 -0
  9. data/ext/Backup.c +783 -0
  10. data/ext/Backup.h +37 -0
  11. data/ext/Blob.c +421 -0
  12. data/ext/Blob.h +65 -0
  13. data/ext/Common.c +54 -0
  14. data/ext/Common.h +37 -0
  15. data/ext/Connection.c +863 -0
  16. data/ext/Connection.h +50 -0
  17. data/ext/DataArea.c +274 -0
  18. data/ext/DataArea.h +38 -0
  19. data/ext/Database.c +449 -0
  20. data/ext/Database.h +48 -0
  21. data/ext/FireRuby.c +240 -0
  22. data/ext/FireRuby.h +50 -0
  23. data/ext/FireRubyException.c +268 -0
  24. data/ext/FireRubyException.h +51 -0
  25. data/ext/Generator.c +689 -0
  26. data/ext/Generator.h +53 -0
  27. data/ext/RemoveUser.c +212 -0
  28. data/ext/RemoveUser.h +37 -0
  29. data/ext/Restore.c +855 -0
  30. data/ext/Restore.h +37 -0
  31. data/ext/ResultSet.c +810 -0
  32. data/ext/ResultSet.h +60 -0
  33. data/ext/Row.c +965 -0
  34. data/ext/Row.h +55 -0
  35. data/ext/ServiceManager.c +316 -0
  36. data/ext/ServiceManager.h +48 -0
  37. data/ext/Services.c +124 -0
  38. data/ext/Services.h +42 -0
  39. data/ext/Statement.c +785 -0
  40. data/ext/Statement.h +62 -0
  41. data/ext/Transaction.c +684 -0
  42. data/ext/Transaction.h +50 -0
  43. data/ext/TypeMap.c +1182 -0
  44. data/ext/TypeMap.h +51 -0
  45. data/ext/extconf.rb +30 -0
  46. data/lib/SQLType.rb +224 -0
  47. data/lib/active_record/connection_adapters/rubyfb_adapter.rb +805 -0
  48. data/lib/mkdoc +1 -0
  49. data/lib/rubyfb.rb +2 -0
  50. data/lib/rubyfb_lib.so +0 -0
  51. data/lib/src.rb +1800 -0
  52. data/mswin32fb/fbclient_ms.lib +0 -0
  53. data/mswin32fb/ibase.h +2555 -0
  54. data/mswin32fb/iberror.h +1741 -0
  55. data/rubyfb.gemspec +31 -0
  56. data/test/AddRemoveUserTest.rb +56 -0
  57. data/test/BackupRestoreTest.rb +99 -0
  58. data/test/BlobTest.rb +57 -0
  59. data/test/CharacterSetTest.rb +63 -0
  60. data/test/ConnectionTest.rb +111 -0
  61. data/test/DDLTest.rb +54 -0
  62. data/test/DatabaseTest.rb +83 -0
  63. data/test/GeneratorTest.rb +50 -0
  64. data/test/KeyTest.rb +140 -0
  65. data/test/ResultSetTest.rb +162 -0
  66. data/test/RoleTest.rb +73 -0
  67. data/test/RowCountTest.rb +65 -0
  68. data/test/RowTest.rb +203 -0
  69. data/test/SQLTest.rb +182 -0
  70. data/test/SQLTypeTest.rb +101 -0
  71. data/test/ServiceManagerTest.rb +29 -0
  72. data/test/StatementTest.rb +135 -0
  73. data/test/TestSetup.rb +11 -0
  74. data/test/TransactionTest.rb +112 -0
  75. data/test/TypeTest.rb +92 -0
  76. data/test/UnitTest.rb +65 -0
  77. metadata +143 -0
data/lib/mkdoc ADDED
@@ -0,0 +1 @@
1
+ rdoc -m README src.rb README
data/lib/rubyfb.rb ADDED
@@ -0,0 +1,2 @@
1
+ require 'rubyfb_lib'
2
+ require 'SQLType'
data/lib/rubyfb_lib.so ADDED
Binary file
data/lib/src.rb ADDED
@@ -0,0 +1,1800 @@
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 Rubyfb
13
+ #
14
+ # This class provides the exception type used by the FireRuby library.
15
+ #
16
+ class FireRubyException
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. It
59
+ # also provides functionality to allow for the creation of new databases.
60
+ #
61
+ class Database
62
+ #
63
+ # This is the constructor for the Database class.
64
+ #
65
+ # ==== Parameters
66
+ # file:: A string containing the database file specifier. This can
67
+ # include details for a remote server if needed.
68
+ # set:: A string containing the name of the character set to be
69
+ # used with the database. Defaults to nil.
70
+ #
71
+ def initialize(file, set=nil)
72
+ end
73
+
74
+
75
+ #
76
+ # This is the accessor for the database file specification attribute.
77
+ #
78
+ def file
79
+ end
80
+
81
+
82
+ #
83
+ # This method attempts to establish a connection to a database. If
84
+ # successful then a Connection instance is returned. If a block is
85
+ # provided to the method then the connection is closed after the
86
+ # block completes. If a block is specified the connection is provided
87
+ # as a parameter to the block.
88
+ #
89
+ # ==== Parameters
90
+ # user:: The user name to be used in making the connection. This
91
+ # defaults to nil.
92
+ # password:: The password to be used in making the connection. This
93
+ # defaults to nil.
94
+ # options:: A Hash of connection options. This should be made up of
95
+ # key/setting pairs where the keys are from the list that
96
+ # is defined within the Connection class. The settings are
97
+ # particular to the key, see the documentation for the
98
+ # Connection class for more details.
99
+ #
100
+ # ==== Exceptions
101
+ # Exception:: Thrown whenever a problem occurs connecting with the
102
+ # database.
103
+ #
104
+ def connect(user=nil, password=nil, options=nil)
105
+ yield(connection)
106
+ end
107
+
108
+
109
+ #
110
+ # This method attempts to drop the database referred to by the details
111
+ # in a Database object.
112
+ #
113
+ # ==== Parameters
114
+ # user:: The user name to be used in dropping the database.
115
+ # password:: The password to be used in dropping the database.
116
+ #
117
+ # ==== Exceptions
118
+ # FireRubyError:: Thrown whenever a problem occurs dropping the database
119
+ # instance.
120
+ #
121
+ def drop(user, password)
122
+ end
123
+
124
+
125
+ #
126
+ # This method can be used to programmatically created a database file.
127
+ # If successful this method returns a Database object.
128
+ #
129
+ # ==== Parameters
130
+ # file:: A string containing the path and name of the database file
131
+ # to be created.
132
+ # user:: A string containing the user name that will be used in
133
+ # creating the file.
134
+ # password:: A string containing the user password that will be used in
135
+ # creating the file.
136
+ # size:: The page size setting to be used with the new database file.
137
+ # This should be 1024, 2048, 4096 or 8192. Defaults to 1024.
138
+ # set:: The name of the default character set to be assigned to the
139
+ # new database file. If this parameter is specifed then the
140
+ # Database object created by the call will use it to whenever
141
+ # a connection request is made. Defaults to nil.
142
+ #
143
+ # ==== Exceptions
144
+ # Exception:: Generated whenever an invalid parameter is specified or a
145
+ # problem occurs creating the database file.
146
+ #
147
+ def Database.create(file, user, password, size=1024, set=nil)
148
+ end
149
+
150
+
151
+ #
152
+ # This method fetches the name of the character set currently assigned
153
+ # to a Database object. This can return nil to indicate that a explicit
154
+ # character set has not been assigned.
155
+ #
156
+ def character_set
157
+ end
158
+
159
+
160
+ #
161
+ # This method allows the specification of a database character set that
162
+ # will be used when creating connections to a database. The value set by
163
+ # this method can be overridden by providing an alternative in the connect
164
+ # call. To remove a character set specification from a Database object
165
+ # pass nil to this method.
166
+ #
167
+ # ==== Parameters
168
+ # set:: A string containing the name of the database character set.
169
+ #
170
+ def character_set=(set)
171
+ end
172
+ end
173
+
174
+
175
+ #
176
+ # This class represents a connection with a Firebird database.
177
+ #
178
+ class Connection
179
+ # A definition for a connection option. This option should be given a
180
+ # setting of either true or false.
181
+ MARK_DATABASE_DAMAGED = 17
182
+
183
+
184
+ # A definition for a connection option. This option should be given a
185
+ # setting of Connection::WRITE_ASYNCHRONOUS or
186
+ # Connection::WRITE_SYNCHRONOUS
187
+ WRITE_POLICY = 24
188
+
189
+
190
+ # A definition for a connection option. This option should be given a
191
+ # string setting which should be the name of the character set to be
192
+ # used by the connection.
193
+ CHARACTER_SET = 48
194
+
195
+
196
+ # A definition for a connection option. This option should be given a
197
+ # string setting which should be the name of the message file to be used
198
+ # by the connection.
199
+ MESSAGE_FILE = 47
200
+
201
+
202
+ # A definition for a connection option. This option should be given a
203
+ # an integer setting. Values between 1 and 255 are valid, with 75 being
204
+ # the default.
205
+ NUMBER_OF_CACHE_BUFFERS = 5
206
+
207
+
208
+ # A definition for a connection option. This option should be given a
209
+ # string value which should be the database DBA user name.
210
+ DBA_USER_NAME = 19
211
+
212
+
213
+ # A definition for a connection option. This option should be given a
214
+ # string value which should be the ROLE to use when connecting.
215
+ SQL_ROLE_NAME = 60
216
+
217
+
218
+ # A definition for a possible setting to accompany the WRITE_POLICY
219
+ # connection setting.
220
+ WRITE_ASYNCHONOUS = 0
221
+
222
+
223
+ # A definition for a possible setting to accompany the WRITE_POLICY
224
+ # connection setting.
225
+ WRITE_SYNCHONOUS = 1
226
+
227
+
228
+ #
229
+ # This is the constructor for the Connection class.
230
+ #
231
+ # ==== Parameters
232
+ # database:: A reference to the Database object to be connected to.
233
+ # user:: A reference to the user name to be used in making the
234
+ # database connection. Defaults to nil.
235
+ # password:: A reference to the user password to be used in making the
236
+ # connection. Defaults to nil.
237
+ # options:: A Hash containing the options to be applied to the new
238
+ # connection. The hash will contain key/setting values, with
239
+ # the keys being based on the option constants defined within
240
+ # the Connection class. Individual options have differing
241
+ # value requirements. See the option documentation entries
242
+ # for further details. Defaults to nil.
243
+ #
244
+ # ==== Exceptions
245
+ # Exception:: Generated whenever an invalid database is specified to
246
+ # the method or an issue occurs establishing the database
247
+ # connection.
248
+ #
249
+ def initialize(database, user, password, options)
250
+ end
251
+
252
+
253
+ #
254
+ # This method is used to determine whether a Connection object represents
255
+ # an active database connection.
256
+ #
257
+ def open?
258
+ end
259
+
260
+
261
+ #
262
+ # This method is used to determine whether a Connection object represents
263
+ # an inactive database connection.
264
+ #
265
+ def closed?
266
+ end
267
+
268
+
269
+ #
270
+ # This method detaches a Connection object from a database. The object
271
+ # may not be used for database functionality following a successful call
272
+ # to this method. The close method will fail if there are outstanding
273
+ # transactions for a connection.
274
+ #
275
+ # ==== Exceptions
276
+ # Exception:: Generated whenever the connection has at least one open
277
+ # transaction or an error occurs closing the connection.
278
+ #
279
+ def close
280
+ end
281
+
282
+
283
+ #
284
+ # This is the accessor method for the database attribute.
285
+ #
286
+ def database
287
+ end
288
+
289
+
290
+ #
291
+ # This method retrieves the user name that was used in creating a
292
+ # Connection object.
293
+ #
294
+ def user
295
+ end
296
+
297
+
298
+ #
299
+ # This method generates a simple descriptive string for a Connection
300
+ # object.
301
+ #
302
+ def to_s
303
+ end
304
+
305
+
306
+ #
307
+ # This method starts a new transaction against a connection. A successful
308
+ # call to this method returns a Transaction object. The transaction that
309
+ # is started relates to the Connection it was called upon only. To start
310
+ # a transaction that covers multiple connections use the Transaction
311
+ # class. This method accepts a block, taking a single parameter which
312
+ # will be the transaction created. This transaction is committed if the
313
+ # block completes normally or rolls back if an exception is thrown from
314
+ # the block.
315
+ #
316
+ # ==== Exceptions
317
+ # Exception:: Thrown whenever a problem occurs starting the transaction.
318
+ #
319
+ def start_transaction
320
+ yield transaction
321
+ end
322
+
323
+
324
+ #
325
+ # This function executes a SQL statement against a connection. If the
326
+ # statement represented a SQL query then a ResultSet object is returned.
327
+ # If the statement was a non-query SQL statement then an Integer is
328
+ # returned indicating the number of rows affected by the statement. For
329
+ # all other types of statement the method returns nil. The method also
330
+ # accepts a block that takes a single parameter. This block will be
331
+ # executed once for each row in any result set generated.
332
+ #
333
+ # ==== Parameters
334
+ # sql:: The SQL statement to be executed.
335
+ # transaction:: The transaction to execute the SQL statement within.
336
+ #
337
+ # ==== Exceptions
338
+ # Exception:: Generated if an error occurs executing the SQL statement.
339
+ #
340
+ def execute(sql, transaction)
341
+ yield(row)
342
+ end
343
+
344
+
345
+ #
346
+ # This function executes a SQL statement against a connection. This
347
+ # differs from the execute method in that an anonymous transaction is
348
+ # used in executing the statement. The output from this method is the
349
+ # same as for the execute method. The method also accepts a block that
350
+ # takes a single parameter. This block will be executed once for each
351
+ # row in any result set generated.
352
+ #
353
+ # ==== Parameters
354
+ # sql:: The SQL statement to be executed.
355
+ #
356
+ # ==== Exceptions
357
+ # Exception:: Generated whenever a problem occurs executing the SQL
358
+ # statement.
359
+ #
360
+ def execute_immediate(sql)
361
+ yield(row)
362
+ end
363
+ end
364
+
365
+
366
+ #
367
+ # This class represents a Firebird database transaction. There may be
368
+ # multiple transaction outstanding against a connection at any one time.
369
+ #
370
+ class Transaction
371
+ TPB_VERSION_1 = 1
372
+ TPB_VERSION_3 = 3
373
+ TPB_CONSISTENCY = 1
374
+ TPB_CONCURRENCY = 2
375
+ TPB_SHARED = 3
376
+ TPB_PROTECTED = 4
377
+ TPB_EXCLUSIVE = 5
378
+ TPB_WAIT = 6
379
+ TPB_NO_WAIT = 7
380
+ TPB_READ = 8
381
+ TPB_WRITE = 9
382
+ TPB_LOCK_READ = 10
383
+ TPB_LOCK_WRITE = 11
384
+ TPB_VERB_TIME = 12
385
+ TPB_COMMIT_TIME = 13
386
+ TPB_IGNORE_LIMBO = 14
387
+ TPB_READ_COMMITTED = 15
388
+ TPB_AUTO_COMMIT = 16
389
+ TPB_REC_VERSION = 17
390
+ TPB_NO_REC_VERSION = 18
391
+ TPB_RESTART_REQUESTS = 19
392
+ # Transaction parameter buffer value constants.
393
+ TPB_NO_AUTO_UNDO = 20
394
+
395
+
396
+ #
397
+ # This is the constructor for the Transaction class.
398
+ #
399
+ # ==== Parameters
400
+ # connections:: Either a single instance of the Connection class or
401
+ # an array of Connection instances to specify a
402
+ # multi-database transaction.
403
+ #
404
+ # ==== Exceptions
405
+ # Exception:: Generated whenever the method is passed an invalid
406
+ # parameter or a problem occurs creating the transaction.
407
+ #
408
+ def initialize(connections)
409
+ end
410
+
411
+
412
+ #
413
+ # This method is used to determine whether a Transaction object is still
414
+ # valid for use (i.e. commit or rollback has not been called for the
415
+ # Transaction).
416
+ #
417
+ def active?
418
+ end
419
+
420
+
421
+ #
422
+ # This is the accessor for the connections attribute. This method returns
423
+ # an array of the connections that the transaction applies to.
424
+ #
425
+ def connections
426
+ end
427
+
428
+
429
+ #
430
+ # This method is used to determine whether a given Transaction applies to
431
+ # a specified Connection.
432
+ #
433
+ # ==== Parameters
434
+ # connection:: A reference to the Connection object to perform the test
435
+ # for.
436
+ #
437
+ def for_connection?(connection)
438
+ end
439
+
440
+
441
+ #
442
+ # This method commits the details outstanding against a Transaction
443
+ # object. The Transaction object may not be reused after a successful
444
+ # call to this method.
445
+ #
446
+ # ==== Exceptions
447
+ # Exception:: Generated whenever a problem occurs committing the details
448
+ # of the transaction.
449
+ #
450
+ def commit
451
+ end
452
+
453
+
454
+ #
455
+ # This method rolls back the details outstanding against a Transaction
456
+ # object. The Transaction object may not be reused after a successful
457
+ # call to this method.
458
+ #
459
+ # ==== Exceptions
460
+ # Exception:: Generated whenever a problem occurs rolling back the
461
+ # details of the transaction.
462
+ #
463
+ def rollback
464
+ end
465
+
466
+
467
+ #
468
+ # This method executes a SQL statement using a Transaction object. This
469
+ # method will only work whenever a Transaction object applies to a
470
+ # single Connection as it would otherwise be impossible to determine
471
+ # which connection to execute against. If the statement executed was a
472
+ # SQL query then the method returns a ResultSet object. For non-query SQL
473
+ # statements (insert, update or delete) the method returns an Integer that
474
+ # contains the number of rows affected by the statement. For all other
475
+ # statements the method returns nil. The method also accepts a block that
476
+ # takes a single parameter. If the SQL statement was a query the block
477
+ # will be invoked and passed each row retrieved.
478
+ #
479
+ # ==== Parameters
480
+ # sql:: A string containing the SQL statement to be executed.
481
+ #
482
+ # ==== Exceptions
483
+ # Exception:: Generated whenever the Transaction object represents more
484
+ # than one connection or a problem occurs executing the SQL
485
+ # statement.
486
+ #
487
+ def execute(sql)
488
+ yield(row)
489
+ end
490
+
491
+
492
+ #
493
+ # This method allows for the creation of a Transaction object with
494
+ # non-standard settings.
495
+ #
496
+ # ==== Parameters
497
+ # connections:: Either a single Connection object or an array of
498
+ # Connection objects that the new Transaction will
499
+ # be associated with.
500
+ # parameters:: An array of the parameters to be used in creating
501
+ # the new constants. Populate this from the TPB
502
+ # constants defined within the class.
503
+ #
504
+ # ==== Exceptions
505
+ # FireRubyError:: Generated whenever a problem occurs creating the
506
+ # transaction.
507
+ #
508
+ def Transaction.create(connections, parameters)
509
+ end
510
+ end
511
+
512
+
513
+ #
514
+ # This class represents a prepared SQL statement that may be executed more
515
+ # than once.
516
+ #
517
+ class Statement
518
+ # A definition for a SQL statement type constant.
519
+ SELECT_STATEMENT = 1
520
+
521
+ # A definition for a SQL statement type constant.
522
+ INSERT_STATEMENT = 2
523
+
524
+ # A definition for a SQL statement type constant.
525
+ UPDATE_STATEMENT = 3
526
+
527
+ # A definition for a SQL statement type constant.
528
+ DELETE_STATEMENT = 4
529
+
530
+ # A definition for a SQL statement type constant.
531
+ DDL_STATEMENT = 5
532
+
533
+ # A definition for a SQL statement type constant.
534
+ GET_SEGMENT_STATEMENT = 6
535
+
536
+ # A definition for a SQL statement type constant.
537
+ PUT_SEGMENT_STATEMENT = 7
538
+
539
+ # A definition for a SQL statement type constant.
540
+ EXECUTE_PROCEDURE_STATEMENT = 8
541
+
542
+ # A definition for a SQL statement type constant.
543
+ START_TRANSACTION_STATEMENT = 9
544
+
545
+ # A definition for a SQL statement type constant.
546
+ COMMIT_STATEMENT = 10
547
+
548
+ # A definition for a SQL statement type constant.
549
+ ROLLBACK_STATEMENT = 11
550
+
551
+ # A definition for a SQL statement type constant.
552
+ SELECT_FOR_UPDATE_STATEMENT = 12
553
+
554
+ # A definition for a SQL statement type constant.
555
+ SET_GENERATOR_STATEMENT = 13
556
+
557
+ # A definition for a SQL statement type constant.
558
+ SAVE_POINT_STATEMENT = 14
559
+
560
+ #
561
+ # This is the constructor for the Statement class.
562
+ #
563
+ # ==== Parameters
564
+ # connection:: The Connection object that the SQL statement will be
565
+ # executed through.
566
+ # transaction:: The Transaction object that the SQL statement will be
567
+ # executed under.
568
+ # sql:: The SQL statement to be prepared for execution.
569
+ # dialect:: The Firebird dialect to be used in preparing the SQL
570
+ # statement.
571
+ #
572
+ def initialize(connection, transaction, sql, dialect)
573
+ end
574
+
575
+
576
+ #
577
+ # This is the accessor for the connection attribute.
578
+ #
579
+ def connection
580
+ end
581
+
582
+
583
+ #
584
+ # This is the accessor for the transaction attribute.
585
+ #
586
+ def transaction
587
+ end
588
+
589
+
590
+ #
591
+ # This is the accessor for the SQL statement attribute.
592
+ #
593
+ def sql
594
+ end
595
+
596
+
597
+ #
598
+ # This is the accessor for the dialect attribute.
599
+ #
600
+ def dialect
601
+ end
602
+
603
+
604
+ #
605
+ # This method is used to determine the type of a SQL statement. The method
606
+ # will return one of the constant SQL types defined within the class.
607
+ #
608
+ def type
609
+ end
610
+
611
+
612
+ #
613
+ # This method fetches a count of the number of dynamic parameters for
614
+ # a statement object (i.e. the number of parameters that must be provided
615
+ # with values before the SQL statement can be executed).
616
+ #
617
+ def parameter_count
618
+ end
619
+
620
+
621
+ #
622
+ # This method executes the SQL statement within a Statement object. This
623
+ # method returns a ResultSet object if the statement executed was a SQL
624
+ # query. For non-query SQL statements (insert, update or delete) it
625
+ # returns an Integer indicating the number of affected rows. For all other
626
+ # statements the method returns nil. This method accepts a block taking a
627
+ # single parameter. If this block is provided and the statement is a query
628
+ # then the rows returned by the query will be passed, one at a time, to
629
+ # the block.
630
+ #
631
+ # ==== Exception
632
+ # Exception:: Generated if the Statement object actual requires some
633
+ # parameters or a problem occurs executing the SQL statement.
634
+ #
635
+ def execute
636
+ yield row
637
+ end
638
+
639
+
640
+ #
641
+ # This method executes the SQL statement within a Statement object and
642
+ # passes it a set of parameters. Parameterized statements use question
643
+ # marks as place holders for values that may change between calls to
644
+ # execute the statement. This method returns a ResultSet object if the
645
+ # statement executed was a SQL query. If the statement was a non-query SQL
646
+ # statement (insert, update or delete) then the method returns a count of
647
+ # the number of rows affected. For all other types of statement the method
648
+ # returns nil. This method accepts a block taking a single parameter. If
649
+ # this block is provided and the statement is a query then the rows
650
+ # returned by the query will be passed, one at a time, to the block.
651
+ #
652
+ # ==== Parameters
653
+ # parameters:: An array of the parameters for the statement. An effort
654
+ # will be made to convert the values passed in to the
655
+ # appropriate types but no guarantees are made (especially
656
+ # in the case of text fields, which will simply use to_s
657
+ # if the object passed is not a String).
658
+ #
659
+ # ==== Exception
660
+ # Exception:: Generated whenever a problem occurs translating one of the
661
+ # input parameters or executing the SQL statement.
662
+ #
663
+ def execute_for(parameters)
664
+ yield row
665
+ end
666
+
667
+
668
+ #
669
+ # This method releases the database resources associated with a Statement
670
+ # object and should be explicitly called when a Statement object is of
671
+ # no further use.
672
+ #
673
+ # ==== Exceptions
674
+ # FireRubyError:: Generated whenever a problem occurs closing the
675
+ # statement object.
676
+ #
677
+ def close
678
+ end
679
+ end
680
+
681
+
682
+ #
683
+ # This class represents the results of a SQL query executed against a
684
+ # database. The viable lifespan of a ResultSet object is limited by the
685
+ # transaction that was used in it's creation. Once this transaction has
686
+ # been committed or rolled back all related ResultSet object are invalidated
687
+ # and can no longer be used.
688
+ #
689
+ class ResultSet
690
+ include Enumerable
691
+
692
+ #
693
+ # This is the constructor for the ResultSet object.
694
+ #
695
+ # ==== Parameters
696
+ # connection:: A reference to the Connection object that will be used
697
+ # to execute the SQL query.
698
+ # transaction:: A reference to the Transaction object that will be used
699
+ # in executing the SQL query.
700
+ # sql:: A reference to a String containing the SQL query that
701
+ # will be executed.
702
+ # dialect:: A reference to an integer containing the Firebird dialect
703
+ # to be used in executing the SQL statement.
704
+ #
705
+ # ==== Exceptions
706
+ # FireRubyException:: Generated whenever a non-query SQL statement is
707
+ # specified, an invalid connection or transaction is
708
+ # provided or a problem occurs executing the SQL
709
+ # against the database.
710
+ #
711
+ def initialize(connection, transaction, sql, dialect)
712
+ end
713
+
714
+
715
+ #
716
+ # This is the accessor for the connection attribute.
717
+ #
718
+ def connection
719
+ end
720
+
721
+
722
+ #
723
+ # This is the accessor for the transaction attribute.
724
+ #
725
+ def transaction
726
+ end
727
+
728
+
729
+ #
730
+ # This is the accessor for the sql attribute.
731
+ #
732
+ def sql
733
+ end
734
+
735
+
736
+ #
737
+ # This is the accessor for the dialect attribute.
738
+ #
739
+ def dialect
740
+ end
741
+
742
+
743
+ #
744
+ # This method fetches a count of the number of columns in a row of data
745
+ # that the ResultSet can fetch.
746
+ #
747
+ def column_count
748
+ end
749
+
750
+
751
+ #
752
+ # This method fetches the name associated with a specified column for a
753
+ # ResultSet object.
754
+ #
755
+ # ==== Parameters
756
+ # column:: A reference to the column number to fetch the details for.
757
+ # Column numbers start at zero.
758
+ #
759
+ def column_name(column)
760
+ end
761
+
762
+
763
+ #
764
+ # This method fetches the alias associated with a specified column for a
765
+ # ResultSet object.
766
+ #
767
+ # ==== Parameters
768
+ # column:: A reference to the column number to fetch the details for.
769
+ # Column numbers start at zero.
770
+ #
771
+ def column_alias(column)
772
+ end
773
+
774
+
775
+ #
776
+ # This method fetches the table name associated with a specified column
777
+ # for a ResultSet object.
778
+ #
779
+ # ==== Parameters
780
+ # column:: A reference to the column number to fetch the details for.
781
+ # Column numbers start at zero.
782
+ #
783
+ def column_table(column)
784
+ end
785
+
786
+
787
+ #
788
+ # This method fetches a single rows worth of data from the ResultSet
789
+ # object. If the set contains more rows then an array containing the
790
+ # row data will be retrieved. If the ResultSet is exhausted (i.e. all
791
+ # rows have been fetched) then nil is returned. Translation of the row
792
+ # data into an appropriate Ruby type is performed on the row data that
793
+ # is extracted.
794
+ #
795
+ def fetch
796
+ end
797
+
798
+
799
+ #
800
+ # This method is used to determine if all of the rows have been retrieved
801
+ # from a ResultSet object. This method will always return false until
802
+ # the fetch method has been called at least once so it cannot be used to
803
+ # detect a result set that returns no rows.
804
+ #
805
+ def exhausted?
806
+ end
807
+
808
+
809
+ #
810
+ # This method fetches a count of the total number of rows retrieved
811
+ # from a result set.
812
+ #
813
+ def row_count
814
+ end
815
+
816
+
817
+ #
818
+ # This method provides an iterator for the (remaining) rows contained in
819
+ # a ResultSet object.
820
+ #
821
+ # ==== Parameters
822
+ # block:: A block that takes a single parameter. This will be called for
823
+ # and passed each remaining row (as per the fetch method) from
824
+ # the ResultSet.
825
+ #
826
+ def each(&block)
827
+ end
828
+
829
+
830
+ #
831
+ # This method releases the database resources associated with a ResultSet
832
+ # object and should be explicitly called when a ResultSet object is of
833
+ # no further use. The method is implicitly called if the rows available
834
+ # from a ResultSet are exhausted but calling this method at that time
835
+ # will not cause an error.
836
+ #
837
+ # ==== Exceptions
838
+ # FireRubyError:: Generated whenever a problem occurs closing the result
839
+ # set object.
840
+ #
841
+ def close
842
+ end
843
+
844
+ #
845
+ # This method retrieves the base SQL type for a column of data within a
846
+ # ResultSet object. The method returns one of the base types defined in
847
+ # the SQLType class but does not return an actual SQLType object.
848
+ #
849
+ # ==== Parameters
850
+ # index:: The offset from the ResultSet first column of the column to
851
+ # return the type information for.
852
+ #
853
+ def get_base_type(index)
854
+ end
855
+ end
856
+
857
+
858
+ #
859
+ # This class models a row of data fetched as part of a SQL query.
860
+ #
861
+ class Row
862
+ include Enumerable
863
+
864
+ #
865
+ # This is the constructor for the Row class. This method shouldn't really
866
+ # be used as Row objects are automatically created by ResultSets.
867
+ #
868
+ # ==== Parameters
869
+ # results:: The ResultSet object that the row relates to.
870
+ # data:: An array containing the row data values.
871
+ # number:: The row number for the new row.
872
+ #
873
+ def initialize(results, data, number)
874
+ end
875
+
876
+ #
877
+ # This is the accessor for the row number attribute. This will generally
878
+ # reflect the order the row was fetched from the result set in, with 1
879
+ # being the first row retrieved.
880
+ #
881
+ def number
882
+ end
883
+
884
+
885
+ #
886
+ # This method fetches a count of the number of columns of data that are
887
+ # available from a row.
888
+ #
889
+ def column_count
890
+ end
891
+
892
+
893
+ #
894
+ # This method fetches the name of a column within a row of data.
895
+ #
896
+ # ==== Parameters
897
+ # index:: The index of the column to fetch the name for. The first
898
+ # column in the row is at offset zero.
899
+ #
900
+ def column_name(index)
901
+ end
902
+
903
+
904
+ #
905
+ # This method fetches the alias of a column within a row of data.
906
+ #
907
+ # ==== Parameters
908
+ # index:: The index of the column to fetch the alias for. The first
909
+ # column in the row is at offset zero.
910
+ #
911
+ def column_alias(index)
912
+ end
913
+
914
+
915
+ #
916
+ # This method fetches the value associated with a column within a Row
917
+ # object.
918
+ #
919
+ # ==== Parameters
920
+ # index:: Either the offset of the column to retrieve the value of or
921
+ # the alias of the column to retrieve the value of (column alias
922
+ # comparisons are case sensitive).
923
+ #
924
+ def [](index)
925
+ end
926
+
927
+
928
+ #
929
+ # This method iterates over the contents of a Row object. The block
930
+ # specified for the method should accept two parameters; one for the
931
+ # column alias and one for the column value.
932
+ #
933
+ def each
934
+ yield column, vlaue
935
+ end
936
+
937
+
938
+ #
939
+ # This method iterates over the column names for a Row class.
940
+ #
941
+ def each_key
942
+ yield column
943
+ end
944
+
945
+
946
+ #
947
+ # This method iterators over the column values for a Row class.
948
+ #
949
+ def each_value
950
+ yield value
951
+ end
952
+
953
+
954
+ #
955
+ # An implementation of the Hash#fetch method for the Row class. The
956
+ # method accepts a block but this should not be specified if a value
957
+ # for the alternative parameter is specified.
958
+ #
959
+ # ==== Parameters
960
+ # key:: A string containing the column alias to retrieve.
961
+ # alternative:: A reference to the alternative value to be returned if
962
+ # the keyed value is not found. Defaults to nil.
963
+ #
964
+ def fetch(key, alternative=nil)
965
+ yield key
966
+ end
967
+
968
+
969
+ #
970
+ # This method is used to determine whether a Row object contains a given
971
+ # column alias.
972
+ #
973
+ # ==== Parameters
974
+ # name:: A String containing the column name to check for.
975
+ #
976
+ def has_key?(name)
977
+ end
978
+
979
+
980
+ #
981
+ # This method is used to determine whether a Row object contains a given
982
+ # column name.
983
+ #
984
+ # ==== Parameters
985
+ # name:: A String containing the column name to check for.
986
+ #
987
+ def has_column?(name)
988
+ end
989
+
990
+
991
+ #
992
+ # This method is used to determine whether a Row object contains a given
993
+ # column alias.
994
+ #
995
+ # ==== Parameters
996
+ # name:: A String containing the column alias to check for.
997
+ #
998
+ def has_alias?(name)
999
+ end
1000
+
1001
+
1002
+ #
1003
+ # This method is used to determine whether a Row object contains a given
1004
+ # column value.
1005
+ #
1006
+ # ==== Parameters
1007
+ # value:: A reference to an object value to be checked for.
1008
+ #
1009
+ def has_value?(value)
1010
+ end
1011
+
1012
+
1013
+ #
1014
+ # This method retrieves an array of column aliases for a Row object.
1015
+ #
1016
+ def keys
1017
+ end
1018
+
1019
+
1020
+ #
1021
+ # This method retrieves an array of column names for a Row object.
1022
+ #
1023
+ def names
1024
+ end
1025
+
1026
+
1027
+ #
1028
+ # This method retrieves an array of column aliases for a Row object.
1029
+ #
1030
+ def aliases
1031
+ end
1032
+
1033
+
1034
+ #
1035
+ # This method retrieves an array of column values for a Row object.
1036
+ #
1037
+ def values
1038
+ end
1039
+
1040
+
1041
+ #
1042
+ # This method returns an array of the Row elements for which the specified
1043
+ # block returns true.
1044
+ #
1045
+ def select
1046
+ yield column, value
1047
+ end
1048
+
1049
+
1050
+ #
1051
+ # This method retrieves an Array containing the values from a Row object.
1052
+ # Each value is represented as an Array containing a column name and the
1053
+ # associated column value.
1054
+ #
1055
+ def to_a
1056
+ end
1057
+
1058
+
1059
+ #
1060
+ # This method retrieves a Hash created from a Row objects values. The Row
1061
+ # objects column names will be used as a key on to the column values.
1062
+ #
1063
+ def to_hash
1064
+ end
1065
+
1066
+
1067
+ #
1068
+ # This method returns an array of column values based on a list of column
1069
+ # aliases.
1070
+ #
1071
+ # ==== Parameters
1072
+ # names:: One or more Strings containing the names of the columns to
1073
+ # retrieve values for.
1074
+ #
1075
+ def values_at(*names)
1076
+ end
1077
+
1078
+ #
1079
+ # This method retrieves the base SQL type for a column of data within a
1080
+ # Row object. The method returns one of the base types defined in the
1081
+ # SQLType class but does not return an actual SQLType object.
1082
+ #
1083
+ # ==== Parameters
1084
+ # index:: The offset from the Row first column of the column to return
1085
+ # the type information for.
1086
+ #
1087
+ def get_base_type(index)
1088
+ end
1089
+ end
1090
+
1091
+ #
1092
+ # This class represents Blob data fetched from the database. The class defers
1093
+ # the actual loading of the blob until requested. The class is somewhat basic
1094
+ # and maybe expanded upon in later releases.
1095
+ #
1096
+ class Blob
1097
+ #
1098
+ # This is the constructor for the Blob class. This shouldn't really be
1099
+ # used outside of the FireRuby library.
1100
+ #
1101
+ def initialize
1102
+ end
1103
+
1104
+
1105
+ #
1106
+ # This method loads the entire data set for a blob as a string.
1107
+ #
1108
+ def to_s
1109
+ end
1110
+
1111
+
1112
+ #
1113
+ # This method closes a blob, freeing any resources associated with it.
1114
+ #
1115
+ def close
1116
+ end
1117
+
1118
+
1119
+ #
1120
+ # This method loads the segments of a blob one after another. The blob
1121
+ # segments are passed as strings to the block passed to the method.
1122
+ #
1123
+ def each
1124
+ yield segment
1125
+ end
1126
+ end
1127
+
1128
+
1129
+ #
1130
+ # This class represents a Firebird generator entity.
1131
+ #
1132
+ class Generator
1133
+ #
1134
+ # This is the constructor for the Generator class. Note, this method
1135
+ # assumes that the named generator already exists. If it doesn't then
1136
+ # the object will be constructed but will fail during use.
1137
+ #
1138
+ # ==== Parameters
1139
+ # name:: A string containing the generator name.
1140
+ # connection:: A reference to the Connection object that will be used
1141
+ # to access the generator.
1142
+ #
1143
+ def initialize(name, connection)
1144
+ end
1145
+
1146
+
1147
+ #
1148
+ # This is the accessor for the name attribute.
1149
+ #
1150
+ def name
1151
+ end
1152
+
1153
+
1154
+ #
1155
+ # This is the accessor for the connection attribute.
1156
+ #
1157
+ def connection
1158
+ end
1159
+
1160
+
1161
+ #
1162
+ # This method fetches the last value generator from a generator.
1163
+ #
1164
+ # ==== Exceptions
1165
+ # Exception:: Generated whenever a problem occurs accessing the
1166
+ # database generator.
1167
+ #
1168
+ def last
1169
+ end
1170
+
1171
+
1172
+ #
1173
+ # This method drops a generator from the database. After a successful
1174
+ # call to this method the Generator object may not be used to obtain
1175
+ # values unless it is recreated.
1176
+ #
1177
+ # ==== Exceptions
1178
+ # Exception:: Generated whenever a problem occurs dropping the generator
1179
+ # from the database.
1180
+ #
1181
+ def drop
1182
+ end
1183
+
1184
+
1185
+ #
1186
+ # This method fetches the next value, depending on a specified increment,
1187
+ # from a generator.
1188
+ #
1189
+ # ==== Parameters
1190
+ # step:: The step interval to be applied to the generator to obtain the
1191
+ # next value.
1192
+ #
1193
+ # ==== Exceptions
1194
+ # Exception:: Generated whenever a problem occurs accessing the
1195
+ # database generator.
1196
+ #
1197
+ def next(step)
1198
+ end
1199
+
1200
+
1201
+ #
1202
+ # This method is used to determine whether a named generator exists
1203
+ # within a database.
1204
+ #
1205
+ # ==== Parameters
1206
+ # name:: A string containing the generator name to check for.
1207
+ # connection:: A reference to the Connection object to be used in
1208
+ # performing the check.
1209
+ #
1210
+ # ==== Exceptions
1211
+ # Exception:: Generated whenever a problem occurs determining the
1212
+ # existence of the generator.
1213
+ #
1214
+ def Generator.exists?(name, connection)
1215
+ end
1216
+
1217
+
1218
+ #
1219
+ # This method creates a new generator within a database. This method
1220
+ # returns a Generator object is successful.
1221
+ #
1222
+ # ==== Parameters
1223
+ # name:: A string containing the name for the new generator.
1224
+ # connection:: A reference to the Connection object that will be used to
1225
+ # create the generator.
1226
+ #
1227
+ # ==== Exceptions
1228
+ # Exception:: Generated whenever a problem occurs creating the new
1229
+ # generator in the database.
1230
+ #
1231
+ def Generator.create(name, connection)
1232
+ end
1233
+ end
1234
+
1235
+
1236
+ #
1237
+ # This class represents a connection to the service manager for a Firebird
1238
+ # database server instance. NOTE: This class does not currently work on the
1239
+ # Mac OS X platform.
1240
+ #
1241
+ class ServiceManager
1242
+ #
1243
+ # This is the constructor for the ServiceManager class.
1244
+ #
1245
+ # ==== Parameters
1246
+ # host:: The name of the host supporting the service manager to be
1247
+ # connected with.
1248
+ #
1249
+ def initialize(host)
1250
+ end
1251
+
1252
+
1253
+ #
1254
+ # This method attaches a ServiceManager object to its host service. The
1255
+ # user name used to connect with can affect which services can be accessed
1256
+ # on the server.
1257
+ #
1258
+ # ==== Parameters
1259
+ # user:: A string containing the user name to connect with.
1260
+ # password:: A string containing the user password to connect with.
1261
+ #
1262
+ def connect(user, password)
1263
+ end
1264
+
1265
+
1266
+ #
1267
+ # This method disconnects a previously connected ServiceManager object.
1268
+ #
1269
+ def disconnect
1270
+ end
1271
+
1272
+
1273
+ #
1274
+ # This method is used to determine whether a ServiceManager object has
1275
+ # been connected.
1276
+ #
1277
+ def connected?
1278
+ end
1279
+
1280
+
1281
+ #
1282
+ # This method is used to batch execute a collection of task objects.
1283
+ #
1284
+ # ==== Parameters
1285
+ # tasks:: One or more task objects to be executed by the service manager.
1286
+ #
1287
+ # ==== Exceptions
1288
+ # FireRubyException:: Generated whenever this method is called on a
1289
+ # disconnected service manager or is a problem
1290
+ # occurs executing one of the tasks.
1291
+ #
1292
+ def execute(*tasks)
1293
+ end
1294
+ end
1295
+
1296
+
1297
+ #
1298
+ # This class represents a service manager task to add a new user to a
1299
+ # database instance. NOTE: This class does not currently work on the
1300
+ # Mac OS X platform.
1301
+ #
1302
+ class AddUser
1303
+ # Attribute accessor.
1304
+ attr_reader :user_name, :password, :first_name, :middle_name, :last_name
1305
+
1306
+ # Attribute mutator.
1307
+ attr_writer :user_name, :password, :first_name, :middle_name, :last_name
1308
+
1309
+ #
1310
+ # This is a constructor for the AddUser class.
1311
+ #
1312
+ # ==== Parameters
1313
+ # user_name:: A String containing the user name to be assigned to the
1314
+ # new user.
1315
+ # password:: A String containing the password to be assigned to the
1316
+ # new user.
1317
+ # first_name:: A String containing the first name to be associated with
1318
+ # the new user. Defaults to nil.
1319
+ # middle_name:: A String containing the middle name to be associated
1320
+ # with the new user. Defaults to nil.
1321
+ # last_name:: A String containing the last name to be associated with
1322
+ # the new user. Defaults to nil.
1323
+ #
1324
+ def initialize(user_name, password, firsts_name=nil, middle_name=nil,
1325
+ last_name=nil)
1326
+ end
1327
+
1328
+
1329
+ #
1330
+ # This method executes the add user task against a service manager.
1331
+ #
1332
+ # ==== Parameters
1333
+ # manager:: A reference to the ServiceManager object to execute the task
1334
+ # on.
1335
+ #
1336
+ # ==== Exceptions
1337
+ # FireRubyException:: Generated whenever a disconnected service manager
1338
+ # is specified or an error occurs executing the
1339
+ # task.
1340
+ #
1341
+ def execute(manager)
1342
+ end
1343
+ end
1344
+
1345
+
1346
+ #
1347
+ # This class represents a service manager task to remove an existing user
1348
+ # from a database instance. NOTE: This class does not currently work on the
1349
+ # Mac OS X platform.
1350
+ #
1351
+ class RemoveUser
1352
+ # Attribute accessor.
1353
+ attr_reader :user_name
1354
+
1355
+ # Attribute mutator.
1356
+ attr_writer :user_name
1357
+
1358
+ #
1359
+ # This is a constructor for the RemoveUser class.
1360
+ #
1361
+ # ==== Parameters
1362
+ # user_name:: A String containing the user name to be assigned to the
1363
+ # new user.
1364
+ #
1365
+ def initialize(user_name)
1366
+ end
1367
+
1368
+
1369
+ #
1370
+ # This method executes the remove user task against a service manager.
1371
+ #
1372
+ # ==== Parameters
1373
+ # manager:: A reference to the ServiceManager object to execute the task
1374
+ # on.
1375
+ #
1376
+ # ==== Exceptions
1377
+ # FireRubyException:: Generated whenever a disconnected service manager
1378
+ # is specified or an error occurs executing the
1379
+ # task.
1380
+ #
1381
+ def execute(manager)
1382
+ end
1383
+ end
1384
+
1385
+
1386
+ #
1387
+ # This class represents a service manager task to backup an existing database
1388
+ # on the Firebird server. NOTE: This class does not currently work on the
1389
+ # Mac OS X platform.
1390
+ #
1391
+ class Backup
1392
+ # Attribute accessor.
1393
+ attr_reader :backup_file, :database
1394
+
1395
+ # Attribute mutator.
1396
+ attr_writer :backup_file, :database
1397
+
1398
+ #
1399
+ # This is the constructor for the Backup class.
1400
+ #
1401
+ # ==== Parameters
1402
+ # database:: A String or File giving the path and name (relative to the
1403
+ # database server) of the main database file for the database
1404
+ # to be backed up.
1405
+ # file:: A String or File giving the path and name (relative to the
1406
+ # database server) of the back up file to be generated.
1407
+ #
1408
+ def initialize(database, file)
1409
+ end
1410
+
1411
+
1412
+ #
1413
+ # This method fetches the blocking factor to be used in generating the
1414
+ # back up. This will return nil until it has been explicitly set.
1415
+ #
1416
+ def blocking_factor
1417
+ end
1418
+
1419
+
1420
+ #
1421
+ # This method sets the blocking factor to be used in generating the
1422
+ # back up.
1423
+ #
1424
+ # ==== Parameters
1425
+ # size:: A reference to an integer containing the new back up blocking
1426
+ # factor setting.
1427
+ #
1428
+ def blocking_factor=(size)
1429
+ end
1430
+
1431
+
1432
+ #
1433
+ # This method fetches the ignore checksums setting for a Backup object.
1434
+ #
1435
+ def ignore_checksums
1436
+ end
1437
+
1438
+
1439
+ #
1440
+ # This method is used to set the indicator for whether checksum values
1441
+ # should be ignored in performing a backup.
1442
+ #
1443
+ # ==== Parameters
1444
+ # setting:: True to ignore checksums, false otherwise.
1445
+ #
1446
+ def ignore_checksums=(setting)
1447
+ end
1448
+
1449
+
1450
+ #
1451
+ # This method fetches the ignore limbo setting for a Backup object.
1452
+ #
1453
+ def ignore_limbo
1454
+ end
1455
+
1456
+
1457
+ #
1458
+ # This method is used to set the indicator for whether limbo transactions
1459
+ # should be ignored in performing a backup.
1460
+ #
1461
+ # ==== Parameters
1462
+ # setting:: True to ignore limbo transactions, false otherwise.
1463
+ #
1464
+ def ignore_limbo=(setting)
1465
+ end
1466
+
1467
+
1468
+ #
1469
+ # This method fetches the metadata only setting for a Backup object.
1470
+ #
1471
+ def metadata_only
1472
+ end
1473
+
1474
+
1475
+ #
1476
+ # This method is used to set the indicator for whether a backup stores
1477
+ # only the database metadata.
1478
+ #
1479
+ # ==== Parameters
1480
+ # setting:: True to store only metadata, false otherwise.
1481
+ #
1482
+ def metadata_only=(setting)
1483
+ end
1484
+
1485
+
1486
+ #
1487
+ # This method fetches the garbage collect setting for a Backup object.
1488
+ #
1489
+ def garbage_collect
1490
+ end
1491
+
1492
+
1493
+ #
1494
+ # This method is used to set the indicator for whether the backup will
1495
+ # undertake garbage collection.
1496
+ #
1497
+ # ==== Parameters
1498
+ # setting:: True to perform garbage collection, false otherwise.
1499
+ #
1500
+ def garbage_collect=(setting)
1501
+ end
1502
+
1503
+
1504
+ #
1505
+ # This method fetches the non-transportable setting for a Backup object.
1506
+ #
1507
+ def non_transportable
1508
+ end
1509
+
1510
+
1511
+ #
1512
+ # This method is used to set the indicator for whether backup generated
1513
+ # by the task will be platform specific.
1514
+ #
1515
+ # ==== Parameters
1516
+ # setting:: True to generate a platform specific backup, false otherwise.
1517
+ #
1518
+ def non_transportable=(setting)
1519
+ end
1520
+
1521
+
1522
+ #
1523
+ # This method fetches the convert tables setting for a Backup object.
1524
+ #
1525
+ def convert_tables
1526
+ end
1527
+
1528
+
1529
+ #
1530
+ # This method is used to set the indicator for whether external tables
1531
+ # will be converted to internal tables as part of the backup.
1532
+ #
1533
+ # ==== Parameters
1534
+ # setting:: True to convert external tables, false otherwise.
1535
+ #
1536
+ def convert_tables=(setting)
1537
+ end
1538
+
1539
+
1540
+ #
1541
+ # This method is used to execute a backup task against a service manager.
1542
+ #
1543
+ # ==== Parameters
1544
+ # manager:: A reference to the service manager to execute the backup
1545
+ # task against.
1546
+ #
1547
+ # ==== Exceptions
1548
+ # FireRubyException:: Generated whenever a disconnected service manager
1549
+ # is specified or a problem occurs executing the
1550
+ # task.
1551
+ #
1552
+ def execute(manager)
1553
+ end
1554
+
1555
+
1556
+ #
1557
+ # This method fetches the log value for a Backup task. This value will
1558
+ # always be nil until the task has been executed. After a successful
1559
+ # execution the log value should contain output from the backup task
1560
+ # generated on the server.
1561
+ #
1562
+ def log
1563
+ end
1564
+ end
1565
+
1566
+
1567
+ #
1568
+ # This class represents a service manager task to restore a previously
1569
+ # created database backup on the Firebird server. NOTE: This class does not
1570
+ # currently work on the Mac OS X platform.
1571
+ #
1572
+ class Restore
1573
+ # Attribute accessor.
1574
+ attr_reader :backup_file, :database
1575
+
1576
+ # Attribute mutator.
1577
+ attr_writer :backup_file, :database
1578
+
1579
+ # Access mode constant definition.
1580
+ ACCESS_READ_ONLY = 39
1581
+
1582
+ # Access mode constant definition.
1583
+ ACCESS_READ_WRITE = 40
1584
+
1585
+ # Restore mode constant definition.
1586
+ MODE_CREATE = 0x1000
1587
+
1588
+ # Restore mode constant definition.
1589
+ MODE_REPLACE = 0x2000
1590
+
1591
+ #
1592
+ # This is the constructor for the Restore class.
1593
+ #
1594
+ # ==== Parameters
1595
+ # file:: A String or File containing the path and name (relative to
1596
+ # the server) of the backup file to be used in the restore.
1597
+ # database:: A String or File containing the path and name (relative to
1598
+ # the server) of the database file to be restored.
1599
+ #
1600
+ def initialize(file, database)
1601
+ end
1602
+
1603
+
1604
+ #
1605
+ # This method retrieves the cache buffers setting for a Restore object.
1606
+ # This will be nil until a value is actual set.
1607
+ #
1608
+ def cache_buffers
1609
+ end
1610
+
1611
+
1612
+ #
1613
+ # This method updates the cache buffers setting for a Restore object.
1614
+ #
1615
+ # ==== Parameters
1616
+ # setting:: The new value for the object setting. Should be an integer.
1617
+ #
1618
+ def cache_buffers=(setting)
1619
+ end
1620
+
1621
+
1622
+ #
1623
+ # This method retrieves the page size setting for a Restore object.
1624
+ # This will be nil until a value is actual set.
1625
+ #
1626
+ def page_size
1627
+ end
1628
+
1629
+
1630
+ #
1631
+ # This method updates the page size setting for a Restore object.
1632
+ #
1633
+ # ==== Parameters
1634
+ # setting:: The new value for the object setting. Should be an integer.
1635
+ #
1636
+ def page_size=(setting)
1637
+ end
1638
+
1639
+
1640
+ #
1641
+ # This method retrieves the access mode setting for a Restore object.
1642
+ # This will be nil until a value is actual set.
1643
+ #
1644
+ def access_mode
1645
+ end
1646
+
1647
+
1648
+ #
1649
+ # This method updates the access mode setting for a Restore object.
1650
+ #
1651
+ # ==== Parameters
1652
+ # setting:: The new value for the object setting. This should be one
1653
+ # of Restore::ACCESS_READ_ONLY or Restore::ACCESS_READ_WRITE.
1654
+ #
1655
+ def access_mode=(setting)
1656
+ end
1657
+
1658
+
1659
+ #
1660
+ # This method retrieves the build indices setting for a Restore object.
1661
+ #
1662
+ def build_indices
1663
+ end
1664
+
1665
+
1666
+ #
1667
+ # This method updates the build indices setting for a Restore object.
1668
+ # This value affects whether the various indexes for a database are
1669
+ # restored with the restore task.
1670
+ #
1671
+ # ==== Parameters
1672
+ # setting:: True to rebuild the database indices, false otherwise.
1673
+ #
1674
+ def build_indices=(setting)
1675
+ end
1676
+
1677
+
1678
+ #
1679
+ # This method retrieves the no shadows setting for a Restore object.
1680
+ #
1681
+ def no_shadows
1682
+ end
1683
+
1684
+
1685
+ #
1686
+ # This method updates the no shadows setting for a Restore object.
1687
+ # This value affects whether shadow databases are recreated as part of a
1688
+ # restore.
1689
+ #
1690
+ # ==== Parameters
1691
+ # setting:: True to recreate shadow files, false otherwise.
1692
+ #
1693
+ def no_shadows=(setting)
1694
+ end
1695
+
1696
+
1697
+ #
1698
+ # This method retrieves the validity checks setting for a Restore object.
1699
+ #
1700
+ def check_validity
1701
+ end
1702
+
1703
+
1704
+ #
1705
+ # This method updates the validity checks setting for a Restore object.
1706
+ # This value affects whether the restore performs validity checks on the
1707
+ # database as it is restored.
1708
+ #
1709
+ # ==== Parameters
1710
+ # setting:: True to perform validity checks, false otherwise.
1711
+ #
1712
+ def check_validity=(setting)
1713
+ end
1714
+
1715
+
1716
+ #
1717
+ # This method retrieves the commit tables setting for a Restore object.
1718
+ #
1719
+ def commit_tables
1720
+ end
1721
+
1722
+
1723
+ #
1724
+ # This method updates the commit tables setting for a Restore object.
1725
+ # This value affects whether the restore commits tables as they are
1726
+ # restored.
1727
+ #
1728
+ # ==== Parameters
1729
+ # setting:: True to commit tables as they are restored, false otherwise.
1730
+ #
1731
+ def commit_tables=(setting)
1732
+ end
1733
+
1734
+
1735
+ #
1736
+ # This method retrieves the restore mode setting for a Restore object.
1737
+ #
1738
+ def restore_mode
1739
+ end
1740
+
1741
+
1742
+ #
1743
+ # This method updates the restore mode setting for a Restore object.
1744
+ # This value affects whether the restore will overwrite an existing
1745
+ # database.
1746
+ #
1747
+ # ==== Parameters
1748
+ # setting:: Either Restore::MODE_CREATE (default) or
1749
+ # Restore::MODE_REPLACE.
1750
+ #
1751
+ def restore_mode=(setting)
1752
+ end
1753
+
1754
+
1755
+ #
1756
+ # This method retrieves the use all space setting for a Restore object.
1757
+ #
1758
+ def use_all_space
1759
+ end
1760
+
1761
+
1762
+ #
1763
+ # This method updates the use all space setting for a Restore object.
1764
+ # This value affects whether restore leaves space within the database
1765
+ # file for expansion. This can be switched on for read only databases.
1766
+ #
1767
+ # ==== Parameters
1768
+ # setting:: True leave no default expansion space within the restored
1769
+ # database file, false otherwise.
1770
+ #
1771
+ def use_all_space=(setting)
1772
+ end
1773
+
1774
+
1775
+ #
1776
+ # This method is used to execute a restore task against a service manager.
1777
+ #
1778
+ # ==== Parameters
1779
+ # manager:: A reference to the service manager to execute the restore
1780
+ # task against.
1781
+ #
1782
+ # ==== Exceptions
1783
+ # FireRubyException:: Generated whenever a disconnected service manager
1784
+ # is specified or a problem occurs executing the
1785
+ # task.
1786
+ #
1787
+ def execute(manager)
1788
+ end
1789
+
1790
+
1791
+ #
1792
+ # This method fetches the log value for a Restore task. This value will
1793
+ # always be nil until the task has been executed. After a successful
1794
+ # execution the log value should contain output from the restore task
1795
+ # generated on the server.
1796
+ #
1797
+ def log
1798
+ end
1799
+ end
1800
+ end