Skip to content

Commit 29603a5

Browse files
committed
Release 1.5.0
1 parent d451b75 commit 29603a5

File tree

6 files changed

+47
-16
lines changed

6 files changed

+47
-16
lines changed

docs/changelog.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@
22
Changelog
33
#########
44

5+
Version 1.5.0
6+
=============
7+
8+
* Fix: `.create_database()` now use server configuration user/password if either is not
9+
specified in database configuration (like `.connect()`)
10+
* Fix: Problem in `.Server` processing incomplete LINE responses.
11+
* New: `verbint` parameter for `.ServerDbServices3.backup()` and `.ServerDbServices3.restore()`
12+
13+
This is undocumented Firebird v3 gbak feature. See https://github.com/FirebirdSQL/firebird/issues/808
14+
for details. It's mutually exclusive with `verbose`, and minimal value is 100.
15+
16+
Potentially breaking changes
17+
----------------------------
18+
19+
* Change in `.ServerDbServices3.restore()`: The `verbose` parameter default value was changed
20+
to `False` to be consistent with `.ServerDbServices3.backup()`
21+
* Change in `.ShutdownMethod`: DENNY_ATTACHMENTS/DENNY_TRANSACTIONS renamed to
22+
DENY_ATTACHMENTS/DENY_TRANSACTIONS.
23+
524
Version 1.4.3
625
=============
726

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
author = 'Pavel Císař'
2424

2525
# The short X.Y version
26-
version = '1.4.3'
26+
version = '1.5.0'
2727

2828
# The full version, including alpha/beta/rc tags
29-
release = '1.4.3'
29+
release = '1.5.0'
3030

3131

3232
# -- General configuration ---------------------------------------------------

firebird/driver/core.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2180,8 +2180,12 @@ def create_database(database: str, *, user: str=None, password: str=None, role:
21802180
raise ValueError(f"Configuration for server '{db_config.server.value}' not found")
21812181
if user is None:
21822182
user = db_config.user.value
2183+
if user is None:
2184+
user = srv_config.user.value
21832185
if password is None:
21842186
password = db_config.password.value
2187+
if password is None:
2188+
password = srv_config.password.value
21852189
if role is None:
21862190
role = db_config.role.value
21872191
if charset is None:
@@ -4239,8 +4243,9 @@ def backup(self, *, database: FILESPEC, backup: Union[FILESPEC, Sequence[FILESPE
42394243
backup_file_sizes: Sequence[int]=(),
42404244
flags: SrvBackupFlag=SrvBackupFlag.NONE, role: str=None,
42414245
callback: CB_OUTPUT_LINE=None, stats: str=None,
4242-
verbose: bool=False, skip_data: str=None, include_data: str=None,
4243-
keyhoder: str=None, keyname: str=None, crypt: str=None) -> None:
4246+
verbose: bool=False, verbint: int=None, skip_data: str=None,
4247+
include_data: str=None, keyhoder: str=None, keyname: str=None,
4248+
crypt: str=None) -> None:
42444249
"""Request logical (GBAK) database backup. **(ASYNC service)**
42454250
42464251
Arguments:
@@ -4252,6 +4257,7 @@ def backup(self, *, database: FILESPEC, backup: Union[FILESPEC, Sequence[FILESPE
42524257
callback: Function to call back with each output line.
42534258
stats: Backup statistic options (TDWR).
42544259
verbose: Whether output should be verbose or not.
4260+
verbint: Verbose information with explicit interval (number of records)
42554261
skip_data: String with table names whose data should be excluded from backup.
42564262
include_data: String with table names whose data should be included into backup [Firebird 4].
42574263
keyholder: Keyholder name [Firebird 4]
@@ -4287,6 +4293,8 @@ def backup(self, *, database: FILESPEC, backup: Union[FILESPEC, Sequence[FILESPE
42874293
spb.insert_int(SPBItem.OPTIONS, flags)
42884294
if verbose:
42894295
spb.insert_tag(SPBItem.VERBOSE)
4296+
if verbint is not None:
4297+
spb.insert_int(SPBItem.VERBINT, verbint)
42904298
if stats:
42914299
spb.insert_string(SrvBackupOption.STAT, stats)
42924300
self._srv()._svc.start(spb.get_buffer())
@@ -4298,10 +4306,11 @@ def restore(self, *, backup: Union[FILESPEC, Sequence[FILESPEC]],
42984306
db_file_pages: Sequence[int]=(),
42994307
flags: SrvRestoreFlag=SrvRestoreFlag.CREATE, role: str=None,
43004308
callback: CB_OUTPUT_LINE=None, stats: str=None,
4301-
verbose: bool=True, skip_data: str=None, page_size: int=None,
4302-
buffers: int=None, access_mode: DbAccessMode=DbAccessMode.READ_WRITE,
4303-
include_data: str=None, keyhoder: str=None, keyname: str=None,
4304-
crypt: str=None, replica_mode: ReplicaMode=None) -> None:
4309+
verbose: bool=False, verbint: int=None, skip_data: str=None,
4310+
page_size: int=None, buffers: int=None,
4311+
access_mode: DbAccessMode=DbAccessMode.READ_WRITE, include_data: str=None,
4312+
keyhoder: str=None, keyname: str=None, crypt: str=None,
4313+
replica_mode: ReplicaMode=None) -> None:
43054314
"""Request database restore from logical (GBAK) backup. **(ASYNC service)**
43064315
43074316
Arguments:
@@ -4313,6 +4322,7 @@ def restore(self, *, backup: Union[FILESPEC, Sequence[FILESPEC]],
43134322
callback: Function to call back with each output line.
43144323
stats: Restore statistic options (TDWR).
43154324
verbose: Whether output should be verbose or not.
4325+
verbint: Verbose information with explicit interval (number of records)
43164326
skip_data: String with table names whose data should be excluded from restore.
43174327
page_size: Page size for restored database.
43184328
buffers: Cache size for restored database.
@@ -4362,6 +4372,8 @@ def restore(self, *, backup: Union[FILESPEC, Sequence[FILESPEC]],
43624372
spb.insert_int(SPBItem.OPTIONS, flags)
43634373
if verbose:
43644374
spb.insert_tag(SPBItem.VERBOSE)
4375+
if verbint is not None:
4376+
spb.insert_int(SPBItem.VERBINT, verbint)
43654377
if stats:
43664378
spb.insert_string(SrvRestoreOption.STAT, stats)
43674379
self._srv()._svc.start(spb.get_buffer())
@@ -5325,9 +5337,9 @@ def _read_output(self, *, init: str='', timeout: int=-1) -> None:
53255337
self._eof = self.response.get_tag() == isc_info_end
53265338
else: # LINE mode
53275339
self._eof = not data
5328-
while self.response.get_tag() == isc_info_truncated:
5340+
while (tag := self.response.get_tag()) == isc_info_truncated:
53295341
data += self._query_output(timeout)
5330-
if self.response.get_tag() != isc_info_end: # pragma: no cover
5342+
if tag != isc_info_end: # pragma: no cover
53315343
raise InterfaceError("Malformed result buffer (missing isc_info_end item)")
53325344
init += data
53335345
if data and self.mode is SrvInfoCode.LINE:

firebird/driver/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,8 @@ class ShutdownMethod(IntEnum):
827827
"""Database shutdown method options.
828828
"""
829829
FORCED = 41
830-
DENNY_ATTACHMENTS = 42
831-
DENNY_TRANSACTIONS = 43
830+
DENY_ATTACHMENTS = 42
831+
DENY_TRANSACTIONS = 43
832832

833833
class TransactionState(IntEnum):
834834
"""Transaction state.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ all-files=True
55

66
[metadata]
77
name = firebird-driver
8-
version = 1.4.3
8+
version = 1.5.0
99
description = Firebird driver
1010
long_description = file: README.rst
1111
long_description_content_type = text/x-rst; charset=UTF-8

test/test_driver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1845,14 +1845,14 @@ def fetchline(line):
18451845
self.assertIsInstance(line, str)
18461846
# callback
18471847
output = []
1848-
self.svc.database.restore(backup=self.fbk, database=self.rfdb,
1848+
self.svc.database.restore(backup=self.fbk, database=self.rfdb, verbose=True,
18491849
flags=SrvRestoreFlag.REPLACE, callback=fetchline)
18501850
self.assertGreater(len(output), 0)
18511851
# Firebird 3.0 stats
18521852
output = []
18531853
self.svc.database.restore(backup=self.fbk, database=self.rfdb,
18541854
flags=SrvRestoreFlag.REPLACE, callback=fetchline,
1855-
stats='TDRW')
1855+
stats='TDRW', verbose=True)
18561856
self.assertGreater(len(output), 0)
18571857
self.assertIn('gbak: time delta reads writes \n', output)
18581858
# Skip data option
@@ -1939,7 +1939,7 @@ def test_shutdown_bring_online(self):
19391939
self.assertIn('multi-user maintenance', ''.join(self.svc.readlines()))
19401940
# Go to full shutdown mode, disabling new attachments during 5 seconds
19411941
self.svc.database.shutdown(database=self.rfdb, mode=ShutdownMode.FULL,
1942-
method=ShutdownMethod.DENNY_ATTACHMENTS, timeout=5)
1942+
method=ShutdownMethod.DENY_ATTACHMENTS, timeout=5)
19431943
self.svc.database.get_statistics(database=self.rfdb, flags=SrvStatFlag.HDR_PAGES)
19441944
self.assertIn('full shutdown', ''.join(self.svc.readlines()))
19451945
# Enable single-user maintenance

0 commit comments

Comments
 (0)