.. module:: firebird.driver.fbapi
    :synopsis: Python ctypes interface to Firebird client library

=====================
firebird.driver.fbapi
=====================

This module contains low-level :ref:`ctypes <python:module-ctypes>` interface to
Firebird client library (`fbclient.so/dll`).

Constants
=========

C integer limit constants
-------------------------

.. hlist::
    :columns: 6

    - SHRT_MIN
    - SHRT_MAX
    - USHRT_MAX
    - INT_MIN
    - INT_MAX
    - UINT_MAX
    - LONG_MIN
    - LONG_MAX
    - SSIZE_T_MIN
    - SSIZE_T_MAX

Type codes
----------

.. hlist::
    :columns: 6

    - 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)
----------------------------------------------------------

.. hlist::
    :columns: 6

    - 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
    - blr_dec64
    - blr_dec128
    - blr_dec_fixed
    - blr_sql_time_tz
    - blr_timestamp_tz

Types
=====

Basic types
-----------

.. autoclass:: Int
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IntPtr
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: Int64
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: Int64Ptr
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: QWord
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: STRING
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_LONG
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_LONG_PTR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_ULONG
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_SHORT
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_USHORT
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_UCHAR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_INT64
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_UINT64
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_DATE
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_TIME
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_DEC16
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_DEC16Ptr
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_DEC34
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_DEC34Ptr
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_I128
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_I128Ptr
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_QUAD
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_QUAD_PTR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_API_HANDLE
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: FB_API_HANDLE_PTR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_STATUS
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_STATUS_PTR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_STATUS_ARRAY
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_STATUS_ARRAY_PTR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_ARRAY_BOUND
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_ARRAY_DESC
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_ARRAY_DESC_PTR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: RESULT_VECTOR
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_TIME_TZ
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_TIME_TZ_EX
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_TIMESTAMP
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_TIMESTAMP_TZ
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ISC_TIMESTAMP_TZ_EX
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: TraceCounts
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: PerformanceInfo
    :no-show-inheritance:
    :no-inherited-members:

Functions
=========

has_api
-------
.. autofunction:: has_api

load_api
--------
.. autofunction:: load_api

get_api
-------
.. autofunction:: get_api


Classes
=======

FirebirdAPI
-----------

.. autoclass:: FirebirdAPI
    :members:

Firebird API Interface definitions
==================================

.. autoclass:: IVersioned_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IVersioned_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IReferenceCounted_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IReferenceCounted_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDisposable_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDisposable_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IStatus_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IStatus_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IMaster_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IMaster_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IPluginBase_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IPluginBase_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IPluginSet_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IPluginSet_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IConfigEntry_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IConfigEntry_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IConfig_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IConfig_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IFirebirdConf_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IFirebirdConf_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IPluginManager_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IPluginManager_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IConfigManager_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IConfigManager_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IEventCallback_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IEventCallback_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IBlob_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IBlob_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ITransaction_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ITransaction_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IMessageMetadata_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IMessageMetadata_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IMetadataBuilder_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IMetadataBuilder_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IResultSet_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IResultSet_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IStatement_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IStatement_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IBatch_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IBatch_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IBatchCompletionState_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IBatchCompletionState_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IRequest_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IRequest_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IEvents_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IEvents_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IAttachment_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IAttachment_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IService_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IService_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IProvider_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IProvider_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDtcStart_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDtcStart_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDtc_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDtc_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ICryptKeyCallback_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ICryptKeyCallback_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ITimer_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ITimer_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ITimerControl_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: ITimerControl_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IVersionCallback_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IVersionCallback_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IUtil_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IUtil_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IOffsetsCallback_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IOffsetsCallback_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IXpbBuilder_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IXpbBuilder_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDecFloat16_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDecFloat16_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDecFloat34_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IDecFloat34_struct
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IInt128_VTable
    :no-show-inheritance:
    :no-inherited-members:

.. autoclass:: IInt128_struct
    :no-show-inheritance:
    :no-inherited-members:
