firebird.driver.types

Exceptions

Next exceptions are required by Python DB API 2.0

Error

Imported from firebird.base.types.

exception firebird.driver.types.Error(*args, **kwargs)

Bases: Exception

Exception that is intended to be used as a base class of all application-related errors. The important difference from Exception class is that Error 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 Error("Error message", err_code=1)
    else:
        raise Error("Unknown error")
except Error as e:
    if e.err_code is None:
        ...
    elif e.err_code == 1:
        ...

Note

Warnings are not considered errors and thus should not use this class as base.

InterfaceError

exception firebird.driver.types.InterfaceError(*args, **kwargs)

Bases: firebird.base.types.Error

Exception raised for errors that are reported by the driver rather than the Firebird itself.

DatabaseError

exception firebird.driver.types.DatabaseError(*args, **kwargs)

Bases: firebird.base.types.Error

Exception raised for all errors reported by Firebird.

gds_codes: Tuple[int] = ()

Tuple with all returned GDS error codes

sqlcode: int = None

Returned SQLCODE or None

sqlstate: str = None

Returned SQLSTATE or None

DataError

exception firebird.driver.types.DataError(*args, **kwargs)

Bases: firebird.driver.types.DatabaseError

Exception raised for errors that are due to problems with the processed data like division by zero, numeric value out of range, etc.

Important

This exceptions is never directly thrown by Firebird driver.

OperationalError

exception firebird.driver.types.OperationalError(*args, **kwargs)

Bases: firebird.driver.types.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.

Important

This exceptions is never directly thrown by Firebird driver.

IntegrityError

exception firebird.driver.types.IntegrityError(*args, **kwargs)

Bases: firebird.driver.types.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.

InternalError

exception firebird.driver.types.InternalError(*args, **kwargs)

Bases: firebird.driver.types.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.

ProgrammingError

exception firebird.driver.types.ProgrammingError(*args, **kwargs)

Bases: firebird.driver.types.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.

NotSupportedError

exception firebird.driver.types.NotSupportedError(*args, **kwargs)

Bases: firebird.driver.types.DatabaseError

Exception raised in case a method or database API was used which is not supported by the database

Important

This exceptions is never directly thrown by Firebird driver.

This is the exception inheritance layout:

StandardError
|__Warning
|__Error
    |__InterfaceError
    |__DatabaseError
        |__DataError
        |__OperationalError
        |__IntegrityError
        |__InternalError
        |__ProgrammingError
        |__NotSupportedError

Other constants and types required by Python DB API 2.0 specification

Globals

firebird.driver.types.apilevel: str = '2.0'

String constant stating the supported DB API level.

firebird.driver.types.threadsafety: int = 1

Integer constant stating the level of thread safety the interface supports. Curretly 1 = Threads may share the module, but not connections.

firebird.driver.types.paramstyle: str = 'qmark'

String constant stating the type of parameter marker formatting expected by the interface. 'qmark' = Question mark style, e.g. ‘…WHERE name=?’

Helper constants for work with Cursor.description content

  • DESCRIPTION_NAME

  • DESCRIPTION_TYPE_CODE

  • DESCRIPTION_DISPLAY_SIZE

  • DESCRIPTION_INTERNAL_SIZE

  • DESCRIPTION_PRECISION

  • DESCRIPTION_SCALE

  • DESCRIPTION_NULL_OK

Types

firebird.driver.types.STRING = <firebird.driver.types.DBAPITypeObject object>

This type object is used to describe columns in a database that are string-based (e.g. CHAR).

firebird.driver.types.BINARY = <firebird.driver.types.DBAPITypeObject object>

This type object is used to describe (long) binary columns in a database (e.g. LONG, RAW, BLOBs).

firebird.driver.types.NUMBER = <firebird.driver.types.DBAPITypeObject object>

This type object is used to describe numeric columns in a database.

firebird.driver.types.DATETIME = <firebird.driver.types.DBAPITypeObject object>

This type object is used to describe date/time columns in a database.

firebird.driver.types.ROWID = <firebird.driver.types.DBAPITypeObject object>

This type object is used to describe the “Row ID” column in a database.

Constructors for data types

firebird.driver.types.Date = <class 'datetime.date'>

This callable constructs an object holding a date value.

firebird.driver.types.Time = <class 'datetime.time'>

This callable constructs an object holding a time value.

firebird.driver.types.Timestamp = <class 'datetime.datetime'>

This callable constructs an object holding a time stamp value.

firebird.driver.types.DateFromTicks(ticks)

Constructs an object holding a date value from the given ticks value (number of seconds since the epoch).

Return type

date

firebird.driver.types.TimeFromTicks(ticks)

Constructs an object holding a time value from the given ticks value (number of seconds since the epoch).

Return type

time

firebird.driver.types.TimestampFromTicks(ticks)

Constructs an object holding a time stamp value from the given ticks value (number of seconds since the epoch).

Return type

datetime

firebird.driver.types.Binary = <class 'memoryview'>

This callable constructs an object capable of holding a binary (long) string value.

Types for type hints

firebird.driver.types.DESCRIPTION = typing.Tuple[str, type, int, int, int, int, bool]

DB API 2.0 Cursor DESCRIPTION

firebird.driver.types.CB_OUTPUT_LINE = typing.Callable[[str], NoneType]

Callback that accepts line of text output

class firebird.driver.types.Transactional(*args, **kwds)

Bases: typing.Protocol

Protocol type for object that supports transactional processing.

begin(tpb=None)

Begin transaction.

Return type

None

commit(*, retaining=False)

Commit transaction.

Return type

None

is_active()

Returns true if transaction is active

Return type

bool

rollback(*, retaining=False, savepoint=None)

Rollback transaction.

Return type

None

Enums

NetProtocol

class firebird.driver.types.NetProtocol(value)

Bases: enum.IntEnum

Network protocol options available for connection

INET = 2
INET4 = 3
WNET = 4
XNET = 1

DirectoryCode

class firebird.driver.types.DirectoryCode(value)

Bases: enum.IntEnum

IConfigManager directory codes

DIR_BIN = 0
DIR_CONF = 2
DIR_DOC = 5
DIR_GUARD = 15
DIR_HELP = 9
DIR_INC = 4
DIR_INTL = 10
DIR_LIB = 3
DIR_LOG = 14
DIR_MISC = 11
DIR_MSG = 13
DIR_PLUGINS = 16
DIR_SAMPLE = 7
DIR_SAMPLEDB = 8
DIR_SBIN = 1
DIR_SECDB = 12
DIR_TZDATA = 17
DIR_UDF = 6

XpbKind

class firebird.driver.types.XpbKind(value)

Bases: enum.IntEnum

Xpb builder kinds

BATCH = 5
BPB = 6
DPB = 1
SPB_ATTACH = 2
SPB_RECEIVE = 8
SPB_RESPONSE = 9
SPB_SEND = 7
SPB_START = 3
TPB = 4

StateResult

class firebird.driver.types.StateResult(value)

Bases: enum.IntEnum

IState result codes

ERROR = -1
NO_DATA = 1
OK = 0
SEGMENT = 2

PageSize

class firebird.driver.types.PageSize(value)

Bases: enum.IntEnum

Supported database page sizes

PAGE_16K = 16384
PAGE_32K = 32768
PAGE_4K = 4096
PAGE_8K = 8192

DBKeyScope

class firebird.driver.types.DBKeyScope(value)

Bases: enum.IntEnum

Scope of DBKey context

ATTACHMENT = 1
TRANSACTION = 0

InfoItemType

class firebird.driver.types.InfoItemType(value)

Bases: enum.IntEnum

Data type of information item

BIGINT = 3
BYTE = 1
BYTES = 4
INTEGER = 2
RAW_BYTES = 5
STRING = 6

SrvInfoCode

class firebird.driver.types.SrvInfoCode(value)

Bases: enum.IntEnum

Service information (isc_info_svc_*) codes

AUTH_BLOCK = 69
CAPABILITIES = 57
GET_CONFIG = 53
GET_ENV = 59
GET_ENV_LOCK = 60
GET_ENV_MSG = 61
GET_USERS = 68
IMPLEMENTATION = 56
LIMBO_TRANS = 66
LINE = 62
RUNNING = 67
SERVER_VERSION = 55
SRV_DB_INFO = 50
STDIN = 78
TIMEOUT = 64
TO_EOF = 63
USER_DBPATH = 58
VERSION = 54

BlobInfoCode

class firebird.driver.types.BlobInfoCode(value)

Bases: enum.IntEnum

BLOB information (isc_info_blob_*) codes

MAX_SEGMENT = 5
NUM_SEGMENTS = 4
TOTAL_LENGTH = 6
TYPE = 7

DbInfoCode

class firebird.driver.types.DbInfoCode(value)

Bases: enum.IntEnum

Database information (isc_info_*) codes

ACTIVE_TRANSACTIONS = 109
ACTIVE_TRAN_COUNT = 110
ALLOCATION = 21
ATTACHMENT_ID = 22
ATT_CHARSET = 101
BACKOUT_COUNT = 28
BASE_LEVEL = 13
BPAGE_ERRORS = 56
BPAGE_WARNS = 117
CONN_FLAGS = 132
CREATION_DATE = 111
CREATION_TIMESTAMP_TZ = 139
CRYPT_PLUGIN = 138
CURRENT_MEMORY = 17
DB_CLASS = 102
DB_FILE_SIZE = 112
DB_ID = 4
DB_PROVIDER = 108
DB_READ_ONLY = 63
DB_SIZE_IN_PAGES = 64
DB_SQL_DIALECT = 62
DELETE_COUNT = 27
DPAGE_ERRORS = 57
DPAGE_WARNS = 118
EXPUNGE_COUNT = 30
FETCHES = 7
FIREBIRD_VERSION = 103
FORCED_WRITES = 52
IMPLEMENTATION = 114
IMPLEMENTATION_OLD = 11
INSERT_COUNT = 25
IPAGE_ERRORS = 58
IPAGE_WARNS = 119
LIMBO = 16
MARKS = 8
MAX_MEMORY = 18
NEXT_TRANSACTION = 107
NO_RESERVE = 34
NUM_BUFFERS = 15
ODS_MINOR_VERSION = 33
ODS_VERSION = 32
OLDEST_ACTIVE = 105
OLDEST_SNAPSHOT = 106
OLDEST_TRANSACTION = 104
PAGES_FREE = 125
PAGES_USED = 124
PAGE_CONTENTS = 113
PAGE_ERRORS = 54
PAGE_SIZE = 14
PAGE_WARNS = 115
PIP_ERRORS = 122
PIP_WARNS = 123
PPAGE_ERRORS = 59
PPAGE_WARNS = 120
PROTOCOL_VERSION = 137
PURGE_COUNT = 29
READS = 5
READ_IDX_COUNT = 24
READ_SEQ_COUNT = 23
RECORD_ERRORS = 55
RECORD_WARNS = 116
SES_IDLE_TIMEOUT_ATT = 130
SES_IDLE_TIMEOUT_DB = 129
SES_IDLE_TIMEOUT_RUN = 131
SET_PAGE_BUFFERS = 61
STMT_TIMEOUT_ATT = 136
STMT_TIMEOUT_DB = 135
SWEEP_INTERVAL = 31
TPAGE_ERRORS = 60
TPAGE_WARNS = 121
UPDATE_COUNT = 26
USER_NAMES = 53
VERSION = 12
WRITES = 6

StmtInfoCode

class firebird.driver.types.StmtInfoCode(value)

Bases: enum.IntEnum

Statement information (isc_info_sql_*) codes

ALIAS = 19
BATCH_FETCH = 24
BIND = 5
BLOB_ALIGN = 30
DESCRIBE_END = 8
DESCRIBE_VARS = 7
EXPLAIN_PLAN = 26
FIELD = 16
FLAGS = 27
GET_PLAN = 22
LENGTH = 14
MESSAGE_SEQ = 10
NULL_IND = 15
NUM_VARIABLES = 6
OWNER = 18
RECORDS = 23
RELATION = 17
RELATION_ALIAS = 25
SCALE = 13
SELECT = 4
SQLDA_SEQ = 9
SQLDA_START = 20
STMT_TYPE = 21
SUB_TYPE = 12
TIMEOUT_RUN = 29
TIMEOUT_USER = 28
TYPE = 11

TraInfoCode

class firebird.driver.types.TraInfoCode(value)

Bases: enum.IntEnum

Transaction information (isc_info_tra_*) codes

ACCESS = 9
DBPATH = 11
ID = 4
ISOLATION = 8
LOCK_TIMEOUT = 10
OLDEST_ACTIVE = 7
OLDEST_INTERESTING = 5
OLDEST_SNAPSHOT = 6

TraInfoIsolation

class firebird.driver.types.TraInfoIsolation(value)

Bases: enum.IntEnum

Transaction isolation response

CONCURRENCY = 2
CONSISTENCY = 1
READ_COMMITTED = 3

TraInfoReadCommitted

class firebird.driver.types.TraInfoReadCommitted(value)

Bases: enum.IntEnum

Transaction isolation Read Committed response

NO_RECORD_VERSION = 0
READ_CONSISTENCY = 2
RECORD_VERSION = 1

TraInfoAccess

class firebird.driver.types.TraInfoAccess(value)

Bases: enum.IntEnum

Transaction isolation access mode response

READ_ONLY = 0
READ_WRITE = 1

TraAccessMode

class firebird.driver.types.TraAccessMode(value)

Bases: enum.IntEnum

Transaction Access Mode TPB parameters

READ = 8
WRITE = 9

TraIsolation

class firebird.driver.types.TraIsolation(value)

Bases: enum.IntEnum

Transaction Isolation TPB paremeters

CONCURRENCY = 2
CONSISTENCY = 1
READ_COMMITTED = 15

TraReadCommitted

class firebird.driver.types.TraReadCommitted(value)

Bases: enum.IntEnum

Read Committed Isolation TPB paremeters

NO_RECORD_VERSION = 18
RECORD_VERSION = 17

Isolation

class firebird.driver.types.Isolation(value)

Bases: enum.IntEnum

Transaction Isolation TPB parameters

CONCURRENCY = 2
CONSISTENCY = 1
READ_COMMITTED = -1
READ_COMMITTED_NO_RECORD_VERSION = 3
READ_COMMITTED_READ_CONSISTENCY = 5
READ_COMMITTED_RECORD_VERSION = 4
REPEATABLE_READ = 2
SERIALIZABLE = 1
SNAPSHOT = 2

TraLockResolution

class firebird.driver.types.TraLockResolution(value)

Bases: enum.IntEnum

Transaction Lock resolution TPB parameters

NO_WAIT = 7
WAIT = 6

TableShareMode

class firebird.driver.types.TableShareMode(value)

Bases: enum.IntEnum

Transaction table share mode TPB parameters

EXCLUSIVE = 5
PROTECTED = 4
SHARED = 3

TableAccessMode

class firebird.driver.types.TableAccessMode(value)

Bases: enum.IntEnum

Transaction Access Mode TPB parameters

LOCK_READ = 10
LOCK_WRITE = 11

DefaultAction

class firebird.driver.types.DefaultAction(value)

Bases: enum.IntEnum

Default action when transaction is ended automatically

COMMIT = 1
ROLLBACK = 2

StatementType

class firebird.driver.types.StatementType(value)

Bases: enum.IntEnum

Statement type

COMMIT = 10
DDL = 5
DELETE = 4
EXEC_PROCEDURE = 8
GET_SEGMENT = 6
INSERT = 2
PUT_SEGMENT = 7
ROLLBACK = 11
SAVEPOINT = 14
SELECT = 1
SELECT_FOR_UPD = 12
SET_GENERATOR = 13
START_TRANS = 9
UPDATE = 3

SQLDataType

class firebird.driver.types.SQLDataType(value)

Bases: enum.IntEnum

SQL data type

ARRAY = 540
BLOB = 520
BOOLEAN = 32764
DATE = 570
DEC16 = 32760
DEC34 = 32762
DOUBLE = 480
D_FLOAT = 530
FLOAT = 482
INT128 = 32752
INT64 = 580
LONG = 496
NULL = 32766
QUAD = 550
SHORT = 500
TEXT = 452
TIME = 560
TIMESTAMP = 510
TIMESTAMP_TZ = 32754
TIMESTAMP_TZ_EX = 32748
TIME_TZ = 32756
TIME_TZ_EX = 32750
VARYING = 448

DPBItem

class firebird.driver.types.DPBItem(value)

Bases: enum.IntEnum

isc_dpb_* items (VERSION2)

ADDRESS_PATH = 70
AUTH_BLOCK = 79
AUTH_PLUGIN_LIST = 85
AUTH_PLUGIN_NAME = 86
CLIENT_VERSION = 80
CONFIG = 87
CONNECT_TIMEOUT = 57
DBKEY_SCOPE = 13
DECFLOAT_ROUND = 94
DECFLOAT_TRAPS = 95
DUMMY_PACKET_INTERVAL = 58
EXT_CALL_DEPTH = 78
FORCE_WRITE = 24
HOST_NAME = 82
LC_CTYPE = 48
MAP_ATTACH = 90
NOLINGER = 88
NO_DB_TRIGGERS = 72
NO_GARBAGE_COLLECT = 16
NO_RESERVE = 27
NUM_BUFFERS = 5
ORG_FILENAME = 76
OS_USER = 83
OVERWRITE = 54
PAGE_SIZE = 4
PASSWORD = 29
PROCESS_ID = 71
PROCESS_NAME = 74
REMOTE_PROTOCOL = 81
RESERVED = 53
RESET_ICU = 89
SESSION_TIME_ZONE = 91
SET_BIND = 93
SET_DB_CHARSET = 68
SET_DB_READONLY = 64
SET_DB_REPLICA = 92
SET_DB_SQL_DIALECT = 65
SET_PAGE_BUFFERS = 61
SPECIFIC_AUTH_DATA = 84
SQL_DIALECT = 63
SQL_ROLE_NAME = 60
SWEEP_INTERVAL = 22
TRUSTED_AUTH = 73
TRUSTED_ROLE = 75
USER_NAME = 28
UTF8_FILENAME = 77
WORKING_DIRECTORY = 62

TPBItem

class firebird.driver.types.TPBItem(value)

Bases: enum.IntEnum

isc_tpb_* items

AT_SNAPSHOT_NUMBER = 23
AUTOCOMMIT = 16
IGNORE_LIMBO = 14
LOCK_TIMEOUT = 21
NO_AUTO_UNDO = 20
READ_CONSISTENCY = 22
VERSION3 = 3

SPBItem

class firebird.driver.types.SPBItem(value)

Bases: enum.IntEnum

isc_spb_* items

AUTH_BLOCK = 115
AUTH_PLUGIN_LIST = 117
AUTH_PLUGIN_NAME = 116
COMMAND_LINE = 105
CONFIG = 123
CONNECT_TIMEOUT = 57
DBNAME = 106
DUMMY_PACKET_INTERVAL = 58
OPTIONS = 108
PASSWORD = 29
SQL_ROLE_NAME = 60
TRUSTED_AUTH = 111
TRUSTED_ROLE = 113
USER_NAME = 28
UTF8_FILENAME = 118
VERBINT = 114
VERBOSE = 107

BPBItem

class firebird.driver.types.BPBItem(value)

Bases: enum.IntEnum

isc_bpb_* items

FILTER_PARAMETER = 6
SOURCE_INTERP = 4
SOURCE_TYPE = 1
STORAGE = 7
TARGET_INTERP = 5
TARGET_TYPE = 2
TYPE = 3

BlobType

class firebird.driver.types.BlobType(value)

Bases: enum.IntEnum

Blob type

SEGMENTED = 0
STREAM = 1

BlobStorage

class firebird.driver.types.BlobStorage(value)

Bases: enum.IntEnum

Blob storage

MAIN = 0
TEMP = 2

ServerAction

class firebird.driver.types.ServerAction(value)

Bases: enum.IntEnum

isc_action_svc_* items

ADD_USER = 4
BACKUP = 1
DB_STATS = 11
DELETE_USER = 5
DISPLAY_USER = 7
DISPLAY_USER_ADM = 29
DROP_MAPPING = 28
GET_FB_LOG = 12
MODIFY_USER = 6
NBAK = 20
NREST = 21
PROPERTIES = 8
REPAIR = 3
RESTORE = 2
SET_MAPPING = 27
TRACE_LIST = 26
TRACE_RESUME = 25
TRACE_START = 22
TRACE_STOP = 23
TRACE_SUSPEND = 24
VALIDATE = 30

SrvDbInfoOption

class firebird.driver.types.SrvDbInfoOption(value)

Bases: enum.IntEnum

Parameters for SvcInfoCode.SRV_DB_INFO

ATT = 5
DB = 6

SrvRepairOption

class firebird.driver.types.SrvRepairOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.REPAIR

COMMIT_TRANS = 15
COMMIT_TRANS_64 = 49
MULTI_TRA_ID = 20
MULTI_TRA_ID_64 = 48
RECOVER_TWO_PHASE = 17
RECOVER_TWO_PHASE_64 = 51
ROLLBACK_TRANS = 34
ROLLBACK_TRANS_64 = 50
SINGLE_TRA_ID = 19
SINGLE_TRA_ID_64 = 47
TRA_ADVISE = 29
TRA_ADVISE_COMMIT = 30
TRA_ADVISE_ROLLBACK = 31
TRA_ADVISE_UNKNOWN = 33
TRA_DB_PATH = 28
TRA_HOST_SITE = 26
TRA_ID = 18
TRA_ID_64 = 46
TRA_REMOTE_SITE = 27
TRA_STATE = 21
TRA_STATE_COMMIT = 23
TRA_STATE_LIMBO = 22
TRA_STATE_ROLLBACK = 24
TRA_STATE_UNKNOWN = 25

SrvBackupOption

class firebird.driver.types.SrvBackupOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.BACKUP

CRYPT = 18
FACTOR = 6
FILE = 5
INCLUDE_DATA = 19
KEYHOLDER = 16
KEYNAME = 17
LENGTH = 7
SKIP_DATA = 8
STAT = 15

SrvRestoreOption

class firebird.driver.types.SrvRestoreOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.RESTORE

ACCESS_MODE = 12
BUFFERS = 9
CRYPT = 18
FILE = 5
FIX_FSS_DATA = 13
FIX_FSS_METADATA = 14
KEYHOLDER = 16
KEYNAME = 17
LENGTH = 11
PAGE_SIZE = 10
SKIP_DATA = 8
STAT = 15

SrvNBackupOption

class firebird.driver.types.SrvNBackupOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.NBAK

DIRECT = 7
FILE = 6
GUID = 8
LEVEL = 5

SrvTraceOption

class firebird.driver.types.SrvTraceOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.TRACE_*

CONFIG = 3
ID = 1
NAME = 2

SrvPropertiesOption

class firebird.driver.types.SrvPropertiesOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.PROPERTIES

ACCESS_MODE = 13
ATTACHMENTS_SHUTDOWN = 42
DENY_NEW_ATTACHMENTS = 9
DENY_NEW_TRANSACTIONS = 10
FORCE_SHUTDOWN = 41
ONLINE_MODE = 45
PAGE_BUFFERS = 5
RESERVE_SPACE = 11
SET_SQL_DIALECT = 14
SHUTDOWN_DB = 7
SHUTDOWN_MODE = 44
SWEEP_INTERVAL = 6
TRANSACTIONS_SHUTDOWN = 43
WRITE_MODE = 12

SrvValidateOption

class firebird.driver.types.SrvValidateOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.VALIDATE

EXCLUDE_INDEX = 4
EXCLUDE_TABLE = 2
INCLUDE_INDEX = 3
INCLUDE_TABLE = 1
LOCK_TIMEOUT = 5

SrvUserOption

class firebird.driver.types.SrvUserOption(value)

Bases: enum.IntEnum

Parameters for ServerAction.ADD_USER|DELETE_USER|MODIFY_USER|DISPLAY_USER

ADMIN = 13
FIRST_NAME = 10
GROUP_ID = 6
GROUP_NAME = 9
LAST_NAME = 12
MIDDLE_NAME = 11
PASSWORD = 8
USER_ID = 5
USER_NAME = 7

DbAccessMode

class firebird.driver.types.DbAccessMode(value)

Bases: enum.IntEnum

Values for isc_spb_prp_access_mode

READ_ONLY = 39
READ_WRITE = 40

DbSpaceReservation

class firebird.driver.types.DbSpaceReservation(value)

Bases: enum.IntEnum

Values for isc_spb_prp_reserve_space

RESERVE = 36
USE_FULL = 35

DbWriteMode

class firebird.driver.types.DbWriteMode(value)

Bases: enum.IntEnum

Values for isc_spb_prp_write_mode

ASYNC = 37
SYNC = 38

ShutdownMode

class firebird.driver.types.ShutdownMode(value)

Bases: enum.IntEnum

Values for isc_spb_prp_shutdown_mode

FULL = 3
MULTI = 1
SINGLE = 2

OnlineMode

class firebird.driver.types.OnlineMode(value)

Bases: enum.IntEnum

Values for isc_spb_prp_online_mode

MULTI = 1
NORMAL = 0
SINGLE = 2

ShutdownMethod

class firebird.driver.types.ShutdownMethod(value)

Bases: enum.IntEnum

Database shutdown method options

DENNY_ATTACHMENTS = 42
DENNY_TRANSACTIONS = 43
FORCED = 41

TransactionState

class firebird.driver.types.TransactionState(value)

Bases: enum.IntEnum

Transaction state

COMMIT = 1
LIMBO = 3
ROLLBACK = 2
UNKNOWN = 0

DbProvider

class firebird.driver.types.DbProvider(value)

Bases: enum.IntEnum

Database Providers

FIREBIRD = 4
INTERBASE = 3
RDB_ELN = 1
RDB_VMS = 2

DbClass

class firebird.driver.types.DbClass(value)

Bases: enum.IntEnum

Database Classes

ACCESS = 1
CACHE = 12
CLASSIC_ACCESS = 13
GATEWAY = 11
PIPE_INT = 7
PIPE_SRVR = 8
REM_INT = 3
REM_SRVR = 4
SAM_INT = 9
SAM_SRVR = 10
SERVER_ACCESS = 14
UNKNOWN = 0
Y_VALVE = 2

Implementation

class firebird.driver.types.Implementation(value)

Bases: enum.IntEnum

Implementation - Legacy format

ALPHA_OSF = 52
ALPHA_VMS = 53
DARWIN_PPC = 63
DARWIN_PPC64 = 77
DARWIN_X64 = 73
DARWIN_X86 = 70
DG_X86 = 58
FREEBSD = 61
FREEBSD_AMD64 = 67
I386 = 60
ISC_APL_68K = 25
ISC_CRAY = 43
ISC_DELTA = 45
ISC_DG = 38
ISC_DOS = 47
ISC_EPSON = 51
ISC_HP_MPEXL = 39
ISC_HP_UX = 31
ISC_HP_UX68K = 40
ISC_IMP = 44
ISC_MAC_AUX = 34
ISC_MIPS_ULT = 36
ISC_NEXT = 46
ISC_OS2 = 29
ISC_RT_AIX = 35
ISC_SCO_UNIX = 42
ISC_SGI = 41
ISC_SUN4 = 30
ISC_SUN_386I = 32
ISC_SUN_68K = 28
ISC_VAX_ULTR = 26
ISC_VMS = 27
ISC_VMS_ORCL = 33
ISC_WINNT_X86 = 50
ISC_XENIX = 37
JRI = 6
JSV = 7
LINUX_ALPHA = 83
LINUX_AMD64 = 66
LINUX_ARM = 75
LINUX_ARM64 = 84
LINUX_HPPA = 82
LINUX_IA64 = 76
LINUX_M68K = 87
LINUX_MIPS = 72
LINUX_MIPSEL = 71
LINUX_PPC = 69
LINUX_PPC64 = 86
LINUX_PPC64EL = 85
LINUX_RISCV64 = 88
LINUX_S390 = 79
LINUX_S390X = 78
LINUX_SH = 80
LINUX_SHEB = 81
LINUX_SPARC = 65
M88K = 48
NCR_3000 = 56
NETBSD = 62
NETWARE_386 = 54
RDB_ELN = 2
RDB_ELN_DEV = 3
RDB_ELN_Y = 5
RDB_VMS = 1
RDB_VMS_Y = 4
SCO_EV = 59
SINIXZ = 64
SUN_AMD64 = 74
UNIXWARE = 49
WINNT_AMD64 = 68
WINNT_PPC = 57
WIN_ONLY = 55

ImpCPU

class firebird.driver.types.ImpCPU(value)

Bases: enum.IntEnum

Implementation - CPU

ALPHA = 14
AMD_INTEL_X64 = 1
ARM = 7
ARM64 = 15
HPPA = 13
IA64 = 8
INTEL386 = 0
M68K = 17
MIPS = 6
MIPSEL = 5
POWER_PC = 3
POWER_PC64 = 4
POWER_PC64EL = 16
S390 = 9
S390X = 10
SH = 11
SHEB = 12
ULTRA_SPARC = 2

ImpOS

class firebird.driver.types.ImpOS(value)

Bases: enum.IntEnum

Implementation - CPU

AIX = 5
DARWIN = 2
FREE_BSD = 7
HPUX = 4
LINUX = 1
MMS = 6
NET_BSD = 8
SOLARIS = 3
WINDOWS = 0

ImpCompiler

class firebird.driver.types.ImpCompiler(value)

Bases: enum.IntEnum

Implementation - Compiler

ACC = 3
GCC = 1
ICC = 5
MSVC = 0
SUN_STUDIO = 4
XLC = 2

Flags

StateFlag

class firebird.driver.types.StateFlag(value)

Bases: enum.IntFlag

IState flags

ERRORS = 2
NONE = 0
WARNINGS = 1

PreparePrefetchFlag

class firebird.driver.types.PreparePrefetchFlag(value)

Bases: enum.IntFlag

Flags for Statement Prefetch

AFFECTED_RECORDS = 32
ALL = 127
DETAILED_PLAN = 16
FLAGS = 64
INPUT_PARAMETERS = 2
LEGACY_PLAN = 8
METADATA = 71
NONE = 0
OUTPUT_PARAMETERS = 4
TYPE = 1

StatementFlag

class firebird.driver.types.StatementFlag(value)

Bases: enum.IntFlag

Statement flags

HAS_CURSOR = 1
NONE = 0
REPEAT_EXECUTE = 2

CursorFlag

class firebird.driver.types.CursorFlag(value)

Bases: enum.IntFlag

Cursor flags

NONE = 0
SCROLLABLE = 1

ConnectionFlag

class firebird.driver.types.ConnectionFlag(value)

Bases: enum.IntFlag

Flags returned for DbInfoCode.CONN_FLAGS

COMPRESSED = 1
ENCRYPTED = 2
NONE = 0

ServerCapability

class firebird.driver.types.ServerCapability(value)

Bases: enum.IntFlag

Server capabilities (returned by isc_info_svc_capabilities)

LOCAL_ENGINE = 32
MULTI_CLIENT = 2
NONE = 0
NO_DB_STATS = 16
NO_FORCED_WRITE = 64
NO_SERVER_SHUTDOWN = 256
NO_SHUTDOWN = 128
NO_SRV_STATS = 8
QUOTED_FILENAME = 1024
REMOTE_HOP = 4
SERVER_CONFIG = 512
WAL = 1

SrvRepairFlag

class firebird.driver.types.SrvRepairFlag(value)

Bases: enum.IntFlag

isc_spb_rpr_* flags for ServerAction.REPAIR

CHECK_DB = 16
CORRUPTION_CHECK = 177
FULL = 128
ICU = 2048
IGNORE_CHECKSUM = 32
KILL_SHADOWS = 64
LIST_LIMBO_TRANS = 8
MEND_DB = 4
REPAIR = 164
SWEEP_DB = 2
VALIDATE_DB = 1

SrvStatFlag

class firebird.driver.types.SrvStatFlag(value)

Bases: enum.IntFlag

isc_spb_sts_* flags for ServerAction.DB_STATS

DATA_PAGES = 1
DB_LOG = 2
DEFAULT = 9
ENCRYPTION = 256
HDR_PAGES = 4
IDX_PAGES = 8
NOCREATION = 128
NONE = 0
RECORD_VERSIONS = 32
SYS_RELATIONS = 16

SrvBackupFlag

class firebird.driver.types.SrvBackupFlag(value)

Bases: enum.IntFlag

isc_spb_bkp_* flags for ServerAction.BACKUP

CONVERT = 64
EXPAND = 128
IGNORE_CHECKSUMS = 1
IGNORE_LIMBO = 2
METADATA_ONLY = 4
NONE = 0
NON_TRANSPORTABLE = 32
NO_GARBAGE_COLLECT = 8
NO_TRIGGERS = 32768
OLD_DESCRIPTIONS = 16
ZIP = 65536

SrvRestoreFlag

class firebird.driver.types.SrvRestoreFlag(value)

Bases: enum.IntFlag

isc_spb_res_* flags for ServerAction.RESTORE

CREATE = 8192
DEACTIVATE_IDX = 256
METADATA_ONLY = 4
NO_SHADOW = 512
NO_TRIGGERS = 32768
NO_VALIDITY = 1024
ONE_AT_A_TIME = 2048
REPLACE = 4096
USE_ALL_SPACE = 16384

SrvNBackupFlag

class firebird.driver.types.SrvNBackupFlag(value)

Bases: enum.IntFlag

isc_spb_nbk_* flags for ServerAction.NBAK

IN_PLACE = 2
NONE = 0
NO_TRIGGERS = 1

SrvPropertiesFlag

class firebird.driver.types.SrvPropertiesFlag(value)

Bases: enum.IntFlag

isc_spb_prp_* flags for ServerAction.PROPERTIES

ACTIVATE = 256
DB_ONLINE = 512
NOLINGER = 1024

ImpFlags

class firebird.driver.types.ImpFlags(value)

Bases: enum.IntFlag

Implementation - Endianness

BIG_ENDIAN = 1
LITTLE_ENDIAN = 0

Dataclasses

ItemMetadata

class firebird.driver.types.ItemMetadata(field, relation, owner, alias, datatype, nullable, subtype, length, scale, charset, offset, null_offset)

Bases: object

Information for single item from iMessageMetadata.

This dataclass is used internally, and it’s not intended for general use.

Variables
  • field (str) – Field name

  • relation (str) – Relation name

  • owner (str) – Owner name

  • alias (str) – Field alias

  • datatype (SQLDataType) – Data type

  • nullable (bool) – Whether NULLs are allowed

  • subtype (int) – Data sub-type

  • length (int) – Size of raw field data in message buffer

  • scale (int) – Field scale

  • charset (int) – Character set

  • offset (int) – Offset of raw field data in message buffer

  • null_offset (int) – Offset of null flag in message buffer

TableAccessStats

class firebird.driver.types.TableAccessStats(table_id, sequential=None, indexed=None, inserts=None, updates=None, deletes=None, backouts=None, purges=None, expunges=None)

Bases: object

Table access statistics.

Data structure returned by Connection.get_table_access_stats().

Variables
  • table_id (int) – Relation ID

  • sequential (int) – Number of sequential table scans (row reads)

  • indexed (int) – Number of reads done via an index

  • inserts (int) – Number of inserts

  • updates (int) – Number of updates

  • deletes (int) – Number of deleted

  • backouts (int) – Number of removals of a version of a record

  • purges (int) – Number of removals of old versions of fully mature records (records that are committed, so that older ancestor versions are no longer needed)

  • expunges (int) – Number of removals of a record and all of its ancestors, for records whose deletions have been committed

UserInfo

class firebird.driver.types.UserInfo(user_name, password=None, first_name=None, middle_name=None, last_name=None, user_id=None, group_id=None, group_name=None, admin=None)

Bases: object

Information about Firebird user.

Data structure returned by Service.get_user() and Service.get_users().

Variables
  • user_name (str) – User (login) name

  • password (str) – User password

  • first_name (str) – First name

  • middle_name (str) – Middle name

  • last_name (str) – Last name

  • user_id (int) – User ID

  • group_id (int) – User Group ID

  • group_name (str) – Group name

  • admin (bool) – True is user has admin priviledges

BCD

class firebird.driver.types.BCD(sign, number, exp)

Bases: object

BCD number.

Variables
  • sign (int) – Sign

  • number (bytes) – Number

  • exp (int) – Exponent

TraceSession

class firebird.driver.types.TraceSession(id, user, timestamp, name='', flags=<factory>)

Bases: object

Information about active trace session.

Variables
  • id (int) – Session ID number

  • timestamp (datetime.datetime) – Session start timestamp

  • name (str) – Session name (if defined)

  • flags (list) – List with session flag names

Helper functions

get_timezone

firebird.driver.types.get_timezone(timezone=None)

Returns datetime.tzinfo for specified time zone.

This is preferred method to obtain timezone information for construction of timezone-aware datetime.datetime and datetime.time objects. Current implementation uses dateutil.tz for timezone tzinfo objects, but adds metadata neccessary to store timezone regions into database instead zoned time, and to handle offset-based timezones in format required by Firebird.

Return type

tzinfo