FDB Reference

Main driver namespace

Constants

__version__

Current driver version, string.

PyDB API 2.0 globals

apilevel

String constant stating the supported DB API level (2.0).

threadsafety

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

paramstyle

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

Constants for work with driver hooks

  • HOOK_API_LOADED

  • HOOK_DATABASE_ATTACHED

  • HOOK_DATABASE_ATTACH_REQUEST

  • HOOK_DATABASE_DETACH_REQUEST

  • HOOK_DATABASE_CLOSED

  • HOOK_SERVICE_ATTACHED

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

Helper Transaction Parameter Block (TPB) constants

ISOLATION_LEVEL_READ_COMMITED_LEGACY

R/W WAIT READ COMMITTED NO RECORD VERSION transaction.

ISOLATION_LEVEL_READ_COMMITED

R/W WAIT READ COMMITTED RECORD VERSION transaction.

ISOLATION_LEVEL_REPEATABLE_READ

Same as ISOLATION_LEVEL_SNAPSHOT.

ISOLATION_LEVEL_SNAPSHOT

R/W WAIT SNAPSHOT transaction.

ISOLATION_LEVEL_SERIALIZABLE

R/W WAIT SERIALIZABLE transaction.

ISOLATION_LEVEL_SNAPSHOT_TABLE_STABILITY

Same as ISOLATION_LEVEL_SERIALIZABLE.

ISOLATION_LEVEL_READ_COMMITED_RO

R/O WAIT READ COMMITTED RECORD VERSION transaction.

MAX_BLOB_SEGMENT_SIZE

charset_map

Python dictionary that maps Firebird character set names (key) to Python character sets (value).

ODS version numbers introduced by Firebird engine version

  • ODS_FB_20

  • ODS_FB_21

  • ODS_FB_25

  • ODS_FB_30

Translation dictionaries

IMPLEMENTATION_NAMES

Dictionary to map Implementation codes to names

PROVIDER_NAMES

Dictionary to map provider codes to names

DB_CLASS_NAMES

Dictionary to map database class codes to names

Firebird API constants and globals

  • frb_info_att_charset

  • isc_dpb_activate_shadow

  • isc_dpb_address_path

  • isc_dpb_allocation

  • isc_dpb_begin_log

  • isc_dpb_buffer_length

  • isc_dpb_cache_manager

  • isc_dpb_cdd_pathname

  • isc_dpb_connect_timeout

  • isc_dpb_damaged

  • isc_dpb_dbkey_scope

  • isc_dpb_debug

  • isc_dpb_delete_shadow

  • isc_dpb_dummy_packet_interval

  • isc_dpb_encrypt_key

  • isc_dpb_force_write

  • isc_dpb_garbage_collect

  • isc_dpb_gbak_attach

  • isc_dpb_gfix_attach

  • isc_dpb_gsec_attach

  • isc_dpb_gstat_attach

  • isc_dpb_interp

  • isc_dpb_lc_ctype

  • isc_dpb_lc_messages

  • isc_dpb_no_garbage_collect

  • isc_dpb_no_reserve

  • isc_dpb_num_buffers

  • isc_dpb_number_of_users

  • isc_dpb_old_dump_id

  • isc_dpb_old_file

  • isc_dpb_old_file_size

  • isc_dpb_old_num_files

  • isc_dpb_old_start_file

  • isc_dpb_old_start_page

  • isc_dpb_old_start_seqno

  • isc_dpb_online

  • isc_dpb_online_dump

  • isc_dpb_overwrite

  • isc_dpb_page_size

  • isc_dpb_password

  • isc_dpb_password_enc

  • isc_dpb_reserved

  • isc_dpb_sec_attach

  • isc_dpb_set_db_charset

  • isc_dpb_set_db_readonly

  • isc_dpb_set_db_sql_dialect

  • isc_dpb_set_page_buffers

  • isc_dpb_shutdown

  • isc_dpb_shutdown_delay

  • isc_dpb_sql_dialect

  • isc_dpb_sql_role_name

  • isc_dpb_sweep

  • isc_dpb_sweep_interval

  • isc_dpb_sys_user_name

  • isc_dpb_sys_user_name_enc

  • isc_dpb_trace

  • isc_dpb_user_name

  • isc_dpb_verify

  • isc_dpb_version1

  • isc_dpb_working_directory

  • isc_dpb_no_db_triggers

  • isc_dpb_nolinger,

  • isc_info_active_tran_count

  • isc_info_end

  • isc_info_truncated

  • isc_info_sql_stmt_type

  • isc_info_sql_get_plan

  • isc_info_sql_records

  • isc_info_req_select_count

  • isc_info_req_insert_count

  • isc_info_req_update_count

  • isc_info_req_delete_count

  • isc_info_blob_total_length

  • isc_info_blob_max_segment

  • isc_info_blob_type

  • isc_info_blob_num_segments

  • fb_info_page_contents

  • isc_info_active_transactions

  • isc_info_allocation

  • isc_info_attachment_id

  • isc_info_backout_count

  • isc_info_base_level

  • isc_info_bpage_errors

  • isc_info_creation_date

  • isc_info_current_memory

  • isc_info_db_class

  • isc_info_db_id

  • isc_info_db_provider

  • isc_info_db_read_only

  • isc_info_db_size_in_pages

  • isc_info_db_sql_dialect

  • isc_info_delete_count

  • isc_info_dpage_errors

  • isc_info_expunge_count

  • isc_info_fetches

  • isc_info_firebird_version

  • isc_info_forced_writes

  • isc_info_implementation

  • isc_info_insert_count

  • isc_info_ipage_errors

  • isc_info_isc_version

  • isc_info_limbo

  • isc_info_marks

  • isc_info_max_memory

  • isc_info_next_transaction

  • isc_info_no_reserve

  • isc_info_num_buffers

  • isc_info_ods_minor_version

  • isc_info_ods_version

  • isc_info_oldest_active

  • isc_info_oldest_snapshot

  • isc_info_oldest_transaction

  • isc_info_page_errors

  • isc_info_page_size

  • isc_info_ppage_errors

  • isc_info_purge_count

  • isc_info_read_idx_count

  • isc_info_read_seq_count

  • isc_info_reads

  • isc_info_record_errors

  • isc_info_set_page_buffers

  • isc_info_sql_stmt_commit

  • isc_info_sql_stmt_ddl

  • isc_info_sql_stmt_delete

  • isc_info_sql_stmt_exec_procedure

  • isc_info_sql_stmt_get_segment

  • isc_info_sql_stmt_insert

  • isc_info_sql_stmt_put_segment

  • isc_info_sql_stmt_rollback

  • isc_info_sql_stmt_savepoint

  • isc_info_sql_stmt_select

  • isc_info_sql_stmt_select_for_upd

  • isc_info_sql_stmt_set_generator

  • isc_info_sql_stmt_start_trans

  • isc_info_sql_stmt_update

  • isc_info_sweep_interval

  • isc_info_tpage_errors

  • isc_info_tra_access

  • isc_info_tra_concurrency

  • isc_info_tra_consistency

  • isc_info_tra_id

  • isc_info_tra_isolation

  • isc_info_tra_lock_timeout

  • isc_info_tra_no_rec_version

  • isc_info_tra_oldest_active

  • isc_info_tra_oldest_interesting

  • isc_info_tra_oldest_snapshot

  • isc_info_tra_read_committed

  • isc_info_tra_readonly

  • isc_info_tra_readwrite

  • isc_info_tra_rec_version

  • fb_info_tra_dbpath

  • isc_info_update_count

  • isc_info_user_names

  • isc_info_version

  • isc_info_writes

  • isc_tpb_autocommit

  • isc_dpb_version2

  • fb_info_implementation

  • fb_info_page_warns

  • fb_info_record_warns

  • fb_info_bpage_warns

  • fb_info_dpage_warns

  • fb_info_ipage_warns

  • fb_info_ppage_warns

  • fb_info_tpage_warns

  • fb_info_pip_errors

  • fb_info_pip_warns

  • isc_tpb_commit_time

  • isc_tpb_concurrency

  • isc_tpb_consistency

  • isc_tpb_exclusive

  • isc_tpb_ignore_limbo

  • isc_tpb_lock_read

  • isc_tpb_lock_timeout

  • isc_tpb_lock_write

  • isc_tpb_no_auto_undo

  • isc_tpb_no_rec_version

  • isc_tpb_nowait

  • isc_tpb_protected

  • isc_tpb_read

  • isc_tpb_read_committed

  • isc_tpb_rec_version

  • isc_tpb_restart_requests

  • isc_tpb_shared

  • isc_tpb_verb_time

  • isc_tpb_version3

  • isc_tpb_wait

  • isc_tpb_write

  • charset_map

  • XSQLDA_PTR

  • ISC_SHORT

  • ISC_LONG

  • ISC_SCHAR

  • ISC_UCHAR

  • ISC_QUAD

  • ISC_DATE

  • ISC_TIME

  • SHRT_MIN

  • SHRT_MAX

  • USHRT_MAX

  • INT_MIN

  • INT_MAX

  • LONG_MIN

  • LONG_MAX

  • SQL_TEXT

  • SQL_VARYING

  • SQL_SHORT

  • SQL_LONG

  • SQL_FLOAT

  • SQL_DOUBLE

  • SQL_D_FLOAT

  • SQL_TIMESTAMP

  • SQL_BLOB

  • SQL_ARRAY

  • SQL_QUAD

  • SQL_TYPE_TIME

  • SQL_TYPE_DATE

  • SQL_INT64

  • SQL_BOOLEAN

  • SUBTYPE_NUMERIC

  • SUBTYPE_DECIMAL

  • MAX_BLOB_SEGMENT_SIZE

  • ISC_INT64

  • XSQLVAR

  • ISC_TEB

  • RESULT_VECTOR

  • ISC_STATUS

  • ISC_STATUS_ARRAY

  • ISC_STATUS_PTR

  • ISC_EVENT_CALLBACK

  • ISC_ARRAY_DESC

  • blr_varying

  • blr_varying2

  • blr_text

  • blr_text2

  • blr_short

  • blr_long

  • blr_int64

  • blr_float

  • blr_d_float

  • blr_double

  • blr_timestamp

  • blr_sql_date

  • blr_sql_time

  • blr_cstring

  • blr_quad

  • blr_blob

  • blr_bool

  • SQLDA_version1

  • isc_segment

  • isc_db_handle

  • isc_tr_handle

  • isc_stmt_handle

  • isc_blob_handle

  • sys_encoding

Exceptions

exception fdb.Error

Bases: Exception

Exception that is the base class of all other error exceptions. You can use this to catch all errors with one single ‘except’ statement. Warnings are not considered errors and thus should not use this class as base.

exception fdb.InterfaceError

Bases: fdb.fbcore.Error

Exception raised for errors that are related to the database interface rather than the database itself.

exception fdb.DatabaseError

Bases: fdb.fbcore.Error

Exception raised for errors that are related to the database.

exception fdb.DataError

Bases: fdb.fbcore.DatabaseError

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

exception fdb.OperationalError

Bases: fdb.fbcore.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.

exception fdb.IntegrityError

Bases: fdb.fbcore.DatabaseError

Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.

exception fdb.InternalError

Bases: fdb.fbcore.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.

exception fdb.ProgrammingError

Bases: fdb.fbcore.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.

exception fdb.NotSupportedError

Bases: fdb.fbcore.DatabaseError

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

exception fdb.TransactionConflict

Bases: fdb.fbcore.DatabaseError

exception fdb.ParseError

Bases: Exception

This is the exception inheritance layout:

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

Functions

connect

fdb.connect(dsn='', user=None, password=None, host=None, port=None, database=None, sql_dialect=3, role=None, charset=None, buffers=None, force_write=None, no_reserve=None, db_key_scope=None, isolation_level=b'\x03\t\x06\x0f\x11', connection_class=None, fb_library_name=None, no_gc=None, no_db_triggers=None, no_linger=None, utf8params=False)

Establish a connection to database.

Keyword Arguments
  • dsn – Connection string in format [host[/port]]:database

  • user (str) – User name. If not specified, fdb attempts to use ISC_USER envar.

  • password (str) – User password. If not specified, fdb attempts to use ISC_PASSWORD envar.

  • host (str) – Server host machine specification.

  • port (int) – Port used by Firebird server.

  • database (str) – Database specification (file spec. or alias)

  • sql_dialect (int) – SQL Dialect for connection (1, 2 or 3).

  • role (str) – User role.

  • charset (str) – Character set for connection.

  • buffers (int) – Page case size override for connection.

  • force_writes (int) – Forced writes override for connection.

  • no_reserve (int) – Page space reservation override for connection.

  • db_key_scope (int) – DBKEY scope override for connection.

  • isolation_level (int) – Default transaction isolation level for connection (not used) (0, 1, 2 or 3).

  • connection_class (subclass of Connection) – Custom connection class

  • fb_library_name (str) – Full path to Firebird client library. See load_api() for details.

  • no_gc (int) – No Garbage Collection flag.

  • no_db_triggers (int) – No database triggers flag (FB 2.1).

  • no_linger (int) – No linger flag (FB3).

  • utf8params (bool) – Notify server that database specification and other string parameters are in UTF-8.

Returns

attached database.

Return type

Connection

Raises

Important

You may specify the database using either dns or database (with optional host), but not both.

Examples

con = fdb.connect(dsn='host:/path/database.fdb', user='sysdba',
                  password='pass', charset='UTF8')
con = fdb.connect(host='myhost', database='/path/database.fdb',
                  user='sysdba', password='pass', charset='UTF8')
Hooks:

Event HOOK_DATABASE_ATTACH_REQUEST: Executed after all parameters are preprocessed and before Connection is created. Hook must have signature: hook_func(dsn, dpb) where dpb is ParameterBuffer instance.

Hook may return Connection (or subclass) instance or None. First instance returned by any hook will become the return value of this function and other hooks are not called.

Event HOOK_DATABASE_ATTACHED: Executed before Connection (or subclass) instance is returned. Hook must have signature: hook_func(connection). Any value returned by hook is ignored.

create_database

fdb.create_database(sql='', sql_dialect=3, dsn='', user=None, password=None, host=None, port=None, database=None, page_size=None, length=None, charset=None, files=None, connection_class=None, fb_library_name=None)

Creates a new database. Parameters could be specified either by supplied “CREATE DATABASE” statement, or set of database parameters.

Keyword Arguments
  • sql (str) – “CREATE DATABASE” statement.

  • sql_dialect (int) – SQL Dialect for newly created database (1 or 3).

  • dsn (str) – Connection string in format [host[/port]]:database

  • user (str) – User name. If not specified, fdb attempts to use ISC_USER envar.

  • password (str) – User password. If not specified, fdb attempts to use ISC_PASSWORD envar.

  • host (str) – Server host machine specification.

  • port (int) – Port used by Firebird server.

  • database (str) – Database specification (file spec. or alias)

  • page_size (int) – Database page size.

  • length (int) – Database size in pages.

  • charset (str) – Character set for connection.

  • files (str) – Specification of secondary database files.

  • connection_class (subclass of Connection) – Custom connection class

  • fb_library_name (str) – Full path to Firebird client library. See load_api() for details.

Returns

the newly created database.

Return type

Connection

Raises

Example

con = fdb.create_database("create database '/temp/db.fdb' user 'sysdba' password 'pass'")
con = fdb.create_database(dsn='/temp/db.fdb',user='sysdba',password='pass',page_size=8192)
Hooks:

Event` HOOK_DATABASE_ATTACHED`: Executed before Connection (or subclass) instance is returned. Hook must have signature: hook_func(connection). Any value returned by hook is ignored.

load_api

fdb.load_api(fb_library_name=None)

Initializes bindings to Firebird Client Library unless they are already initialized. Called automatically by fdb.connect() and fdb.create_database().

Parameters
  • fb_library_name (str) – (optional) Path to Firebird Client Library.

  • it's not specified, FDB does its best to locate appropriate client library. (When) –

Returns

fbclient_API instance.

Hooks:

Event HOOK_API_LOADED: Executed after api is initialized. Hook routine must have signature: hook_func(api). Any value returned by hook is ignored.

Classes

Connection

class fdb.Connection(db_handle, dpb=None, sql_dialect=3, charset=None, isolation_level=b'x03tx06x0fx11')

Represents a connection between the database client (the Python process) and the database server.

Important

DO NOT create instances of this class directly! Use only connect() or create_database() to get Connection instances.

Parameters

db_handle – Database handle provided by factory function.

Keyword Arguments
  • dpb – Database Parameter Block associated with database handle.

  • sql_dialect (int) – SQL Dialect associated with database handle.

  • charset (str) – Character set associated with database handle.

  • isolation_level (bytes) – Default TPB

exception DataError

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

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception DatabaseError

Exception raised for errors that are related to the database.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception Error

Exception that is the base class of all other error exceptions. You can use this to catch all errors with one single ‘except’ statement. Warnings are not considered errors and thus should not use this class as base.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception IntegrityError

Exception raised when the relational integrity of the database is affected, e.g. a foreign key check fails.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception InterfaceError

Exception raised for errors that are related to the database interface rather than the database itself.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception InternalError

Exception raised when the database encounters an internal error, e.g. the cursor is not valid anymore, the transaction is out of sync, etc.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception NotSupportedError

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

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception OperationalError

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.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception ProgrammingError

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.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
exception Warning

Base class for warning categories.

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

args
begin(tpb=None)

Starts a transaction explicitly. Operates on main_transaction. See Transaction.begin() for details.

Keyword Arguments

tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – Transaction Parameter Buffer for newly started transaction. If not specified, default_tpb is used.

close()

Close the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection. The same applies to all cursor and transaction objects trying to use the connection.

Also closes all EventConduit, Cursor and Transaction instances associated with this connection.

Raises

fdb.ProgrammingError – When connection is a member of a ConnectionGroup.

Hooks:

Event HOOK_DATABASE_DETACH_REQUEST: Executed before connection is closed. Hook must have signature: hook_func(connection). If any hook function returns True, connection is not closed.

Event HOOK_DATABASE_CLOSED: Executed after connection is closed. Hook must have signature: hook_func(connection). Any value returned by hook is ignored.

commit(retaining=False)

Commit pending transaction to the database. Operates on main_transaction. See Transaction.commit() for details.

Keyword Arguments

retaining (bool) – Indicates whether the transactional context of the transaction being resolved should be recycled.

Raises

fdb.ProgrammingError – If Connection is closed.

cursor()

Return a new Cursor instance using the connection associated with main_transaction. See Transaction.cursor() for details.

Raises

fdb.ProgrammingError – If Connection is closed.

database_info(info_code, result_type, page_number=None)

Wraps the Firebird C API function isc_database_info.

For documentation, see the IB 6 API Guide section entitled “Requesting information about an attachment” (p. 51).

Note that this method is a VERY THIN wrapper around the FB C API function isc_database_info. This method does NOT attempt to interpret its results except with regard to whether they are a string or an integer.

For example, requesting isc_info_user_names will return a string containing a raw succession of length-name pairs. A thicker wrapper might interpret those raw results and return a Python tuple, but it would need to handle a multitude of special cases in order to cover all possible isc_info_* items.

Parameters
  • info_code (int) – One of the isc_info_* constants.

  • result_type (str) – Must be either ‘b’ if you expect a binary string result, or ‘i’ if you expect an integer result.

Keyword Arguments

page_number (int) – Page number for fb_info_page_contents info code.

Raises

See also

Extracting data with the database_info function is rather clumsy. See db_info() for higher-level means of accessing the same information.

Note

Some of the information available through this method would be more easily retrieved with the Services API (see submodule fdb.services).

db_info(request)

Higher-level convenience wrapper around the database_info() method that parses the output of database_info into Python-friendly objects instead of returning raw binary buffers in the case of complex result types.

Parameters

request – Single fdb.isc_info_* info request code or a sequence of such codes.

Returns

Mapping of (info request code -> result).

Return type

dist

Raises
  • ValueError – When requested code is not recognized.

  • fdb.OperationalError – On unexpected processing condition.

drop_database()

Drops the database to which this connection is attached.

Unlike plain file deletion, this method behaves responsibly, in that it removes shadow files and other ancillary files for this database.

Raises
event_conduit(event_names)

Creates a conduit through which database event notifications will flow into the Python program.

Parameters

event_names (list of str) – A sequence of string event names.

Returns

Return type

EventConduit

execute_immediate(sql)

Executes a statement in context of main_transaction without caching its prepared form.

Automatically starts transaction if it’s not already started.

Parameters

sql (str) – SQL statement to execute.

Important

The statement must not be of a type that returns a result set. In most cases (especially cases in which the same statement – perhaps a parameterized statement – is executed repeatedly), it is better to create a cursor using the connection’s cursor method, then execute the statement using one of the cursor’s execute methods.

Raises
get_active_transaction_count()

Return count of currently active transactions.

get_active_transaction_ids()

Return list of transaction IDs for all currently active transactions.

get_page_contents(page_number)

Return content of specified database page as binary string.

Parameters

page_number (int) – Page sequence number.

get_table_access_stats()

Return current stats for access to tables.

Returns

of _TableAccessStats instances.

Return type

list

isreadonly()

Returns True if database is read-only.

rollback(retaining=False, savepoint=None)

Causes the the database to roll back to the start of pending transaction. Operates on main_transaction. See Transaction.rollback() for details.

Keyword Arguments
  • retaining (bool) – Indicates whether the transactional context of the transaction being resolved should be recycled.

  • savepoint (str) – Causes the transaction to roll back only as far as the designated savepoint, rather than rolling back entirely.

Raises

fdb.ProgrammingError – If Connection is closed.

savepoint(name)

Establishes a named SAVEPOINT for current transaction. Operates on main_transaction. See Transaction.savepoint() for details.

Parameters

name (str) – Name for savepoint.

Raises

fdb.ProgrammingError – If Connection is closed.

Example

con.savepoint('BEGINNING_OF_SOME_SUBTASK')
...
con.rollback(savepoint='BEGINNING_OF_SOME_SUBTASK')
trans(default_tpb=None)

Creates a new Transaction that operates within the context of this connection. Cursors can be created within that Transaction via its cursor() method.

Keyword Arguments

default_tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – Transaction Parameter Block for newly created Transaction. If not specified, default_tpb is used.

Raises

fdb.ProgrammingError – If Connection is closed.

trans_info(request)

Pythonic wrapper around transaction_info() call. Operates on main_transaction.

See also

Transaction.trans_info() for details.

transaction_info(info_code, result_type)

Returns information about active transaction. Thin wrapper around Firebird API isc_transaction_info call. Operates on main_transaction.

See also

Transaction.transaction_info() for details.

property attachment_id

(R/O) Internal ID (server-side) for connection.

Type

int

property charset

(R/O) Connection Character set name.

Type

str

property closed

(R/O) True if connection is closed.

Type

bool

property creation_date

(R/O) Database creation date & time.

Type

datetime.datetime

property current_memory

(R/O) Amount of server memory (in bytes) currently in use.

Type

int

property database_name

(R/O) Database name (filename or alias).

Type

str

property database_sql_dialect

(R/O) SQL dialect of attached database.

Type

int

property db_class_id

(R/O Database class ID

Type

int

property default_tpb

(R/W) Deafult Transaction Parameter Block used for all newly started transactions.

Type

bytes

property engine_version

(R/O) Firebird version number of connected server. Only major.minor version.

Type

float

property firebird_version

(R/O) Version string returned by server for this connection. This version string contains Firebird engine version number, i.e. version that DOES NOT takes into account inherited IB version number. For example it’s ‘LI-V2.5.2.26540 Firebird 2.5’ for Firebird 2.5.2

Type

str

property forced_writes

(R/O) Mode in which database writes are performed (True=sync, False=async).

Type

bool

property group

(R/O) ConnectionGroup this Connection belongs to, or None.

property implementation_id

(R/O) Server implementation ID

Type

int

property io_stats

(R/O) Dictionary with I/O stats (reads,writes,fetches,marks) Keys are isc_info_reads, isc_info_writes, isc_info_fetches and isc_info_marks constants.

Type

dict

property main_transaction

Main transaction for this connection. Connection methods begin(), savepoint(), commit() and rollback() are delegated to this transaction object.

Type

Transaction

property max_memory

(R/O) Maximum amount of memory (in bytes) used at one time since the first process attached to the database.

Type

int

property monitor

Database monitoring object.

Type

Monitor

property next_transaction

(R/O) ID of Next Transaction.

Type

int

property oat

(R/O) ID of Oldest Active Transaction.

Type

int

property ods

(R/O) On-Disk Structure (ODS).

Type

float

property ods_minor_version

(R/O) On-Disk Structure (ODS) minor version number.

Type

int

property ods_version

(R/O) On-Disk Structure (ODS) major version number.

Type

int

property oit

(R/O) ID of Oldest Interesting Transaction.

Type

int

property ost

(R/O) ID of Oldest Snapshot Transaction.

Type

int

property page_cache_size

(R/O) Size of page cache in pages.

Type

int

property page_size

(R/O) Database page size in bytes.

Type

int

property pages_allocated

(R/O) Number of database pages allocated.

Type

int

property provider_id

(R/O) Server provider ID

Type

int

property query_transaction

Special “query” transaction for this connection. This is ReadOnly ReadCommitted transaction that could be active indefinitely without blocking garbage collection. It’s used internally to query metadata, but it’s generally useful.

Type

Transaction

property schema

Database metadata object.

Type

Schema

property server_version

(R/O) Version string returned by server for this connection. This version string contains InterBase-friendly engine version number, i.e. version that takes into account inherited IB version number. For example it’s ‘LI-V6.3.2.26540 Firebird 2.5’ for Firebird 2.5.2

Type

str

property site_name

(R/O) Database site name.

Type

str

property space_reservation

(R/O) When True 20% page space is reserved for holding backup versions of modified records.

Type

bool

property sql_dialect

(R/O) SQL dialect for this connection.

Type

int

property sweep_interval

(R/O) Sweep interval.

Type

int

property transactions

Instances associated with this connection.

Type

tuple of Transaction

property version

(R/O) Firebird version number string of connected server. Uses Firebird version numbers in form: major.minor.subrelease.build

Type

str

ConnectionWithSchema

class fdb.ConnectionWithSchema(db_handle, dpb=None, sql_dialect=3, charset=None, isolation_level=b'x03tx06x0fx11')

Connection descendant that exposes all attributes of encapsulated Schema instance directly as connection attributes, except close() and bind(), and those attributes that are already defined by Connection class.

Note

Use connection_class parametr of connect() or create_database() to create connections with direct schema interface.

See also

fdb.schema.Schema for list of methods that extend this class.

Parameters

db_handle – Database handle provided by factory function.

Keyword Arguments
  • dpb – Database Parameter Block associated with database handle.

  • sql_dialect (int) – SQL Dialect associated with database handle.

  • charset (str) – Character set associated with database handle.

  • isolation_level (bytes) – Default TPB

Cursor

class fdb.Cursor(connection, transaction)

Represents a database cursor, which is used to execute SQL statement and manage the context of a fetch operation.

Important

DO NOT create instances of this class directly! Use only Connection.cursor(), Transaction.cursor() and ConnectionGroup.cursor() to get Cursor instances that operate in desired context.

Note

Cursor is actually a high-level wrapper around PreparedStatement instance(s) that handle the actual SQL statement execution and result management.

Tip

Cursor supports the iterator protocol, yielding tuples of values like fetchone().

Important

The association between a Cursor and its Transaction and Connection is set when the Cursor is created, and cannot be changed during the lifetime of that Cursor.

Parameters
  • connection (Connection) – instance this cursor should be bound to.

  • transaction (Transaction) – instance this cursor should be bound to.

callproc(procname, parameters=None)

Call a stored database procedure with the given name.

The result of the call is available through the standard fetchXXX() methods.

Parameters

procname (str) – Stored procedure name.

Keyword Arguments

parameters (iterable) – Sequence of parameters. Must contain one entry for each argument that the procedure expects.

Returns

parameters as required by Python DB API 2.0 Spec.

Raises
close()

Close the cursor now (rather than whenever __del__ is called).

Closes any currently open PreparedStatement. However, the cursor is still bound to Connection and Transaction, so it could be still used to execute SQL statements.

Warning

FDB’s implementation of Cursor somewhat violates the Python DB API 2.0, which requires that cursor will be unusable after call to close; and an Error (or subclass) exception should be raised if any operation is attempted with the cursor.

If you’ll take advantage of this anomaly, your code would be less portable to other Python DB API 2.0 compliant drivers.

execute(operation, parameters=None)

Prepare and execute a database operation (query or command).

Note

Execution is handled by PreparedStatement that is either supplied as operation parameter, or created internally when operation is a string. Internally created PreparedStatements are stored in cache for later reuse, when the same operation string is used again.

Returns

self so call to execute could be used as iterator.

Parameters

operation (str PreparedStatement) – SQL command specification.

Keyword Arguments

parameters (list or tuple) – Sequence of parameters. Must contain one entry for each argument that the operation expects.

Raises
  • ValueError – When operation PreparedStatement belongs to different Cursor instance.

  • TypeError – When parameters is not List or Tuple.

  • fdb.ProgrammingError – When more parameters than expected are suplied.

  • fdb.DatabaseError – When error is returned by server.

executemany(operation, seq_of_parameters)

Prepare a database operation (query or command) and then execute it against all parameter sequences or mappings found in the sequence seq_of_parameters.

Note

This function simply calls execute() in a loop, feeding it with parameters from seq_of_parameters. Because execute caches PreparedStatements, calling executemany is equally efective as direct use of prepared statement and calling execute in a loop directly in application.

Returns

self so call to executemany could be used as iterator.

Parameters
  • operation (str ot PreparedStatement) – SQL command specification.

  • seq_of_parameters (list or tuple) – Sequence of sequences of parameters. Must contain one sequence of parameters for each execution that has one entry for each argument that the operation expects.

Raises
  • ValueError – When operation PreparedStatement belongs to different Cursor instance.

  • TypeError – When seq_of_parameters is not List or Tuple.

  • fdb.ProgrammingError – When there are more parameters in any sequence than expected.

  • fdb.DatabaseError – When error is returned by server.

fetchall()

Fetch all (remaining) rows of a query result.

Returns

List of tuples, where each tuple is one row of returned values.

Raises
fetchallmap()

Fetch all (remaining) rows of a query result like fetchall(), except that it returns a list of mappings of field name to field value, rather than a list of tuples.

Returns

List of fbcore._RowMapping instances, one such instance for each row.

Raises
fetchmany(size=1)

Fetch the next set of rows of a query result, returning a sequence of sequences (e.g. a list of tuples). An empty sequence is returned when no more rows are available. The number of rows to fetch per call is specified by the parameter. If it is not given, the cursor’s arraysize determines the number of rows to be fetched. The method does try to fetch as many rows as indicated by the size parameter. If this is not possible due to the specified number of rows not being available, fewer rows may be returned.

Keyword Arguments

size (int) – Max. number of rows to fetch.

Returns

List of tuples, where each tuple is one row of returned values.

Raises
fetchmanymap(size=1)

Fetch the next set of rows of a query result, like fetchmany(), except that it returns a list of mappings of field name to field value, rather than a list of tuples.

Keyword Arguments

size (int) – Max. number of rows to fetch.

Returns

List of fbcore._RowMapping instances, one such instance for each row.

Raises
fetchone()

Fetch the next row of a query result set.

Returns

Tuple of returned values, or None when no more data is available.

Raises
fetchonemap()

Fetch the next row of a query result set like fetchone(), except that it returns a mapping of field name to field value, rather than a tuple.

Returns

fbcore._RowMapping of returned values, or None when no more data is available.

Raises
iter()

Equivalent to the fetchall(), except that it returns iterator rather than materialized list.

Returns

that yields tuple of values like fetchone().

Return type

iterator

itermap()

Equivalent to the fetchallmap(), except that it returns iterator rather than materialized list.

Returns

Iterator that yields fbcore._RowMapping instance like fetchonemap().

next()

Return the next item from the container. Part of iterator protocol.

Raises

StopIteration – If there are no further items.

prep(operation)

Create prepared statement for repeated execution.

Note

Returned PreparedStatement instance is bound to its Cursor instance via strong reference, and is not stored in Cursor’s internal cache of prepared statements.

Parameters

operation (str) – SQL command

Returns

PreparedStatement

Raises
set_stream_blob(blob_name)

Specify a BLOB column(s) to work in stream mode instead classic, materialized mode for already executed statement.

Parameters

blob_name (str or list) – Single name or sequence of column names. Name must be in format as it’s stored in database (refer to description for real value).

Important

BLOB name is permanently added to the list of BLOBs handled as stream BLOBs by current PreparedStatement instance. If instance is stored in internal cache of prepared statements, the same command executed repeatedly will retain this setting.

Parameters

blob_name (str) – Name of BLOB column.

Raises

fdb.ProgrammingError

set_stream_blob_treshold(size)

Specify max. blob size for materialized blobs. If size of particular blob exceeds this threshold, returns streamed blob (BlobReader) instead string. Value -1 means no size limit (use at your own risk). Default value is 64K

Parameters

size (int) – Max. size for materialized blob.

setinputsizes(sizes)

Required by Python DB API 2.0, but pointless for Firebird, so it does nothing.

setoutputsize(size, column=None)

Required by Python DB API 2.0, but pointless for Firebird, so it does nothing.

arraysize = 1

(R/W) As required by the Python DB API 2.0 spec, the value of this attribute is observed with respect to the fetchmany() method. However, changing the value of this attribute does not make any difference in fetch efficiency because the database engine only supports fetching a single row at a time.

Type

int

property connection

(R/O) PEP 249 Extension. Reference to the Connection object on which the cursor was created.

Type

Connection

property description

(R/O) List of tuples (with 7-item). Each of these tuples contains information describing one result column: (name, type_code, display_size,internal_size, precision, scale, null_ok)

If cursor doesn’t have a prepared statement, the value is None.

Type

list

property name

(R/O) Name for the SQL cursor. This property can be ignored entirely if you don’t need to use it.

Type

str

property plan

(R/O) A string representation of the execution plan for last executed statement generated by the database engine’s optimizer. None if no statement was executed.

Type

str

property rowcount

(R/O) Specifies the number of rows that the last executeXXX() produced (for DQL statements like select) or affected (for DML statements like update or insert ).

The attribute is -1 in case no executeXXX() has been performed on the cursor or the rowcount of the last operation is not determinable by the interface.

Note

The database engine’s own support for the determination of “rows affected”/”rows selected” is quirky. The database engine only supports the determination of rowcount for INSERT, UPDATE, DELETE, and SELECT statements. When stored procedures become involved, row count figures are usually not available to the client. Determining rowcount for SELECT statements is problematic: the rowcount is reported as zero until at least one row has been fetched from the result set, and the rowcount is misreported if the result set is larger than 1302 rows. The server apparently marshals result sets internally in batches of 1302, and will misreport the rowcount for result sets larger than 1302 rows until the 1303rd row is fetched, result sets larger than 2604 rows until the 2605th row is fetched, and so on, in increments of 1302.

Type

int

property transaction

(R/O) Reference to the Transaction object on which the cursor was created.

Type

Transaction

Transaction

class fdb.Transaction(connections, default_tpb=None, default_action='commit')

Represents a transaction context, which is used to execute SQL statement.

Important

DO NOT create instances of this class directly! Connection and ConnectionGroup manage Transaction internally, surfacing all important methods directly in their interfaces. If you want additional transactions independent from Connection.main_transaction, use Connection.trans() method to obtain such Transaction instance.

Parameters

connections (iterable) – Sequence of (up to 16) Connection instances.

Keyword Arguments
  • default_tpb (TPB instance, iterable of isc_tpb_* constants or bytestring) – Transaction Parameter Block for this transaction. If None is specified, uses ISOLATION_LEVEL_READ_COMMITED.

  • default_action (str) – Action taken when active transaction is ended automatically (during close() or begin()). Accepted values: ‘commit’ or ‘rollback’

Raises

fdb.ProgrammingError – When zero or more than 16 connections are given.

begin(tpb=None)

Starts a transaction explicitly.

Keyword Arguments

tpb (TPB instance, iterable of isc_tpb_* constants or bytestring) – Transaction Parameter Block for newly created Transaction. If not specified, default_tpb is used.

Note

Calling this method directly is never required; a transaction will be started implicitly if necessary.

Important

If the physical transaction is unresolved when this method is called, a commit() or rollback() will be performed first, accordingly to default_action value.

Raises
close()

Permanently closes the Transaction object and severs its associations with other objects (Cursor and Connection instances).

Important

If the physical transaction is unresolved when this method is called, a commit() or rollback() will be performed first, accordingly to default_action value.

commit(retaining=False)

Commit any pending transaction to the database.

Note

If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.

Keyword Arguments

retaining (bool) – Indicates whether the transactional context of the transaction being resolved should be recycled.

Raises

fdb.DatabaseError – When error is returned by server as response to commit.

cursor(connection=None)

Creates a new Cursor that will operate in the context of this Transaction.

Keyword Arguments

connection (Connection) – Required only when Transaction is bound to multiple Connections, to specify to which Connection the returned Cursor should be bound.

Raises

fdb.ProgrammingError – When transaction operates on multiple Connections and: connection parameter is not specified, or specified connection is not among Connections this Transaction is bound to.

execute_immediate(sql)
Executes a statement without caching its prepared form on

all connections this transaction is bound to.

Automatically starts transaction if it’s not already started.

Parameters

sql (str) – SQL statement to execute.

Important

The statement must not be of a type that returns a result set. In most cases (especially cases in which the same statement – perhaps a parameterized statement – is executed repeatedly), it is better to create a cursor using the connection’s cursor method, then execute the statement using one of the cursor’s execute methods.

Raises

fdb.DatabaseError – When error is returned from server.

isreadonly()

Returns True if transaction is Read Only.

prepare()

Manually triggers the first phase of a two-phase commit (2PC).

Note

Direct use of this method is optional; if preparation is not triggered manually, it will be performed implicitly by commit() in a 2PC.

rollback(retaining=False, savepoint=None)

Rollback any pending transaction to the database.

Note

If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.

Keyword Arguments
  • retaining (bool) – Indicates whether the transactional context of the transaction being resolved should be recycled. Mutually exclusive with ‘savepoint`.

  • savepoint (str) – Savepoint name. Causes the transaction to roll back only as far as the designated savepoint, rather than rolling back entirely. Mutually exclusive with ‘retaining`.

Raises
savepoint(name)

Establishes a savepoint with the specified name.

Note

If transaction is bound to multiple connections, savepoint is created on all of them.

Important

Because savepoint is created not through Firebird API (there is no such API call), but by executing SAVEPOINT <name> SQL statement, calling this method starts the transaction if it was not yet started.

Parameters

name (str) – Savepoint name.

trans_info(request)

Pythonic wrapper around transaction_info() call.

Parameters

request – One or more information request codes (see transaction_info() for details). Multiple codes must be passed as tuple.

Returns

Decoded response(s) for specified request code(s). When multiple requests are passed, returns a dictionary where key is the request code and value is the response from server.

transaction_info(info_code, result_type)

Return information about active transaction.

This is very thin wrapper around Firebird API isc_transaction_info call.

Parameters
  • info_code (int) – One from the isc_info_tra_* constants.

  • result_type (str) – Code for result type. Accepted values: ‘b’ for binary string or ‘i’ for integer

Raises
property active

(R/O) True if transaction is active.

Type

bool

property closed

(R/O) True if transaction is closed.

Type

bool

property cursors

(R/O) List of Cursor objects associated with this Transaction.

Type

list

property default_action

(R/W) commit or rollback, action to be taken when physical transaction has to be ended automatically. Default is commit.

Type

str

default_tpb = b'\x03\t\x06\x0f\x11'

(Read/Write) Transaction Parameter Block.

property isolation
property lock_timeout

(R/O) Lock timeout (seconds or -1 for unlimited).

Type

int

property oat

(R/O) ID of Oldest Active Transaction when this transaction started.

Type

int

property oit

(R/O) ID of Oldest Interesting Transaction when this transaction started.

Type

int

property ost

(R/O) ID of Oldest Snapshot Transaction when this transaction started.

Type

int

property transaction_id

(R/O) Internal ID (server-side) for transaction.

Type

int

PreparedStatement

class fdb.PreparedStatement(operation, cursor, internal=True)

Represents a prepared statement, an “inner” database cursor, which is used to manage the SQL statement execution and context of a fetch operation.

Important

DO NOT create instances of this class directly! Use only Cursor.prep() to get PreparedStatement instances.

Note

PreparedStatements are bound to Cursor instance that created them, and using them with other Cursor would report an error.

close()

Drops the resources associated with executed prepared statement, but keeps it prepared for another execution.

set_stream_blob(blob_spec)

Specify a BLOB column(s) to work in stream mode instead classic, materialized mode.

Parameters
  • blob_spec (str) –

    Single name or sequence of column names. Name must be in format as it’s stored in database (refer to description for real value).

    Important

    BLOB name is permanently added to the list of BLOBs handled as stream BLOBs by this instance.

  • blob_spec – Name of BLOB column.

set_stream_blob_treshold(size)

Specify max. blob size for materialized blobs. If size of particular blob exceeds this threshold, returns streamed blob (BlobReader) instead string. Value -1 means no size limit (use at your own risk). Default value is 64K

Parameters

size (int) – Max. size for materialized blob.

NO_FETCH_ATTEMPTED_YET = -1

Constant for internal use by this class. Do not change!

RESULT_SET_EXHAUSTED = 100

Constant for internal use by this class. Do not change!

property closed

(R/O) True if closed. Note that closed means that PS statement handle was closed for further fetching, releasing server resources, but wasn’t dropped, and couldbe still used for another execution.

Type

bool

cursor = None

Cursor instance that manages this PreparedStatement. Do not change!

property description

Each of these sequences contains information describing one result column - (name, type_code, display_size,internal_size, precision, scale, null_ok)

Type

Sequence of 7-item sequences

n_input_params = 0

The number of input parameters the statement requires. Do not change!

n_output_params = 0

The number of output fields the statement produces. Do not change!

property name

(R/O) Name for the SQL cursor. This property can be ignored entirely if you don’t need to use it.

Type

str

property plan

(R/O) A string representation of the execution plan generated for this statement by the database engine’s optimizer.

Type

str

property rowcount

(R/O) Specifies the number of rows that the last execution produced (for DQL statements like select) or affected (for DML statements like update or insert ).

The attribute is -1 in case the statement was not yet executed or the rowcount of the operation is not determinable by the interface.

Type

int

property sql

(R/O) SQL command this PreparedStatement executes.

Type

str

statement_type = 0

(integer) An integer code that can be matched against the statement type constants in the isc_info_sql_stmt_* series. Do not change!

ConnectionGroup

class fdb.ConnectionGroup(connections=())

Manager for distributed transactions, i.e. transactions that span multiple databases.

Tip

ConnectionGroup supports in operator to check membership of connections.

Parameters

connections (iterable) – Sequence of Connection instances.

See also

See add() for list of exceptions the constructor may throw.

add(con)

Adds active connection to the group.

Parameters

con – A Connection instance to add to this group.

Raises
  • TypeError – When con is not Connection instance.

  • fdb.ProgrammingError – When con is already member of this or another group, or closed. When this group has unresolved transaction or contains 16 connections.

begin(tpb=None)

Starts distributed transaction over member connections.

Keyword Arguments

tpb (TPB instance, list/tuple of isc_tpb_* constants or bytestring) – Transaction Parameter Buffer for newly started transaction. If not specified, default_tpb is used.

Raises

fdb.ProgrammingError – When group is empty or has active transaction.

clear()

Removes all connections from group.

Raises

fdb.ProgrammingError` When transaction is active.

commit(retaining=False)

Commits distributed transaction over member connections using 2PC.

Note

If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.

Keyword Arguments

retaining (bool) – Indicates whether the transactional context of the transaction being resolved should be recycled.

Raises

fdb.ProgrammingError – When group is empty.

contains(con)

Returns True if specified connection belong to this group.

Parameters

con (Connection) – Connection that should be checked for presence.

count()

Returns number of Connection objects that belong to this group.

cursor(connection)

Creates a new Cursor that will operate in the context of distributed transaction and specific Connection that belongs to this group.

Note

Automatically starts transaction if it’s not already started.

Parameters

connection (Connection) –

Raises

fdb.ProgrammingError – When group is empty or specified connection doesn’t belong to this group.

disband()

Forcefully deletes all connections from connection group.

Note

  1. If transaction is active, it’s canceled (rollback).

  2. Any error during transaction finalization doesn’t stop the disband process, however the exception catched is eventually reported.

execute_immediate(sql)

Executes a statement on all member connections without caching its prepared form.

Automatically starts transaction if it’s not already started.

Parameters

sql (str) – SQL statement to execute.

Important

The statement must not be of a type that returns a result set. In most cases (especially cases in which the same statement – perhaps a parameterized statement – is executed repeatedly), it is better to create a cursor using the connection’s cursor method, then execute the statement using one of the cursor’s execute methods.

Raises

fdb.DatabaseError – When error is returned from server.

members()

Returns list of connection objects that belong to this group.

prepare()

Manually triggers the first phase of a two-phase commit (2PC). Use of this method is optional; if preparation is not triggered manually, it will be performed implicitly by commit() in a 2PC.

remove(con)

Removes specified connection from group.

Parameters

con – A Connection instance to remove.

Raises

fdb.ProgrammingError – When con doesn’t belong to this group or transaction is active.

rollback(retaining=False, savepoint=None)

Rollbacks distributed transaction over member connections.

Note

If transaction is not active, this method does nothing, because the consensus among Python DB API experts is that transactions should always be started implicitly, even if that means allowing a commit() or rollback() without an actual transaction.

Keyword Arguments
  • retaining (bool) – Indicates whether the transactional context of the transaction being resolved should be recycled.

  • savepoint (str) – Savepoint name. Causes the transaction to roll back only as far as the designated savepoint, rather than rolling back entirely. Mutually exclusive with ‘retaining`.

Raises

fdb.ProgrammingError – When group is empty.

savepoint(name)

Establishes a named SAVEPOINT on all member connections. See Transaction.savepoint() for details.

Parameters

name (str) – Name for savepoint.

Raises

fdb.ProgrammingError – When group is empty.

property default_tpb

(R/W) Deafult Transaction Parameter Block used for transactions.

Type

bytes

TransactionContext

class fdb.TransactionContext(transaction)

Context Manager that manages transaction for object passed to constructor.

Performs rollback if exception is thrown inside code block, otherwise performs commit at the end of block.

Note

Transaction acts as context manager and supports with statement directly.

Examples

with TransactionContext(my_transaction):
    cursor.execute('insert into tableA (x,y) values (?,?)',(x,y))
    cursor.execute('insert into tableB (x,y) values (?,?)',(x,y))
Parameters

transaction – Any object that supports begin(), commit() and rollback().

transaction = None

Transaction-like object this instance manages.

EventConduit

class fdb.EventConduit(db_handle, event_names)

Represents a conduit through which database event notifications will flow into the Python program.

Important

DO NOT create instances of this class directly! Use only Connection.event_conduit() to get EventConduit instances.

Notifications of any events are not accumulated until begin() method is called.

From the moment the begin() method is called, notifications of any events that occur will accumulate asynchronously within the conduit’s internal queue until the conduit is closed either explicitly (via the close() method) or implicitly (via garbage collection).

EventConduit implements context manager protocol to call method begin() and close() automatically.

Example

with connection.event_conduit( ('event_a', 'event_b') ) as conduit:
    events = conduit.wait()
    process_events(events)
Parameters
  • db_handle – Database handle.

  • event_names (list) – List of strings that represent event names.

begin()

Starts listening for events.

Must be called directly or through context manager interface.

close()

Cancels the standing request for this conduit to be notified of events.

After this method has been called, this EventConduit object is useless, and should be discarded.

flush()

Clear any event notifications that have accumulated in the conduit’s internal queue.

wait(timeout=None)

Wait for events.

Blocks the calling thread until at least one of the events occurs, or the specified timeout (if any) expires.

Keyword Arguments

timeout (int or float) – Number of seconds (use a float to indicate fractions of seconds). If not even one of the relevant events has occurred after timeout seconds, this method will unblock and return None. The default timeout is infinite.

Returns

None if the wait timed out, otherwise a dictionary that maps event_name -> event_occurrence_count.

Example

>>>conduit = connection.event_conduit( ('event_a', 'event_b') )
>>>conduit.begin()
>>>conduit.wait()
{
 'event_a': 1,
 'event_b': 0
}

In the example above event_a occurred once and event_b did not occur at all.

property closed

(Read Only) (boolean) True if conduit is closed.

BlobReader

class fdb.BlobReader(blobid, db_handle, tr_handle, is_text, charset)

BlobReader is a “file-like” class, so it acts much like a file instance opened in rb mode.

Important

DO NOT create instances of this class directly! BlobReader instances are returned automatically in place of output BLOB values when stream BLOB access is requested via PreparedStatement.set_stream_blob().

Tip

BlobReader supports iterator protocol, yielding lines like readline().

close()

Closes the Reader. Like file.close().

Raises

fdb.DatabaseError – When error is returned by server.

flush()

Flush the internal buffer. Like file.flush(). Does nothing as it’s pointless for reader.

get_info()

Return information about BLOB.

Returns

tuple with items: blob_length, segment_size, num_segments, blob_type

Return type

tuple

Meaning of individual values:

Blob_length

Total blob length in bytes

Segment_size

Size of largest segment

Num_segments

Number of segments

Blob_type

isc_bpb_type_segmented or isc_bpb_type_stream

next()

Return the next line from the BLOB. Part of iterator protocol.

Raises

StopIteration – If there are no further lines.

read(size=-1)

Read at most size bytes from the file (less if the read hits EOF before obtaining size bytes). If the size argument is negative or omitted, read all data until EOF is reached. The bytes are returned as a string object. An empty string is returned when EOF is encountered immediately. Like file.read().

Raises

fdb.ProgrammingError – When reader is closed.

Note

Performs automatic conversion to unicode for TEXT BLOBs, if used Python is v3 or connection charset is defined.

readline()

Read one entire line from the file. A trailing newline character is kept in the string (but may be absent when a file ends with an incomplete line). An empty string is returned when EOF is encountered immediately. Like file.readline().

Raises

fdb.ProgrammingError – When reader is closed.

Note

Performs automatic conversion to unicode for TEXT BLOBs, if used Python is v3 or connection charset is defined.

readlines(sizehint=None)

Read until EOF using readline() and return a list containing the lines thus read. The optional sizehint argument (if present) is ignored. Like file.readlines().

Note

Performs automatic conversion to unicode for TEXT BLOBs, if used Python is v3 or connection charset is defined.

seek(offset, whence=0)

Set the file’s current position, like stdio‘s fseek(). See file.seek() details.

Parameters

offset (int) – Offset from specified position.

Keyword Arguments

whence (int) – Context for offset. Accepted values: os.SEEK_SET, os.SEEK_CUR or os.SEEK_END

Raises

fdb.ProgrammingError – When reader is closed.

Warning

If BLOB was NOT CREATED as stream BLOB, this method raises DatabaseError exception. This constraint is set by Firebird.

tell()

Return current position in BLOB, like stdio‘s ftell() and file.tell().

property blob_charset

(R/O) BLOB character set

Type

str

property blob_id

(R/O) BLOB ID

Type

ISC_QUAD

property charset

(R/O) Python character set for BLOB

Type

str

property closed

(R/O) True is BlobReader is closed.

Type

bool

property is_text

(R/O) True if BLOB is a text BLOB

Type

bool

property mode

(R/O) File mode - always “rb”

Type

str

TPB

class fdb.TPB

Helper class for convenient and safe construction of custom Transaction Parameter Blocks.

clear()
copy()

Returns a copy of self.

render()

Create valid transaction parameter block according to current values of member attributes.

Returns

binary Transaction Parameter Block for FB API calls

Return type

bytes

property access_mode

Required access mode (isc_tpb_read or isc_tpb_write). Default: isc_tpb_write

Type

int

property isolation_level

Required Transaction Isolation Level. Single integer value equivalent to isc_tpb_concurrency or isc_tpb_consistency, or tuple of exactly two integer values, where the first one is isc_tpb_read_committed and second either isc_tpb_rec_version or isc_tpb_no_rec_version.

When value isc_tpb_read_committed is assigned without suboption, the isc_tpb_rec_version is assigned as default suboption.

Default: isc_tpb_concurrency

Type

int or tuple

property lock_resolution

Required lock resolution method. Either isc_tpb_wait or isc_tpb_nowait.

Default: isc_tpb_wait

Type

int

property lock_timeout

Required lock timeout or None. Default: None

Type

int

property table_reservation

Table reservation specification.

Default: None.

Instead of changing the value of the TableReservation object itself, you must change its elements by manipulating it as though it were a dictionary that mapped “TABLE_NAME”: (sharingMode, accessMode) For example:

tpb.table_reservation["MY_TABLE"] = (fdb.isc_tpb_protected, fdb.isc_tpb_lock_write)
Type

TableReservation

TableReservation

class fdb.TableReservation

A dictionary-like helper class that maps “TABLE_NAME”: (sharingMode, accessMode). It performs validation of values assigned to keys.

copy()
get(key, default=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
render()

Create valid table access parameter block according to current key/value pairs.

Returns

Table access definition block.

Return type

str

values()

ParameterBuffer

class fdb.ParameterBuffer(charset)

Helper class for construction of Database (and other) parameter buffers. Parameters are stored in insertion order.

add_byte(byte)

Add byte value to buffer.

Parameters

byte (int) – Value to be added.

add_byte_parameter(code, value)

Add byte value to parameter buffer.

Parameters
  • code (int) – Firebird code for the parameter

  • value (int) – Parameter value (0-255)

add_integer_parameter(code, value)

Add integer value to parameter buffer.

Parameters
  • code (int) – Firebird code for the parameter

  • value (int) – Parameter value

add_parameter_code(code)

Add parameter code to parameter buffer.

Parameters

code (int) – Firebird code for the parameter

add_string(value)

Add string value to buffer.

Parameters

value (bytes) – String to be added.

add_string_parameter(code, value)

Add string to parameter buffer.

Parameters
  • code (int) – Firebird code for the parameter

  • value (str) – Parameter value

add_word(word)

Add two byte value to buffer.

Parameters

word (int) – Value to be added.

clear()

Clear all parameters stored in parameter buffer.

get_buffer()

Get parameter buffer content.

Returns

Byte string with all inserted parameters.

Return type

bytes

get_length()

Returns actual total length of parameter buffer.

Internally used classes exposed to driver users

_RowMapping

class fdb.fbcore._RowMapping(description, row)

An internal dictionary-like class that wraps a row of results in order to map field name to field value.

Warning

We make ABSOLUTELY NO GUARANTEES about the return value of the fetch(one|many|all) methods except that it is a sequence indexed by field position, and no guarantees about the return value of the fetch(one|many|all)map methods except that it is a mapping of field name to field value.

Therefore, client programmers should NOT rely on the return value being an instance of a particular class or type.

get(field_name, default_value=None)
items()
iteritems()
iterkeys()
itervalues()
keys()
values()

EventBlock

class fdb.fbcore.EventBlock(queue, db_handle, event_names)

Represents Firebird API structure for block of events.

close()

Close this block canceling managed events.

count_and_reregister()

Count event occurences and reregister interest in futrther notifications.

buf_length = 0

length of internal event buffer

Type

int

property closed

(R/O)True if block is closed for business

Type

bool

event_buf = None

Event buffer

Type

bytes

event_id = 0

Event ID

Type

int

event_names = []

Registered event names

Type

list

result_buf = None

Result buffer

Type

bytes

TableAccessStats

class fdb.fbcore._TableAccessStats(table_id)

An internal class that wraps results from get_table_access_stats()

Services

Constants

shutdown_mode codes for Connection.shutdown() and Connection.bring_online()

  • SHUT_LEGACY

  • SHUT_NORMAL

  • SHUT_MULTI

  • SHUT_SINGLE

  • SHUT_FULL

shutdown_method codes for Connection.shutdown()

  • SHUT_FORCE

  • SHUT_DENY_NEW_TRANSACTIONS

  • SHUT_DENY_NEW_ATTACHMENTS

mode codes for Connection.setWriteMode()

  • WRITE_FORCED

  • WRITE_BUFFERED

mode codes for Connection.setAccessMode()

  • ACCESS_READ_WRITE

  • ACCESS_READ_ONLY

Connection.get_server_capabilities() return codes

  • CAPABILITY_MULTI_CLIENT

  • CAPABILITY_REMOTE_HOP

  • CAPABILITY_SERVER_CONFIG

  • CAPABILITY_QUOTED_FILENAME

  • CAPABILITY_NO_SERVER_SHUTDOWN

‘stats’ codes for Connection.backup()/Connection.restore()

  • STATS_TOTAL_TIME

  • STATS_TIME_DELTA

  • STATS_PAGE_READS

  • STATS_PAGE_WRITES

Functions

connect

fdb.services.connect(host='service_mgr', user=None, password=None)

Establishes a connection to the Services Manager.

Parameters
  • host (str) – (optional) Host machine specification. Local by default.

  • user (str) – (optional) Administrative user name. Defaults to content of environment variable ISC_USER or SYSDBA.

  • password (str) – Administrative user password. Default is content of environment variable ISC_PASSWORD.

Note

By definition, a Services Manager connection is bound to a particular host. Therefore, the database specified as a parameter to methods such as getStatistics MUST NOT include the host name of the database server.

Hooks:

Event HOOK_SERVICE_ATTACHED: Executed before Connection instance is returned. Hook must have signature: hook_func(connection). Any value returned by hook is ignored.

Classes

Connection

class fdb.services.Connection(host, user, password, charset=None)

Represents a sevice connection between the database client (the Python process) and the database server.

Important

DO NOT create instances of this class directly! Use only connect() to get Connection instances.

Tip

Connection supports the iterator protocol, yielding lines of result like readline().

activate_shadow(database)

Activate Database Shadow(s).

Parameters

database (str) – Database filename or alias.

add_user(user)

Add new user.

Parameters

user (User) – Instance of User with at least its name and password attributes specified as non-empty values. All other attributes are optional.

Note

This method ignores the user_id and group_id attributes of User regardless of their values.

backup(source_database, dest_filenames, dest_file_sizes=(), ignore_checksums=0, ignore_limbo_transactions=0, metadata_only=0, collect_garbage=1, transportable=1, convert_external_tables=0, compressed=1, no_db_triggers=0, callback=None, stats=None)

Request logical (GBAK) database backup. (ASYNC service)

Parameters
  • source_database (str) – Source database specification.

  • dest_filenames (str or tuple(str)) – Backup file(s) specification.

Keyword Arguments
  • dest_file_sizes (tuple(int)) – Specification of backup file max. sizes.

  • ignore_checksums (int) – 1 to ignore checksums.

  • ignore_limbo_transactions (int) – 1 to ignore limbo transactions.

  • metadata_only (int) – 1 to create only metadata backup.

  • collect_garbage (int) – 0 to skip garbage collection.

  • transportable (int) – 0 to do not create transportable backup.

  • convert_external_tables (int) – 1 to convert external table to internal ones.

  • compressed (int) – 0 to create uncompressed backup.

  • no_db_triggers (int) – 1 to disable database triggers temporarily.

  • callback (callable) – Function to call back with each output line. Function must accept only one parameter: line of output.

  • stats (list) – List of arguments for run-time statistics, see STATS_* constants.

If callback is not specified, backup log could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().

Note

Until backup report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.

bring_online(database, online_mode=0)

Bring previously shut down database back online.

Parameters

database (str) – Database filename or alias.

Keyword Arguments

online_mode (int) – One from following constants: SHUT_LEGACY, SHUT_SINGLE, SHUT_MULTI or (Default) SHUT_NORMAL.

See also

Method shutdown()

close()

Close the connection now (rather than whenever __del__ is called). The connection will be unusable from this point forward; an Error (or subclass) exception will be raised if any operation is attempted with the connection.

commit_limbo_transaction(database, transaction_id)

Resolve limbo transaction with commit.

Parameters
  • database (str) – Database filename or alias.

  • transaction_id (int) – ID of Transaction to resolve.

get_architecture()

Get Firebird Server architecture.

Returns

Architecture (example: ‘Firebird/linux AMD64’).

Return type

str

get_attached_database_names()

Get list of attached databases.

Returns

Filenames of attached databases.

Return type

list

get_connection_count()

Get number of attachments to server.

Returns

Number of attachments.

Return type

int

get_home_directory()

Get Firebird Home (installation) Directory.

Returns

Directory path.

Return type

str

get_limbo_transaction_ids(database)

Get list of transactions in limbo.

Parameters

database (str) – Database filename or alias.

Returns

Transaction IDs.

Return type

list

Raises

fdb.InternalError – When can’t process the result buffer.

get_lock_file_directory()

Get directory location for Firebird lock files.

Returns

Directory path.

Return type

str

get_log(callback=None)

Request content of Firebird Server log. (ASYNC service)

Keyword Arguments

callback (callable) – Function to call back with each output line. Function must accept only one parameter: line of output.

If callback is not specified, log content could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().

Note

Until log content is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.

get_message_file_directory()

Get directory with Firebird message file.

Returns

Directory path.

Return type

str

get_security_database_path()

Get full path to Firebird security database.

Returns

Path (path+filename) to security database.

Return type

str

get_server_capabilities()

Get list of Firebird capabilities.

Returns

Capability info codes for each capability reported by server.

Return type

tuple

Next fdb.services constants define possible info codes returned:

CAPABILITY_MULTI_CLIENT
CAPABILITY_REMOTE_HOP
CAPABILITY_SERVER_CONFIG
CAPABILITY_QUOTED_FILENAME
CAPABILITY_NO_SERVER_SHUTDOWN

Example

>>>fdb.services.CAPABILITY_REMOTE_HOP in svc.get_server_capabilities()
True
get_server_version()

Get Firebird version.

Returns

Firebird version (example: ‘LI-V2.5.2.26536 Firebird 2.5’).

Return type

str

get_service_manager_version()

Get Firebird Service Manager version number.

Returns

Version number.

Return type

int

get_statistics(database, show_only_db_log_pages=0, show_only_db_header_pages=0, show_user_data_pages=1, show_user_index_pages=1, show_system_tables_and_indexes=0, show_record_versions=0, callback=None, tables=None)

Request database statisctics. (ASYNC service)

Parameters

database (str) – Database specification.

Keyword Arguments
  • show_only_db_log_pages (int) – 1 to analyze only log pages.

  • show_only_db_header_pages (int) – 1 to analyze only database header. When set, all other parameters are ignored.

  • show_user_data_pages (int) – 0 to skip user data analysis.

  • show_user_index_pages (int) – 0 to skip user index analysis.

  • show_system_tables_and_indexes (int) – 1 to analyze system tables and indices.

  • show_record_versions (int) – 1 to analyze record versions.

  • callback (callable) – Function to call back with each output line. Function must accept only one parameter: line of output.

  • tables (str or list) – table name or iterable of table names.

If callback is not specified, statistical report could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().

Note

Until report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.

get_users(user_name=None)

Get information about user(s).

Keyword Arguments

user_name (str) – When specified, returns information only about user with specified user name.

Returns

List of User instances.

Return type

list

isrunning()

Returns True if service is running.

Note

Some services like backup() or sweep() may take time to comlete, so they’re called asynchronously. Until they’re finished, no other async service could be started.

local_backup(source_database, backup_stream, ignore_checksums=0, ignore_limbo_transactions=0, metadata_only=0, collect_garbage=1, transportable=1, convert_external_tables=0, compressed=1, no_db_triggers=0)

Request logical (GBAK) database backup into local byte stream. (SYNC service)

Parameters
  • source_database (str) – Source database specification.

  • backup_stream (stream) – Backup stream.

Keyword Arguments
  • ignore_checksums (int) – 1 to ignore checksums.

  • ignore_limbo_transactions (int) – 1 to ignore limbo transactions.

  • metadata_only (int) – 1 to create only metadata backup.

  • collect_garbage (int) – 0 to skip garbage collection.

  • transportable (int) – 0 to do not create transportable backup.

  • convert_external_tables (int) – 1 to convert external table to internal ones.

  • compressed (int) – 0 to create uncompressed backup.

  • no_db_triggers (int) – 1 to disable database triggers temporarily.

local_restore(backup_stream, dest_filenames, dest_file_pages=(), page_size=None, cache_buffers=None, access_mode_read_only=0, replace=0, deactivate_indexes=0, do_not_restore_shadows=0, do_not_enforce_constraints=0, commit_after_each_table=0, use_all_page_space=0, no_db_triggers=0, metadata_only=0)

Request database restore from logical (GBAK) backup stored in local byte stream. (SYNC service)

Parameters
  • backup_stream (stream) – Backup stream.

  • dest_filenames (str or tuple(str)) – Database file(s) specification.

Keyword Arguments
  • dest_file_pages (tuple(int)) – Specification of database file max. # of pages.

  • page_size (int) – Page size.

  • cache_buffers (int) – Size of page-cache for this database.

  • access_mode_read_only (int) – 1 to create R/O database.

  • replace (int) – 1 to replace existing database.

  • deactivate_indexes (int) – 1 to do not activate indices.

  • do_not_restore_shadows (int) – 1 to do not restore shadows.

  • do_not_enforce_constraints (int) – 1 to do not enforce constraints during restore.

  • commit_after_each_table (int) – 1 to commit after each table is restored.

  • use_all_page_space (int) – 1 to use all space on data pages.

  • no_db_triggers (int) – 1 to disable database triggers temporarily.

  • metadata_only (int) – 1 to restore only database metadata.

modify_user(user)

Modify user information.

Parameters

user (User) – Instance of User with at least its name attribute specified as non-empty value.

Note

This method sets first_name, middle_name and last_name to their actual values, and ignores the user_id and group_id attributes regardless of their values. password is set only when it has value.

nbackup(source_database, dest_filename, nbackup_level=0, no_db_triggers=0)

Perform physical (NBACKUP) database backup.

Parameters
  • source_database (str) – Source database specification.

  • dest_filename (str) – Backup file specification.

Keyword Arguments
  • nbackup_level (int) – Incremental backup level.

  • no_db_triggers (int) – 1 to disable database triggers temporarily.

Note

Method call will not return until action is finished.

next()

Return the next result line from service manager. Part of iterator protocol.

Raises

StopIteration – If there are no further lines.

no_linger(database)

Set one-off override for database linger.

Parameters

database (str) – Database filename or alias.

nrestore(source_filenames, dest_filename, no_db_triggers=0)

Perform restore from physical (NBACKUP) database backup.

Parameters
  • source_filenames (str or tuple(str)) – Backup file(s) specification.

  • dest_filename (str) – Database file specification.

Keyword Arguments

no_db_triggers (int) – 1 to disable database triggers temporarily.

Note

Method call will not return until action is finished.

readline()

Get next line of textual output from last service query.

Returns

Output line.

Return type

str

readlines()

Get list of remaining output lines from last service query.

Returns

Service output.

Return type

list

Raises

fdb.ProgrammingError – When service is not in fetching mode.

remove_user(user)

Remove user.

Parameters

user (User) – User name or Instance of User with at least its name attribute specified as non-empty value.

repair(database, read_only_validation=0, ignore_checksums=0, kill_unavailable_shadows=0, mend_database=0, validate_database=1, validate_record_fragments=1)

Database Validation and Repair.

Parameters

database (str) – Database filename or alias.

Keyword Arguments
  • read_only_validation (int) – 1 to prevent any database changes.

  • ignore_checksums (int) – 1 to ignore page checksum errors.

  • kill_unavailable_shadows (int) – 1 to kill unavailable shadows.

  • mend_database (int) – 1 to fix database for backup.

  • validate_database (int) – 0 to skip database validation.

  • validate_record_fragments (int) – 0 to skip validation of record fragments.

Note

Method call will not return until action is finished.

restore(source_filenames, dest_filenames, dest_file_pages=(), page_size=None, cache_buffers=None, access_mode_read_only=0, replace=0, deactivate_indexes=0, do_not_restore_shadows=0, do_not_enforce_constraints=0, commit_after_each_table=0, use_all_page_space=0, no_db_triggers=0, metadata_only=0, callback=None, stats=None)

Request database restore from logical (GBAK) backup. (ASYNC service)

Parameters
  • source_filenames (str or tuple(str)) – Backup file(s) specification.

  • dest_filenames (str or tuple(str)) – Database file(s) specification.

Keyword Arguments
  • dest_file_pages (tuple(int)) – Specification of database file max. # of pages.

  • page_size (int) – Page size.

  • cache_buffers (int) – Size of page-cache for this database.

  • access_mode_read_only (int) – 1 to create R/O database.

  • replace (int) – 1 to replace existing database.

  • deactivate_indexes (int) – 1 to do not activate indices.

  • do_not_restore_shadows (int) – 1 to do not restore shadows.

  • do_not_enforce_constraints (int) – 1 to do not enforce constraints during restore.

  • commit_after_each_table (int) – 1 to commit after each table is restored.

  • use_all_page_space (int) – 1 to use all space on data pages.

  • no_db_triggers (int) – 1 to disable database triggers temporarily.

  • metadata_only (int) – 1 to restore only database metadata.

  • callback (callable) – Function to call back with each output line. Function must accept only one parameter: line of output.

  • stats (list) – List of arguments for run-time statistics, see STATS_* constants.

If callback is not specified, restore log could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().

Note

Until restore report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.

rollback_limbo_transaction(database, transaction_id)

Resolve limbo transaction with rollback.

Parameters
  • database (str) – Database filename or alias.

  • transaction_id (int) – ID of Transaction to resolve.

set_access_mode(database, mode)

Set Database Access mode: Read Only or Read/Write

Parameters
  • database (str) – Database filename or alias.

  • mode (int) – One from following constants: ACCESS_READ_WRITE or ACCESS_READ_ONLY

set_default_page_buffers(database, n)

Set individual page cache size for Database.

Parameters
  • database (str) – Database filename or alias.

  • n (int) – Number of pages.

set_reserve_page_space(database, reserve_space)

Set data page space reservation policy.

Parameters
  • database (str) – Database filename or alias.

  • reserve_space (bool) – True to reserve space, False to do not.

set_sql_dialect(database, dialect)

Set SQL Dialect for Database.

Parameters
  • database (str) – Database filename or alias.

  • dialect (int) – 1 or 3.

set_sweep_interval(database, n)

Set treshold for automatic sweep.

Parameters
  • database (str) – Database filename or alias.

  • n (int) – Sweep treshold, or 0 to disable automatic sweep.

set_write_mode(database, mode)

Set Disk Write Mode: Sync (forced writes) or Async (buffered).

Parameters
  • database (str) – Database filename or alias.

  • mode (int) – One from following constants: WRITE_FORCED or WRITE_BUFFERED

shutdown(database, shutdown_mode, shutdown_method, timeout)

Database shutdown.

Parameters
  • database (str) – Database filename or alias.

  • shutdown_mode (int) – One from following constants: SHUT_LEGACY, SHUT_SINGLE, SHUT_MULTI or SHUT_FULL.

  • shutdown_method (int) – One from following constants: SHUT_FORCE, SHUT_DENY_NEW_TRANSACTIONS or SHUT_DENY_NEW_ATTACHMENTS.

  • timeout (int) – Time in seconds, that the shutdown must complete in.

See also

Method bring_online()

sweep(database)

Perform Database Sweep.

Note

Method call will not return until sweep is finished.

Parameters

database (str) – Database filename or alias.

trace_list()

Get information about existing trace sessions.

Returns

Mapping SESSION_ID -> SESSION_PARAMS

Return type

dict

Session parameters is another dictionary with next keys:

name

(str) (optional) Session name if specified.

date

(datetime.datetime) Session start date and time.

user

(str) Trace user name.

flags

(list(str)) Session flags.

Raises

fdb.OperationalError – When server can’t perform requested operation.

trace_resume(trace_id)

Resume trace session.

Parameters

trace_id (int) – Trace session ID.

Returns

Text with confirmation that session was resumed.

Return type

str

Raises
trace_start(config, name=None)

Start new trace session. (ASYNC service)

Parameters

config (str) – Trace session configuration.

Keyword Arguments

name (str) – Trace session name.

Returns

Trace session ID.

Return type

integer

Raises

fdb.DatabaseError – When session ID is not returned on start.

Trace session output could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().

Note

Until session output is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service including call to any trace_ method will fail with exception.

trace_stop(trace_id)

Stop trace session.

Parameters

trace_id (int) – Trace session ID.

Returns

Text with confirmation that session was stopped.

Return type

str

Raises
trace_suspend(trace_id)

Suspend trace session.

Parameters

trace_id (int) – Trace session ID.

Returns

Text with confirmation that session was paused.

Return type

str

Raises
user_exists(user)

Check for user’s existence.

Parameters

user (User) – User name or Instance of User with at least its name attribute specified as non-empty value.

Returns

True when the specified user exists.

Return type

bool

validate(database, include_tables=None, exclude_tables=None, include_indices=None, exclude_indices=None, lock_timeout=None, callback=None)

On-line database validation.

Parameters

database (str) – Database filename or alias.

Keyword Arguments
  • include_tables (str) – Pattern for table names to include in validation run.

  • exclude_tables (str) – Pattern for table names to exclude from validation run.

  • include_indices (str) – Pattern for index names to include in validation run.

  • exclude_indices (str) – Pattern for index names to exclude from validation run.

  • lock_timeout (int) – lock timeout, used to acquire locks for table to validate, in seconds, default is 10 secs. 0 is no-wait, -1 is infinite wait.

  • callback (callable) – Function to call back with each output line. Function must accept only one parameter: line of output.

Note

Patterns are regular expressions, processed by the same rules as SIMILAR TO expressions. All patterns are case-sensitive, regardless of database dialect. If the pattern for tables is omitted then all user tables will be validated. If the pattern for indexes is omitted then all indexes of the appointed tables will be validated. System tables are not validated.

If callback is not specified, validation log could be retrieved through readline(), readlines(), iteration over Connection or ignored via call to wait().

Note

Until validate report is not fully fetched from service (or ignored via wait()), any attempt to start another asynchronous service will fail with exception.

wait()

Wait until running service completes, i.e. stops sending data.

QUERY_TYPE_PLAIN_INTEGER = 1
QUERY_TYPE_PLAIN_STRING = 2
QUERY_TYPE_RAW = 3
property closed

(Read Only) True if connection is closed.

property engine_version

(Read Only) (float) Firebird version number of connected server. Only major.minor version.

property fetching

(Read Only) True if connection is fetching result.

property version

(Read Only) (string) Firebird version number string of connected server. Uses Firebird version numbers in form: major.minor.subrelease.build

User

class fdb.services.User(name=None)
load_information(svc)

Load information about user from server.

Parameters

svc (Connection) – Open service connection.

Returns

True if information was successfuly retrieved, False otherwise.

Raises

fdb.ProgrammingError – If user name is not defined.

first_name = None

First name.

Type

str

group_id = None

User group ID

Type

int

last_name = None

Last name

Type

str

middle_name = None

Middle name

Type

str

name = None

User login name (username).

Type

str

password = None

Password. Not returned by user output methods, but must be specified to add a user.

Type

str

user_id = None

User ID

Type

int

Database schema

Module globals

Firebird field type codes

  • FBT_SMALLINT

  • FBT_INTEGER

  • FBT_QUAD

  • FBT_FLOAT

  • FBT_CHAR

  • FBT_DOUBLE_PRECISION

  • FBT_DATE

  • FBT_VARCHAR

  • FBT_CSTRING

  • FBT_BLOB_ID

  • FBT_BLOB

  • FBT_SQL_DATE

  • FBT_SQL_TIME

  • FBT_SQL_TIMESTAMP

  • FBT_BIGINT

  • FBT_BOOLEAN

Trigger masks

  • TRIGGER_TYPE_SHIFT

  • TRIGGER_TYPE_MASK

  • TRIGGER_TYPE_DML

  • TRIGGER_TYPE_DB

  • TRIGGER_TYPE_DDL

Trigger type codes

  • DDL_TRIGGER_ANY

  • DDL_TRIGGER_CREATE_TABLE

  • DDL_TRIGGER_ALTER_TABLE

  • DDL_TRIGGER_DROP_TABLE

  • DDL_TRIGGER_CREATE_PROCEDURE

  • DDL_TRIGGER_ALTER_PROCEDURE

  • DDL_TRIGGER_DROP_PROCEDURE

  • DDL_TRIGGER_CREATE_FUNCTION

  • DDL_TRIGGER_ALTER_FUNCTION

  • DDL_TRIGGER_DROP_FUNCTION

  • DDL_TRIGGER_CREATE_TRIGGER

  • DDL_TRIGGER_ALTER_TRIGGER

  • DDL_TRIGGER_DROP_TRIGGER

  • DDL_TRIGGER_CREATE_EXCEPTION

  • DDL_TRIGGER_ALTER_EXCEPTION

  • DDL_TRIGGER_DROP_EXCEPTION

  • DDL_TRIGGER_CREATE_VIEW

  • DDL_TRIGGER_ALTER_VIEW

  • DDL_TRIGGER_DROP_VIEW

  • DDL_TRIGGER_CREATE_DOMAIN

  • DDL_TRIGGER_ALTER_DOMAIN

  • DDL_TRIGGER_DROP_DOMAIN

  • DDL_TRIGGER_CREATE_ROLE

  • DDL_TRIGGER_ALTER_ROLE

  • DDL_TRIGGER_DROP_ROLE

  • DDL_TRIGGER_CREATE_INDEX

  • DDL_TRIGGER_ALTER_INDEX

  • DDL_TRIGGER_DROP_INDEX

  • DDL_TRIGGER_CREATE_SEQUENCE

  • DDL_TRIGGER_ALTER_SEQUENCE

  • DDL_TRIGGER_DROP_SEQUENCE

  • DDL_TRIGGER_CREATE_USER

  • DDL_TRIGGER_ALTER_USER

  • DDL_TRIGGER_DROP_USER

  • DDL_TRIGGER_CREATE_COLLATION

  • DDL_TRIGGER_DROP_COLLATION

  • DDL_TRIGGER_ALTER_CHARACTER_SET

  • DDL_TRIGGER_CREATE_PACKAGE

  • DDL_TRIGGER_ALTER_PACKAGE

  • DDL_TRIGGER_DROP_PACKAGE

  • DDL_TRIGGER_CREATE_PACKAGE_BODY

  • DDL_TRIGGER_DROP_PACKAGE_BODY

  • DDL_TRIGGER_CREATE_MAPPING

  • DDL_TRIGGER_ALTER_MAPPING

  • DDL_TRIGGER_DROP_MAPPING

Collation parameters codes

  • COLLATION_PAD_SPACE

  • COLLATION_CASE_INSENSITIVE

  • COLLATION_ACCENT_INSENSITIVE

Index type names

  • INDEX_TYPE_ASCENDING

  • INDEX_TYPE_DESCENDING

Relation type codes

  • RELATION_TYPE_TABLE

  • RELATION_TYPE_VIEW

  • RELATION_TYPE_GTT

  • RELATION_TYPE_GTT_PRESERVE

  • RELATION_TYPE_GTT_DELETE

Procedure parameter type codes

  • PROCPAR_DATATYPE

  • PROCPAR_DOMAIN

  • PROCPAR_TYPE_OF_DOMAIN

  • PROCPAR_TYPE_OF_COLUMN

Section codes for Schema.get_metadata_ddl()

  • SCRIPT_COLLATIONS

  • SCRIPT_CHARACTER_SETS

  • SCRIPT_UDFS

  • SCRIPT_GENERATORS

  • SCRIPT_EXCEPTIONS

  • SCRIPT_DOMAINS

  • SCRIPT_PACKAGE_DEFS

  • SCRIPT_FUNCTION_DEFS

  • SCRIPT_PROCEDURE_DEFS

  • SCRIPT_TABLES

  • SCRIPT_PRIMARY_KEYS

  • SCRIPT_UNIQUE_CONSTRAINTS

  • SCRIPT_CHECK_CONSTRAINTS

  • SCRIPT_FOREIGN_CONSTRAINTS

  • SCRIPT_INDICES

  • SCRIPT_VIEWS

  • SCRIPT_PACKAGE_BODIES

  • SCRIPT_PROCEDURE_BODIES

  • SCRIPT_FUNCTION_BODIES

  • SCRIPT_TRIGGERS

  • SCRIPT_ROLES

  • SCRIPT_GRANTS

  • SCRIPT_COMMENTS

  • SCRIPT_SHADOWS

  • SCRIPT_SET_GENERATORS

  • SCRIPT_INDEX_DEACTIVATIONS

  • SCRIPT_INDEX_ACTIVATIONS

  • SCRIPT_TRIGGER_DEACTIVATIONS

  • SCRIPT_TRIGGER_ACTIVATIONS

Lists and disctionary maps

COLUMN_TYPES

Dictionary map from filed type codes to type names

INTEGRAL_SUBTYPES

List of integral type names, works as map

INDEX_TYPES

List of index types

BLOB_SUBTYPES

List of blob type names, works as map

TRIGGER_PREFIX_TYPES

List of trigger prefix type names, works as map

TRIGGER_SUFFIX_TYPES

List of trigger suffix type names, works as map

TRIGGER_DB_TYPES

List of db trigger type names, works as map

TRIGGER_DDL_TYPES

List of DLL trigger type names, works as map

RESERVED

List of reserved Firebird words

NON_RESERVED

List of non-reserved Firebird words

SCRIPT_DEFAULT_ORDER

List of default sections (in order) for Schema.get_metadata_ddl()

Functions

get_grants

fdb.schema.get_grants(privileges, grantors=None)

Get list of minimal set of SQL GRANT statamenets necessary to grant specified privileges.

Parameters

privileges (list) – List of Privilege instances.

Keyword Arguments

grantors (list) – List of standard grantor names. Generates GRANTED BY clause for privileges granted by user that’s not in list.

iskeyword

fdb.schema.iskeyword(ident)

Return True if ident is (any) Firebird keyword.

escape_single_quotes

fdb.schema.escape_single_quotes(text)

Return text with any single quotes escaped (doubled).

Classes

Schema

class fdb.schema.Schema

Bases: fdb.utils.Visitable

This class represents database schema.

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

bind(connection)

Bind this instance to specified Connection.

Parameters

connectionConnection instance.

Raises

fdb.ProgrammingError – If Schema object was set as internal (via _set_as_internal()).

clear()

Drop all cached metadata objects.

close()

Sever link to Connection.

Raises

fdb.ProgrammingError – If Schema object was set as internal (via _set_as_internal()).

get_character_set(name)

Get CharacterSet by name.

Parameters

name (str) – Character set name.

Returns

CharacterSet with specified name or None.

get_character_set_by_id(id)

Get CharacterSet by ID.

Parameters

id (int) – CharacterSet ID.

Returns

CharacterSet with specified ID or None.

get_collation(name)

Get Collation by name.

Parameters

name (str) – Collation name.

Returns

Collation with specified name or None.

get_collation_by_id(charset_id, collation_id)

Get Collation by ID.

Parameters
  • charset_id (int) – Character set ID.

  • collation_id (int) – Collation ID.

Returns

Collation with specified ID or None.

get_constraint(name)

Get Constraint by name.

Parameters

name (str) – Constraint name.

Returns

Constraint with specified name or None.

get_domain(name)

Get Domain by name.

Parameters

name (str) – Domain name.

Returns

Domain with specified name or None.

get_exception(name)

Get DatabaseException by name.

Parameters

name (str) – Exception name.

Returns

DatabaseException with specified name or None.

get_function(name)

Get Function by name.

Parameters

name (str) – Function name.

Returns

Function with specified name or None.

get_generator(name)

Get Sequence by name.

Parameters

name (str) – Sequence name.

Returns

Sequence with specified name or None.

get_index(name)

Get Index by name.

Parameters

name (str) – Index name.

Returns

Index with specified name or None.

get_metadata_ddl(sections=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 21, 23, 24, 25])

Return list of DDL SQL commands for creation of specified categories of database objects.

Keyword Arguments

sections (list) – List of section identifiers.

Returns

List with SQL commands.

Sections identifiers are represented by SCRIPT_* contants defined in schema module.

Sections are created in the order of occerence in list. Uses SCRIPT_DEFAULT_ORDER list when sections are not specified.

get_package(name)

Get Package by name.

Parameters

name (str) – Package name.

Returns

Package with specified name or None.

get_privileges_of(user, user_type=None)

Get list of all privileges granted to user/database object.

Parameters

user – User name or instance of class that represents possible user. Allowed classes are User, Table, View, Procedure, Trigger or Role.

Keyword Arguments

user_type (int) – Required if user is provided as string name. Numeric code for user type, see Schema.enum_object_types.

Returns

List of Privilege objects.

Raises

fdb.ProgrammingError – For unknown user_type code.

get_procedure(name)

Get Procedure by name.

Parameters

name (str) – Procedure name.

Returns

Procedure with specified name or None.

get_role(name)

Get Role by name.

Parameters

name (str) – Role name.

Returns

Role with specified name or None.

get_sequence(name)

Get Sequence by name.

Parameters

name (str) – Sequence name.

Returns

Sequence with specified name or None.

get_table(name)

Get Table by name.

Parameters

name (str) – Table name.

Returns

Table with specified name or None.

get_trigger(name)

Get Trigger by name.

Parameters

name (str) – Trigger name.

Returns

Trigger with specified name or None.

get_view(name)

Get View by name.

Parameters

name (str) – View name.

Returns

View with specified name or None.

ismultifile()

Returns true if database has multiple files.

reload(data=None)

Drop all or specified category of cached metadata objects, so they’re reloaded from database on next reference.

Keyword Arguments

dataNone, metadata category code or iterable with category codes.

Note

Category codes are defined by SCHEMA_* globals.

Also commits query transaction!

Raises

fdb.ProgrammingError – For undefined metadata category.

property backup_history

ObjectList of all nbackup hisotry records. Items are BackupHistory objects.

property character_sets

ObjectList of all character sets in database. Items are CharacterSet objects.

property closed

True if link to Connection is closed.

property collations

ObjectList of all collations in database. Items are Collation objects.

property constraints

ObjectList of all constraints in database. Items are Constraint objects.

property default_character_set

Default CharacterSet for database

property dependencies

ObjectList of all dependencies in database. Items are Dependency objects.

property description

Database description or None if it doesn’t have a description.

property domains

ObjectList of all user domains in database. Items are Domain objects.

enum_character_set_names = {}

key = numID, value = charset_name

Type

Character set names

enum_determinism_flags = {}

numID, value = flag_name

Type

Determinism flags

enum_field_subtypes = {}

key = numID, value = type_name

Type

Field sub types

enum_field_types = {}

key = numID, value = type_name

Type

Field types

enum_function_types = {}

key = numID, value = type_name

Type

Function types

enum_grant_options = {}

key = numID, value = option_name

Type

Grant option

enum_index_activity_flags = {}

key = numID, value = flag_name

Type

Index activity status

enum_index_unique_flags = {}

key = numID, value = flag_name

Type

Index uniqueness

enum_legacy_flags = {}

numID, value = flag_name

Type

Legacy flags

enum_mechanism_types = {}

key = numID, value = type_name

Type

Mechanism Types

enum_object_type_codes = {}

key = type_name, value = numID

Type

Object type codes

enum_object_types = {}

key = numID, value = type_name

Type

Object types

enum_page_types = {}

key = numID, value = type_name

Type

Page type

enum_param_type_from = {0: 'DATATYPE', 1: 'DOMAIN', 2: 'TYPE OF DOMAIN', 3: 'TYPE OF COLUMN'}

key = numID, value = name

Type

Datatype declaration methods for procedure parameters

enum_parameter_mechanism_types = {}

key = numID, value = type_name

Type

Parameter Mechanism Types

enum_parameter_types = {}

key = numID, value = type_name

Type

Parameter Types

enum_privacy_flags = {}

numID, value = flag_name

Type

Privacy flags

enum_procedure_types = {}

key = numID, value = type_name

Type

Procedure Types

enum_relation_types = {}

key = numID, value = type_name

Type

Relation Types

enum_system_flag_types = {}

key = numID, value = type_name

Type

System Flag Types

enum_transaction_state_types = {}

key = numID, value = type_name

Type

Transaction State Types

enum_trigger_activity_flags = {}

key = numID, value = flag_name_name

Type

Trigger activity status

enum_trigger_types = {}

key = numID, value = type_name

Type

Trigger Types

property exceptions

ObjectList of all exceptions in database. Items are DatabaseException objects.

property files

ObjectList of all extension files defined for database. Items are DatabaseFile objects.

property filters

ObjectList of all user-defined BLOB filters. Items are Filter objects.

property functions

ObjectList of all user functions defined in database. Items are Function objects.

property generators

ObjectList of all user generators in database. Items are Sequence objects.

property indices

ObjectList of all user indices in database. Items are Index objects.

property linger

Database linger value.

opt_always_quote = False

Always quote db object names on output

Type

option switch

opt_generator_keyword = 'SEQUENCE'

Keyword for generator/sequence

Type

option switch

property owner_name

Database owner name.

property packages

ObjectList of all packages defined for database. Items are Package objects.

property privileges

ObjectList of all privileges defined for database. Items are Privilege objects.

property procedures

ObjectList of all user procedures in database. Items are Procedure objects.

property roles

ObjectList of all roles in database. Items are Role objects.

property security_class

Can refer to the security class applied as databasewide access control limits.

property sequences

ObjectList of all user generators in database. Items are Sequence objects.

property shadows

ObjectList of all shadows defined for database. Items are Shadow objects.

property sysdomains

ObjectList of all system domains in database. Items are Domain objects.

property sysfunctions

ObjectList of all system functions defined in database. Items are Function objects.

property sysgenerators

ObjectList of all system generators in database. Items are Sequence objects.

property sysindices

ObjectList of all system indices in database. Items are Index objects.

property sysprocedures

ObjectList of all system procedures in database. Items are Procedure objects.

property syssequences

ObjectList of all system generators in database. Items are Sequence objects.

property systables

ObjectList of all system tables in database. Items are Table objects.

property systriggers

ObjectList of all system triggers in database. Items are Trigger objects.

property sysviews

ObjectList of all system views in database. Items are View objects.

property tables

ObjectList of all user tables in database. Items are Table objects.

property triggers

ObjectList of all user triggers in database. Items are Trigger objects.

property views

ObjectList of all user views in database. Items are View objects.

BaseSchemaItem

class fdb.schema.BaseSchemaItem(schema, attributes)

Bases: fdb.utils.Visitable

Base class for all database schema objects.

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property name

Database object name or None if object doesn’t have a name.

schema = None

Weak reference to parent Schema instance.

Collation

class fdb.schema.Collation(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents collation.

Supported SQL actions:
  • User collation: create, drop, comment

  • System collation: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

isaccentinsensitive()

Returns True if collation has ACCENT INSENSITIVE attribute.

isbasedonexternal()

Returns True if collation is based on external collation definition.

iscaseinsensitive()

Returns True if collation has CASE INSENSITIVE attribute.

ispadded()

Returns True if collation has PAD SPACE attribute.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property attributes

Collation attributes.

property base_collation

Base Collation object that’s extended by this one or None.

property character_set

Character set object associated with collation.

property description

Database object description or None if object doesn’t have a description.

property function_name

Not currently used.

property id

Collation ID.

property name

Database object name or None if object doesn’t have a name.

property owner_name

Creator user name.

schema = None
property security_class

Security class name or None.

property specific_attributes

Collation specific attributes.

CharacterSet

class fdb.schema.CharacterSet(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents character set.

Supported SQL actions:

alter (collation=Collation instance or collation name), comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_collation(name)

Return Collation object with specified name that belongs to this character set.

get_collation_by_id(id)

Return Collation object with specified id that belongs to this character set.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property bytes_per_character

Size of characters in bytes.

property collations

ObjectList of Collations associated with character set.

property default_collate

Collate object of default collate.

property description

Database object description or None if object doesn’t have a description.

property id

Character set ID.

property name

Database object name or None if object doesn’t have a name.

property owner_name

Creator user name.

schema = None
property security_class

Security class name or None.

DatabaseException

class fdb.schema.DatabaseException(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents database exception.

Supported SQL actions:
  • User exception: create, recreate, alter (message=string), create_or_alter, drop, comment

  • System exception: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property id

System-assigned unique exception number.

property message

Custom message text.

property name

Database object name or None if object doesn’t have a name.

property owner_name

Creator user name.

schema = None
property security_class

Security class name or None.

Sequence

class fdb.schema.Sequence(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents database generator/sequence.

Supported SQL actions:
  • User sequence: create, alter (value=number), drop, comment

  • System sequence: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

isidentity()

Returns True for system generators created for IDENTITY columns.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property id

Internal ID number of the sequence.

property increment

Sequence increment.

property inital_value

Initial sequence value.

property name

Database object name or None if object doesn’t have a name.

property owner_name

Creator user name.

schema = None
property security_class

Security class name or None.

property value

Current sequence value.

Index

class fdb.schema.Index(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents database index.

Supported SQL actions:
  • User index: create, activate, deactivate, recompute, drop, comment

  • System index: activate, recompute, comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

isenforcer()

Returns True if index is used to enforce a constraint.

isexpression()

Returns True if index is expression index.

isinactive()

Returns True if index is INACTIVE.

issystemobject()

Returns True if this database object is system object.

isunique()

Returns True if index is UNIQUE.

property actions

List of supported SQL operations on metadata object instance.

property constraint

Constraint instance that uses this index or None.

property description

Database object description or None if object doesn’t have a description.

property expression

Source of an expression or None.

property id

Internal number ID of the index.

property index_type

ASCENDING or DESCENDING.

property name

Database object name or None if object doesn’t have a name.

property partner_index

Associated unique/primary key Index instance, or None.

schema = None
property segment_names

List of index segment names.

property segment_statistics

List of index segment statistics (for ODS 11.1 and higher).

property segments

ObjectList of index segments as TableColumn instances.

property statistics

Latest selectivity of the index.

property table

The Table instance the index applies to.

TableColumn

class fdb.schema.TableColumn(schema, table, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents table column.

Supported SQL actions:
  • User column: drop, comment, alter (name=string, datatype=string_SQLTypeDef, position=number, expression=computed_by_expr, restart=None_or_init_value)

  • System column: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_computedby()

Returns (string) extression for column computation or None.

get_dependencies()

Return list of database objects that this object depend on.

get_dependents()

Return list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_default()

Returns True if column has default value.

iscomputed()

Returns True if column is computed.

isdomainbased()

Returns True if column is based on user domain.

isidentity()

Returns True for identity type column.

isnullable()

Returns True if column can accept NULL values.

issystemobject()

Returns True if this database object is system object.

iswritable()

Returns True if column is writable (i.e. it’s not computed etc.).

property actions

List of supported SQL operations on metadata object instance.

property collation

Collation object or None.

property datatype

Comlete SQL datatype definition.

property default

Default value for column or None.

property description

Database object description or None if object doesn’t have a description.

property domain

Domain object this column is based on.

property generator

Internal flags.

property id

Internam number ID for the column.

property identity_type

Internal flags.

property name

Database object name or None if object doesn’t have a name.

property position

Column’s sequence number in row.

property privileges

ObjectList of Privilege objects granted to this object.

schema = None
property security_class

Security class name or None.

property table

The Table object this column belongs to.

ViewColumn

class fdb.schema.ViewColumn(schema, view, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents view column.

Supported SQL actions:

comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Return list of database objects that this object depend on.

get_dependents()

Return list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

isnullable()

Returns True if column is NULLABLE.

issystemobject()

Returns True if this database object is system object.

iswritable()

Returns True if column is writable.

property actions

List of supported SQL operations on metadata object instance.

property base_field

The source column from the base relation. Result could be either TableColumn, ViewColumn or ProcedureParameter instance or None.

property collation

Collation object or None.

property datatype

Comlete SQL datatype definition.

property description

Database object description or None if object doesn’t have a description.

property domain

Domain object this column is based on.

property name

Database object name or None if object doesn’t have a name.

property position

Column’s sequence number in row.

property privileges

ObjectList of Privilege objects granted to this object.

schema = None
property security_class

Security class name or None.

property view

View object this column belongs to.

Domain

class fdb.schema.Domain(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents SQl Domain.

Supported SQL actions:
  • User domain: create, drop, comment, alter (name=string, default=string_definition_or_None, check=string_definition_or_None, datatype=string_SQLTypeDef)

  • System domain: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_default()

Returns True if domain has default value.

isarray()

Returns True if domain defines an array.

iscomputed()

Returns True if domain is computed.

isnullable()

Returns True if domain is not defined with NOT NULL.

issystemobject()

Return True if this database object is system object.

isvalidated()

Returns True if domain has validation constraint.

property actions

List of supported SQL operations on metadata object instance.

property character_length

Length of CHAR and VARCHAR column, in characters (not bytes).

property character_set

CharacterSet object for a character or text BLOB column, or None.

property collation

Collation object for a character column or None.

property datatype

Comlete SQL datatype definition.

property default

Expression that defines the default value or None.

property description

Database object description or None if object doesn’t have a description.

property dimensions

List of dimension definition pairs if column is an array type. Always empty for non-array columns.

property expression

Expression that defines the COMPUTED BY column or None.

property external_length

Length of field as it is in an external table. Always 0 for regular tables.

property external_scale

Scale factor of an integer field as it is in an external table.

property external_type

Data type of the field as it is in an external table.

property field_type

Number code of the data type defined for the column.

property length

Length of the column in bytes.

property name

Database object name or None if object doesn’t have a name.

property owner_name

Creator user name.

property precision

Indicates the number of digits of precision available to the data type of the column.

property scale

Negative number representing the scale of NUMBER and DECIMAL column.

schema = None
property security_class

Security class name or None.

property segment_length

For BLOB columns, a suggested length for BLOB buffers.

property sub_type

BLOB subtype.

property validation

CHECK constraint for the domain or None.

Dependency

class fdb.schema.Dependency(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Maps dependency between database objects.

Supported SQL actions:

none

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns empty list because Dependency object never has dependencies.

get_dependents()

Returns empty list because Dependency object never has dependents.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

ispackaged()

Returns True if dependency is defined in package.

issystemobject()

Returns True as dependency entries are considered as system objects.

property actions

List of supported SQL operations on metadata object instance.

property depended_on

Database object on which dependent depends.

property depended_on_name

Name of db object on which dependent depends.

property depended_on_type

Type of db object on which dependent depends.

property dependent

Dependent database object.

property dependent_name

Dependent database object name.

property dependent_type

Dependent database object type.

property description

Database object description or None if object doesn’t have a description.

property field_name

Name of one column in depended on object.

property name

Database object name or None if object doesn’t have a name.

property package

Package instance if dependent depends on object in package or None.

schema = None

Constraint

class fdb.schema.Constraint(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents table or column constraint.

Supported SQL actions:
  • Constraint on user table except NOT NULL constraint: create, drop

  • Constraint on system table: none

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

ischeck()

Returns True if it’s CHECK constraint.

isdeferrable()

Returns True if it’s DEFERRABLE constraint.

isdeferred()

Returns True if it’s INITIALLY DEFERRED constraint.

isfkey()

Returns True if it’s FOREIGN KEY constraint.

isnotnull()

Returns True if it’s NOT NULL constraint.

ispkey()

Returns True if it’s PRIMARY KEY constraint.

issystemobject()

Returns True if this database object is system object.

isunique()

Returns True if it’s UNIQUE constraint.

property actions

List of supported SQL operations on metadata object instance.

property column_name

For a NOT NULL constraint, this is the name of the column to which the constraint applies.

property constraint_type

primary key/unique/foreign key/check/not null.

property delete_rule

For a FOREIGN KEY constraint, this is the action applicable to when primary key is deleted.

property description

Database object description or None if object doesn’t have a description.

property index

Index instance that enforces the constraint. None if constraint is not primary key/unique or foreign key.

property match_option

For a FOREIGN KEY constraint only. Current value is FULL in all cases.

property name

Database object name or None if object doesn’t have a name.

property partner_constraint

For a FOREIGN KEY constraint, this is the unique or primary key Constraint referred.

schema = None
property table

Table instance this constraint applies to.

property trigger_names

For a CHECK constraint contains trigger names that enforce the constraint.

property triggers

For a CHECK constraint contains Trigger instances that enforce the constraint.

property update_rule

For a FOREIGN KEY constraint, this is the action applicable to when primary key is updated.

Table

class fdb.schema.Table(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents Table in database.

Supported SQL actions:
  • User table: create (no_pk=bool, no_unique=bool),

    recreate (no_pk=bool, no_unique=bool), drop, comment

  • System table: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_column(name)

Return TableColumn object with specified name.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_fkey()

Returns True if table has any FOREIGN KEY constraint.

has_pkey()

Returns True if table has PRIMARY KEY defined.

isexternal()

Returns True if table is external table.

isgtt()

Returns True if table is GLOBAL TEMPORARY table.

ispersistent()

Returns True if table is persistent one.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property columns

Returns ObjectList of columns defined for table. Items are TableColumn objects.

property constraints

Returns ObjectList of constraints defined for table. Items are Constraint objects.

property dbkey_length

Length of the RDB$DB_KEY column in bytes.

property default_class

Default security class.

property description

Database object description or None if object doesn’t have a description.

property external_file

Full path to the external data file, if any.

property flags

Internal flags.

property foreign_keys

ObjectList of FOREIGN KEY Constraint instances for this table.

property format

Internal format ID for the table.

property id

Internam number ID for the table.

property indices

Returns ObjectList of indices defined for table. Items are Index objects.

property name

Database object name or None if object doesn’t have a name.

property owner_name

User name of table’s creator.

property primary_key

PRIMARY KEY Constraint for this table or None.

property privileges

ObjectList of Privilege objects granted to this object.

schema = None
property security_class

Security class that define access limits to the table.

property table_type

Table type.

property triggers

Returns ObjectList of triggers defined for table. Items are Trigger objects.

View

class fdb.schema.View(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents database View.

Supported SQL actions:
  • User views: create, recreate, alter (columns=string_or_list, query=string,check=bool),

    create_or_alter, drop, comment

  • System views: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_column(name)

Return TableColumn object with specified name.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

get_trigger(name)

Return Trigger object with specified name.

has_checkoption()

Returns True if View has WITH CHECK OPTION defined.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property columns

Returns ObjectList of columns defined for view. Items are ViewColumn objects.

property dbkey_length

Length of the RDB$DB_KEY column in bytes.

property default_class

Default security class.

property description

Database object description or None if object doesn’t have a description.

property flags

Internal flags.

property format

Internal format ID for the view.

property id

Internal number ID for the view.

property name

Database object name or None if object doesn’t have a name.

property owner_name

User name of view’s creator.

property privileges

ObjectList of Privilege objects granted to this object.

schema = None
property security_class

Security class that define access limits to the view.

property sql

The query specification.

property triggers

Returns ObjectList of triggers defined for view. Items are Trigger objects.

Trigger

class fdb.schema.Trigger(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents trigger.

Supported SQL actions:
  • User trigger: create (inactive=bool), recreate, create_or_alter, drop, comment, alter (fire_on=string, active=bool,sequence=int, declare=string_or_list, code=string_or_list)

  • System trigger: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

get_type_as_string()

Return string with action and operation specification.

isactive()

Returns True if this trigger is active.

isafter()

Returns True if this trigger is set for AFTER action.

isbefore()

Returns True if this trigger is set for BEFORE action.

isdbtrigger()

Returns True if this trigger is database trigger.

isddltrigger()

Returns True if this trigger is DDL trigger.

isdelete()

Returns True if this trigger is set for DELETE operation.

isinsert()

Returns True if this trigger is set for INSERT operation.

issystemobject()

Returns True if this database object is system object.

isupdate()

Returns True if this trigger is set for UPDATE operation.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property engine_name

Engine name.

property entrypoint

Entrypoint.

property flags

Internal flags.

property name

Database object name or None if object doesn’t have a name.

property relation

Table or View that the trigger is for, or None for database triggers

schema = None
property sequence

Sequence (position) of trigger. Zero usually means no sequence defined.

property source

PSQL source code.

property trigger_type

Numeric code for trigger type that define what event and when are covered by trigger.

property valid_blr

Trigger BLR invalidation flag. Coul be True/False or None.

ProcedureParameter

class fdb.schema.ProcedureParameter(schema, proc, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents procedure parameter.

Supported SQL actions:

comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_definition()

Returns SQL definition for parameter.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_default()

Returns True if parameter has default value.

isinput()

Returns True if parameter is INPUT parameter.

isnullable()

Returns True if parameter allows NULL.

ispackaged()

Returns True if procedure parameter is defined in package.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property collation

collation for this parameter.

property column

TableColumn for this parameter.

property datatype

Comlete SQL datatype definition.

property default

Default value.

property description

Database object description or None if object doesn’t have a description.

property domain

Domain for this parameter.

property mechanism

Parameter mechanism code.

property name

Database object name or None if object doesn’t have a name.

property package

Package this procedure belongs to. Object is Package instance or None.

property procedure

Name of the stored procedure.

schema = None
property sequence

Sequence (position) of parameter.

property type_from

Numeric code. See Schema.enum_param_type_from.`

Procedure

class fdb.schema.Procedure(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents stored procedure.

Supported SQL actions:
  • User procedure: create (no_code=bool), recreate no_code=bool), create_or_alter (no_code=bool), drop, comment alter (input=string_or_list, output=string_or_list, declare=string_or_list, code=string_or_list)

  • System procedure: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_param(name)

Returns ProcedureParameter with specified name or None

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_input()

Returns True if procedure has any input parameters.

has_output()

Returns True if procedure has any output parameters.

ispackaged()

Returns True if procedure is defined in package.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property engine_name

Engine name.

property entrypoint

Entrypoint.

property id

Internal unique ID number.

property input_params

ObjectList of input parameters. Instances are ProcedureParameter instances.

property name

Database object name or None if object doesn’t have a name.

property output_params

ObjectList of output parameters. Instances are ProcedureParameter instances.

property owner_name

User name of procedure’s creator.

property package

Package this procedure belongs to. Object is Package instance or None.

property privacy

Privacy flag.

property privileges

ObjectList of Privilege objects granted to this object.

property proc_type

Procedure type code. See enum_procedure_types.

schema = None
property security_class

Security class that define access limits to the procedure.

property source

PSQL source code.

property valid_blr

Procedure BLR invalidation flag. Coul be True/False or None.

Role

class fdb.schema.Role(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents user role.

Supported SQL actions:
  • User role: create, drop, comment

  • System role: comment

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property name

Database object name or None if object doesn’t have a name.

property owner_name

User name of role owner.

property privileges

ObjectList of Privilege objects granted to this object.

schema = None
property security_class

Security class name or None.

FunctionArgument

class fdb.schema.FunctionArgument(schema, function, attributes)

Bases: fdb.schema.BaseSchemaItem

Represets UDF argument.

Supported SQL actions:

none

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_definition()

Returns SQL definition for parameter.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_default()

Returns True if parameter has default value.

isbydescriptor(any=False)

Returns True if argument is passed by descriptor.

Parameters

any (bool) – If True, method returns True if any kind of descriptor is used (including BLOB and ARRAY descriptors).

isbyreference()

Returns True if argument is passed by reference.

isbyvalue()

Returns True if argument is passed by value.

isfreeit()

Returns True if (return) argument is declared as FREE_IT.

isnullable()

Returns True if parameter allows NULL.

ispackaged()

Returns True if function argument is defined in package.

isreturning()

Returns True if argument represents return value for function.

issystemobject()

Returns True if this database object is system object.

iswithnull()

Returns True if argument is passed by reference with NULL support.

property actions

List of supported SQL operations on metadata object instance.

property argument_mechanism

Argument mechanism.

property argument_name

Argument name.

property character_length

Length of CHAR and VARCHAR column, in characters (not bytes).

property character_set

CharacterSet for a character/text BLOB argument, or None.

property collation

Collation for this parameter.

property column

TableColumn for this parameter.

property datatype

Comlete SQL datatype definition.

property default

Default value.

property description

Database object description or None if object doesn’t have a description.

property domain

Domain for this parameter.

property field_type

Number code of the data type defined for the argument.

property function

Function to which this argument belongs.

property length

Length of the argument in bytes.

property mechanism

How argument is passed.

property name

Database object name or None if object doesn’t have a name.

property package

Package this function belongs to. Object is Package instance or None.

property position

Argument position.

property precision

Indicates the number of digits of precision available to the data type of the argument.

property scale

Negative number representing the scale of NUMBER and DECIMAL argument.

schema = None
property sub_type

BLOB subtype.

property type_from

Numeric code. See Schema.enum_param_type_from.`

Function

class fdb.schema.Function(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents user defined function.

Supported SQL actions:
  • External UDF: declare, drop, comment

  • PSQL UDF (FB 3, not declared in package): create (no_code=bool), recreate (no_code=bool), create_or_alter (no_code=bool), drop, alter (arguments=string_or_list, returns=string, declare=string_or_list, code=string_or_list)

  • System UDF: none

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_arguments()

Returns True if function has input arguments.

has_return()

Returns True if function returns a value.

has_return_argument()

Returns True if function returns a value in input argument.

isexternal()

Returns True if function is external UDF, False for PSQL functions.

ispackaged()

Returns True if function is defined in package.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property arguments

ObjectList of function arguments. Items are FunctionArgument instances.

property description

Database object description or None if object doesn’t have a description.

property deterministic_flag

Deterministic flag.

property engine_mame

Engine name.

property entrypoint

Entrypoint in module.

property id

Function ID.

property legacy_flag

Legacy flag.

property module_name

Module name.

property name

Database object name or None if object doesn’t have a name.

property owner_name

Owner name.

property package

Package this function belongs to. Object is Package instance or None.

property private_flag

Private flag.

property returns

Returning FunctionArgument or None.

schema = None
property security_class

Security class.

property source

Function source.

property valid_blr

BLR validity flag.

DatabaseFile

class fdb.schema.DatabaseFile(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents database extension file.

Supported SQL actions:

create

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property filename

File name.

property length

File length in pages.

property name

Database object name or None if object doesn’t have a name.

schema = None
property sequence

File sequence number.

property start

File start page number.

Shadow

class fdb.schema.Shadow(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents database shadow.

Supported SQL actions:

create, drop (preserve=bool)

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

isconditional()

Returns True if it’s CONDITIONAL shadow.

isinactive()

Returns True if it’s INACTIVE shadow.

ismanual()

Returns True if it’s MANUAL shadow.

issystemobject()

Returns False.

SHADOW_CONDITIONAL = 16
SHADOW_INACTIVE = 2
SHADOW_MANUAL = 4
property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property files

List of shadow files. Items are DatabaseFile instances.

property flags

Shadow flags.

property id

Shadow ID number.

property name

Database object name or None if object doesn’t have a name.

schema = None

Privilege

class fdb.schema.Privilege(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents priviledge to database object.

Supported SQL actions:

grant (grantors), revoke (grantors, grant_option)

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_grant()

Returns True if privilege comes with GRANT OPTION.

isdelete()

Returns True if this is DELETE privilege.

isexecute()

Returns True if this is EXECUTE privilege.

isinsert()

Returns True if this is INSERT privilege.

ismembership()

Returns True if this is ROLE membership privilege.

isreference()

Returns True if this is REFERENCE privilege.

isselect()

Returns True if this is SELECT privilege.

issystemobject()

Returns True.

isupdate()

Returns True if this is UPDATE privilege.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property field_name

Field name.

property grantor

Grantor User object.

property grantor_name

Grantor name.

property name

Database object name or None if object doesn’t have a name.

property privilege

Privilege code.

schema = None
property subject

Priviledge subject. Either Role, Table, View or Procedure object.

property subject_name

Subject name.

property subject_type

Subject type.

property user

Grantee. Either User, Role, Procedure, Trigger or View object.

property user_name

User name.

property user_type

User type.

Package

class fdb.schema.Package(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents PSQL package.

Supported SQL actions:

create (body=bool), recreate (body=bool), create_or_alter (body=bool), alter (header=string_or_list), drop (body=bool)

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

has_valid_body()
issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property body

Package body source.

property description

Database object description or None if object doesn’t have a description.

property functions

ObjectList of package functions. Items are Function instances.

property header

Package header source.

property name

Database object name or None if object doesn’t have a name.

property owner_name

User name of package creator.

property procedures

ObjectList of package procedures. Items are Procedure instances.

schema = None
property security_class

Security class name or None.

BackupHistory

class fdb.schema.BackupHistory(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents entry of history for backups performed using the nBackup utility.

Supported SQL actions:

None

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True.

property actions

List of supported SQL operations on metadata object instance.

property backup_id

The identifier assigned by the engine.

property created

Backup date and time.

property description

Database object description or None if object doesn’t have a description.

property filename

Full path and file name of backup file.

property guid

Unique identifier.

property level

Backup level.

property name

Database object name or None if object doesn’t have a name.

schema = None
property scn

System (scan) number.

Filter

class fdb.schema.Filter(schema, attributes)

Bases: fdb.schema.BaseSchemaItem

Represents userdefined BLOB filter.

Supported SQL actions:
  • BLOB filter: declare, drop, comment

  • System UDF: none

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

get_dependencies()

Returns list of database objects that this object depend on.

get_dependents()

Returns list of all database objects that depend on this one.

get_quoted_name()

Returns quoted (if necessary) name.

get_sql_for(action, **params)

Returns SQL command for specified action on metadata object.

Supported actions are defined by actions list.

Raises

fdb.ProgrammingError – For unsupported action or wrong parameters passed.

issystemobject()

Returns True if this database object is system object.

property actions

List of supported SQL operations on metadata object instance.

property description

Database object description or None if object doesn’t have a description.

property entrypoint

The exported name of the BLOB filter in the filter library.

property input_sub_type

The BLOB subtype of the data to be converted by the function.

property module_name

The name of the dynamic library or shared object where the code of the BLOB filter is located.

property name

Database object name or None if object doesn’t have a name.

property output_sub_type

The BLOB subtype of the converted data.

schema = None

Monitoring information

Constants

Shutdown modes for DatabaseInfo.shutdown_mode

  • SHUTDOWN_MODE_ONLINE

  • SHUTDOWN_MODE_MULTI

  • SHUTDOWN_MODE_SINGLE

  • SHUTDOWN_MODE_FULL

Backup states for DatabaseInfo.backup_state

  • BACKUP_STATE_NORMAL

  • BACKUP_STATE_STALLED

  • BACKUP_STATE_MERGE

States for AttachmentInfo.state, TransactionInfo.state and StatementInfo.state

  • STATE_IDLE

  • STATE_ACTIVE

Isolation modes for TransactionInfo.isolation_mode

  • ISOLATION_CONSISTENCY

  • ISOLATION_CONCURRENCY

  • ISOLATION_READ_COMMITTED_RV

  • ISOLATION_READ_COMMITTED_NO_RV

Special timeout values for TransactionInfo.lock_timeout

  • INFINITE_WAIT

  • NO_WAIT

Group codes for IOStatsInfo.group

  • STAT_DATABASE

  • STAT_ATTACHMENT

  • STAT_TRANSACTION

  • STAT_STATEMENT

  • STAT_CALL

Security database

  • SEC_DEFAULT

  • SEC_SELF

  • SEC_OTHER

Classes

Monitor

class fdb.monitor.Monitor

Class for access to Firebird monitoring tables.

bind(connection)

Bind this instance to specified Connection.

Parameters

connectionConnection instance.

Raises

fdb.ProgrammingError – If Monitor object was set as internal (via _set_as_internal()) or database has ODS lower than 11.1.

clear()

Drop all cached information objects. Force reload of fresh monitoring information on next reference.

close()

Sever link to Connection.

Raises

fdb.ProgrammingError – If Monitor object was set as internal (via _set_as_internal()).

get_attachment(id)

Get AttachmentInfo by ID.

Parameters

id (int) – Attachment ID.

Returns

AttachmentInfo with specified ID or None.

get_call(id)

Get CallStackInfo by ID.

Parameters

id (int) – Callstack ID.

Returns

CallStackInfo with specified ID or None.

get_statement(id)

Get StatementInfo by ID.

Parameters

id (int) – Statement ID.

Returns

StatementInfo with specified ID or None.

get_transaction(id)

Get TransactionInfo by ID.

Parameters

id (int) – Transaction ID.

Returns

TransactionInfo with specified ID or None.

refresh()

Reloads fresh monitoring information.

property attachments

ObjectList of all attachments. Items are AttachmentInfo objects.

property callstack

ObjectList with complete call stack. Items are CallStackInfo objects.

property closed

True if link to Connection is closed.

property db

DatabaseInfo object for attached database.

property iostats

ObjectList of all I/O statistics. Items are IOStatsInfo objects.

property statements

ObjectList of all statements. Items are StatementInfo objects.

property tablestats

ObjectList of all table record I/O statistics. Items are TableStatsInfo objects.

property this_attachment

AttachmentInfo object for current connection.

property transactions

ObjectList of all transactions. Items are TransactionInfo objects.

property variables

ObjectList of all context variables. Items are ContextVariableInfo objects.

BaseInfoItem

class fdb.monitor.BaseInfoItem(monitor, attributes)

Bases: object

Base class for all database monitoring objects.

monitor = None

Weak reference to parent Monitor instance.

property stat_id

Internal ID.

DatabaseInfo

class fdb.monitor.DatabaseInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about attached database.

property backup_state

Current state of database with respect to nbackup physical backup.

property cache_size

Number of pages allocated in the page cache.

property created

Creation date and time, i.e., when the database was created or last restored.

property crypt_page

Number of page being encrypted.

property forced_writes

True if database uses synchronous writes.

property iostats

IOStatsInfo for this object.

monitor = None
property name

Database pathname or alias.

property next_transaction

Transaction ID of the next transaction that will be started.

property oat

Transaction ID of the oldest active transaction.

property ods

On-Disk Structure (ODS) version number.

property oit

Transaction ID of the oldest [interesting] transaction.

property ost

Transaction ID of the Oldest Snapshot, i.e., the number of the OAT when the last garbage collection was done.

property owner

User name of database owner.

property page_size

Size of database page in bytes.

property pages

Number of pages allocated on disk.

property read_only

True if database is Read Only.

property reserve_space

True if database reserves space on data pages.

property security_database

Type of security database (Default, Self or Other).

property shutdown_mode

Current shutdown mode.

property sql_dialect

SQL dialect of the database.

property stat_id

Internal ID.

property sweep_interval

The sweep interval configured in the database header. Value 0 indicates that sweeping is disabled.

property tablestats

Dictionary of TableStatsInfo instances for this object.

AttachmentInfo

class fdb.monitor.AttachmentInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about attachment (connection) to database.

isactive()

Returns True if attachment is active.

isgcallowed()

Returns True if Garbage Collection is enabled for this attachment.

isidle()

Returns True if attachment is idle.

isinternal()

Returns True if attachment is internal system attachment.

terminate()

Terminates client session associated with this attachment.

Raises
fdb.ProgrammingError: If database has ODS lower than 11.2 or

this attachement is current session.

property auth_method

Authentication method.

property character_set

CharacterSet for this attachment.

property client_version

Client library version.

property id

Attachment ID.

property iostats

IOStatsInfo for this object.

monitor = None
property name

Database pathname or alias.

property remote_address

Remote address.

property remote_host

Name of remote host.

property remote_os_user

OS user name of client process.

property remote_pid

Remote client process ID.

property remote_process

Remote client process pathname.

property remote_protocol

Remote protocol name.

property remote_version

Remote protocol version.

property role

Role name.

property server_pid

Server process ID.

property stat_id

Internal ID.

property state

Attachment state (idle/active).

property statements

ObjectList of statements associated with attachment. Items are StatementInfo objects.

property system

True for system attachments.

property tablestats

Dictionary of TableStatsInfo instances for this object.

property timestamp

Attachment date/time.

property transactions

ObjectList of transactions associated with attachment. Items are TransactionInfo objects.

property user

User name.

property variables

ObjectList of variables associated with attachment. Items are ContextVariableInfo objects.

TransactionInfo

class fdb.monitor.TransactionInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about transaction.

isactive()

Returns True if transaction is active.

isautocommit()

Returns True for autocommited transaction.

isautoundo()

Returns True for transaction with automatic undo.

isidle()

Returns True if transaction is idle.

isreadonly()

Returns True if transaction is Read Only.

property attachment

AttachmentInfo instance to which this transaction belongs.

property id

Transaction ID.

property iostats

IOStatsInfo for this object.

property isolation_mode

Transaction isolation mode code.

property lock_timeout

Lock timeout.

monitor = None
property oldest

Oldest transaction (local OIT).

property oldest_active

Oldest active transaction (local OAT).

property stat_id

Internal ID.

property state

Transaction state (idle/active).

property statements

ObjectList of statements associated with transaction. Items are StatementInfo objects.

property tablestats

Dictionary of TableStatsInfo instances for this object.

property timestamp

Transaction start date/time.

property top

Top transaction.

property variables

ObjectList of variables associated with transaction. Items are ContextVariableInfo objects.

StatementInfo

class fdb.monitor.StatementInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about executed SQL statement.

isactive()

Returns True if statement is active.

isidle()

Returns True if statement is idle.

terminate()

Terminates execution of statement.

Raises

fdb.ProgrammingError – If this attachement is current session.

property attachment

AttachmentInfo instance to which this statement belongs.

property callstack

ObjectList with call stack for statement. Items are CallStackInfo objects.

property id

Statement ID.

property iostats

IOStatsInfo for this object.

monitor = None
property plan

Explained execution plan.

property sql_text

Statement text, if appropriate.

property stat_id

Internal ID.

property state

Statement state (idle/active).

property tablestats

Dictionary of TableStatsInfo instances for this object.

property timestamp

Statement start date/time.

property transaction

TransactionInfo instance to which this statement belongs or None.

CallStackInfo

class fdb.monitor.CallStackInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about PSQL call (stack frame).

property caller

Call stack entry (CallStackInfo) of the caller.

property column

SQL source column number.

property dbobject

PSQL object. Procedure or Trigger instance.

property id

Call ID.

property iostats

IOStatsInfo for this object.

property line

SQL source line number.

monitor = None
property package_name

Package name.

property stat_id

Internal ID.

property statement

Top-level StatementInfo instance to which this call stack entry belongs.

property timestamp

Request start date/time.

IOStatsInfo

class fdb.monitor.IOStatsInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about page and row level I/O operations, and about memory consumption.

property backouts

Number of records where a new primary record version or a change to an existing primary record version is backed out due to rollback or savepoint undo.

property backversion_reads

Number of record backversion reads.

property conflits

Number of record conflits.

property deletes

Number of deleted records.

property expunges

Number of records where record version chain is being deleted due to deletions by transactions older than OAT.

property fetches

Number of page fetches.

property fragment_reads

Number of record fragment reads.

property group

Object group code.

property idx_reads

Number of records read via an index.

property inserts

Number of inserted records.

property locks

Number of record locks.

property marks

Number of pages with changes pending.

property max_memory_allocated

Maximum number of bytes allocated from the operating system by this object.

property max_memory_used

Maximum number of bytes used by this object.

property memory_allocated

Number of bytes currently allocated at the OS level.

property memory_used

Number of bytes currently in use.

monitor = None
property owner

Object that owns this IOStats instance. Could be either DatabaseInfo, AttachmentInfo, TransactionInfo, StatementInfo or CallStackInfo instance.

property purges

Number of records where record version chain is being purged of versions no longer needed by OAT or younger transactions.

property reads

Number of page reads.

property repeated_reads

Number of repeated record reads.

property seq_reads

Number of records read sequentially.

property stat_id

Internal ID.

property updates

Number of updated records.

property waits

Number of record waits.

property writes

Number of page writes.

TableStatsInfo

class fdb.monitor.TableStatsInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about row level I/O operations on single table.

property backouts

Number of records where a new primary record version or a change to an existing primary record version is backed out due to rollback or savepoint undo.

property backversion_reads

Number of record backversion reads.

property conflits

Number of record conflits.

property deletes

Number of deleted records.

property expunges

Number of records where record version chain is being deleted due to deletions by transactions older than OAT.

property fragment_reads

Number of record fragment reads.

property group

Object group code.

property idx_reads

Number of records read via an index.

property inserts

Number of inserted records.

property locks

Number of record locks.

monitor = None
property owner

Object that owns this TableStats instance. Could be either DatabaseInfo, AttachmentInfo, TransactionInfo, StatementInfo or CallStackInfo instance.

property purges

Number of records where record version chain is being purged of versions no longer needed by OAT or younger transactions.

property repeated_reads

Number of repeated record reads.

property row_stat_id

Internal ID.

property seq_reads

Number of records read sequentially.

property stat_id

Internal ID.

property table_name

Table name.

property updates

Number of updated records.

property waits

Number of record waits.

ContextVariableInfo

class fdb.monitor.ContextVariableInfo(monitor, attributes)

Bases: fdb.monitor.BaseInfoItem

Information about context variable.

isattachmentvar()

Returns True if variable is associated to attachment context.

istransactionvar()

Returns True if variable is associated to transaction context.

property attachment

AttachmentInfo instance to which this context variable belongs or None.

monitor = None
property name

Context variable name.

property stat_id

Internal ID.

property transaction

TransactionInfo instance to which this context variable belongs or None.

property value

Value of context variable.

Firebird trace & audit

Constants

Trace event status codes

  • STATUS_OK

  • STATUS_FAILED

  • STATUS_UNAUTHORIZED

  • STATUS_UNKNOWN

Trace event codes

  • EVENT_TRACE_INIT

  • EVENT_TRACE_SUSPEND

  • EVENT_TRACE_END

  • EVENT_CREATE_DATABASE

  • EVENT_DROP_DATABASE

  • EVENT_ATTACH

  • EVENT_DETACH

  • EVENT_TRANSACTION_START

  • EVENT_COMMIT

  • EVENT_ROLLBACK

  • EVENT_COMMIT_R

  • EVENT_ROLLBACK_R

  • EVENT_STMT_PREPARE

  • EVENT_STMT_START

  • EVENT_STMT_END

  • EVENT_STMT_FREE

  • EVENT_STMT_CLOSE

  • EVENT_TRG_START

  • EVENT_TRG_END

  • EVENT_PROC_START

  • EVENT_PROC_END

  • EVENT_SVC_START

  • EVENT_SVC_ATTACH

  • EVENT_SVC_DETACH

  • EVENT_SVC_QUERY

  • EVENT_SET_CONTEXT

  • EVENT_ERROR

  • EVENT_WARNING

  • EVENT_SWEEP_START

  • EVENT_SWEEP_PROGRESS

  • EVENT_SWEEP_FINISH

  • EVENT_SWEEP_FAILED

  • EVENT_BLR_COMPILE

  • EVENT_BLR_EXECUTE

  • EVENT_DYN_EXECUTE

  • EVENT_UNKNOWN

EVENTS

List of trace event names in order matching their numeric codes

Classes

Named tuples for information packages

fdb.trace.AttachmentInfo(attachment_id, database, charset, protocol, address, user, role, remote_process, remote_pid)
fdb.trace.TransactionInfo(attachment_id, transaction_id, options)
fdb.trace.ServiceInfo(service_id, user, protocol, address, remote_process, remote_pid)
fdb.trace.SQLInfo(sql_id, sql, plan)
fdb.trace.ParamInfo(par_id, params)
fdb.trace.AccessTuple(table, natural, index, update, insert, delete, backout, purge, expunge)

Named tuples for individual trace events

fdb.trace.EventTraceInit(event_id, timestamp, session_name)
fdb.trace.EventTraceSuspend(event_id, timestamp, session_name)
fdb.trace.EventTraceFinish(event_id, timestamp, session_name)
fdb.trace.EventCreate(event_id, timestamp, status, attachment_id, database, charset, protocol, address, user, role, remote_process, remote_pid)
fdb.trace.EventDrop(event_id, timestamp, status, attachment_id, database, charset, protocol, address, user, role, remote_process, remote_pid)
fdb.trace.EventAttach(event_id, timestamp, status, attachment_id, database, charset, protocol, address, user, role, remote_process, remote_pid)
fdb.trace.EventDetach(event_id, timestamp, status, attachment_id, database, charset, protocol, address, user, role, remote_process, remote_pid)
fdb.trace.EventTransactionStart(event_id, timestamp, status, attachment_id, transaction_id, options)
fdb.trace.EventCommit(event_id, timestamp, status, attachment_id, transaction_id, options, run_time, reads, writes, fetches, marks)
fdb.trace.EventRollback(event_id, timestamp, status, attachment_id, transaction_id, options, run_time, reads, writes, fetches, marks)
fdb.trace.EventCommitRetaining(event_id, timestamp, status, attachment_id, transaction_id, options, run_time, reads, writes, fetches, marks)
fdb.trace.EventRollbackRetaining(event_id, timestamp, status, attachment_id, transaction_id, options, run_time, reads, writes, fetches, marks)
fdb.trace.EventPrepareStatement(event_id, timestamp, status, attachment_id, transaction_id, statement_id, sql_id, prepare_time)
fdb.trace.EventStatementStart(event_id, timestamp, status, attachment_id, transaction_id, statement_id, sql_id, param_id)
fdb.trace.EventStatementFinish(event_id, timestamp, status, attachment_id, transaction_id, statement_id, sql_id, param_id, records, run_time, reads, writes, fetches, marks, access)
fdb.trace.EventFreeStatement(event_id, timestamp, attachment_id, transaction_id, statement_id, sql_id)
fdb.trace.EventCloseCursor(event_id, timestamp, attachment_id, transaction_id, statement_id, sql_id)
fdb.trace.EventTriggerStart(event_id, timestamp, status, attachment_id, transaction_id, trigger, table, event)
fdb.trace.EventTriggerFinish(event_id, timestamp, status, attachment_id, transaction_id, trigger, table, event, run_time, reads, writes, fetches, marks, access)
fdb.trace.EventProcedureStart(event_id, timestamp, status, attachment_id, transaction_id, procedure, param_id)
fdb.trace.EventProcedureFinish(event_id, timestamp, status, attachment_id, transaction_id, procedure, param_id, run_time, reads, writes, fetches, marks, access)
fdb.trace.EventServiceAttach(event_id, timestamp, status, service_id)
fdb.trace.EventServiceDetach(event_id, timestamp, status, service_id)
fdb.trace.EventServiceStart(event_id, timestamp, status, service_id, action, parameters)
fdb.trace.EventServiceQuery(event_id, timestamp, status, service_id, action, parameters)
fdb.trace.EventSetContext(event_id, timestamp, attachment_id, transaction_id, context, key, value)
fdb.trace.EventError(event_id, timestamp, attachment_id, place, details)
fdb.trace.EventServiceError(event_id, timestamp, service_id, place, details)
fdb.trace.EventWarning(event_id, timestamp, attachment_id, place, details)
fdb.trace.EventServiceWarning(event_id, timestamp, service_id, place, details)
fdb.trace.EventSweepStart(event_id, timestamp, attachment_id, oit, oat, ost, next)
fdb.trace.EventSweepProgress(event_id, timestamp, attachment_id, run_time, reads, writes, fetches, marks, access)
fdb.trace.EventSweepFinish(event_id, timestamp, attachment_id, oit, oat, ost, next, run_time, reads, writes, fetches, marks)
fdb.trace.EventSweepFailed(event_id, timestamp, attachment_id)
fdb.trace.EventBLRCompile(event_id, timestamp, status, attachment_id, statement_id, content, prepare_time)
fdb.trace.EventBLRExecute(event_id, timestamp, status, attachment_id, transaction_id, statement_id, content, run_time, reads, writes, fetches, marks, access)
fdb.trace.EventDYNExecute(event_id, timestamp, status, attachment_id, transaction_id, content, run_time)
fdb.trace.EventUnknown(event_id, timestamp, data)

TraceParser

class fdb.trace.TraceParser

Parser for standard textual trace log. Produces named tuples describing individual trace log entries/events.

seen_attachments

Set of attachment ids that were already processed.

Type

set

seen_transactions

Set of transaction ids that were already processed.

Type

set

seen_services

Set of service ids that were already processed.

Type

set

sqlinfo_map

Dictionary that maps (sql_cmd,plan) keys to internal ids

Type

dict

param_map

Dictionary that maps parameters (statement or procedure) keys to internal ids

Type

dict

next_event_id

Sequence id that would be assigned to next parsed event (starts with 1).

Type

int

next_sql_id

Sequence id that would be assigned to next parsed unique SQL command (starts with 1).

Type

int

next_param_id

Sequence id that would be assigned to next parsed unique parameter (starts with 1).

Type

int

parse(lines)

Parse output from Firebird trace session.

Parameters

lines (iterable) – Iterable that return lines produced by firebird trace session.

Yields

Named tuples describing individual trace log entries/events.

Raises

fdb.ParseError – When any problem is found in input stream.

parse_event(trace_block)

Parse single trace event.

Parameters

trace_block (list) – List with trace entry lines for single trace event.

Returns

Named tuple with parsed event.

GSTAT protocols

Module globals

GSTAT version

  • GSTAT_25

  • GSTAT_30

Database attribute codes

  • ATTR_FORCE_WRITE

  • ATTR_NO_RESERVE

  • ATTR_NO_SHARED_CACHE

  • ATTR_ACTIVE_SHADOW

  • ATTR_SHUTDOWN_MULTI

  • ATTR_SHUTDOWN_SINGLE

  • ATTR_SHUTDOWN_FULL

  • ATTR_READ_ONLY

  • ATTR_BACKUP_LOCK

  • ATTR_BACKUP_MERGE

  • ATTR_BACKUP_WRONG

Note

Also works as index to ATTRIBUTES.

ATTRIBUTES

List with database attribute names

Functions

empty_str

fdb.gstat.empty_str(str_)

Return True if string is empty (whitespace don’t count) or None

parse

fdb.gstat.parse(lines)

Parse output from Firebird gstat utility.

Parameters

lines (iterable) – Lines produced by Firebird gstat utility.

Returns

StatDatabase instance with parsed results.

Raises

fdb.ParseError – When any problem is found in input stream.

Classes

Named tuples

fdb.gstat.FillDistribution(d20, d40, d50, d80, d100)
fdb.gstat.Encryption(pages, encrypted, unencrypted)

StatDatabase

class fdb.gstat.StatDatabase

Bases: object

Firebird database statistics (produced by gstat).

has_encryption_stats()

Return True if instance contains information about database encryption.

has_index_stats()

Return True if instance contains information about indices.

has_row_stats()

Return True if instance contains information about table rows.

has_system()

Return True if instance contains information about system tables.

has_table_stats()

Return True if instance contains information about tables.

Important

This is not the same as check for empty tables list. When gstat is run with -i without -d option, tables list contains instances that does not have any other information about table but table name and its indices.

attributes = None

Database attributes

Type

list

backup_diff_file = None

Backup difference file (variable hdr item)

Type

str

backup_guid = None

Backup GUID (variable hdr item)

Type

str

bumped_transaction = None

Bumped Transaction (v2 only)

Type

int

checksum = None

Checksum (v2 only)

Type

int

completed = None

datetime.datetime; gstat completion timestamp

continuation_file = None

Continuation file (variable hdr item)

Type

str

continuation_files = None

database file names

Type

list

creation_date = None

Database creation timestamp

Type

datetime.datetime

database_dialect = None

SQL Dialect

Type

int

encrypted_blob_pages = None

Stats for enxrypted blob page

Type

Encryption

encrypted_data_pages = None

Stats for enxrypted data page

Type

Encryption

encrypted_index_pages = None

Stats for enxrypted index page

Type

Encryption

executed = None

gstat execution timestamp

Type

datetime.datetime

filename = None

Database filename

Type

str

flags = None

Database flags

Type

int

generation = None

Database header generation

Type

int

gstat_version = None

GSTAT version

Type

int

implementation = None

Implementation (v3 only)

Type

str

implementation_id = None

Implementation ID (v2 only)

Type

int

indices = None

StatIndex or StatIndex3 instances

Type

ObjectList

last_logical_page = None

Last logical page (variable hdr item)

Type

int

next_attachment_id = None

Next attachment ID

Type

int

next_header_page = None

Next header page

Type

int

next_transaction = None

Next Transaction

Type

int

oat = None

Oldest Active Transaction

Type

int

oit = None

Oldest Interesting Transaction

Type

int

ost = None

Oldest Snapshot Transaction

Type

int

page_buffers = None

Number of page buffers

Type

int

page_size = None

Database page size

Type

int

replay_logging_file = None

replay logging file (variable hdr item)

Type

str

root_filename = None

Root file name (variable hdr item)

Type

str

shadow_count = None

Number of shadows

Type

int

sweep_interval = None

Sweep interval (variable hdr item)

Type

int

system_change_number = None

System change number (v3 only)

Type

int

tables = None

StatTable or StatTable3 instances

Type

ObjectList

StatTable

class fdb.gstat.StatTable

Bases: object

Statisctics for single database table.

avg_fill = None

Average data page fill ratio

Type

float

avg_record_length = None

Average record length

Type

float

avg_version_length = None

Average record version length

Type

float

data_page_slots = None

Number of data page slots for table

Type

int

data_pages = None

Number of data pages for table

Type

int

distribution = None

Data page fill distribution statistics

Type

FillDistribution

index_root_page = None

Index Root Page for table

Type

int

indices = None

Indices belonging to table

Type

ObjectList

max_versions = None

Max number of versions for single record

Type

int

name = None

Table name

Type

str

primary_pointer_page = None

Primary Pointer Page for table

Type

int

table_id = None

Table ID

Type

int

total_records = None

Total number of record in table

Type

int

total_versions = None

Total number of record versions

Type

int

StatTable3

class fdb.gstat.StatTable3

Bases: fdb.gstat.StatTable

Statisctics for single database table (Firebird 3 and above).

avg_fragment_length = None

Average length of record fragments

Type

float

avg_unpacked_length = None

Average length of unpacked record

Type

float

blob_pages = None

Number of BLOB pages

Type

int

blobs = None

Number of BLOB values

Type

int

blobs_total_length = None

Total length of BLOB values (bytes)

Type

int

compression_ratio = None

Record compression ratio

Type

float

empty_pages = None

Number of empty data pages

Type

int

full_pages = None

Number of full data pages

Type

int

level_0 = None

Number of Level 0 BLOB values

Type

int

level_1 = None

Number of Level 1 BLOB values

Type

int

level_2 = None

Number of Level 2 BLOB values

Type

int

max_fragments = None

Max number of fragments for single record

Type

int

pointer_pages = None

Number of Pointer Pages

Type

int

primary_pages = None

Number of Primary Data Pages

Type

int

secondary_pages = None

Number of Secondary Data Pages

Type

int

swept_pages = None

Number of swept data pages

Type

int

total_formats = None

Number of record formats

Type

int

total_fragments = None

Total number of record fragments

Type

int

used_formats = None

Number of actually used record formats

Type

int

StatIndex

class fdb.gstat.StatIndex(table)

Bases: object

Statisctics for single database index.

avg_data_length = None

Average data length

Type

float

depth = None

Depth of index tree

Type

int

distribution = None

Index page fill distribution statistics

Type

FillDistribution

index_id = None

Index ID

Type

int

leaf_buckets = None

Number of leaft index tree buckets

Type

int

max_dup = None

Max number of occurences for single duplicate key

Type

int

name = None

Index name

Type

str

nodes = None

Number of index tree nodes

Type

int

table = None

Proxy to parent TableStats

Type

wekref.proxy

total_dup = None

Total number of duplicate keys

Type

int

StatIndex3

class fdb.gstat.StatIndex3(table)

Bases: fdb.gstat.StatIndex

Statisctics for single database index (Firebird 3 and above).

avg_key_length = None

Average key length

Type

float

avg_node_length = None

Average node length

Type

float

avg_prefix_length = None

Average key prefix length

Type

float

clustering_factor = None

Index clustering factor

Type

float

compression_ratio = None

Index key compression ratio

Type

float

ratio = None

Ration

Type

float

root_page = None

Index Root page

Type

int

Firebird server log

Functions

parse

fdb.log.parse(lines)

Parse Firebird server log and yield named tuples describing individual log entries/events.

Parameters

lines – Iterable of lines from Firebird server log.

Raises

fdb.ParseError – When any problem is found in input stream.

Classes

Named tuples

fdb.log.LogEntry(source_id, timestamp, message)

Utilities

Functions

fdb.utils.update_meta(self, other)

Helper function for LateBindingProperty class.

fdb.utils.iter_class_properties(cls)

Iterator function.

Parameters

cls (class) – Class object.

Yields

name’, ‘property pairs for all properties in class.

fdb.utils.iter_class_variables(cls)

Iterator function.

Parameters

cls (class) – Class object.

Yields

Names of all non-callable attributes in class.

fdb.utils.embed_attributes(from_class, attr)

Class decorator that injects properties and attributes from another class instance embedded in class instances. Only attributes and properties that are not already defined in decorated class are injected.

Parameters
  • from_class (class) – Class that should extend decorated class.

  • attr (str) – Attribute name that holds instance of embedded class within decorated class instance.

Classes

LateBindingProperty

class fdb.utils.LateBindingProperty

Bases: property

Property class that binds to getter/setter/deleter methods when instance of class that define the property is created. This allows you to override these methods in descendant classes (if they are not private) without necessity to redeclare the property itself in descendant class.

Recipe from Tim Delaney, 2005/03/31 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/408713

Example

class C(object):
    def getx(self):
        print 'C.getx'
        return self._x
    def setx(self, x):
        print 'C.setx'
        self._x = x
    def delx(self):
        print 'C.delx'
        del self._x
    x = LateBindingProperty(getx, setx, delx)

class D(C):
    def setx(self, x):
        print 'D.setx'
        super(D, self).setx(x)
    def delx(self):
        print 'D.delx'
        super(D, self).delx()

c = C()
c.x = 1
c.x
c.x
del c.x
print
d = D()
d.x = 1
d.x
d.x
del d.x
This has the advantages that:
  • You get back an actual property object (with attendant memory savings, performance increases, etc);

  • It’s the same syntax as using property(fget, fset, fdel, doc) except for the name;

  • It will fail earlier (when you define the class as opposed to when you use it).

  • It’s shorter ;)

  • If you inspect the property you will get back functions with the correct __name__, __doc__, etc.

Iterator

class fdb.utils.Iterator(method, sentinel=None)

Generic iterator implementation.

Parameters
  • method (callable) – Callable without parameters that returns next item.

  • sentinel – Value that when returned by method indicates the end of sequence.

next()

EmbeddedProperty

class fdb.utils.EmbeddedProperty(obj, prop)

Bases: property

Property class that forwards calls to getter/setter/deleter methods to respective property methods of another object. This class allows you to “inject” properties from embedded object into class definition of parent object.

Parameters
  • obj (string) – Attribute name with embedded object.

  • prop (property) – Property instance from embedded object.

EmbeddedAttribute

class fdb.utils.EmbeddedAttribute(obj, attr)

Bases: property

Property class that gets/sets attribute of another object. This class allows you to “inject” attributes from embedded object into class definition of parent object.

Parameters
  • obj (string) – Attribute name with embedded object.

  • attr (string) – Attribute name from embedded object.

ObjectList

class fdb.utils.ObjectList(items=None, _cls=None, key_expr=None)

Bases: list

List of objects with additional functionality.

New in version 2.0.

Parameters
  • items (iterable) – Sequence to initialize the collection.

  • _cls (class or list/tuple) – Only instances of these class(es) would be allowed in collection.

  • key_expr (str) – Key expression. Must contain item referrence as item, for example item.attribute_name.

Raises

ValueError – When initialization sequence contains invalid instance.

all(expr)

Return True if expr is evaluated as True for all list elements.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

all(lambda x: x.name.startswith("ABC"))
all('item.name.startswith("ABC")')
any(expr)

Return True if expr is evaluated as True for any list element.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

any(lambda x: x.name.startswith("ABC"))
any('item.name.startswith("ABC")')
append(item)

Add an item to the end of the list.

Raises

TypeError – When list is frozen or item is not an instance of allowed class

clear()

Remove all items from the list.

Raises

TypeError – When list is frozen.

contains(value, expr=None)

Return True if list has any item with default or specified key expression equal to given value.

Parameters

value – Tested key value.

Keyword Arguments

expr – Key value expression, a callable accepting two parameters (item,value) or expression as string referencing list item as item.

Examples

# Search using default key expression
contains('ITEM_NAME')
# Search using callable key expression
contains('ITEM_NAME',lambda x: x.name.upper())
# Search using string key expression
contains('ITEM_NAME','item.name.upper()')
ecount(expr)

Return number of items for which expr is evaluated as True.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

ecount(lambda x: x.name.startswith("ABC"))
ecount('item.name.startswith("ABC")')
extend(iterable)

Extend the list by appending all the items in the given iterable.

Raises

TypeError – When list is frozen or item is not an instance of allowed class

extract(expr)

Move items for which expr is evaluated as True into new ObjectLists.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Raises

TypeError – When list is frozen.

Example

extract(lambda x: x.name.startswith("ABC"))
extract('item.name.startswith("ABC")')
filter(expr)

Return new ObjectList of items for which expr is evaluated as True.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

filter(lambda x: x.name.startswith("ABC"))
filter('item.name.startswith("ABC")')
freeze()

Set list to immutable (frozen) state.

Freezing list makes internal map from key_expr to item index that significantly speeds up retrieval by key using the get() method.

It’s not possible to add, delete or change items in frozen list, but sort is allowed.

get(value, expr=None)

Return item with given key value using default or specified key expression, or None if there is no such item.

Uses very fast method to look up value of default key expression in frozen list, otherwise it uses slower list traversal.

Parameters

value – Searched value.

Keyword Arguments

expr – Key value expression, a callable accepting two parameters (item,value) or expression as string referencing list item as item.

Raises

TypeError – If key expression is not defined.

Examples

# Search using default key expression
get('ITEM_NAME')
# Search using callable key expression
get('ITEM_NAME',lambda x: x.name.upper())
# Search using string key expression
get('ITEM_NAME','item.name.upper()')
ifilter(expr)

Return generator that yields items for which expr is evaluated as True.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

ifilter(lambda x: x.name.startswith("ABC"))
ifilter('item.name.startswith("ABC")')
ifilterfalse(expr)

Return generator that yields items for which expr is evaluated as False.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

ifilter(lambda x: x.name.startswith("ABC"))
ifilter('item.name.startswith("ABC")')
insert(index, item)

Insert item before index.

Raises

TypeError – When list is frozen or item is not an instance of allowed class

ireport(*args)

Return generator that yields data produced by expression(s) evaluated on list items.

Parameter(s) could be one from:

  • A callable accepting one parameter and returning data for output

  • One or more expressions as string referencing item as item.

Examples

# generator of tuples with item.name and item.size

report(lambda x: (x.name, x.size))
report('item.name','item.size')

# generator of item names

report(lambda x: x.name)
report('item.name')
report(*args)

Return list of data produced by expression(s) evaluated on list items.

Parameter(s) could be one from:

  • A callable accepting one parameter and returning data for output

  • One or more expressions as string referencing item as item.

Examples

# returns list of tuples with item.name and item.size

report(lambda x: (x.name, x.size))
report('item.name','item.size')

# returns list of item names

report(lambda x: x.name)
report('item.name')
reverse()

Reverse the elements of the list, in place.

sort(attrs=None, expr=None, reverse=False)

Sort items in-place, optionaly using attribute values as key or key expression.

Parameters
  • attrs (list) – List of attribute names.

  • expr – Key expression, a callable accepting one parameter or expression as string referencing list item as item.

Important

Only one parameter (attrs or expr) could be specified. If none is present then uses default list sorting rule.

Examples

sort(attrs=['name','degree'])       # Sort by item.name, item.degree
sort(expr=lambda x: x.name.upper()) # Sort by upper item.name
sort(expr='item.name.upper()')      # Sort by upper item.name
split(expr)

Return two new ObjectLists, first with items for which expr is evaluated as True and second for expr evaluated as False.

Parameters

expr – Boolean expression, a callable accepting one parameter or expression as string referencing list item as item.

Example

split(lambda x: x.size > 100)
split('item.size > 100')
property class_type

Class or list/tuple of classes that this list accepts.

property frozen

True if list items couldn’t be changed

property key

Key expression

Visitable

class fdb.utils.Visitable

Base class for Visitor Pattern support.

New in version 2.0.

accept(visitor)

Visitor Pattern support. Calls visit(self) on parameter object.

Parameters

visitor – Visitor object of Visitor Pattern.

Visitor

class fdb.utils.Visitor

Base class for Visitor Pattern visitors.

New in version 2.0.

Descendants may implement methods to handle individual object types that follow naming pattern visit_<class_name>. Calls default_action() if appropriate special method is not defined.

Important

This implementation uses Python Method Resolution Order (__mro__) to find special handling method, so special method for given class is used also for its decendants.

Example

class Node(object): pass class A(Node): pass class B(Node): pass class C(A,B): pass

class MyVisitor(object):
def default_action(self, obj):

print ‘default_action ‘+obj.__class__.__name__

def visit_B(self, obj):

print ‘visit_B ‘+obj.__class__.__name__

a = A() b = B() c = C() visitor = MyVisitor() visitor.visit(a) visitor.visit(b) visitor.visit(c)

Will create output:

default_action A visit_B B visit_B C

default_action(obj)

Default handler for visited objects.

Parameters

obj – Object to be handled.

Note

This implementation does nothing!

visit(obj)

Dispatch to method that handles obj.

First traverses the obj.__mro__ to try find method with name following visit_<class_name> pattern and calls it with obj. Otherwise it calls default_action().

Parameters

obj – Object to be handled by visitor.

ctypes interface to Firebird client library

ctypes interface to fbclient.so/dll is defined in submodule fdb.ibase and fdb.blr.

The fdb.ibase is the main module for Firebird API. The fdb.blr module contains only constants related to Firebird’s low-level Binary Language Representation (BLR).

Constants

C integer limit constants

  • SHRT_MIN

  • SHRT_MAX

  • USHRT_MAX

  • INT_MIN

  • INT_MAX

  • UINT_MAX

  • LONG_MIN

  • LONG_MAX

  • SSIZE_T_MIN

  • SSIZE_T_MAX

Type codes

  • SQL_TEXT

  • SQL_VARYING

  • SQL_SHORT

  • SQL_LONG

  • SQL_FLOAT

  • SQL_DOUBLE

  • SQL_D_FLOAT

  • SQL_TIMESTAMP

  • SQL_BLOB

  • SQL_ARRAY

  • SQL_QUAD

  • SQL_TYPE_TIME

  • SQL_TYPE_DATE

  • SQL_INT64

  • SQL_BOOLEAN

  • SQL_NULL

  • SUBTYPE_NUMERIC

  • SUBTYPE_DECIMAL

Internal type codes (for example used by ARRAY descriptor)

  • blr_text

  • blr_text2

  • blr_short

  • blr_long

  • blr_quad

  • blr_float

  • blr_double

  • blr_d_float

  • blr_timestamp

  • blr_varying

  • blr_varying2

  • blr_blob

  • blr_cstring

  • blr_cstring2

  • blr_blob_id

  • blr_sql_date

  • blr_sql_time

  • blr_int64

  • blr_blob2

  • blr_domain_name

  • blr_domain_name2

  • blr_not_nullable

  • blr_column_name

  • blr_column_name2

  • blr_bool

Database parameter block stuff

  • isc_dpb_version1

  • isc_dpb_version2

  • isc_dpb_cdd_pathname

  • isc_dpb_allocation

  • isc_dpb_page_size

  • isc_dpb_num_buffers

  • isc_dpb_buffer_length

  • isc_dpb_debug

  • isc_dpb_garbage_collect

  • isc_dpb_verify

  • isc_dpb_sweep

  • isc_dpb_dbkey_scope

  • isc_dpb_number_of_users

  • isc_dpb_trace

  • isc_dpb_no_garbage_collect

  • isc_dpb_damaged

  • isc_dpb_sys_user_name

  • isc_dpb_encrypt_key

  • isc_dpb_activate_shadow

  • isc_dpb_sweep_interval

  • isc_dpb_delete_shadow

  • isc_dpb_force_write

  • isc_dpb_begin_log

  • isc_dpb_quit_log

  • isc_dpb_no_reserve

  • isc_dpb_user_name

  • isc_dpb_password

  • isc_dpb_password_enc

  • isc_dpb_sys_user_name_enc

  • isc_dpb_interp

  • isc_dpb_online_dump

  • isc_dpb_old_file_size

  • isc_dpb_old_num_files

  • isc_dpb_old_file

  • isc_dpb_old_start_page

  • isc_dpb_old_start_seqno

  • isc_dpb_old_start_file

  • isc_dpb_old_dump_id

  • isc_dpb_lc_messages

  • isc_dpb_lc_ctype

  • isc_dpb_cache_manager

  • isc_dpb_shutdown

  • isc_dpb_online

  • isc_dpb_shutdown_delay

  • isc_dpb_reserved

  • isc_dpb_overwrite

  • isc_dpb_sec_attach

  • isc_dpb_connect_timeout

  • isc_dpb_dummy_packet_interval

  • isc_dpb_gbak_attach

  • isc_dpb_sql_role_name

  • isc_dpb_set_page_buffers

  • isc_dpb_working_directory

  • isc_dpb_sql_dialect

  • isc_dpb_set_db_readonly

  • isc_dpb_set_db_sql_dialect

  • isc_dpb_gfix_attach

  • isc_dpb_gstat_attach

  • isc_dpb_set_db_charset

  • isc_dpb_gsec_attach

  • isc_dpb_address_path

  • isc_dpb_process_id

  • isc_dpb_no_db_triggers

  • isc_dpb_trusted_auth

  • isc_dpb_process_name

  • isc_dpb_trusted_role

  • isc_dpb_org_filename

  • isc_dpb_utf8_filename

  • isc_dpb_ext_call_depth

  • isc_dpb_auth_block

  • isc_dpb_remote_protocol

  • isc_dpb_client_version

  • isc_dpb_host_name

  • isc_dpb_os_user

  • isc_dpb_specific_auth_data

  • isc_dpb_auth_plugin_list

  • isc_dpb_auth_plugin_name

  • isc_dpb_config

  • isc_dpb_nolinger

  • isc_dpb_reset_icu

  • isc_dpb_map_attach

Info structural codes

  • isc_info_end

  • isc_info_truncated

  • isc_info_error

  • isc_info_data_not_ready

  • isc_info_length

  • isc_info_flag_end

DB Info item codes

isc_info_db_id

[db_filename,site_name[,site_name…]]

isc_info_reads

number of page reads

isc_info_writes

number of page writes

isc_info_fetches

number of reads from the memory buffer cache

isc_info_marks

number of writes to the memory buffer cache

isc_info_implementation

(implementation code, implementation class)

isc_info_isc_version

interbase server version identification string

isc_info_base_level

capability version of the server

isc_info_page_size

database page size

isc_info_num_buffers

number of memory buffers currently allocated

isc_info_limbo

limbo transactions

isc_info_current_memory

amount of server memory (in bytes) currently in use

isc_info_max_memory

maximum amount of memory (in bytes) used at one time since the first process attached to the database

isc_info_allocation

number of last database page allocated

isc_info_attachment_id

attachment id number

all *_count codes below return {[table_id]=operation_count,…}; table IDs are in the system table RDB$RELATIONS.

isc_info_read_seq_count

number of sequential table scans (row reads) done on each table since the database was last attached

isc_info_read_idx_count

number of reads done via an index since the database was last attached

isc_info_insert_count

number of inserts into the database since the database was last attached

isc_info_update_count

number of database updates since the database was last attached

isc_info_delete_count

number of database deletes since the database was last attached

isc_info_backout_count

number of removals of a version of a record

isc_info_purge_count

number of removals of old versions of fully mature records (records that are committed, so that older ancestor versions are no longer needed)

isc_info_expunge_count

number of removals of a record and all of its ancestors, for records whose deletions have been committed

isc_info_sweep_interval

number of transactions that are committed between sweeps to remove database record versions that are no longer needed

isc_info_ods_version

On-disk structure (ODS) minor major version number

isc_info_ods_minor_version

On-disk structure (ODS) minor version number

isc_info_no_reserve

20% page space reservation for holding backup versions of modified records: 0=yes, 1=no

isc_info_forced_writes

mode in which database writes are performed: 0=sync, 1=async

isc_info_user_names

array of names of all the users currently attached to the database

isc_info_page_errors

number of page level errors validate found

isc_info_record_errors

number of record level errors validate found

isc_info_bpage_errors

number of blob page errors validate found

isc_info_dpage_errors

number of data page errors validate found

isc_info_ipage_errors

number of index page errors validate found

isc_info_ppage_errors

number of pointer page errors validate found

isc_info_tpage_errors

number of transaction page errors validate found

isc_info_set_page_buffers

number of memory buffers that should be allocated

isc_info_db_sql_dialect

dialect of currently attached database

isc_info_db_read_only

whether the database is read-only (1) or not (0)

isc_info_db_size_in_pages

number of allocated pages

frb_info_att_charset

charset of current attachment

isc_info_db_class

server architecture

isc_info_firebird_version

firebird server version identification string

isc_info_oldest_transaction

ID of oldest transaction

isc_info_oldest_active

ID of oldest active transaction

isc_info_oldest_snapshot

ID of oldest snapshot transaction

isc_info_next_transaction

ID of next transaction

isc_info_db_provider

for firebird is ‘isc_info_db_code_firebird’

isc_info_active_transactions

array of active transaction IDs

isc_info_active_tran_count

number of active transactions

isc_info_creation_date

time_t struct representing database creation date & time

isc_info_db_file_size

added in FB 2.1, nbackup-related - size (in pages) of locked db

fb_info_page_contents

added in FB 2.5, get raw page contents; takes page_number as parameter;

fb_info_implementation

(cpu code, OS code, compiler code, flags, implementation class)

fb_info_page_warns

number of page level warnings validate found

fb_info_record_warns

number of record level warnings validate found

fb_info_bpage_warns

number of blob page level warnings validate found

fb_info_dpage_warns

number of data page level warnings validate found

fb_info_ipage_warns

number of index page level warnings validate found

fb_info_ppage_warns

number of pointer page level warnings validate found

fb_info_tpage_warns

number of trabsaction page level warnings validate found

fb_info_pip_errors

number of pip page level errors validate found

fb_info_pip_warns

number of pip page level warnings validate found

isc_info_version

= isc_info_isc_version

Blob information items

  • isc_info_blob_num_segments

  • isc_info_blob_max_segment

  • isc_info_blob_total_length

  • isc_info_blob_type

Transaction information items

  • isc_info_tra_id

  • isc_info_tra_oldest_interesting

  • isc_info_tra_oldest_snapshot

  • isc_info_tra_oldest_active

  • isc_info_tra_isolation

  • isc_info_tra_access

  • isc_info_tra_lock_timeout

  • fb_info_tra_dbpath

isc_info_tra_isolation responses:

  • isc_info_tra_consistency

  • isc_info_tra_concurrency

  • isc_info_tra_read_committed

isc_info_tra_read_committed options:

  • isc_info_tra_no_rec_version

  • isc_info_tra_rec_version

isc_info_tra_access responses:

  • isc_info_tra_readonly

  • isc_info_tra_readwrite

SQL information items

  • isc_info_sql_select

  • isc_info_sql_bind

  • isc_info_sql_num_variables

  • isc_info_sql_describe_vars

  • isc_info_sql_describe_end

  • isc_info_sql_sqlda_seq

  • isc_info_sql_message_seq

  • isc_info_sql_type

  • isc_info_sql_sub_type

  • isc_info_sql_scale

  • isc_info_sql_length

  • isc_info_sql_null_ind

  • isc_info_sql_field

  • isc_info_sql_relation

  • isc_info_sql_owner

  • isc_info_sql_alias

  • isc_info_sql_sqlda_start

  • isc_info_sql_stmt_type

  • isc_info_sql_get_plan

  • isc_info_sql_records

  • isc_info_sql_batch_fetch

  • isc_info_sql_relation_alias

  • isc_info_sql_explain_plan

  • isc_info_sql_stmt_flags

SQL information return values

  • isc_info_sql_stmt_select

  • isc_info_sql_stmt_insert

  • isc_info_sql_stmt_update

  • isc_info_sql_stmt_delete

  • isc_info_sql_stmt_ddl

  • isc_info_sql_stmt_get_segment

  • isc_info_sql_stmt_put_segment

  • isc_info_sql_stmt_exec_procedure

  • isc_info_sql_stmt_start_trans

  • isc_info_sql_stmt_commit

  • isc_info_sql_stmt_rollback

  • isc_info_sql_stmt_select_for_upd

  • isc_info_sql_stmt_set_generator

  • isc_info_sql_stmt_savepoint

Transaction parameter block stuff

  • isc_tpb_version1

  • isc_tpb_version3

  • isc_tpb_consistency

  • isc_tpb_concurrency

  • isc_tpb_shared

  • isc_tpb_protected

  • isc_tpb_exclusive

  • isc_tpb_wait

  • isc_tpb_nowait

  • isc_tpb_read

  • isc_tpb_write

  • isc_tpb_lock_read

  • isc_tpb_lock_write

  • isc_tpb_verb_time

  • isc_tpb_commit_time

  • isc_tpb_ignore_limbo

  • isc_tpb_read_committed

  • isc_tpb_autocommit

  • isc_tpb_rec_version

  • isc_tpb_no_rec_version

  • isc_tpb_restart_requests

  • isc_tpb_no_auto_undo

  • isc_tpb_lock_timeout

BLOB parameter buffer

  • isc_bpb_version1

  • isc_bpb_source_type

  • isc_bpb_target_type

  • isc_bpb_type

  • isc_bpb_source_interp

  • isc_bpb_target_interp

  • isc_bpb_filter_parameter

  • isc_bpb_storage

  • isc_bpb_type_segmented

  • isc_bpb_type_stream

  • isc_bpb_storage_main

  • isc_bpb_storage_temp

Service parameter block stuff

  • isc_spb_current_version

  • isc_spb_version

  • isc_spb_version3

  • isc_spb_user_name

  • isc_spb_sys_user_name

  • isc_spb_sys_user_name_enc

  • isc_spb_password

  • isc_spb_password_enc

  • isc_spb_command_line

  • isc_spb_dbname

  • isc_spb_verbose

  • isc_spb_options

  • isc_spb_address_path

  • isc_spb_process_id

  • isc_spb_trusted_auth

  • isc_spb_process_name

  • isc_spb_trusted_role

  • isc_spb_verbint

  • isc_spb_auth_block

  • isc_spb_auth_plugin_name

  • isc_spb_auth_plugin_list

  • isc_spb_utf8_filename

  • isc_spb_client_version

  • isc_spb_remote_protocol

  • isc_spb_host_name

  • isc_spb_os_user

  • isc_spb_config

  • isc_spb_expected_db

Parameters for isc_action_{add|del|mod|disp)_user:

  • isc_spb_sec_userid

  • isc_spb_sec_groupid

  • isc_spb_sec_username

  • isc_spb_sec_password

  • isc_spb_sec_groupname

  • isc_spb_sec_firstname

  • isc_spb_sec_middlename

  • isc_spb_sec_lastname

  • isc_spb_sec_admin

Parameters for isc_action_svc_backup:

  • isc_spb_bkp_file

  • isc_spb_bkp_factor

  • isc_spb_bkp_length

  • isc_spb_bkp_skip_data

  • isc_spb_bkp_stat

  • isc_spb_bkp_ignore_checksums

  • isc_spb_bkp_ignore_limbo

  • isc_spb_bkp_metadata_only

  • isc_spb_bkp_no_garbage_collect

  • isc_spb_bkp_old_descriptions

  • isc_spb_bkp_non_transportable

  • isc_spb_bkp_convert

  • isc_spb_bkp_expand

  • isc_spb_bkp_no_triggers

Parameters for isc_action_svc_properties:

  • isc_spb_prp_page_buffers

  • isc_spb_prp_sweep_interval

  • isc_spb_prp_shutdown_db

  • isc_spb_prp_deny_new_attachments

  • isc_spb_prp_deny_new_transactions

  • isc_spb_prp_reserve_space

  • isc_spb_prp_write_mode

  • isc_spb_prp_access_mode

  • isc_spb_prp_set_sql_dialect

  • isc_spb_prp_activate

  • isc_spb_prp_db_online

  • isc_spb_prp_nolinger

  • isc_spb_prp_force_shutdown

  • isc_spb_prp_attachments_shutdown

  • isc_spb_prp_transactions_shutdown

  • isc_spb_prp_shutdown_mode

  • isc_spb_prp_online_mode

Parameters for isc_spb_prp_shutdown_mode and isc_spb_prp_online_mode:

  • isc_spb_prp_sm_normal

  • isc_spb_prp_sm_multi

  • isc_spb_prp_sm_single

  • isc_spb_prp_sm_full

Parameters for isc_spb_prp_reserve_space:

  • isc_spb_prp_res_use_full

  • isc_spb_prp_res

Parameters for isc_spb_prp_write_mode:

  • isc_spb_prp_wm_async

  • isc_spb_prp_wm_sync

Parameters for isc_action_svc_validate:

  • isc_spb_val_tab_incl

  • isc_spb_val_tab_excl

  • isc_spb_val_idx_incl

  • isc_spb_val_idx_excl

  • isc_spb_val_lock_timeout

Parameters for isc_spb_prp_access_mode:

  • isc_spb_rpr_commit_trans

  • isc_spb_rpr_rollback_trans

  • isc_spb_rpr_recover_two_phase

  • isc_spb_tra_id

  • isc_spb_single_tra_id

  • isc_spb_multi_tra_id

  • isc_spb_tra_state

  • isc_spb_tra_state_limbo

  • isc_spb_tra_state_commit

  • isc_spb_tra_state_rollback

  • isc_spb_tra_state_unknown

  • isc_spb_tra_host_site

  • isc_spb_tra_remote_site

  • isc_spb_tra_db_path

  • isc_spb_tra_advise

  • isc_spb_tra_advise_commit

  • isc_spb_tra_advise_rollback

  • isc_spb_tra_advise_unknown

  • isc_spb_tra_id_64

  • isc_spb_single_tra_id_64

  • isc_spb_multi_tra_id_64

  • isc_spb_rpr_commit_trans_64

  • isc_spb_rpr_rollback_trans_64

  • isc_spb_rpr_recover_two_phase_64

  • isc_spb_rpr_validate_db

  • isc_spb_rpr_sweep_db

  • isc_spb_rpr_mend_db

  • isc_spb_rpr_list_limbo_trans

  • isc_spb_rpr_check_db

  • isc_spb_rpr_ignore_checksum

  • isc_spb_rpr_kill_shadows

  • isc_spb_rpr_full

  • isc_spb_rpr_icu

Parameters for isc_action_svc_restore:

  • isc_spb_res_skip_data

  • isc_spb_res_buffers

  • isc_spb_res_page_size

  • isc_spb_res_length

  • isc_spb_res_access_mode

  • isc_spb_res_fix_fss_data

  • isc_spb_res_fix_fss_metadata

  • isc_spb_res_stat

  • isc_spb_res_metadata_only

  • isc_spb_res_deactivate_idx

  • isc_spb_res_no_shadow

  • isc_spb_res_no_validity

  • isc_spb_res_one_at_a_time

  • isc_spb_res_replace

  • isc_spb_res_create

  • isc_spb_res_use_all_space

Parameters for isc_spb_res_access_mode:

  • isc_spb_res_am_readonly

  • isc_spb_res_am_readwrite

Parameters for isc_info_svc_svr_db_info:

  • isc_spb_num_att

  • isc_spb_num_db

Parameters for isc_info_svc_db_stats:

  • isc_spb_sts_data_pages

  • isc_spb_sts_db_log

  • isc_spb_sts_hdr_pages

  • isc_spb_sts_idx_pages

  • isc_spb_sts_sys_relations

  • isc_spb_sts_record_versions

  • isc_spb_sts_table

  • isc_spb_sts_nocreation

  • isc_spb_sts_encryption

Parameters for isc_action_svc_nbak:

  • isc_spb_nbk_level

  • isc_spb_nbk_file

  • isc_spb_nbk_direct

  • isc_spb_nbk_no_triggers

Parameters for trace:

  • isc_spb_trc_id

  • isc_spb_trc_name

  • isc_spb_trc_cfg

Service action items

  • isc_action_svc_backup

  • isc_action_svc_restore

  • isc_action_svc_repair

  • isc_action_svc_add_user

  • isc_action_svc_delete_user

  • isc_action_svc_modify_user

  • isc_action_svc_display_user

  • isc_action_svc_properties

  • isc_action_svc_add_license

  • isc_action_svc_remove_license

  • isc_action_svc_db_stats

  • isc_action_svc_get_ib_log

  • isc_action_svc_get_fb_log

  • isc_action_svc_nbak

  • isc_action_svc_nrest

  • isc_action_svc_trace_start

  • isc_action_svc_trace_stop

  • isc_action_svc_trace_suspend

  • isc_action_svc_trace_resume

  • isc_action_svc_trace_list

  • isc_action_svc_set_mapping

  • isc_action_svc_drop_mapping

  • isc_action_svc_display_user_adm

  • isc_action_svc_validate

Service information items

  • isc_info_svc_svr_db_info

  • isc_info_svc_get_config

  • isc_info_svc_version

  • isc_info_svc_server_version

  • isc_info_svc_implementation

  • isc_info_svc_capabilities

  • isc_info_svc_user_dbpath

  • isc_info_svc_get_env

  • isc_info_svc_get_env_lock

  • isc_info_svc_get_env_msg

  • isc_info_svc_line

  • isc_info_svc_to_eof

  • isc_info_svc_timeout

  • isc_info_svc_limbo_trans

  • isc_info_svc_running

  • isc_info_svc_get_users

  • isc_info_svc_auth_block

  • isc_info_svc_stdin

BLOB action codes

  • blb_got_eof

  • blb_got_fragment

  • blb_got_full_segment

  • blb_seek_relative

  • blb_seek_from_tail

Implementation codes

  • isc_info_db_impl_rdb_vms

  • isc_info_db_impl_rdb_eln

  • isc_info_db_impl_rdb_eln_dev

  • isc_info_db_impl_rdb_vms_y

  • isc_info_db_impl_rdb_eln_y

  • isc_info_db_impl_jri

  • isc_info_db_impl_jsv

  • isc_info_db_impl_isc_apl_68K

  • isc_info_db_impl_isc_vax_ultr

  • isc_info_db_impl_isc_vms

  • isc_info_db_impl_isc_sun_68k

  • isc_info_db_impl_isc_os2

  • isc_info_db_impl_isc_sun4

  • isc_info_db_impl_isc_hp_ux

  • isc_info_db_impl_isc_sun_386i

  • isc_info_db_impl_isc_vms_orcl

  • isc_info_db_impl_isc_mac_aux

  • isc_info_db_impl_isc_rt_aix

  • isc_info_db_impl_isc_mips_ult

  • isc_info_db_impl_isc_xenix

  • isc_info_db_impl_isc_dg

  • isc_info_db_impl_isc_hp_mpexl

  • isc_info_db_impl_isc_hp_ux68K

  • isc_info_db_impl_isc_sgi

  • isc_info_db_impl_isc_sco_unix

  • isc_info_db_impl_isc_cray

  • isc_info_db_impl_isc_imp

  • isc_info_db_impl_isc_delta

  • isc_info_db_impl_isc_next

  • isc_info_db_impl_isc_dos

  • isc_info_db_impl_m88K

  • isc_info_db_impl_unixware

  • isc_info_db_impl_isc_winnt_x86

  • isc_info_db_impl_isc_epson

  • isc_info_db_impl_alpha_osf

  • isc_info_db_impl_alpha_vms

  • isc_info_db_impl_netware_386

  • isc_info_db_impl_win_only

  • isc_info_db_impl_ncr_3000

  • isc_info_db_impl_winnt_ppc

  • isc_info_db_impl_dg_x86

  • isc_info_db_impl_sco_ev

  • isc_info_db_impl_i386

  • isc_info_db_impl_freebsd

  • isc_info_db_impl_netbsd

  • isc_info_db_impl_darwin_ppc

  • isc_info_db_impl_sinixz

  • isc_info_db_impl_linux_sparc

  • isc_info_db_impl_linux_amd64

  • isc_info_db_impl_freebsd_amd64

  • isc_info_db_impl_winnt_amd64

  • isc_info_db_impl_linux_ppc

  • isc_info_db_impl_darwin_x86

  • isc_info_db_impl_linux_mipsel

  • isc_info_db_impl_linux_mips

  • isc_info_db_impl_darwin_x64

  • isc_info_db_impl_sun_amd64

  • isc_info_db_impl_linux_arm

  • isc_info_db_impl_linux_ia64

  • isc_info_db_impl_darwin_ppc64

  • isc_info_db_impl_linux_s390x

  • isc_info_db_impl_linux_s390

  • isc_info_db_impl_linux_sh

  • isc_info_db_impl_linux_sheb

  • isc_info_db_impl_linux_hppa

  • isc_info_db_impl_linux_alpha

  • isc_info_db_impl_linux_arm64

  • isc_info_db_impl_linux_ppc64el

  • isc_info_db_impl_linux_ppc64

Info DB provider codes

  • isc_info_db_code_rdb_eln

  • isc_info_db_code_rdb_vms

  • isc_info_db_code_interbase

  • isc_info_db_code_firebird

Info DB class codes

  • isc_info_db_class_access

  • isc_info_db_class_y_valve

  • isc_info_db_class_rem_int

  • isc_info_db_class_rem_srvr

  • isc_info_db_class_pipe_int

  • isc_info_db_class_pipe_srvr

  • isc_info_db_class_sam_int

  • isc_info_db_class_sam_srvr

  • isc_info_db_class_gateway

  • isc_info_db_class_cache

  • isc_info_db_class_classic_access

  • isc_info_db_class_server_access

Request information items

  • isc_info_number_messages

  • isc_info_max_message

  • isc_info_max_send

  • isc_info_max_receive

  • isc_info_state

  • isc_info_message_number

  • isc_info_message_size

  • isc_info_request_cost

  • isc_info_access_path

  • isc_info_req_select_count

  • isc_info_req_insert_count

  • isc_info_req_update_count

  • isc_info_req_delete_count

Access path items

  • isc_info_rsb_end

  • isc_info_rsb_begin

  • isc_info_rsb_type

  • isc_info_rsb_relation

  • isc_info_rsb_plan

Record Source Block (RSB) types

  • isc_info_rsb_unknown

  • isc_info_rsb_indexed

  • isc_info_rsb_navigate

  • isc_info_rsb_sequential

  • isc_info_rsb_cross

  • isc_info_rsb_sort

  • isc_info_rsb_first

  • isc_info_rsb_boolean

  • isc_info_rsb_union

  • isc_info_rsb_aggregate

  • isc_info_rsb_merge

  • isc_info_rsb_ext_sequential

  • isc_info_rsb_ext_indexed

  • isc_info_rsb_ext_dbkey

  • isc_info_rsb_left_cross

  • isc_info_rsb_select

  • isc_info_rsb_sql_join

  • isc_info_rsb_simulate

  • isc_info_rsb_sim_cross

  • isc_info_rsb_once

  • isc_info_rsb_procedure

  • isc_info_rsb_skip

  • isc_info_rsb_virt_sequential

  • isc_info_rsb_recursive

  • isc_info_rsb_window

  • isc_info_rsb_singular

  • isc_info_rsb_writelock

  • isc_info_rsb_buffer

  • isc_info_rsb_hash

RSB Bitmap expressions

  • isc_info_rsb_and

  • isc_info_rsb_or

  • isc_info_rsb_dbkey

  • isc_info_rsb_index

Info request response codes

  • isc_info_req_active

  • isc_info_req_inactive

  • isc_info_req_send

  • isc_info_req_receive

  • isc_info_req_select

  • isc_info_req_sql_stall

Blob Subtypes

  • isc_blob_untyped

  • isc_blob_text

  • isc_blob_blr

  • isc_blob_acl

  • isc_blob_ranges

  • isc_blob_summary

  • isc_blob_format

  • isc_blob_tra

  • isc_blob_extfile

  • isc_blob_debug_info

  • isc_blob_max_predefined_subtype

Cancel types for fb_cancel_operation

  • fb_cancel_disable

  • fb_cancel_enable

  • fb_cancel_raise

  • fb_cancel_abort

Other constants

  • DSQL_close

  • DSQL_drop

  • DSQL_unprepare

  • SQLDA_version1

  • isc_info_req_select_count

  • isc_info_req_insert_count

  • isc_info_req_update_count

  • isc_info_req_delete_count

flags set in fb_info_crypt_state:

  • fb_info_crypt_encrypted

  • fb_info_crypt_process

FB_API_VER

(int) Firebird API version number

MAX_BLOB_SEGMENT_SIZE

(int) Max size for BLOB segment

Types

Basic types

fdb.ibase.STRING

alias of ctypes.c_char_p

fdb.ibase.WSTRING

alias of ctypes.c_wchar_p

fdb.ibase.FB_API_HANDLE

alias of ctypes.c_uint

fdb.ibase.ISC_STATUS

alias of ctypes.c_long

fdb.ibase.ISC_STATUS_PTR

alias of fdb.ibase.LP_c_long

fdb.ibase.ISC_STATUS_ARRAY

alias of fdb.ibase.c_long_Array_20

fdb.ibase.FB_SQLSTATE_STRING

alias of fdb.ibase.c_char_Array_6

fdb.ibase.ISC_LONG

alias of ctypes.c_int

fdb.ibase.ISC_ULONG

alias of ctypes.c_uint

fdb.ibase.ISC_SHORT

alias of ctypes.c_short

fdb.ibase.ISC_USHORT

alias of ctypes.c_ushort

fdb.ibase.ISC_UCHAR

alias of ctypes.c_ubyte

fdb.ibase.ISC_SCHAR

alias of ctypes.c_char

fdb.ibase.ISC_INT64

alias of ctypes.c_long

fdb.ibase.ISC_UINT64

alias of ctypes.c_ulong

fdb.ibase.ISC_DATE

alias of ctypes.c_int

fdb.ibase.ISC_TIME

alias of ctypes.c_uint

class fdb.ibase.ISC_TIMESTAMP
timestamp_date

Structure/Union member

timestamp_time

Structure/Union member

class fdb.ibase.GDS_QUAD_t
gds_quad_high

Structure/Union member

gds_quad_low

Structure/Union member

fdb.ibase.GDS_QUAD

alias of fdb.ibase.GDS_QUAD_t

fdb.ibase.ISC_QUAD

alias of fdb.ibase.GDS_QUAD_t

class fdb.ibase.ISC_ARRAY_BOUND
array_bound_lower

Structure/Union member

array_bound_upper

Structure/Union member

class fdb.ibase.ISC_ARRAY_DESC
array_desc_bounds

Structure/Union member

array_desc_dimensions

Structure/Union member

array_desc_dtype

Structure/Union member

array_desc_field_name

Structure/Union member

array_desc_flags

Structure/Union member

array_desc_length

Structure/Union member

array_desc_relation_name

Structure/Union member

array_desc_scale

Structure/Union member

class fdb.ibase.ISC_BLOB_DESC
blob_desc_charset

Structure/Union member

blob_desc_field_name

Structure/Union member

blob_desc_relation_name

Structure/Union member

blob_desc_segment_size

Structure/Union member

blob_desc_subtype

Structure/Union member

class fdb.ibase.isc_blob_ctl
ctl_bpb

Structure/Union member

ctl_bpb_length

Structure/Union member

ctl_buffer

Structure/Union member

ctl_buffer_length

Structure/Union member

ctl_data

Structure/Union member

ctl_from_sub_type

Structure/Union member

ctl_max_segment

Structure/Union member

ctl_number_segments

Structure/Union member

ctl_segment_length

Structure/Union member

ctl_source

Structure/Union member

ctl_source_handle

Structure/Union member

ctl_status

Structure/Union member

ctl_to_sub_type

Structure/Union member

ctl_total_length

Structure/Union member

class fdb.ibase.bstream
bstr_blob

Structure/Union member

bstr_buffer

Structure/Union member

bstr_cnt

Structure/Union member

bstr_length

Structure/Union member

bstr_mode

Structure/Union member

bstr_ptr

Structure/Union member

fdb.ibase.BSTREAM

alias of fdb.ibase.bstream

fdb.ibase.FB_BLOB_STREAM

alias of fdb.ibase.LP_bstream

class fdb.ibase.paramdsc
dsc_address

Structure/Union member

dsc_dtype

Structure/Union member

dsc_flags

Structure/Union member

dsc_length

Structure/Union member

dsc_scale

Structure/Union member

dsc_sub_type

Structure/Union member

class fdb.ibase.paramvary
vary_length

Structure/Union member

vary_string

Structure/Union member

ISC_TEB

class fdb.ibase.ISC_TEB
db_ptr

Structure/Union member

tpb_len

Structure/Union member

tpb_ptr

Structure/Union member

XSQLVAR

class fdb.ibase.XSQLVAR
aliasname

Structure/Union member

aliasname_length

Structure/Union member

ownname

Structure/Union member

ownname_length

Structure/Union member

relname

Structure/Union member

relname_length

Structure/Union member

sqldata

Structure/Union member

sqlind

Structure/Union member

sqllen

Structure/Union member

sqlname

Structure/Union member

sqlname_length

Structure/Union member

sqlscale

Structure/Union member

sqlsubtype

Structure/Union member

sqltype

Structure/Union member

XSQLDA

class fdb.ibase.XSQLDA
sqld

Structure/Union member

sqldabc

Structure/Union member

sqldaid

Structure/Union member

sqln

Structure/Union member

sqlvar

Structure/Union member

version

Structure/Union member

fdb.ibase.XSQLDA_PTR

alias of fdb.ibase.LP_XSQLDA

USER_SEC_DATA

class fdb.ibase.USER_SEC_DATA
dba_password

Structure/Union member

dba_user_name

Structure/Union member

first_name

Structure/Union member

gid

Structure/Union member

group_name

Structure/Union member

last_name

Structure/Union member

middle_name

Structure/Union member

password

Structure/Union member

protocol

Structure/Union member

sec_flags

Structure/Union member

server

Structure/Union member

uid

Structure/Union member

user_name

Structure/Union member

RESULT_VECTOR

fdb.ibase.RESULT_VECTOR

alias of fdb.ibase.c_uint_Array_15

Callbacks

class fdb.ibase.FB_SHUTDOWN_CALLBACK

ctypes.CFUNCTYPE(UNCHECKED(c_int), c_int, c_int, POINTER(None))

class fdb.ibase.ISC_CALLBACK

ctypes.CFUNCTYPE(None)

class fdb.ibase.ISC_PRINT_CALLBACK

ctypes.CFUNCTYPE(None, c_void_p, c_short, STRING)

class fdb.ibase.ISC_VERSION_CALLBACK

ctypes.CFUNCTYPE(None, c_void_p, STRING)

class fdb.ibase.ISC_EVENT_CALLBACK

ctypes.CFUNCTYPE(None, POINTER(ISC_UCHAR), c_ushort, POINTER(ISC_UCHAR))

class fdb.ibase.blobcallback
blob_get_segment

Structure/Union member

blob_handle

Structure/Union member

blob_lseek

Structure/Union member

blob_max_segment

Structure/Union member

blob_number_segments

Structure/Union member

blob_put_segment

Structure/Union member

blob_total_length

Structure/Union member

Other globals

charset_map

Dictionary that maps DB CHAR SET NAME to PYTHON CODEC NAME (CANONICAL)

fdb.ibase.ISC_TRUE
fdb.ibase.ISC_FALSE

Functions

Classes

fbclient_API

class fdb.ibase.fbclient_API(fb_library_name=None)

Firebird Client API interface object. Loads Firebird Client Library and exposes API functions as member methods. Uses ctypes for bindings.

isc_event_block(event_buffer, result_buffer, *args)

Injects variable number of parameters into C_isc_event_block call

BLOB_close = None

BLOB_close(POINTER(BSTREAM))

BLOB_display = None

BLOB_display(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

BLOB_dump = None

BLOB_dump(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

BLOB_edit = None

BLOB_edit(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

BLOB_get = None

BLOB_get(POINTER(BSTREAM))

BLOB_load = None

BLOB_load(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

BLOB_open = None

BLOB_open(isc_blob_handle, STRING, c_int)

BLOB_put = None

BLOB_put(ISC_SCHAR, POINTER(BSTREAM))

BLOB_text_dump = None

BLOB_text_dump(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

BLOB_text_load = None

BLOB_text_load(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

Bopen = None

Bopen(POINTER(ISC_QUAD), isc_db_handle, isc_tr_handle, STRING)

C_isc_event_block = None

C_isc_event_block(ISC_LONG, POINTER(POINTER(ISC_UCHAR)), POINTER(POINTER(ISC_UCHAR)), ISC_USHORT)

client_library = None

Firebird client library (loaded by ctypes)

client_library_name = None

Firebird client library name

fb_interpret = None

fb_interpret(STRING, c_uint, POINTER(POINTER(ISC_STATUS)))

isc_add_user = None

isc_add_user(POINTER(ISC_STATUS), POINTER(USER_SEC_DATA))

isc_array_gen_sdl = None

isc_array_gen_sdl(POINTER(ISC_STATUS), POINTER(ISC_ARRAY_DESC), POINTER(ISC_SHORT), POINTER(ISC_UCHAR), POINTER(ISC_SHORT))

isc_array_get_slice = None

isc_array_get_slice(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(ISC_QUAD), POINTER(ISC_ARRAY_DESC), c_void_p, POINTER(ISC_LONG))

isc_array_lookup_bounds = None

isc_array_lookup_bounds(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), STRING, STRING, POINTER(ISC_ARRAY_DESC))

isc_array_lookup_desc = None

isc_array_lookup_desc(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), STRING, STRING, POINTER(ISC_ARRAY_DESC))

isc_array_put_slice = None

isc_array_put_slice(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(ISC_QUAD), POINTER(ISC_ARRAY_DESC), c_void_p, POINTER(ISC_LONG))

isc_array_set_desc = None

isc_array_set_desc(POINTER(ISC_STATUS), STRING, STRING, POINTER(c_short), POINTER(c_short), POINTER(c_short), POINTER(ISC_ARRAY_DESC))

isc_attach_database = None

isc_attach_database(POINTER(ISC_STATUS), c_short, STRING, POINTER(isc_db_handle), c_short, STRING)

isc_blob_default_desc = None

isc_blob_default_desc(POINTER(ISC_BLOB_DESC), POINTER(ISC_UCHAR), POINTER(ISC_UCHAR))

isc_blob_gen_bpb = None

isc_blob_gen_bpb(POINTER(ISC_STATUS), POINTER(ISC_BLOB_DESC), POINTER(ISC_BLOB_DESC), c_ushort, POINTER(ISC_UCHAR), POINTER(c_ushort))

isc_blob_info = None

isc_blob_info(POINTER(ISC_STATUS), POINTER(isc_blob_handle), c_short, STRING, c_short, POINTER(c_char))

isc_blob_lookup_desc = None

isc_blob_lookup_desc(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(ISC_UCHAR), POINTER(ISC_UCHAR), POINTER(ISC_BLOB_DESC), POINTER(ISC_UCHAR))

isc_blob_set_desc = None

isc_blob_set_desc(POINTER(ISC_STATUS), POINTER(ISC_UCHAR), POINTER(ISC_UCHAR), c_short, c_short, c_short, POINTER(ISC_BLOB_DESC))

isc_cancel_blob = None

isc_cancel_blob(POINTER(ISC_STATUS), POINTER(isc_blob_handle))

isc_cancel_events = None

isc_cancel_events(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(ISC_LONG))

isc_close = None

isc_close(POINTER(ISC_STATUS), STRING)

isc_close_blob = None

isc_close_blob(POINTER(ISC_STATUS), POINTER(isc_blob_handle))

isc_commit_retaining = None

isc_commit_retaining(POINTER(ISC_STATUS), POINTER(isc_tr_handle))

isc_commit_transaction = None

isc_commit_transaction(POINTER(ISC_STATUS), POINTER(isc_tr_handle)

isc_compile_request = None

isc_compile_request(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_req_handle), c_short, STRING)

isc_compile_request2 = None

isc_compile_request2(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_req_handle), c_short, STRING)

isc_create_blob = None

isc_create_blob(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(isc_blob_handle), POINTER(ISC_QUAD))

isc_create_blob2 = None

isc_create_blob2(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(isc_blob_handle), POINTER(ISC_QUAD), c_short, STRING)

isc_create_database = None

isc_create_database(POINTER(ISC_STATUS), c_short, STRING, POINTER(isc_db_handle), c_short, STRING, c_short)

isc_database_info = None

isc_database_info(POINTER(ISC_STATUS), POINTER(isc_db_handle), c_short, STRING, c_short, STRING)

isc_ddl = None

isc_ddl(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_short, STRING) This function always returns error since FB 3.0

isc_declare = None

isc_declare(POINTER(ISC_STATUS), STRING, STRING)

isc_decode_date = None

isc_decode_date(POINTER(ISC_QUAD), c_void_p)

isc_decode_sql_date = None

isc_decode_sql_date(POINTER(ISC_DATE), c_void_p)

isc_decode_sql_time = None

isc_decode_sql_time(POINTER(ISC_TIME), c_void_p)

isc_decode_timestamp = None

isc_decode_timestamp(POINTER(ISC_TIMESTAMP), c_void_p)

isc_delete_user = None

isc_delete_user(POINTER(ISC_STATUS), POINTER(USER_SEC_DATA))

isc_describe = None

isc_describe(POINTER(ISC_STATUS), STRING, POINTER(XSQLDA))

isc_describe_bind = None

isc_describe_bind(POINTER(ISC_STATUS), STRING, POINTER(XSQLDA))

isc_detach_database = None

isc_detach_database(POINTER(ISC_STATUS), POINTER(isc_db_handle))

isc_drop_database = None

isc_drop_database(POINTER(ISC_STATUS), POINTER(isc_db_handle))

isc_dsql_alloc_statement2 = None

isc_dsql_alloc_statement2(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_stmt_handle))

isc_dsql_allocate_statement = None

isc_dsql_allocate_statement(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_stmt_handle)

isc_dsql_describe = None

isc_dsql_describe(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort, POINTER(XSQLDA))

isc_dsql_describe_bind = None

isc_dsql_describe_bind(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort, POINTER(XSQLDA)

isc_dsql_exec_immed2 = None

isc_dsql_exec_immed2(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_ushort, STRING, c_ushort, POINTER(XSQLDA), POINTER(XSQLDA))

isc_dsql_exec_immed3_m = None

isc_dsql_exec_immed3_m(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_ushort, STRING, c_ushort, c_ushort, STRING, c_ushort, c_ushort, STRING, c_ushort, STRING, c_ushort, c_ushort, STRING)

isc_dsql_execute = None

isc_dsql_execute(POINTER(ISC_STATUS), POINTER(isc_tr_handle), POINTER(isc_stmt_handle), c_ushort, POINTER(XSQLDA))

isc_dsql_execute2 = None

isc_dsql_execute2(POINTER(ISC_STATUS), POINTER(isc_tr_handle), POINTER(isc_stmt_handle), c_ushort, POINTER(XSQLDA), POINTER(XSQLDA))

isc_dsql_execute2_m = None

isc_dsql_execute2_m(POINTER(ISC_STATUS), POINTER(isc_tr_handle), POINTER(isc_stmt_handle), c_ushort, STRING, c_ushort, c_ushort, STRING, c_ushort, STRING, c_ushort, c_ushort, STRING)

isc_dsql_execute_immediate = None

isc_dsql_execute_immediate(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_ushort, STRING, c_ushort, POINTER(XSQLDA))

isc_dsql_execute_immediate_m = None

isc_dsql_execute_immediate_m(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_ushort, STRING, c_ushort, c_ushort, STRING, c_ushort, c_ushort, STRING)

isc_dsql_execute_m = None

isc_dsql_execute_m(POINTER(ISC_STATUS), POINTER(isc_tr_handle), POINTER(isc_stmt_handle), c_ushort, STRING, c_ushort, c_ushort, STRING)

isc_dsql_fetch = None

isc_dsql_fetch(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort, POINTER(XSQLDA))

isc_dsql_fetch_m = None

isc_dsql_fetch_m(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort, STRING, c_ushort, c_ushort, STRING)

isc_dsql_finish = None

isc_dsql_finish(POINTER(isc_db_handle))

isc_dsql_free_statement = None

isc_dsql_free_statement(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort)

isc_dsql_insert = None

isc_dsql_insert(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort, POINTER(XSQLDA))

isc_dsql_insert_m = None

isc_dsql_insert_m(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_ushort, STRING, c_ushort, c_ushort, STRING)

isc_dsql_prepare = None

isc_dsql_prepare(POINTER(ISC_STATUS), POINTER(isc_tr_handle), POINTER(isc_stmt_handle), c_ushort, STRING, c_ushort, POINTER(XSQLDA)

isc_dsql_prepare_m = None

isc_dsql_prepare_m(POINTER(ISC_STATUS), POINTER(isc_tr_handle), POINTER(isc_stmt_handle), c_ushort, STRING, c_ushort, c_ushort, STRING, c_ushort, STRING)

isc_dsql_release = None

isc_dsql_release(POINTER(ISC_STATUS), STRING)

isc_dsql_set_cursor_name = None

isc_dsql_set_cursor_name(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), STRING, c_ushort)

isc_dsql_sql_info = None

isc_dsql_sql_info(POINTER(ISC_STATUS), POINTER(isc_stmt_handle), c_short, STRING, c_short, STRING)

isc_embed_dsql_close = None

isc_embed_dsql_close(POINTER(ISC_STATUS), STRING)

isc_embed_dsql_declare = None

isc_embed_dsql_declare(POINTER(ISC_STATUS), STRING, STRING)

isc_embed_dsql_describe = None

isc_embed_dsql_describe(POINTER(ISC_STATUS), STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_describe_bind = None

isc_embed_dsql_describe_bind(POINTER(ISC_STATUS), STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_execute = None

isc_embed_dsql_execute(POINTER(ISC_STATUS), POINTER(isc_tr_handle), STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_execute2 = None

isc_embed_dsql_execute2(POINTER(ISC_STATUS), POINTER(isc_tr_handle), STRING, c_ushort, POINTER(XSQLDA), POINTER(XSQLDA))

isc_embed_dsql_execute_immed = None

isc_embed_dsql_execute_immed(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_ushort, STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_fetch = None

isc_embed_dsql_fetch(POINTER(ISC_STATUS), STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_fetch_a = None

isc_embed_dsql_fetch_a(POINTER(ISC_STATUS), POINTER(c_int), STRING, ISC_USHORT, POINTER(XSQLDA))

isc_embed_dsql_insert = None

isc_embed_dsql_insert(POINTER(ISC_STATUS), STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_open = None

isc_embed_dsql_open(POINTER(ISC_STATUS), POINTER(isc_tr_handle), STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_open2 = None

isc_embed_dsql_open2(POINTER(ISC_STATUS), POINTER(isc_tr_handle), STRING, c_ushort, POINTER(XSQLDA), POINTER(XSQLDA))

isc_embed_dsql_prepare = None

isc_embed_dsql_prepare(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), STRING, c_ushort, STRING, c_ushort, POINTER(XSQLDA))

isc_embed_dsql_release = None

isc_embed_dsql_release(POINTER(ISC_STATUS), STRING)

isc_encode_date = None

isc_encode_date(c_void_p, POINTER(ISC_QUAD))

isc_encode_sql_date = None

isc_encode_sql_date(c_void_p, POINTER(ISC_DATE))

isc_encode_sql_time = None

isc_encode_sql_time(c_void_p, POINTER(ISC_TIME))

isc_encode_timestamp = None

isc_encode_timestamp(c_void_p, POINTER(ISC_TIMESTAMP))

isc_event_counts = None

isc_event_counts(POINTER(RESULT_VECTOR), c_short, POINTER(ISC_UCHAR), POINTER(ISC_UCHAR))

isc_execute = None

isc_execute(POINTER(ISC_STATUS), POINTER(isc_tr_handle), STRING, POINTER(XSQLDA))

isc_execute_immediate = None

isc_execute_immediate(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(c_short), STRING)

isc_expand_dpb = None

isc_expand_dpb(POINTER(STRING), POINTER(c_short))

isc_fetch = None

isc_fetch(POINTER(ISC_STATUS), STRING, POINTER(XSQLDA))

isc_free = None

isc_free(STRING

isc_ftof = None

isc_ftof(STRING, c_ushort, STRING, c_ushort)

isc_get_client_major_version = None

isc_get_client_major_version()

isc_get_client_minor_version = None

isc_get_client_minor_version()

isc_get_client_version = None

isc_get_client_version(STRING)

isc_get_segment = None

isc_get_segment(POINTER(ISC_STATUS), POINTER(isc_blob_handle), POINTER(c_ushort), c_ushort, c_void_p)

isc_get_slice = None

isc_get_slice(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(ISC_QUAD), c_short, STRING, c_short, POINTER(ISC_LONG), ISC_LONG, c_void_p, POINTER(ISC_LONG))

isc_interprete = None

isc_interprete(STRING, POINTER(POINTER(ISC_STATUS)))

isc_modify_dpb = None

isc_modify_dpb(POINTER(STRING), POINTER(c_short), c_ushort, STRING, c_short)

isc_modify_user = None

isc_modify_user(POINTER(ISC_STATUS), POINTER(USER_SEC_DATA))

isc_open = None

isc_open(POINTER(ISC_STATUS), POINTER(isc_tr_handle), STRING, POINTER(XSQLDA))

isc_open_blob = None

isc_open_blob(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(isc_blob_handle), POINTER(ISC_QUAD))

isc_open_blob2 = None

isc_open_blob2(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(isc_blob_handle), POINTER(ISC_QUAD), ISC_USHORT, STRING)

isc_portable_integer = None

isc_portable_integer(POINTER(ISC_UCHAR), c_short)

isc_prepare = None

isc_prepare(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), STRING, POINTER(c_short), STRING, POINTER(XSQLDA))

isc_prepare_transaction = None

isc_prepare_transaction(POINTER(ISC_STATUS), POINTER(isc_tr_handle))

isc_prepare_transaction2 = None

isc_prepare_transaction2(POINTER(ISC_STATUS), POINTER(isc_tr_handle), ISC_USHORT, POINTER(ISC_UCHAR))

isc_print_blr = None

isc_print_blr(STRING, ISC_PRINT_CALLBACK, c_void_p, c_short)

isc_print_sqlerror = None

isc_print_sqlerror(ISC_SHORT, POINTER(ISC_STATUS))

isc_print_status = None

isc_print_status(POINTER(ISC_STATUS))

isc_put_segment = None

isc_put_segment(POINTER(ISC_STATUS), POINTER(isc_blob_handle), c_ushort, c_void_p)

isc_put_slice = None

isc_put_slice(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), POINTER(ISC_QUAD), c_short, STRING, c_short, POINTER(ISC_LONG), ISC_LONG, c_void_p)

isc_qtoq = None

isc_qtoq(POINTER(ISC_QUAD), POINTER(ISC_QUAD))

isc_que_events = None

isc_que_events(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(ISC_LONG), c_short, POINTER(ISC_UCHAR), ISC_EVENT_CALLBACK, POINTER(ISC_UCHAR))

isc_receive = None

isc_receive(POINTER(ISC_STATUS), POINTER(isc_req_handle), c_short, c_short, c_void_p, c_short)

isc_reconnect_transaction = None

isc_reconnect_transaction(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_short, STRING)

isc_release_request = None

isc_release_request(POINTER(ISC_STATUS), POINTER(isc_req_handle))

isc_request_info = None

isc_request_info(POINTER(ISC_STATUS), POINTER(isc_req_handle), c_short, c_short, STRING, c_short, STRING)

isc_rollback_retaining = None

isc_rollback_retaining(POINTER(ISC_STATUS), POINTER(isc_tr_handle))

isc_rollback_transaction = None

isc_rollback_transaction(POINTER(ISC_STATUS), POINTER(isc_tr_handle))

isc_seek_blob = None

isc_seek_blob(POINTER(ISC_STATUS), POINTER(isc_blob_handle), c_short, ISC_LONG, POINTER(ISC_LONG))

isc_send = None

isc_send(POINTER(ISC_STATUS), POINTER(isc_req_handle), c_short, c_short, c_void_p, c_short)

isc_service_attach = None

isc_service_attach(POINTER(ISC_STATUS), c_ushort, STRING, POINTER(isc_svc_handle), c_ushort, STRING)

isc_service_detach = None

isc_service_detach(POINTER(ISC_STATUS), POINTER(isc_svc_handle))

isc_service_query = None

isc_service_query(POINTER(ISC_STATUS), POINTER(isc_svc_handle), POINTER(isc_resv_handle), c_ushort, STRING, c_ushort, STRING, c_ushort, STRING)

isc_service_start = None

isc_service_start(POINTER(ISC_STATUS), POINTER(isc_svc_handle), POINTER(isc_resv_handle), c_ushort, STRING)

isc_set_debug = None

isc_set_debug(c_int)

isc_sql_interprete = None

isc_sql_interprete(c_short, STRING, c_short)

isc_sqlcode = None

isc_sqlcode(POINTER(ISC_STATUS))

isc_start_and_send = None

isc_start_and_send(POINTER(ISC_STATUS), POINTER(isc_req_handle), POINTER(isc_tr_handle), c_short, c_short, c_void_p, c_short)

isc_start_multiple = None

isc_start_multiple(POINTER(ISC_STATUS), POINTER(isc_tr_handle), c_short, c_void_p)

isc_start_request = None

isc_start_request(POINTER(ISC_STATUS), POINTER(isc_req_handle), POINTER(isc_tr_handle), c_short)

isc_start_transaction = None

isc_start_transaction(POINTER(ISC_STATUS), POINTER(isc_tr_handle), c_short, POINTER(isc_db_handle), c_short, STRING)

isc_transact_request = None

isc_transact_request(POINTER(ISC_STATUS), POINTER(isc_db_handle), POINTER(isc_tr_handle), c_ushort, STRING, c_ushort, STRING, c_ushort, STRING)

isc_transaction_info = None

isc_transaction_info(POINTER(ISC_STATUS), POINTER(isc_tr_handle), c_short, STRING, c_short, STRING)

isc_unwind_request = None

isc_unwind_request(POINTER(ISC_STATUS), POINTER(isc_tr_handle), c_short)

isc_vax_integer = None

isc_vax_integer(STRING, c_short)

isc_version = None

isc_version(POINTER(isc_db_handle), ISC_VERSION_CALLBACK, c_void_p)

isc_vtof = None

isc_vtof(STRING, STRING, c_ushort)

isc_vtov = None

isc_vtov(STRING, STRING, c_short)

isc_wait_for_event = None

isc_wait_for_event(POINTER(ISC_STATUS), POINTER(isc_db_handle), c_short, POINTER(ISC_UCHAR), POINTER(ISC_UCHAR))

BLR Constants

Note

BLR data types are defined in fdb.ibase

Main BLR codes

  • blr_inner

  • blr_left

  • blr_right

  • blr_full

  • blr_gds_code

  • blr_sql_code

  • blr_exception

  • blr_trigger_code

  • blr_default_code

  • blr_raise

  • blr_exception_msg

  • blr_exception_params

  • blr_sql_state

  • blr_version4

  • blr_version5

  • blr_eoc

  • blr_end

  • blr_assignment

  • blr_begin

  • blr_dcl_variable

  • blr_message

  • blr_erase

  • blr_fetch

  • blr_for

  • blr_if

  • blr_loop

  • blr_modify

  • blr_handler

  • blr_receive

  • blr_select

  • blr_send

  • blr_store

  • blr_label

  • blr_leave

  • blr_store2

  • blr_post

  • blr_literal

  • blr_dbkey

  • blr_field

  • blr_fid

  • blr_parameter

  • blr_variable

  • blr_average

  • blr_count

  • blr_maximum

  • blr_minimum

  • blr_total

  • blr_add

  • blr_subtract

  • blr_multiply

  • blr_divide

  • blr_negate

  • blr_concatenate

  • blr_substring

  • blr_parameter2

  • blr_from

  • blr_via

  • blr_parameter2_old

  • blr_user_name

  • blr_null

  • blr_equiv

  • blr_eql

  • blr_neq

  • blr_gtr

  • blr_geq

  • blr_lss

  • blr_leq

  • blr_containing

  • blr_matching

  • blr_starting

  • blr_between

  • blr_or

  • blr_and

  • blr_not

  • blr_any

  • blr_missing

  • blr_unique

  • blr_like

  • blr_rse

  • blr_first

  • blr_project

  • blr_sort

  • blr_boolean

  • blr_ascending

  • blr_descending

  • blr_relation

  • blr_rid

  • blr_union

  • blr_map

  • blr_group_by

  • blr_aggregate

  • blr_join_type

  • blr_agg_count

  • blr_agg_max

  • blr_agg_min

  • blr_agg_total

  • blr_agg_average

  • blr_parameter3

  • blr_agg_count2

  • blr_agg_count_distinct

  • blr_agg_total_distinct

  • blr_agg_average_distinct

  • blr_function

  • blr_gen_id

  • blr_prot_mask

  • blr_upcase

  • blr_lock_state

  • blr_value_if

  • blr_matching2

  • blr_index

  • blr_ansi_like

  • blr_scrollable

  • blr_run_count

  • blr_rs_stream

  • blr_exec_proc

  • blr_procedure

  • blr_pid

  • blr_exec_pid

  • blr_singular

  • blr_abort

  • blr_block

  • blr_error_handler

  • blr_cast

  • blr_pid2

  • blr_procedure2

  • blr_start_savepoint

  • blr_end_savepoint

Other BLR codes

  • blr_domain_type_of

  • blr_domain_full

  • blr_date

  • blr_plan

  • blr_merge

  • blr_join

  • blr_sequential

  • blr_navigational

  • blr_indices

  • blr_retrieve

  • blr_relation2

  • blr_rid2

  • blr_set_generator

  • blr_ansi_any

  • blr_exists

  • blr_record_version

  • blr_stall

  • blr_ansi_all

  • blr_extract

  • blr_continue

  • blr_forward

  • blr_backward

  • blr_bof_forward

  • blr_eof_backward

  • blr_extract_year

  • blr_extract_month

  • blr_extract_day

  • blr_extract_hour

  • blr_extract_minute

  • blr_extract_second

  • blr_extract_weekday

  • blr_extract_yearday

  • blr_extract_millisecond

  • blr_extract_week

  • blr_current_date

  • blr_current_timestamp

  • blr_current_time

  • blr_post_arg

  • blr_exec_into

  • blr_user_savepoint

  • blr_dcl_cursor

  • blr_cursor_stmt

  • blr_current_timestamp2

  • blr_current_time2

  • blr_agg_list

  • blr_agg_list_distinct

  • blr_modify2

  • blr_current_role

  • blr_skip

  • blr_exec_sql

  • blr_internal_info

  • blr_nullsfirst

  • blr_writelock

  • blr_nullslast

  • blr_lowcase

  • blr_strlen

  • blr_strlen_bit

  • blr_strlen_char

  • blr_strlen_octet

  • blr_trim

  • blr_trim_both

  • blr_trim_leading

  • blr_trim_trailing

  • blr_trim_spaces

  • blr_trim_characters

  • blr_savepoint_set

  • blr_savepoint_release

  • blr_savepoint_undo

  • blr_savepoint_release_single

  • blr_cursor_open

  • blr_cursor_close

  • blr_cursor_fetch

  • blr_cursor_fetch_scroll

  • blr_croll_forward

  • blr_croll_backward

  • blr_croll_bof

  • blr_croll_eof

  • blr_croll_absolute

  • blr_croll_relative

  • blr_init_variable

  • blr_recurse

  • blr_sys_function

  • blr_auto_trans

  • blr_similar

  • blr_exec_stmt

  • blr_exec_stmt_inputs

  • blr_exec_stmt_outputs

  • blr_exec_stmt_sql

  • blr_exec_stmt_proc_block

  • blr_exec_stmt_data_src

  • blr_exec_stmt_user

  • blr_exec_stmt_pwd

  • blr_exec_stmt_tran

  • blr_exec_stmt_tran_clone

  • blr_exec_stmt_privs

  • blr_exec_stmt_in_params

  • blr_exec_stmt_in_params2

  • blr_exec_stmt_out_params

  • blr_exec_stmt_role

  • blr_stmt_expr

  • blr_derived_expr

  • blr_procedure3

  • blr_exec_proc2

  • blr_function2

  • blr_window

  • blr_partition_by

  • blr_continue_loop

  • blr_procedure4

  • blr_agg_function

  • blr_substring_similar

  • blr_bool_as_value

  • blr_coalesce

  • blr_decode

  • blr_exec_subproc

  • blr_subproc_decl

  • blr_subproc

  • blr_subfunc_decl

  • blr_subfunc

  • blr_record_version2

  • blr_gen_id2