Skip to content

Commit 91f1805

Browse files
committed
Add classic API functions for work with NLR requests
1 parent 50000c7 commit 91f1805

File tree

1 file changed

+76
-14
lines changed

1 file changed

+76
-14
lines changed

src/firebird/driver/fbapi.py

Lines changed: 76 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,57 +1992,58 @@ def __init__(self, filename: Path = None):
19921992
if not file_name:
19931993
raise Exception(f"Firebird Client Library '{filename}' not found")
19941994
filename = file_name
1995+
#: Firebird client library
19951996
self.client_library: ctypes.CDLL = None
19961997
if sys.platform in ('win32', 'cygwin', 'os2', 'os2emx'):
19971998
self.client_library: ctypes.CDLL = ctypes.WinDLL(str(filename))
19981999
else:
19992000
self.client_library: ctypes.CDLL = ctypes.CDLL(str(filename))
2000-
#
2001+
#: Firebird client library name
20012002
self.client_library_name: Path = Path(filename)
2002-
#
2003+
#: Firebird API
20032004
self.fb_get_master_interface = (self.client_library.fb_get_master_interface)
20042005
self.fb_get_master_interface.restype = IMaster
20052006
self.fb_get_master_interface.argtypes = []
2006-
#
2007+
#: Firebird API
20072008
self.fb_get_database_handle = self.client_library.fb_get_database_handle
20082009
self.fb_get_database_handle.restype = ISC_STATUS
20092010
self.fb_get_database_handle.argtypes = [ISC_STATUS_PTR, FB_API_HANDLE_PTR, IAttachment]
2010-
#
2011+
#: Firebird API
20112012
self.fb_get_transaction_handle = (self.client_library.fb_get_transaction_handle)
20122013
self.fb_get_transaction_handle.restype = ISC_STATUS
20132014
self.fb_get_transaction_handle.argtypes = [ISC_STATUS_PTR, FB_API_HANDLE_PTR, ITransaction]
2014-
#
2015+
#: Firebird API
20152016
self.fb_sqlstate = self.client_library.fb_sqlstate
20162017
self.fb_sqlstate.restype = None
20172018
self.fb_sqlstate.argtypes = [STRING, ISC_STATUS_PTR]
2018-
#
2019+
#: Firebird API
20192020
self.fb_shutdown_callback = self.client_library.fb_shutdown_callback
20202021
self.fb_shutdown_callback.restype = ISC_STATUS
20212022
self.fb_shutdown_callback.argtypes = [ISC_STATUS_PTR,
20222023
FB_SHUTDOWN_CALLBACK,
20232024
c_int,
20242025
c_void_p]
2025-
#
2026+
#: Firebird API
20262027
self.isc_sqlcode = self.client_library.isc_sqlcode
20272028
self.isc_sqlcode.restype = ISC_LONG
20282029
self.isc_sqlcode.argtypes = [ISC_STATUS_PTR]
2029-
#
2030+
#: Firebird API
20302031
self.fb_interpret = self.client_library.fb_interpret
20312032
self.fb_interpret.restype = ISC_LONG
20322033
self.fb_interpret.argtypes = [STRING, c_uint, POINTER(ISC_STATUS_PTR)]
2033-
#
2034+
#: Firebird API
20342035
self.isc_array_lookup_bounds = (self.client_library.isc_array_lookup_bounds)
20352036
self.isc_array_lookup_bounds.restype = ISC_STATUS
20362037
self.isc_array_lookup_bounds.argtypes = [ISC_STATUS_PTR, FB_API_HANDLE_PTR,
20372038
FB_API_HANDLE_PTR, STRING, STRING,
20382039
ISC_ARRAY_DESC_PTR]
2039-
#
2040+
#: Firebird API
20402041
self.isc_array_put_slice = self.client_library.isc_array_put_slice
20412042
self.isc_array_put_slice.restype = ISC_STATUS
20422043
self.isc_array_put_slice.argtypes = [ISC_STATUS_PTR, FB_API_HANDLE_PTR,
20432044
FB_API_HANDLE_PTR, ISC_QUAD_PTR,
20442045
ISC_ARRAY_DESC_PTR, c_void_p, ISC_LONG_PTR]
2045-
#
2046+
#: Firebird API
20462047
self.isc_array_get_slice = self.client_library.isc_array_get_slice
20472048
self.isc_array_get_slice.restype = ISC_STATUS
20482049
self.isc_array_get_slice.argtypes = [ISC_STATUS_PTR, FB_API_HANDLE_PTR,
@@ -2054,22 +2055,83 @@ def __init__(self, filename: Path = None):
20542055
# C_isc_event_block(ISC_LONG, POINTER(POINTER(ISC_UCHAR)), POINTER(POINTER(ISC_UCHAR)), ISC_USHORT)
20552056
self.C_isc_event_block = self.P_isc_event_block(('isc_event_block', self.client_library))
20562057
self.P_isc_event_block_args = self.C_isc_event_block.argtypes
2057-
#
2058+
#: Firebird API
20582059
self.isc_que_events = self.client_library.isc_que_events
20592060
self.isc_que_events.restype = ISC_STATUS
20602061
self.isc_que_events.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
20612062
POINTER(ISC_LONG), c_short, POINTER(ISC_UCHAR),
20622063
ISC_EVENT_CALLBACK, POINTER(ISC_UCHAR)]
2063-
#
2064+
#: Firebird API
20642065
self.isc_event_counts = self.client_library.isc_event_counts
20652066
self.isc_event_counts.restype = None
20662067
self.isc_event_counts.argtypes = [POINTER(RESULT_VECTOR), c_short,
20672068
POINTER(ISC_UCHAR), POINTER(ISC_UCHAR)]
2068-
#
2069+
#: Firebird API
20692070
self.isc_cancel_events = self.client_library.isc_cancel_events
20702071
self.isc_cancel_events.restype = ISC_STATUS
20712072
self.isc_cancel_events.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
20722073
POINTER(ISC_LONG)]
2074+
#: Firebird API
2075+
self.isc_compile_request = self.client_library.isc_compile_request
2076+
self.isc_compile_request.restype = ISC_STATUS
2077+
self.isc_compile_request.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2078+
POINTER(FB_API_HANDLE), c_short, STRING]
2079+
#: Firebird API
2080+
self.isc_start_request = self.client_library.isc_start_request
2081+
self.isc_start_request.restype = ISC_STATUS
2082+
self.isc_start_request.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2083+
POINTER(FB_API_HANDLE), c_short]
2084+
#: Firebird API
2085+
self.isc_release_request = self.client_library.isc_release_request
2086+
self.isc_release_request.restype = ISC_STATUS
2087+
self.isc_release_request.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE)]
2088+
#: Firebird API
2089+
self.isc_receive = self.client_library.isc_receive
2090+
self.isc_receive.restype = ISC_STATUS
2091+
self.isc_receive.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2092+
c_short, c_short, c_void_p, c_short]
2093+
#: Firebird API
2094+
self.isc_start_and_send = self.client_library.isc_start_and_send
2095+
self.isc_start_and_send.restype = ISC_STATUS
2096+
self.isc_start_and_send.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2097+
POINTER(FB_API_HANDLE), c_short, c_short,
2098+
c_void_p, c_short]
2099+
#: Firebird API
2100+
self.isc_send = self.client_library.isc_send
2101+
self.isc_send.restype = ISC_STATUS
2102+
self.isc_send.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2103+
c_short, c_short, c_void_p, c_short]
2104+
#: Firebird API
2105+
self.isc_open_blob2 = self.client_library.isc_open_blob2
2106+
self.isc_open_blob2.restype = ISC_STATUS
2107+
self.isc_open_blob2.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2108+
POINTER(FB_API_HANDLE), POINTER(FB_API_HANDLE),
2109+
POINTER(ISC_QUAD), ISC_USHORT, STRING] # POINTER(ISC_UCHAR)
2110+
#: Firebird API
2111+
self.isc_blob_info = self.client_library.isc_blob_info
2112+
self.isc_blob_info.restype = ISC_STATUS
2113+
self.isc_blob_info.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2114+
c_short, STRING, c_short, POINTER(c_char)]
2115+
#: Firebird API
2116+
self.isc_create_blob2 = self.client_library.isc_create_blob2
2117+
self.isc_create_blob2.restype = ISC_STATUS
2118+
self.isc_create_blob2.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2119+
POINTER(FB_API_HANDLE), POINTER(FB_API_HANDLE),
2120+
POINTER(ISC_QUAD), c_short, STRING]
2121+
#: Firebird API
2122+
self.isc_get_segment = self.client_library.isc_get_segment
2123+
self.isc_get_segment.restype = ISC_STATUS
2124+
self.isc_get_segment.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2125+
POINTER(c_ushort), c_ushort, c_void_p]
2126+
#: Firebird API
2127+
self.isc_put_segment = self.client_library.isc_put_segment
2128+
self.isc_put_segment.restype = ISC_STATUS
2129+
self.isc_put_segment.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE),
2130+
c_ushort, c_void_p]
2131+
#: Firebird API
2132+
self.isc_close_blob = self.client_library.isc_close_blob
2133+
self.isc_close_blob.restype = ISC_STATUS
2134+
self.isc_close_blob.argtypes = [POINTER(ISC_STATUS), POINTER(FB_API_HANDLE)]
20732135
# Next netributes are set in types by API_LOADED hook
20742136
self.master = None
20752137
self.util = None

0 commit comments

Comments
 (0)