main
¶
Firebirdsql wrapper inspired by subprocess.run.
Functions:
Name | Description |
---|---|
connection |
Create a connection to a Firebird database using the firebirdsql library. |
execute |
Execute a transaction in a Firebird database. |
make_query |
Create a query for a stored procedure in a Firebird database. |
callproc |
Execute a stored procedure in a Firebird database. |
connection
¶
connection(
db: Path | str,
host: str = "127.0.0.1",
port: int = 3050,
user: str = "TWUSER",
passwd: str = "",
access: DBAccess = READ_WRITE,
) -> Connection
Create a connection to a Firebird database using the firebirdsql library.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
db
|
Path | str
|
The path or name of the database. |
required |
host
|
str
|
The host address of the server. |
'127.0.0.1'
|
port
|
int
|
The port number of the server. |
3050
|
user
|
str
|
The username for authentication. |
'TWUSER'
|
passwd
|
str
|
The password. If omitted, it is taken from |
''
|
access
|
DBAccess
|
The access mode for the connection. |
READ_WRITE
|
Returns:
Name | Type | Description |
---|---|---|
conn |
Connection
|
The connection object. |
Source code in src/firebirdsql_run/main.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
execute
¶
execute(
query: str,
params: tuple = (),
db: Path | str = "",
host: str = "127.0.0.1",
port: int = 3050,
user: str = "TWUSER",
passwd: str = "",
access: DBAccess = READ_WRITE,
use_conn: Connection | None = None,
) -> CompletedTransaction
Execute a transaction in a Firebird database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query
|
str
|
The SQL query to execute. |
required |
params
|
tuple
|
The parameters to be used in the query. |
()
|
db
|
Path | str
|
The path or name of the database. |
''
|
host
|
str
|
The host address of the server. |
'127.0.0.1'
|
port
|
int
|
The port number of the server. |
3050
|
user
|
str
|
The username for authentication. |
'TWUSER'
|
passwd
|
str
|
The password. If omitted, it is taken from |
''
|
access
|
DBAccess
|
The access mode for the connection. |
READ_WRITE
|
use_conn
|
Connection | None
|
An existing connection to use. Takes precedence over the default connection settings. |
None
|
Returns:
Name | Type | Description |
---|---|---|
result |
CompletedTransaction
|
An named tuple containing the transaction details, including the query result. |
Source code in src/firebirdsql_run/main.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
|
make_query
¶
Create a query for a stored procedure in a Firebird database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
procname
|
str
|
The name of the stored procedure to execute. |
required |
params
|
tuple
|
The parameters to pass to the stored procedure. |
required |
Returns:
Name | Type | Description |
---|---|---|
query |
str
|
The query for the stored procedure. |
Source code in src/firebirdsql_run/main.py
120 121 122 123 124 125 126 127 128 129 130 |
|
callproc
¶
callproc(
procname: str,
params: tuple = (),
db: Path | str = "",
host: str = "127.0.0.1",
port: int = 3050,
user: str = "TWUSER",
passwd: str = "",
access: DBAccess = READ_WRITE,
use_conn: Connection | None = None,
) -> CompletedTransaction
Execute a stored procedure in a Firebird database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
procname
|
str
|
The name of the stored procedure to execute. |
required |
params
|
tuple
|
The parameters to pass to the stored procedure. |
()
|
db
|
Path | str
|
The path or name of the database. |
''
|
host
|
str
|
The host address of the server. |
'127.0.0.1'
|
port
|
int
|
The port number of the server. |
3050
|
user
|
str
|
The username for authentication. |
'TWUSER'
|
passwd
|
str
|
The password. If omitted, it is taken from |
''
|
access
|
DBAccess
|
The access mode for the connection. |
READ_WRITE
|
use_conn
|
Connection | None
|
An existing connection to use. Takes precedence over the default connection settings. |
None
|
Returns:
Name | Type | Description |
---|---|---|
result |
CompletedTransaction
|
An named tuple containing the transaction details, including the query result. |
Source code in src/firebirdsql_run/main.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|