-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathtypes.py
More file actions
1530 lines (1371 loc) · 37.5 KB
/
types.py
File metadata and controls
1530 lines (1371 loc) · 37.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SPDX-FileCopyrightText: 2020-present The Firebird Projects <www.firebirdsql.org>
#
# SPDX-License-Identifier: MIT
#
# PROGRAM/MODULE: firebird-driver
# FILE: firebird/driver/types.py
# DESCRIPTION: Types for Firebird driver
# CREATED: 4.3.2020
#
# The contents of this file are subject to the MIT License
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Copyright (c) 2020 Firebird Project (www.firebirdsql.org)
# All Rights Reserved.
#
# Contributor(s): Pavel Císař (original code)
# ______________________________________
"""firebird-driver - Types for Firebird driver
This module defines DB-API 2.0 exceptions, Firebird-specific constants (enums and flags),
data structures (dataclasses), type objects, and type hints used throughout the driver.
"""
from __future__ import annotations
import datetime
import decimal
import time
from collections.abc import Callable
from dataclasses import dataclass, field
from enum import Enum, IntEnum, IntFlag
from pathlib import Path
from typing import Protocol
from dateutil import tz
from firebird.base.types import Error
# Exceptions required by Python Database API 2.0
class InterfaceError(Error):
"""Exception raised for errors that are reported by the driver rather than
the Firebird itself.
"""
class DatabaseError(Error):
"""Exception raised for all errors reported by Firebird.
"""
#: Returned SQLSTATE or None
sqlstate: str = None
#: Returned SQLCODE or None
sqlcode: int = None
#: Tuple with all returned GDS error codes
gds_codes: tuple[int] = ()
class DataError(DatabaseError):
"""Exception raised for errors that are due to problems with the processed
data like division by zero, numeric value out of range, etc.
Note:
This exception class exists for DB-API 2.0 compatibility. The driver typically raises
the base DatabaseError with specific Firebird codes, rather than this specialized
subclass directly.
"""
class OperationalError(DatabaseError):
"""Exception raised for errors that are related to the database's operation
and not necessarily under the control of the programmer, e.g. an unexpected
disconnect occurs, the data source name is not found, a transaction could not
be processed, a memory allocation error occurred during processing, etc.
Note:
This exception class exists for DB-API 2.0 compatibility. The driver typically raises
the base DatabaseError with specific Firebird codes, rather than this specialized
subclass directly.
"""
class IntegrityError(DatabaseError):
"""Exception raised when the relational integrity of the database is affected,
e.g. a foreign key check fails.
Important:
This exceptions is never directly thrown by Firebird driver.
"""
class InternalError(DatabaseError):
"""Exception raised when the database encounters an internal error, e.g. the
cursor is not valid anymore, the transaction is out of sync, etc.
Important:
This exceptions is never directly thrown by Firebird driver.
"""
class ProgrammingError(DatabaseError):
"""Exception raised for programming errors, e.g. table not found or already
exists, syntax error in the SQL statement, wrong number of parameters specified,
etc.
Important:
This exceptions is never directly thrown by Firebird driver.
"""
class NotSupportedError(DatabaseError):
"""Exception raised in case a method or database API was used which is not
supported by the database.
"""
# Firebird engine warning via Python Warning mechanism
class FirebirdWarning(UserWarning):
"""Warning from Firebird engine.
The important difference from `Warning` class is that `FirebirdWarning` accepts keyword
arguments, that are stored into instance attributes with the same name.
Important:
Attribute lookup on this class never fails, as all attributes that are not actually
set, have `None` value.
Example::
try:
if condition:
raise FirebirdWarning("Error message", err_code=1)
else:
raise FirebirdWarning("Unknown error")
except FirebirdWarning as e:
if e.err_code is None:
...
elif e.err_code == 1:
...
"""
def __init__(self, *args, **kwargs):
super().__init__(*args)
for name, value in kwargs.items():
setattr(self, name, value)
def __getattr__(self, name):
return None
# Enums
class NetProtocol(IntEnum):
"""Network protocol options available for connection.
"""
XNET = 1
INET = 2
INET4 = 3
WNET = 4
class DirectoryCode(IntEnum):
"""IConfigManager directory codes.
"""
DIR_BIN = 0
DIR_SBIN = 1
DIR_CONF = 2
DIR_LIB = 3
DIR_INC = 4
DIR_DOC = 5
DIR_UDF = 6
DIR_SAMPLE = 7
DIR_SAMPLEDB = 8
DIR_HELP = 9
DIR_INTL = 10
DIR_MISC = 11
DIR_SECDB = 12
DIR_MSG = 13
DIR_LOG = 14
DIR_GUARD = 15
DIR_PLUGINS = 16
DIR_TZDATA = 17 # >>> Firebird 4
class XpbKind(IntEnum):
"""Xpb builder kinds.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
DPB = 1
SPB_ATTACH = 2
SPB_START = 3
TPB = 4
# Firebird 4 and 3.0.6+
BATCH = 5
BPB = 6
SPB_SEND = 7
SPB_RECEIVE = 8
SPB_RESPONSE = 9
class StateResult(IntEnum):
"""IState result codes.
"""
ERROR = -1
OK = 0
NO_DATA = 1
SEGMENT = 2
class PageSize(IntEnum):
"""Supported database page sizes.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
PAGE_4K = 4096
PAGE_8K = 8192
PAGE_16K = 16384
PAGE_32K = 32768 # Firebird 4
class DBKeyScope(IntEnum):
"""Scope of DBKey context.
"""
TRANSACTION = 0
ATTACHMENT = 1
class InfoItemType(IntEnum):
"""Data type of information item.
"""
BYTE = 1
INTEGER = 2
BIGINT = 3
BYTES = 4
RAW_BYTES = 5
STRING = 6
class SrvInfoCode(IntEnum):
"""Service information (isc_info_svc_*) codes.
"""
SRV_DB_INFO = 50
#GET_CONFIG = 53
VERSION = 54
SERVER_VERSION = 55
IMPLEMENTATION = 56
CAPABILITIES = 57
USER_DBPATH = 58
GET_ENV = 59
GET_ENV_LOCK = 60
GET_ENV_MSG = 61
LINE = 62
TO_EOF = 63
TIMEOUT = 64
LIMBO_TRANS = 66
RUNNING = 67
GET_USERS = 68
AUTH_BLOCK = 69
STDIN = 78
class BlobInfoCode(IntEnum):
"""BLOB information (isc_info_blob_*) codes.
"""
NUM_SEGMENTS = 4
MAX_SEGMENT = 5
TOTAL_LENGTH = 6
TYPE = 7
class DbInfoCode(IntEnum):
"""Database information codes, corresponding to the isc_info_* constants used for
database-level information requests.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
DB_ID = 4
READS = 5
WRITES = 6
FETCHES = 7
MARKS = 8
IMPLEMENTATION_OLD = 11
VERSION = 12
BASE_LEVEL = 13
PAGE_SIZE = 14
NUM_BUFFERS = 15
LIMBO = 16
CURRENT_MEMORY = 17
MAX_MEMORY = 18
# Obsolete 19-20
ALLOCATION = 21
ATTACHMENT_ID = 22
READ_SEQ_COUNT = 23
READ_IDX_COUNT = 24
INSERT_COUNT = 25
UPDATE_COUNT = 26
DELETE_COUNT = 27
BACKOUT_COUNT = 28
PURGE_COUNT = 29
EXPUNGE_COUNT = 30
SWEEP_INTERVAL = 31
ODS_VERSION = 32
ODS_MINOR_VERSION = 33
NO_RESERVE = 34
# Obsolete 35-51
FORCED_WRITES = 52
USER_NAMES = 53
PAGE_ERRORS = 54
RECORD_ERRORS = 55
BPAGE_ERRORS = 56
DPAGE_ERRORS = 57
IPAGE_ERRORS = 58
PPAGE_ERRORS = 59
TPAGE_ERRORS = 60
SET_PAGE_BUFFERS = 61
DB_SQL_DIALECT = 62
DB_READ_ONLY = 63
DB_SIZE_IN_PAGES = 64
# Values 65 -100 unused to avoid conflict with InterBase
ATT_CHARSET = 101
DB_CLASS = 102
FIREBIRD_VERSION = 103
OLDEST_TRANSACTION = 104
OLDEST_ACTIVE = 105
OLDEST_SNAPSHOT = 106
NEXT_TRANSACTION = 107
DB_PROVIDER = 108
ACTIVE_TRANSACTIONS = 109
ACTIVE_TRAN_COUNT = 110
CREATION_DATE = 111
DB_FILE_SIZE = 112
PAGE_CONTENTS = 113
IMPLEMENTATION = 114
PAGE_WARNS = 115
RECORD_WARNS = 116
BPAGE_WARNS = 117
DPAGE_WARNS = 118
IPAGE_WARNS = 119
PPAGE_WARNS = 120
TPAGE_WARNS = 121
PIP_ERRORS = 122
PIP_WARNS = 123
PAGES_USED = 124
PAGES_FREE = 125
SES_IDLE_TIMEOUT_DB = 129 # Firebird 4
SES_IDLE_TIMEOUT_ATT = 130 # Firebird 4
SES_IDLE_TIMEOUT_RUN = 131 # Firebird 4
CONN_FLAGS = 132
CRYPT_KEY = 133
CRYPT_STATE = 134
# Firebird 4
STMT_TIMEOUT_DB = 135
STMT_TIMEOUT_ATT = 136
PROTOCOL_VERSION = 137
CRYPT_PLUGIN = 138
CREATION_TIMESTAMP_TZ = 139
WIRE_CRYPT = 140
FEATURES = 141
NEXT_ATTACHMENT = 142
NEXT_STATEMENT = 143
DB_GUID = 144
DB_FILE_ID = 145
REPLICA_MODE = 146
USER_NAME = 147
SQL_ROLE = 148
class Features(IntEnum):
"""Firebird features (Response to DbInfoCode.FEATURES).
"""
MULTI_STATEMENTS = 1 # Multiple prepared statements in single attachment
MULTI_TRANSACTIONS = 2 # Multiple concurrent transaction in single attachment
NAMED_PARAMETERS = 3 # Query parameters can be named
SESSION_RESET = 4 # ALTER SESSION RESET is supported
READ_CONSISTENCY = 5 # Read consistency TIL is supported
STATEMENT_TIMEOUT = 6 # Statement timeout is supported
STATEMENT_LONG_LIFE = 7 # Prepared statements are not dropped on transaction end
class ReplicaMode(IntEnum):
"""Replica modes. Response to DbInfoCode.REPLICA_MODE or as value for
DPBItem.SET_DB_REPLICA.
"""
NONE = 0
READ_ONLY = 1
READ_WRITE = 2
class StmtInfoCode(IntEnum):
"""Statement information (isc_info_sql_*) codes.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
STMT_TYPE = 21
GET_PLAN = 22
RECORDS = 23
BATCH_FETCH = 24
EXPLAIN_PLAN = 26
FLAGS = 27
# Firebird 4
TIMEOUT_USER = 28
TIMEOUT_RUN = 29
BLOB_ALIGN = 30
# Firebird 5
EXEC_PATH_BLR_BYTES = 31
EXEC_PATH_BLR_TEXT = 32
class ReqInfoCode(IntEnum):
"""Request information (isc_info_*) codes.
"""
NUMBER_MESSAGES = 4
MAX_MESSAGE = 5
MAX_SEND = 6
MAX_RECEIVE = 7
INFO_STATE = 8
MESSAGE_NUMBER = 9
MESSAGE_SIZE = 10
REQUEST_COST = 11
ACCESS_PATH = 12
SELECT_COUNT = 13
INSERT_COUNT = 14
UPDATE_COUNT = 15
DELETE_COUNT = 16
class ReqState(IntEnum):
"""Request states(isc_info_req_*) codes.
"""
ACTIVE = 2
INACTIVE = 3
SEND = 4
RECEIVE = 5
SELECT = 6
SQL_STALL = 7
class ResultSetInfoCode(IntEnum):
"""Result set information codes.
"""
RECORD_COUNT = 10
class TraInfoCode(IntEnum):
"""Transaction information (isc_info_tra_*) codes.
"""
ID = 4
OLDEST_INTERESTING = 5
OLDEST_SNAPSHOT = 6
OLDEST_ACTIVE = 7
ISOLATION = 8
ACCESS = 9
LOCK_TIMEOUT = 10
DBPATH = 11
SNAPSHOT_NUMBER = 12
class TraInfoIsolation(IntEnum):
"""Transaction isolation response.
"""
CONSISTENCY = 1
CONCURRENCY = 2
READ_COMMITTED = 3
class TraInfoReadCommitted(IntEnum):
"""Transaction isolation Read Committed response.
"""
NO_RECORD_VERSION = 0
RECORD_VERSION = 1
READ_CONSISTENCY = 2 # Firebird 4
class TraInfoAccess(IntEnum):
"""Transaction isolation access mode response.
"""
READ_ONLY = 0
READ_WRITE = 1
class TraAccessMode(IntEnum):
"""Transaction Access Mode TPB parameters.
"""
READ = 8
WRITE = 9
class TraIsolation(IntEnum):
"""Transaction Isolation TPB paremeters.
"""
CONSISTENCY = 1
CONCURRENCY = 2
READ_COMMITTED = 15
class TraReadCommitted(IntEnum):
"""Read Committed Isolation TPB paremeters.
"""
RECORD_VERSION = 17
NO_RECORD_VERSION = 18
READ_CONSISTENCY = 22
class Isolation(IntEnum):
"""Transaction Isolation TPB parameters.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
READ_COMMITTED = -1
SERIALIZABLE = 1
SNAPSHOT = 2
READ_COMMITTED_NO_RECORD_VERSION = 3
READ_COMMITTED_RECORD_VERSION = 4
READ_COMMITTED_READ_CONSISTENCY = 5 # Firebird 4
# Aliases
REPEATABLE_READ = SNAPSHOT
CONCURRENCY = SNAPSHOT
CONSISTENCY = SERIALIZABLE
class TraLockResolution(IntEnum):
"""Transaction Lock resolution TPB parameters.
"""
WAIT = 6
NO_WAIT = 7
class TableShareMode(IntEnum):
"""Transaction table share mode TPB parameters.
"""
SHARED = 3
PROTECTED = 4
EXCLUSIVE = 5
class TableAccessMode(IntEnum):
"""Transaction Access Mode TPB parameters.
"""
LOCK_READ = 10
LOCK_WRITE = 11
class DefaultAction(IntEnum):
"""Default action when transaction is ended automatically.
"""
COMMIT = 1
ROLLBACK = 2
class StatementType(IntEnum):
"""Statement type.
"""
SELECT = 1
INSERT = 2
UPDATE = 3
DELETE = 4
DDL = 5
GET_SEGMENT = 6
PUT_SEGMENT = 7
EXEC_PROCEDURE = 8
START_TRANS = 9
COMMIT = 10
ROLLBACK = 11
SELECT_FOR_UPD = 12
SET_GENERATOR = 13
SAVEPOINT = 14
class SQLDataType(IntEnum):
"""SQL data type.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
TEXT = 452
VARYING = 448
SHORT = 500
LONG = 496
FLOAT = 482
DOUBLE = 480
D_FLOAT = 530
TIMESTAMP = 510
BLOB = 520
ARRAY = 540
QUAD = 550
TIME = 560
DATE = 570
INT64 = 580
TIMESTAMP_TZ_EX = 32748 # Firebird 4
TIME_TZ_EX = 32750 # Firebird 4
INT128 = 32752 # Firebird 4
TIMESTAMP_TZ = 32754 # Firebird 4
TIME_TZ = 32756 # Firebird 4
DEC16 = 32760 # Firebird 4
DEC34 = 32762 # Firebird 4
BOOLEAN = 32764
NULL = 32766
class DPBItem(IntEnum):
"""Database Parameter Buffer (DPB) items, corresponding to isc_dpb_* constants (using VERSION2 codes).
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
PAGE_SIZE = 4
NUM_BUFFERS = 5
DBKEY_SCOPE = 13
NO_GARBAGE_COLLECT = 16
SWEEP_INTERVAL = 22
FORCE_WRITE = 24
NO_RESERVE = 27
USER_NAME = 28
PASSWORD = 29
LC_CTYPE = 48
RESERVED = 53
OVERWRITE = 54
CONNECT_TIMEOUT = 57
DUMMY_PACKET_INTERVAL = 58
SQL_ROLE_NAME = 60
SET_PAGE_BUFFERS = 61
WORKING_DIRECTORY = 62
SQL_DIALECT = 63
SET_DB_READONLY = 64
SET_DB_SQL_DIALECT = 65
SET_DB_CHARSET = 68
ADDRESS_PATH = 70
PROCESS_ID = 71
NO_DB_TRIGGERS = 72
TRUSTED_AUTH = 73
PROCESS_NAME = 74
TRUSTED_ROLE = 75
ORG_FILENAME = 76
UTF8_FILENAME = 77
EXT_CALL_DEPTH = 78
AUTH_BLOCK = 79
CLIENT_VERSION = 80
REMOTE_PROTOCOL = 81
HOST_NAME = 82
OS_USER = 83
SPECIFIC_AUTH_DATA = 84
AUTH_PLUGIN_LIST = 85
AUTH_PLUGIN_NAME = 86
CONFIG = 87
NOLINGER = 88
RESET_ICU = 89
MAP_ATTACH = 90
# Firebird 4
SESSION_TIME_ZONE = 91
SET_DB_REPLICA = 92
SET_BIND = 93
DECFLOAT_ROUND = 94
DECFLOAT_TRAPS = 95
CLEAR_MAP = 96
# Firebird 5
UPGRADE_DB = 97
PARALLEL_WORKERS = 100
WORKER_ATTACH = 101
class TPBItem(IntEnum):
"""Transaction Parameter Buffer (DPB) items, corresponding to isc_tpb_* constants.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
VERSION3 = 3
IGNORE_LIMBO = 14
AUTOCOMMIT = 16
NO_AUTO_UNDO = 20
LOCK_TIMEOUT = 21
# Firebird 4
READ_CONSISTENCY = 22
AT_SNAPSHOT_NUMBER = 23
class SPBItem(IntEnum):
"""isc_spb_* items.
"""
USER_NAME = 28
PASSWORD = 29
CONNECT_TIMEOUT = 57
DUMMY_PACKET_INTERVAL = 58
SQL_ROLE_NAME = 60
COMMAND_LINE = 105
DBNAME = 106
VERBOSE = 107
OPTIONS = 108
TRUSTED_AUTH = 111
TRUSTED_ROLE = 113
VERBINT = 114
AUTH_BLOCK = 115
AUTH_PLUGIN_NAME = 116
AUTH_PLUGIN_LIST = 117
UTF8_FILENAME = 118
CONFIG = 123
EXPECTED_DB = 124
class BPBItem(IntEnum):
"""isc_bpb_* items.
"""
SOURCE_TYPE = 1
TARGET_TYPE = 2
TYPE = 3
SOURCE_INTERP = 4
TARGET_INTERP = 5
FILTER_PARAMETER = 6
STORAGE = 7
class BlobType(IntEnum):
"""Blob type.
"""
SEGMENTED = 0x0
STREAM = 0x1
class BlobStorage(IntEnum):
"""Blob storage.
"""
MAIN = 0x0
TEMP = 0x2
class ServerAction(IntEnum):
"""isc_action_svc_* items.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
BACKUP = 1
RESTORE = 2
REPAIR = 3
ADD_USER = 4
DELETE_USER = 5
MODIFY_USER = 6
DISPLAY_USER = 7
PROPERTIES = 8
DB_STATS = 11
GET_FB_LOG = 12
NBAK = 20
NREST = 21
TRACE_START = 22
TRACE_STOP = 23
TRACE_SUSPEND = 24
TRACE_RESUME = 25
TRACE_LIST = 26
SET_MAPPING = 27
DROP_MAPPING = 28
DISPLAY_USER_ADM = 29
VALIDATE = 30
NFIX = 31 # Firebird 4
class SrvDbInfoOption(IntEnum):
"""Parameters for SvcInfoCode.SRV_DB_INFO.
"""
ATT = 5
DB = 6
class SrvRepairOption(IntEnum):
"""Parameters for ServerAction.REPAIR.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
COMMIT_TRANS = 15
ROLLBACK_TRANS = 34
RECOVER_TWO_PHASE = 17
TRA_ID = 18
SINGLE_TRA_ID = 19
MULTI_TRA_ID = 20
TRA_STATE = 21
TRA_STATE_LIMBO = 22
TRA_STATE_COMMIT = 23
TRA_STATE_ROLLBACK = 24
TRA_STATE_UNKNOWN = 25
TRA_HOST_SITE = 26
TRA_REMOTE_SITE = 27
TRA_DB_PATH = 28
TRA_ADVISE = 29
TRA_ADVISE_COMMIT = 30
TRA_ADVISE_ROLLBACK = 31
TRA_ADVISE_UNKNOWN = 33
TRA_ID_64 = 46
SINGLE_TRA_ID_64 = 47
MULTI_TRA_ID_64 = 48
COMMIT_TRANS_64 = 49
ROLLBACK_TRANS_64 = 50
RECOVER_TWO_PHASE_64 = 51
PARALLEL_WORKERS = 52 # Firebird 5
class SrvBackupOption(IntEnum):
"""Parameters for ServerAction.BACKUP.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
FILE = 5
FACTOR = 6
LENGTH = 7
SKIP_DATA = 8
STAT = 15
# Firebird 4
KEYHOLDER = 16
KEYNAME = 17
CRYPT = 18
INCLUDE_DATA = 19
PARALLEL_WORKERS = 21 # Firebird 5
class SrvRestoreOption(IntEnum):
"""Parameters for ServerAction.RESTORE.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
FILE = 5
SKIP_DATA = 8
BUFFERS = 9
PAGE_SIZE = 10
LENGTH = 11
ACCESS_MODE = 12
FIX_FSS_DATA = 13
FIX_FSS_METADATA = 14
STAT = 15
# Firebird 4
KEYHOLDER = 16
KEYNAME = 17
CRYPT = 18
INCLUDE_DATA = 19
REPLICA_MODE = 20
PARALLEL_WORKERS = 21 # Firebird 5
class SrvNBackupOption(IntEnum):
"""Parameters for ServerAction.NBAK.
Note:
Some members are specific to certain Firebird versions, indicated by comments.
"""
LEVEL = 5
FILE = 6
DIRECT = 7
GUID = 8 # Firebird 4
# Firebird 5
CLEAN_HISTORY = 9
KEEP_DAYS = 10
KEEP_ROWS = 11
class SrvTraceOption(IntEnum):
"""Parameters for ServerAction.TRACE_*.
"""
ID = 1
NAME = 2
CONFIG = 3
class SrvPropertiesOption(IntEnum):
"""Parameters for ServerAction.PROPERTIES.
"""
PAGE_BUFFERS = 5
SWEEP_INTERVAL = 6
SHUTDOWN_DB = 7
DENY_NEW_ATTACHMENTS = 9
DENY_NEW_TRANSACTIONS = 10
RESERVE_SPACE = 11
WRITE_MODE = 12
ACCESS_MODE = 13
SET_SQL_DIALECT = 14
FORCE_SHUTDOWN = 41
ATTACHMENTS_SHUTDOWN = 42
TRANSACTIONS_SHUTDOWN = 43
SHUTDOWN_MODE = 44
ONLINE_MODE = 45
REPLICA_MODE = 46 # Firebird 4
class SrvValidateOption(IntEnum):
"""Parameters for ServerAction.VALIDATE.
"""
INCLUDE_TABLE = 1
EXCLUDE_TABLE = 2
INCLUDE_INDEX = 3
EXCLUDE_INDEX = 4
LOCK_TIMEOUT = 5
class SrvUserOption(IntEnum):
"""Parameters for ServerAction.ADD_USER|DELETE_USER|MODIFY_USER|DISPLAY_USER.
"""
USER_ID = 5
GROUP_ID = 6
USER_NAME = 7
PASSWORD = 8
GROUP_NAME = 9
FIRST_NAME = 10
MIDDLE_NAME = 11
LAST_NAME = 12
ADMIN = 13
class DbAccessMode(IntEnum):
"""Values for isc_spb_prp_access_mode.
"""
READ_ONLY = 39
READ_WRITE = 40
class DbSpaceReservation(IntEnum):
"""Values for isc_spb_prp_reserve_space.
"""
USE_FULL = 35
RESERVE = 36
class DbWriteMode(IntEnum):
"""Values for isc_spb_prp_write_mode.
"""
ASYNC = 37
SYNC = 38
class ShutdownMode(IntEnum):
"""Values for isc_spb_prp_shutdown_mode.
"""
NORMAL = 0
MULTI = 1
SINGLE = 2
FULL = 3
class OnlineMode(IntEnum):
"""Values for isc_spb_prp_online_mode.
"""
NORMAL = 0
MULTI = 1
SINGLE = 2
class ShutdownMethod(IntEnum):
"""Database shutdown method options.
"""
FORCED = 41
DENY_ATTACHMENTS = 42
DENY_TRANSACTIONS = 43
class TransactionState(IntEnum):
"""Transaction state.
"""
UNKNOWN = 0
COMMIT = 1
ROLLBACK = 2
LIMBO = 3
class DbProvider(IntEnum):
"""Database Providers.
"""
RDB_ELN = 1
RDB_VMS = 2
INTERBASE = 3
FIREBIRD = 4
class DbClass(IntEnum):
"""Database Classes.
"""
UNKNOWN = 0
ACCESS_METHOD = 1
Y_VALVE = 2
REMOTE_INTERFACE = 3
REMOTE_SERVER = 4
PIPE_INTERFACE = 7
PIPE_SERVER = 8
CENTRAL_INTERFACE = 9
CENTRAL_SERVER = 10
GATEWAY = 11
CLASSIC_SERVER = 12
SUPER_SERVER = 13
SERVER_ACCESS = 14
class Implementation(IntEnum):
"""Implementation - Legacy format.
"""
RDB_VMS = 1
RDB_ELN = 2
RDB_ELN_DEV = 3
RDB_VMS_Y = 4
RDB_ELN_Y = 5
JRI = 6
JSV = 7
ISC_APL_68K = 25
ISC_VAX_ULTR = 26
ISC_VMS = 27
ISC_SUN_68K = 28
ISC_OS2 = 29
ISC_SUN4 = 30
ISC_HP_UX = 31
ISC_SUN_386I = 32
ISC_VMS_ORCL = 33
ISC_MAC_AUX = 34
ISC_RT_AIX = 35
ISC_MIPS_ULT = 36
ISC_XENIX = 37
ISC_DG = 38
ISC_HP_MPEXL = 39
ISC_HP_UX68K = 40
ISC_SGI = 41
ISC_SCO_UNIX = 42
ISC_CRAY = 43
ISC_IMP = 44
ISC_DELTA = 45
ISC_NEXT = 46
ISC_DOS = 47
M88K = 48
UNIXWARE = 49
ISC_WINNT_X86 = 50
ISC_EPSON = 51
ALPHA_OSF = 52
ALPHA_VMS = 53
NETWARE_386 = 54
WIN_ONLY = 55
NCR_3000 = 56
WINNT_PPC = 57
DG_X86 = 58
SCO_EV = 59
I386 = 60
FREEBSD = 61
NETBSD = 62
DARWIN_PPC = 63
SINIXZ = 64
LINUX_SPARC = 65
LINUX_AMD64 = 66
FREEBSD_AMD64 = 67