fireruby 0.2.2-powerpc-darwin → 0.3.0-powerpc-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/doc/CVS/Entries +2 -3
- data/doc/CVS/Entries.Log +2 -0
- data/doc/README +149 -53
- data/doc/classes/CVS/Entries +1 -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 +1 -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.src/CVS/Entries +1 -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/Database.src/CVS/Entries +1 -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/FireRubyError.src/CVS/Entries +1 -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/Generator.src/CVS/Entries +1 -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/ResultSet.src/CVS/Entries +1 -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/Statement.src/CVS/Entries +1 -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/Transaction.src/CVS/Entries +1 -0
- data/doc/classes/FireRuby/Transaction.src/CVS/Repository +1 -0
- data/doc/classes/FireRuby/Transaction.src/CVS/Root +1 -0
- data/doc/files/CVS/Entries +1 -0
- data/doc/files/CVS/Repository +1 -0
- data/doc/files/CVS/Root +1 -0
- data/lib/CVS/Entries +1 -1
- data/lib/fireruby.bundle +0 -0
- data/lib/src.rb +807 -25
- data/test/AddRemoveUserTest.rb +50 -0
- data/test/BackupRestoreTest.rb +97 -0
- data/test/CVS/Entries +13 -9
- data/test/ConnectionTest.rb +1 -1
- data/test/DDLTest.rb +10 -8
- data/test/GeneratorTest.rb +2 -2
- data/test/ResultSetTest.rb +42 -8
- data/test/RowCountTest.rb +63 -0
- data/test/RowTest.rb +93 -5
- data/test/SQLTest.rb +16 -8
- data/test/ServiceManagerTest.rb +21 -0
- data/test/StatementTest.rb +3 -3
- data/test/TransactionTest.rb +6 -5
- data/test/UnitTest.rb +6 -0
- metadata +59 -2
data/lib/src.rb
CHANGED
@@ -124,15 +124,15 @@ module FireRuby
|
|
124
124
|
# password:: A string containing the user password that will be used in
|
125
125
|
# creating the file.
|
126
126
|
# size:: The page size setting to be used with the new database file.
|
127
|
-
# This should be 1024, 2048, 4096 or 8192.
|
127
|
+
# This should be 1024, 2048, 4096 or 8192. Defaults to 1024.
|
128
128
|
# set:: The name of the default character set to be assigned to the
|
129
|
-
# new database file.
|
129
|
+
# new database file. Defaults to nil.
|
130
130
|
#
|
131
131
|
# ==== Exceptions
|
132
132
|
# Exception:: Generated whenever an invalid parameter is specified or a
|
133
133
|
# problem occurs creating the database file.
|
134
134
|
#
|
135
|
-
def Database.create(file, user, password, size, set)
|
135
|
+
def Database.create(file, user, password, size=1024, set=nil)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -233,8 +233,10 @@ module FireRuby
|
|
233
233
|
|
234
234
|
#
|
235
235
|
# This function executes a SQL statement against a connection. If the
|
236
|
-
# statement represented a SQL query then a
|
237
|
-
# the statement
|
236
|
+
# statement represented a SQL query then a ResultSet object is returned.
|
237
|
+
# If the statement was a non-query SQL statement then an Integer is
|
238
|
+
# returned indicating the number of rows affected by the statement. For
|
239
|
+
# all other types of statement the method returns nil. The method also
|
238
240
|
# accepts a block that takes a single parameter. This block will be
|
239
241
|
# executed once for each row in any result set generated.
|
240
242
|
#
|
@@ -377,10 +379,12 @@ module FireRuby
|
|
377
379
|
# method will only work whenever a Transaction object applies to a
|
378
380
|
# single Connection as it would otherwise be impossible to determine
|
379
381
|
# which connection to execute against. If the statement executed was a
|
380
|
-
# SQL query then the method returns a ResultSet object
|
381
|
-
#
|
382
|
-
#
|
383
|
-
#
|
382
|
+
# SQL query then the method returns a ResultSet object. For non-query SQL
|
383
|
+
# statements (insert, update or delete) the method returns an Integer that
|
384
|
+
# contains the number of rows affected by the statement. For all other
|
385
|
+
# statements the method returns nil. The method also accepts a block that
|
386
|
+
# takes a single parameter. If the SQL statement was a query the block
|
387
|
+
# will be invoked and passed each row retrieved.
|
384
388
|
#
|
385
389
|
# ==== Parameters
|
386
390
|
# sql:: A string containing the SQL statement to be executed.
|
@@ -421,6 +425,48 @@ module FireRuby
|
|
421
425
|
# than once.
|
422
426
|
#
|
423
427
|
class Statement
|
428
|
+
# A definition for a SQL statement type constant.
|
429
|
+
SELECT_STATEMENT = 1
|
430
|
+
|
431
|
+
# A definition for a SQL statement type constant.
|
432
|
+
INSERT_STATEMENT = 2
|
433
|
+
|
434
|
+
# A definition for a SQL statement type constant.
|
435
|
+
UPDATE_STATEMENT = 3
|
436
|
+
|
437
|
+
# A definition for a SQL statement type constant.
|
438
|
+
DELETE_STATEMENT = 4
|
439
|
+
|
440
|
+
# A definition for a SQL statement type constant.
|
441
|
+
DDL_STATEMENT = 5
|
442
|
+
|
443
|
+
# A definition for a SQL statement type constant.
|
444
|
+
GET_SEGMENT_STATEMENT = 6
|
445
|
+
|
446
|
+
# A definition for a SQL statement type constant.
|
447
|
+
PUT_SEGMENT_STATEMENT = 7
|
448
|
+
|
449
|
+
# A definition for a SQL statement type constant.
|
450
|
+
EXECUTE_PROCEDURE_STATEMENT = 8
|
451
|
+
|
452
|
+
# A definition for a SQL statement type constant.
|
453
|
+
START_TRANSACTION_STATEMENT = 9
|
454
|
+
|
455
|
+
# A definition for a SQL statement type constant.
|
456
|
+
COMMIT_STATEMENT = 10
|
457
|
+
|
458
|
+
# A definition for a SQL statement type constant.
|
459
|
+
ROLLBACK_STATEMENT = 11
|
460
|
+
|
461
|
+
# A definition for a SQL statement type constant.
|
462
|
+
SELECT_FOR_UPDATE_STATEMENT = 12
|
463
|
+
|
464
|
+
# A definition for a SQL statement type constant.
|
465
|
+
SET_GENERATOR_STATEMENT = 13
|
466
|
+
|
467
|
+
# A definition for a SQL statement type constant.
|
468
|
+
SAVE_POINT_STATEMENT = 14
|
469
|
+
|
424
470
|
#
|
425
471
|
# This is the constructor for the Statement class.
|
426
472
|
#
|
@@ -466,10 +512,10 @@ module FireRuby
|
|
466
512
|
|
467
513
|
|
468
514
|
#
|
469
|
-
# This method is used to determine
|
470
|
-
#
|
515
|
+
# This method is used to determine the type of a SQL statement. The method
|
516
|
+
# will return one of the constant SQL types defined within the class.
|
471
517
|
#
|
472
|
-
def
|
518
|
+
def type
|
473
519
|
end
|
474
520
|
|
475
521
|
|
@@ -485,10 +531,12 @@ module FireRuby
|
|
485
531
|
#
|
486
532
|
# This method executes the SQL statement within a Statement object. This
|
487
533
|
# method returns a ResultSet object if the statement executed was a SQL
|
488
|
-
# query
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
534
|
+
# query. For non-query SQL statements (insert, update or delete) it
|
535
|
+
# returns an Integer indicating the number of affected rows. For all other
|
536
|
+
# statements the method returns nil. This method accepts a block taking a
|
537
|
+
# single parameter. If this block is provided and the statement is a query
|
538
|
+
# then the rows returned by the query will be passed, one at a time, to
|
539
|
+
# the block.
|
492
540
|
#
|
493
541
|
# ==== Exception
|
494
542
|
# Exception:: Generated if the Statement object actual requires some
|
@@ -504,10 +552,12 @@ module FireRuby
|
|
504
552
|
# passes it a set of parameters. Parameterized statements use question
|
505
553
|
# marks as place holders for values that may change between calls to
|
506
554
|
# execute the statement. This method returns a ResultSet object if the
|
507
|
-
# statement executed was a SQL query
|
508
|
-
#
|
509
|
-
#
|
510
|
-
#
|
555
|
+
# statement executed was a SQL query. If the statement was a non-query SQL
|
556
|
+
# statement (insert, update or delete) then the method returns a count of
|
557
|
+
# the number of rows affected. For all other types of statement the method
|
558
|
+
# returns nil. This method accepts a block taking a single parameter. If
|
559
|
+
# this block is provided and the statement is a query then the rows
|
560
|
+
# returned by the query will be passed, one at a time, to the block.
|
511
561
|
#
|
512
562
|
# ==== Parameters
|
513
563
|
# parameters:: An array of the parameters for the statement. An effort
|
@@ -548,17 +598,50 @@ module FireRuby
|
|
548
598
|
# This is the constructor for the ResultSet object.
|
549
599
|
#
|
550
600
|
# ==== Parameters
|
551
|
-
#
|
552
|
-
#
|
601
|
+
# connection:: A reference to the Connection object that will be used
|
602
|
+
# to execute the SQL query.
|
603
|
+
# transaction:: A reference to the Transaction object that will be used
|
604
|
+
# in executing the SQL query.
|
605
|
+
# sql:: A reference to a String containing the SQL query that
|
606
|
+
# will be executed.
|
607
|
+
# dialect:: A reference to an integer containing the Firebird dialect
|
608
|
+
# to be used in executing the SQL statement.
|
609
|
+
#
|
610
|
+
# ==== Exceptions
|
611
|
+
# FireRubyException:: Generated whenever a non-query SQL statement is
|
612
|
+
# specified, an invalid connection or transaction is
|
613
|
+
# provided or a problem occurs executing the SQL
|
614
|
+
# against the database.
|
615
|
+
#
|
616
|
+
def initialize(connection, transaction, sql, dialect)
|
617
|
+
end
|
618
|
+
|
619
|
+
|
620
|
+
#
|
621
|
+
# This is the accessor for the connection attribute.
|
622
|
+
#
|
623
|
+
def connection
|
624
|
+
end
|
625
|
+
|
626
|
+
|
627
|
+
#
|
628
|
+
# This is the accessor for the transaction attribute.
|
629
|
+
#
|
630
|
+
def transaction
|
631
|
+
end
|
632
|
+
|
633
|
+
|
634
|
+
#
|
635
|
+
# This is the accessor for the sql attribute.
|
553
636
|
#
|
554
|
-
def
|
637
|
+
def sql
|
555
638
|
end
|
556
639
|
|
557
640
|
|
558
641
|
#
|
559
|
-
# This is the accessor for the
|
642
|
+
# This is the accessor for the dialect attribute.
|
560
643
|
#
|
561
|
-
def
|
644
|
+
def dialect
|
562
645
|
end
|
563
646
|
|
564
647
|
|
@@ -731,6 +814,139 @@ module FireRuby
|
|
731
814
|
#
|
732
815
|
def [](index)
|
733
816
|
end
|
817
|
+
|
818
|
+
|
819
|
+
#
|
820
|
+
# This method iterates over the contents of a Row object. The block
|
821
|
+
# specified for the method should accept two parameters; one for the
|
822
|
+
# column name and one for the column value.
|
823
|
+
#
|
824
|
+
def each
|
825
|
+
yield column, vlaue
|
826
|
+
end
|
827
|
+
|
828
|
+
|
829
|
+
#
|
830
|
+
# This method iterates over the column names for a Row class.
|
831
|
+
#
|
832
|
+
def each_key
|
833
|
+
yield column
|
834
|
+
end
|
835
|
+
|
836
|
+
|
837
|
+
#
|
838
|
+
# This method iterators over the column values for a Row class.
|
839
|
+
#
|
840
|
+
def each_value
|
841
|
+
yield value
|
842
|
+
end
|
843
|
+
|
844
|
+
|
845
|
+
#
|
846
|
+
# An implementation of the Hash#fetch method for the Row class. The
|
847
|
+
# method accepts a block but this should not be specified if a value
|
848
|
+
# for the alternative parameter is specified.
|
849
|
+
#
|
850
|
+
# ==== Parameters
|
851
|
+
# key:: A string containing the column name to retrieve.
|
852
|
+
# alternative:: A reference to the alternative value to be returned if
|
853
|
+
# the keyed value is not found. Defaults to nil.
|
854
|
+
#
|
855
|
+
def fetch(key, alternative=nil)
|
856
|
+
yield key
|
857
|
+
end
|
858
|
+
|
859
|
+
|
860
|
+
#
|
861
|
+
# This method is used to determine whether a Row object contains a given
|
862
|
+
# column name.
|
863
|
+
#
|
864
|
+
# ==== Parameters
|
865
|
+
# name:: A String containing the column name to check for.
|
866
|
+
#
|
867
|
+
def has_key?(name)
|
868
|
+
end
|
869
|
+
|
870
|
+
|
871
|
+
#
|
872
|
+
# This method is used to determine whether a Row object contains a given
|
873
|
+
# column alias.
|
874
|
+
#
|
875
|
+
# ==== Parameters
|
876
|
+
# name:: A String containing the column alias to check for.
|
877
|
+
#
|
878
|
+
def has_alias?(name)
|
879
|
+
end
|
880
|
+
|
881
|
+
|
882
|
+
#
|
883
|
+
# This method is used to determine whether a Row object contains a given
|
884
|
+
# column value.
|
885
|
+
#
|
886
|
+
# ==== Parameters
|
887
|
+
# value:: A reference to an object value to be checked for.
|
888
|
+
#
|
889
|
+
def has_value?(value)
|
890
|
+
end
|
891
|
+
|
892
|
+
|
893
|
+
#
|
894
|
+
# This method retrieves an array of column names for a Row object.
|
895
|
+
#
|
896
|
+
def keys
|
897
|
+
end
|
898
|
+
|
899
|
+
|
900
|
+
#
|
901
|
+
# This method retrieves an array of column aliases for a Row object.
|
902
|
+
#
|
903
|
+
def aliases
|
904
|
+
end
|
905
|
+
|
906
|
+
|
907
|
+
#
|
908
|
+
# This method retrieves an array of column values for a Row object.
|
909
|
+
#
|
910
|
+
def values
|
911
|
+
end
|
912
|
+
|
913
|
+
|
914
|
+
#
|
915
|
+
# This method returns an array of the Row elements for which the specified
|
916
|
+
# block returns true.
|
917
|
+
#
|
918
|
+
def select
|
919
|
+
yield column, value
|
920
|
+
end
|
921
|
+
|
922
|
+
|
923
|
+
#
|
924
|
+
# This method retrieves an Array containing the values from a Row object.
|
925
|
+
# Each value is represented as an Array containing a column name and the
|
926
|
+
# associated column value.
|
927
|
+
#
|
928
|
+
def to_a
|
929
|
+
end
|
930
|
+
|
931
|
+
|
932
|
+
#
|
933
|
+
# This method retrieves a Hash created from a Row objects values. The Row
|
934
|
+
# objects column names will be used as a key on to the column values.
|
935
|
+
#
|
936
|
+
def to_hash
|
937
|
+
end
|
938
|
+
|
939
|
+
|
940
|
+
#
|
941
|
+
# This method returns an array of column values based on a list of column
|
942
|
+
# names.
|
943
|
+
#
|
944
|
+
# ==== Parameters
|
945
|
+
# names:: One or more Strings containing the names of the columns to
|
946
|
+
# retrieve values for.
|
947
|
+
#
|
948
|
+
def values_at(*names)
|
949
|
+
end
|
734
950
|
end
|
735
951
|
|
736
952
|
#
|
@@ -876,4 +1092,570 @@ module FireRuby
|
|
876
1092
|
def Generator.create(name, connection)
|
877
1093
|
end
|
878
1094
|
end
|
1095
|
+
|
1096
|
+
|
1097
|
+
#
|
1098
|
+
# This class represents a connection to the service manager for a Firebird
|
1099
|
+
# database server instance. NOTE: This class does not currently work on the
|
1100
|
+
# Mac OS X platform.
|
1101
|
+
#
|
1102
|
+
class ServiceManager
|
1103
|
+
#
|
1104
|
+
# This is the constructor for the ServiceManager class.
|
1105
|
+
#
|
1106
|
+
# ==== Parameters
|
1107
|
+
# host:: The name of the host supporting the service manager to be
|
1108
|
+
# connected with.
|
1109
|
+
#
|
1110
|
+
def initialize(host)
|
1111
|
+
end
|
1112
|
+
|
1113
|
+
|
1114
|
+
#
|
1115
|
+
# This method attaches a ServiceManager object to its host service. The
|
1116
|
+
# user name used to connect with can affect which services can be accessed
|
1117
|
+
# on the server.
|
1118
|
+
#
|
1119
|
+
# ==== Parameters
|
1120
|
+
# user:: A string containing the user name to connect with.
|
1121
|
+
# password:: A string containing the user password to connect with.
|
1122
|
+
#
|
1123
|
+
def connect(user, password)
|
1124
|
+
end
|
1125
|
+
|
1126
|
+
|
1127
|
+
#
|
1128
|
+
# This method disconnects a previously connected ServiceManager object.
|
1129
|
+
#
|
1130
|
+
def disconnect
|
1131
|
+
end
|
1132
|
+
|
1133
|
+
|
1134
|
+
#
|
1135
|
+
# This method is used to determine whether a ServiceManager object has
|
1136
|
+
# been connected.
|
1137
|
+
#
|
1138
|
+
def connected?
|
1139
|
+
end
|
1140
|
+
|
1141
|
+
|
1142
|
+
#
|
1143
|
+
# This method is used to batch execute a collection of task objects.
|
1144
|
+
#
|
1145
|
+
# ==== Parameters
|
1146
|
+
# tasks:: One or more task objects to be executed by the service manager.
|
1147
|
+
#
|
1148
|
+
# ==== Exceptions
|
1149
|
+
# FireRubyException:: Generated whenever this method is called on a
|
1150
|
+
# disconnected service manager or is a problem
|
1151
|
+
# occurs executing one of the tasks.
|
1152
|
+
#
|
1153
|
+
def execute(*tasks)
|
1154
|
+
end
|
1155
|
+
end
|
1156
|
+
|
1157
|
+
|
1158
|
+
#
|
1159
|
+
# This class represents a service manager task to add a new user to a
|
1160
|
+
# database instance. NOTE: This class does not currently work on the
|
1161
|
+
# Mac OS X platform.
|
1162
|
+
#
|
1163
|
+
class AddUser
|
1164
|
+
# Attribute accessor.
|
1165
|
+
attr_reader :user_name, :password, :first_name, :middle_name, :last_name
|
1166
|
+
|
1167
|
+
# Attribute mutator.
|
1168
|
+
attr_writer :user_name, :password, :first_name, :middle_name, :last_name
|
1169
|
+
|
1170
|
+
#
|
1171
|
+
# This is a constructor for the AddUser class.
|
1172
|
+
#
|
1173
|
+
# ==== Parameters
|
1174
|
+
# user_name:: A String containing the user name to be assigned to the
|
1175
|
+
# new user.
|
1176
|
+
# password:: A String containing the password to be assigned to the
|
1177
|
+
# new user.
|
1178
|
+
# first_name:: A String containing the first name to be associated with
|
1179
|
+
# the new user. Defaults to nil.
|
1180
|
+
# middle_name:: A String containing the middle name to be associated
|
1181
|
+
# with the new user. Defaults to nil.
|
1182
|
+
# last_name:: A String containing the last name to be associated with
|
1183
|
+
# the new user. Defaults to nil.
|
1184
|
+
#
|
1185
|
+
def initialize(user_name, password, firsts_name=nil, middle_name=nil,
|
1186
|
+
last_name=nil)
|
1187
|
+
end
|
1188
|
+
|
1189
|
+
|
1190
|
+
#
|
1191
|
+
# This method executes the add user task against a service manager.
|
1192
|
+
#
|
1193
|
+
# ==== Parameters
|
1194
|
+
# manager:: A reference to the ServiceManager object to execute the task
|
1195
|
+
# on.
|
1196
|
+
#
|
1197
|
+
# ==== Exceptions
|
1198
|
+
# FireRubyException:: Generated whenever a disconnected service manager
|
1199
|
+
# is specified or an error occurs executing the
|
1200
|
+
# task.
|
1201
|
+
#
|
1202
|
+
def execute(manager)
|
1203
|
+
end
|
1204
|
+
end
|
1205
|
+
|
1206
|
+
|
1207
|
+
#
|
1208
|
+
# This class represents a service manager task to remove an existing user
|
1209
|
+
# from a database instance. NOTE: This class does not currently work on the
|
1210
|
+
# Mac OS X platform.
|
1211
|
+
#
|
1212
|
+
class RemoveUser
|
1213
|
+
# Attribute accessor.
|
1214
|
+
attr_reader :user_name
|
1215
|
+
|
1216
|
+
# Attribute mutator.
|
1217
|
+
attr_writer :user_name
|
1218
|
+
|
1219
|
+
#
|
1220
|
+
# This is a constructor for the RemoveUser class.
|
1221
|
+
#
|
1222
|
+
# ==== Parameters
|
1223
|
+
# user_name:: A String containing the user name to be assigned to the
|
1224
|
+
# new user.
|
1225
|
+
#
|
1226
|
+
def initialize(user_name)
|
1227
|
+
end
|
1228
|
+
|
1229
|
+
|
1230
|
+
#
|
1231
|
+
# This method executes the remove user task against a service manager.
|
1232
|
+
#
|
1233
|
+
# ==== Parameters
|
1234
|
+
# manager:: A reference to the ServiceManager object to execute the task
|
1235
|
+
# on.
|
1236
|
+
#
|
1237
|
+
# ==== Exceptions
|
1238
|
+
# FireRubyException:: Generated whenever a disconnected service manager
|
1239
|
+
# is specified or an error occurs executing the
|
1240
|
+
# task.
|
1241
|
+
#
|
1242
|
+
def execute(manager)
|
1243
|
+
end
|
1244
|
+
end
|
1245
|
+
|
1246
|
+
|
1247
|
+
#
|
1248
|
+
# This class represents a service manager task to backup an existing database
|
1249
|
+
# on the Firebird server. NOTE: This class does not currently work on the
|
1250
|
+
# Mac OS X platform.
|
1251
|
+
#
|
1252
|
+
class Backup
|
1253
|
+
# Attribute accessor.
|
1254
|
+
attr_reader :backup_file, :database
|
1255
|
+
|
1256
|
+
# Attribute mutator.
|
1257
|
+
attr_writer :backup_file, :database
|
1258
|
+
|
1259
|
+
#
|
1260
|
+
# This is the constructor for the Backup class.
|
1261
|
+
#
|
1262
|
+
# ==== Parameters
|
1263
|
+
# database:: A String or File giving the path and name (relative to the
|
1264
|
+
# database server) of the main database file for the database
|
1265
|
+
# to be backed up.
|
1266
|
+
# file:: A String or File giving the path and name (relative to the
|
1267
|
+
# database server) of the back up file to be generated.
|
1268
|
+
#
|
1269
|
+
def initialize(database, file)
|
1270
|
+
end
|
1271
|
+
|
1272
|
+
|
1273
|
+
#
|
1274
|
+
# This method fetches the blocking factor to be used in generating the
|
1275
|
+
# back up. This will return nil until it has been explicitly set.
|
1276
|
+
#
|
1277
|
+
def blocking_factor
|
1278
|
+
end
|
1279
|
+
|
1280
|
+
|
1281
|
+
#
|
1282
|
+
# This method sets the blocking factor to be used in generating the
|
1283
|
+
# back up.
|
1284
|
+
#
|
1285
|
+
# ==== Parameters
|
1286
|
+
# size:: A reference to an integer containing the new back up blocking
|
1287
|
+
# factor setting.
|
1288
|
+
#
|
1289
|
+
def blocking_factor=(size)
|
1290
|
+
end
|
1291
|
+
|
1292
|
+
|
1293
|
+
#
|
1294
|
+
# This method fetches the ignore checksums setting for a Backup object.
|
1295
|
+
#
|
1296
|
+
def ignore_checksums
|
1297
|
+
end
|
1298
|
+
|
1299
|
+
|
1300
|
+
#
|
1301
|
+
# This method is used to set the indicator for whether checksum values
|
1302
|
+
# should be ignored in performing a backup.
|
1303
|
+
#
|
1304
|
+
# ==== Parameters
|
1305
|
+
# setting:: True to ignore checksums, false otherwise.
|
1306
|
+
#
|
1307
|
+
def ignore_checksums=(setting)
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
|
1311
|
+
#
|
1312
|
+
# This method fetches the ignore limbo setting for a Backup object.
|
1313
|
+
#
|
1314
|
+
def ignore_limbo
|
1315
|
+
end
|
1316
|
+
|
1317
|
+
|
1318
|
+
#
|
1319
|
+
# This method is used to set the indicator for whether limbo transactions
|
1320
|
+
# should be ignored in performing a backup.
|
1321
|
+
#
|
1322
|
+
# ==== Parameters
|
1323
|
+
# setting:: True to ignore limbo transactions, false otherwise.
|
1324
|
+
#
|
1325
|
+
def ignore_limbo=(setting)
|
1326
|
+
end
|
1327
|
+
|
1328
|
+
|
1329
|
+
#
|
1330
|
+
# This method fetches the metadata only setting for a Backup object.
|
1331
|
+
#
|
1332
|
+
def metadata_only
|
1333
|
+
end
|
1334
|
+
|
1335
|
+
|
1336
|
+
#
|
1337
|
+
# This method is used to set the indicator for whether a backup stores
|
1338
|
+
# only the database metadata.
|
1339
|
+
#
|
1340
|
+
# ==== Parameters
|
1341
|
+
# setting:: True to store only metadata, false otherwise.
|
1342
|
+
#
|
1343
|
+
def metadata_only=(setting)
|
1344
|
+
end
|
1345
|
+
|
1346
|
+
|
1347
|
+
#
|
1348
|
+
# This method fetches the garbage collect setting for a Backup object.
|
1349
|
+
#
|
1350
|
+
def garbage_collect
|
1351
|
+
end
|
1352
|
+
|
1353
|
+
|
1354
|
+
#
|
1355
|
+
# This method is used to set the indicator for whether the backup will
|
1356
|
+
# undertake garbage collection.
|
1357
|
+
#
|
1358
|
+
# ==== Parameters
|
1359
|
+
# setting:: True to perform garbage collection, false otherwise.
|
1360
|
+
#
|
1361
|
+
def garbage_collect=(setting)
|
1362
|
+
end
|
1363
|
+
|
1364
|
+
|
1365
|
+
#
|
1366
|
+
# This method fetches the non-transportable setting for a Backup object.
|
1367
|
+
#
|
1368
|
+
def non_transportable
|
1369
|
+
end
|
1370
|
+
|
1371
|
+
|
1372
|
+
#
|
1373
|
+
# This method is used to set the indicator for whether backup generated
|
1374
|
+
# by the task will be platform specific.
|
1375
|
+
#
|
1376
|
+
# ==== Parameters
|
1377
|
+
# setting:: True to generate a platform specific backup, false otherwise.
|
1378
|
+
#
|
1379
|
+
def non_transportable=(setting)
|
1380
|
+
end
|
1381
|
+
|
1382
|
+
|
1383
|
+
#
|
1384
|
+
# This method fetches the convert tables setting for a Backup object.
|
1385
|
+
#
|
1386
|
+
def convert_tables
|
1387
|
+
end
|
1388
|
+
|
1389
|
+
|
1390
|
+
#
|
1391
|
+
# This method is used to set the indicator for whether external tables
|
1392
|
+
# will be converted to internal tables as part of the backup.
|
1393
|
+
#
|
1394
|
+
# ==== Parameters
|
1395
|
+
# setting:: True to convert external tables, false otherwise.
|
1396
|
+
#
|
1397
|
+
def convert_tables=(setting)
|
1398
|
+
end
|
1399
|
+
|
1400
|
+
|
1401
|
+
#
|
1402
|
+
# This method is used to execute a backup task against a service manager.
|
1403
|
+
#
|
1404
|
+
# ==== Parameters
|
1405
|
+
# manager:: A reference to the service manager to execute the backup
|
1406
|
+
# task against.
|
1407
|
+
#
|
1408
|
+
# ==== Exceptions
|
1409
|
+
# FireRubyException:: Generated whenever a disconnected service manager
|
1410
|
+
# is specified or a problem occurs executing the
|
1411
|
+
# task.
|
1412
|
+
#
|
1413
|
+
def execute(manager)
|
1414
|
+
end
|
1415
|
+
|
1416
|
+
|
1417
|
+
#
|
1418
|
+
# This method fetches the log value for a Backup task. This value will
|
1419
|
+
# always be nil until the task has been executed. After a successful
|
1420
|
+
# execution the log value should contain output from the backup task
|
1421
|
+
# generated on the server.
|
1422
|
+
#
|
1423
|
+
def log
|
1424
|
+
end
|
1425
|
+
end
|
1426
|
+
|
1427
|
+
|
1428
|
+
#
|
1429
|
+
# This class represents a service manager task to restore a previously
|
1430
|
+
# created database backup on the Firebird server. NOTE: This class does not
|
1431
|
+
# currently work on the Mac OS X platform.
|
1432
|
+
#
|
1433
|
+
class Restore
|
1434
|
+
# Attribute accessor.
|
1435
|
+
attr_reader :backup_file, :database
|
1436
|
+
|
1437
|
+
# Attribute mutator.
|
1438
|
+
attr_writer :backup_file, :database
|
1439
|
+
|
1440
|
+
# Access mode constant definition.
|
1441
|
+
ACCESS_READ_ONLY = 39
|
1442
|
+
|
1443
|
+
# Access mode constant definition.
|
1444
|
+
ACCESS_READ_WRITE = 40
|
1445
|
+
|
1446
|
+
# Restore mode constant definition.
|
1447
|
+
MODE_CREATE = 0x1000
|
1448
|
+
|
1449
|
+
# Restore mode constant definition.
|
1450
|
+
MODE_REPLACE = 0x2000
|
1451
|
+
|
1452
|
+
#
|
1453
|
+
# This is the constructor for the Restore class.
|
1454
|
+
#
|
1455
|
+
# ==== Parameters
|
1456
|
+
# file:: A String or File containing the path and name (relative to
|
1457
|
+
# the server) of the backup file to be used in the restore.
|
1458
|
+
# database:: A String or File containing the path and name (relative to
|
1459
|
+
# the server) of the database file to be restored.
|
1460
|
+
#
|
1461
|
+
def initialize(file, database)
|
1462
|
+
end
|
1463
|
+
|
1464
|
+
|
1465
|
+
#
|
1466
|
+
# This method retrieves the cache buffers setting for a Restore object.
|
1467
|
+
# This will be nil until a value is actual set.
|
1468
|
+
#
|
1469
|
+
def cache_buffers
|
1470
|
+
end
|
1471
|
+
|
1472
|
+
|
1473
|
+
#
|
1474
|
+
# This method updates the cache buffers setting for a Restore object.
|
1475
|
+
#
|
1476
|
+
# ==== Parameters
|
1477
|
+
# setting:: The new value for the object setting. Should be an integer.
|
1478
|
+
#
|
1479
|
+
def cache_buffers=(setting)
|
1480
|
+
end
|
1481
|
+
|
1482
|
+
|
1483
|
+
#
|
1484
|
+
# This method retrieves the page size setting for a Restore object.
|
1485
|
+
# This will be nil until a value is actual set.
|
1486
|
+
#
|
1487
|
+
def page_size
|
1488
|
+
end
|
1489
|
+
|
1490
|
+
|
1491
|
+
#
|
1492
|
+
# This method updates the page size setting for a Restore object.
|
1493
|
+
#
|
1494
|
+
# ==== Parameters
|
1495
|
+
# setting:: The new value for the object setting. Should be an integer.
|
1496
|
+
#
|
1497
|
+
def page_size=(setting)
|
1498
|
+
end
|
1499
|
+
|
1500
|
+
|
1501
|
+
#
|
1502
|
+
# This method retrieves the access mode setting for a Restore object.
|
1503
|
+
# This will be nil until a value is actual set.
|
1504
|
+
#
|
1505
|
+
def access_mode
|
1506
|
+
end
|
1507
|
+
|
1508
|
+
|
1509
|
+
#
|
1510
|
+
# This method updates the access mode setting for a Restore object.
|
1511
|
+
#
|
1512
|
+
# ==== Parameters
|
1513
|
+
# setting:: The new value for the object setting. This should be one
|
1514
|
+
# of Restore::ACCESS_READ_ONLY or Restore::ACCESS_READ_WRITE.
|
1515
|
+
#
|
1516
|
+
def access_mode=(setting)
|
1517
|
+
end
|
1518
|
+
|
1519
|
+
|
1520
|
+
#
|
1521
|
+
# This method retrieves the build indices setting for a Restore object.
|
1522
|
+
#
|
1523
|
+
def build_indices
|
1524
|
+
end
|
1525
|
+
|
1526
|
+
|
1527
|
+
#
|
1528
|
+
# This method updates the build indices setting for a Restore object.
|
1529
|
+
# This value affects whether the various indexes for a database are
|
1530
|
+
# restored with the restore task.
|
1531
|
+
#
|
1532
|
+
# ==== Parameters
|
1533
|
+
# setting:: True to rebuild the database indices, false otherwise.
|
1534
|
+
#
|
1535
|
+
def build_indices=(setting)
|
1536
|
+
end
|
1537
|
+
|
1538
|
+
|
1539
|
+
#
|
1540
|
+
# This method retrieves the no shadows setting for a Restore object.
|
1541
|
+
#
|
1542
|
+
def no_shadows
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
|
1546
|
+
#
|
1547
|
+
# This method updates the no shadows setting for a Restore object.
|
1548
|
+
# This value affects whether shadow databases are recreated as part of a
|
1549
|
+
# restore.
|
1550
|
+
#
|
1551
|
+
# ==== Parameters
|
1552
|
+
# setting:: True to recreate shadow files, false otherwise.
|
1553
|
+
#
|
1554
|
+
def no_shadows=(setting)
|
1555
|
+
end
|
1556
|
+
|
1557
|
+
|
1558
|
+
#
|
1559
|
+
# This method retrieves the validity checks setting for a Restore object.
|
1560
|
+
#
|
1561
|
+
def check_validity
|
1562
|
+
end
|
1563
|
+
|
1564
|
+
|
1565
|
+
#
|
1566
|
+
# This method updates the validity checks setting for a Restore object.
|
1567
|
+
# This value affects whether the restore performs validity checks on the
|
1568
|
+
# database as it is restored.
|
1569
|
+
#
|
1570
|
+
# ==== Parameters
|
1571
|
+
# setting:: True to perform validity checks, false otherwise.
|
1572
|
+
#
|
1573
|
+
def check_validity=(setting)
|
1574
|
+
end
|
1575
|
+
|
1576
|
+
|
1577
|
+
#
|
1578
|
+
# This method retrieves the commit tables setting for a Restore object.
|
1579
|
+
#
|
1580
|
+
def commit_tables
|
1581
|
+
end
|
1582
|
+
|
1583
|
+
|
1584
|
+
#
|
1585
|
+
# This method updates the commit tables setting for a Restore object.
|
1586
|
+
# This value affects whether the restore commits tables as they are
|
1587
|
+
# restored.
|
1588
|
+
#
|
1589
|
+
# ==== Parameters
|
1590
|
+
# setting:: True to commit tables as they are restored, false otherwise.
|
1591
|
+
#
|
1592
|
+
def commit_tables=(setting)
|
1593
|
+
end
|
1594
|
+
|
1595
|
+
|
1596
|
+
#
|
1597
|
+
# This method retrieves the restore mode setting for a Restore object.
|
1598
|
+
#
|
1599
|
+
def restore_mode
|
1600
|
+
end
|
1601
|
+
|
1602
|
+
|
1603
|
+
#
|
1604
|
+
# This method updates the restore mode setting for a Restore object.
|
1605
|
+
# This value affects whether the restore will overwrite an existing
|
1606
|
+
# database.
|
1607
|
+
#
|
1608
|
+
# ==== Parameters
|
1609
|
+
# setting:: Either Restore::MODE_CREATE (default) or
|
1610
|
+
# Restore::MODE_REPLACE.
|
1611
|
+
#
|
1612
|
+
def restore_mode=(setting)
|
1613
|
+
end
|
1614
|
+
|
1615
|
+
|
1616
|
+
#
|
1617
|
+
# This method retrieves the use all space setting for a Restore object.
|
1618
|
+
#
|
1619
|
+
def use_all_space
|
1620
|
+
end
|
1621
|
+
|
1622
|
+
|
1623
|
+
#
|
1624
|
+
# This method updates the use all space setting for a Restore object.
|
1625
|
+
# This value affects whether restore leaves space within the database
|
1626
|
+
# file for expansion. This can be switched on for read only databases.
|
1627
|
+
#
|
1628
|
+
# ==== Parameters
|
1629
|
+
# setting:: True leave no default expansion space within the restored
|
1630
|
+
# database file, false otherwise.
|
1631
|
+
#
|
1632
|
+
def use_all_space=(setting)
|
1633
|
+
end
|
1634
|
+
|
1635
|
+
|
1636
|
+
#
|
1637
|
+
# This method is used to execute a restore task against a service manager.
|
1638
|
+
#
|
1639
|
+
# ==== Parameters
|
1640
|
+
# manager:: A reference to the service manager to execute the restore
|
1641
|
+
# task against.
|
1642
|
+
#
|
1643
|
+
# ==== Exceptions
|
1644
|
+
# FireRubyException:: Generated whenever a disconnected service manager
|
1645
|
+
# is specified or a problem occurs executing the
|
1646
|
+
# task.
|
1647
|
+
#
|
1648
|
+
def execute(manager)
|
1649
|
+
end
|
1650
|
+
|
1651
|
+
|
1652
|
+
#
|
1653
|
+
# This method fetches the log value for a Restore task. This value will
|
1654
|
+
# always be nil until the task has been executed. After a successful
|
1655
|
+
# execution the log value should contain output from the restore task
|
1656
|
+
# generated on the server.
|
1657
|
+
#
|
1658
|
+
def log
|
1659
|
+
end
|
1660
|
+
end
|
879
1661
|
end
|