2 @message |
firebird.driver.types.DatabaseError: feature is not supported
LOG DETAILS:
2025-04-03 13:12:14.797
2025-04-03 13:12:14.797 act = <firebird.qa.plugin.Action object at [hex]>
2025-04-03 13:12:14.797 tmp_blob_file = WindowsPath('H:/QA/temp/qa2024.tmp/fbqa/test_11855/tmp_small_blob.dat')
2025-04-03 13:12:14.797 capsys = <_pytest.capture.CaptureFixture object at [hex]>
2025-04-03 13:12:14.797
2025-04-03 13:12:14.797 @pytest.mark.version('>=5.0.3')
2025-04-03 13:12:14.797 def test_1(act: Action, tmp_blob_file: Path, capsys):
2025-04-03 13:12:14.797 with act.db.connect() as con:
2025-04-03 13:12:14.797 cur1 = con.cursor()
2025-04-03 13:12:14.797 cur1.execute("select rdb$get_context('SYSTEM', 'CLIENT_VERSION') as client_version from rdb$database")
2025-04-03 13:12:14.797 hdr=cur1.description
2025-04-03 13:12:14.797 for r in cur1:
2025-04-03 13:12:14.797 for i in range(0,len(hdr)):
2025-04-03 13:12:14.798 print( hdr[i][0],':', r[i] )
2025-04-03 13:12:14.798 print(f'{con.info.version=}, {con.info.get_info(DbInfoCode.PROTOCOL_VERSION)=}')
2025-04-03 13:12:14.798
2025-04-03 13:12:14.798 failed_count = 0
2025-04-03 13:12:14.798 for b_range_mnemona, b_len_checked_range in CHECKED_LEN_RANGES.items():
2025-04-03 13:12:14.798 print(f'Preparing data, {b_range_mnemona=}, {b_len_checked_range=}')
2025-04-03 13:12:14.798 for b_gen_size in range(b_len_checked_range[0], b_len_checked_range[1]+1):
2025-04-03 13:12:14.798 print(f'\nGenerate file with data to be stored further in blob field, {b_len_checked_range=}, {b_gen_size=}')
2025-04-03 13:12:14.798 with open(tmp_blob_file, 'wb') as f_binary_data:
2025-04-03 13:12:14.798 f_binary_data.write( bytearray( ''.join(random.choices(string.ascii_letters + string.digits, k = b_gen_size)).encode('ascii') ) )
2025-04-03 13:12:14.798
2025-04-03 13:12:14.798 with open(tmp_blob_file, 'rb') as f_binary_data:
2025-04-03 13:12:14.798 cur1.execute("delete from bdata")
2025-04-03 13:12:14.798 cur1.execute("insert into bdata(blob_fld) values (?)", (f_binary_data,))
2025-04-03 13:12:14.798 con.commit()
2025-04-03 13:12:14.798
2025-04-03 13:12:14.798 cur1.stream_blobs.append('BLOB_FLD')
2025-04-03 13:12:14.798 cur1.execute('select blob_fld from bdata')
2025-04-03 13:12:14.798 blob_reader_1 = cur1.fetchone()[0]
2025-04-03 13:12:14.799
2025-04-03 13:12:14.799 pos_beg, pos_end = b_len_checked_range[:2]
2025-04-03 13:12:14.799 b_read_cnt = 0
2025-04-03 13:12:14.799 for i_pos in range(pos_beg, pos_end+1):
2025-04-03 13:12:14.799 print(f'\n{i_pos=}', ' - *NOTE* WORK BEYOND EOF:' if i_pos > b_gen_size else '')
2025-04-03 13:12:14.799 for whence in (os.SEEK_SET, os.SEEK_CUR, os.SEEK_END):
2025-04-03 13:12:14.799 print(f'\n Start loop for whence in (os.SEEK_SET, os.SEEK_CUR, os.SEEK_END): {f_binary_data.tell()=}, {blob_reader_1.tell()=}')
2025-04-03 13:12:14.799 if whence == os.SEEK_CUR:
2025-04-03 13:12:14.799 f_binary_data.seek( -min(b_gen_size, (i_pos + b_read_cnt)), os.SEEK_CUR)
2025-04-03 13:12:14.799 blob_reader_1.seek( -min(b_gen_size, (i_pos + b_read_cnt)), os.SEEK_CUR)
2025-04-03 13:12:14.799 print(f' whence == os.SEEK_CUR --> move back for {-min(b_gen_size, (i_pos + b_read_cnt))=}. Result: {f_binary_data.tell()=}, {blob_reader_1.tell()=}')
2025-04-03 13:12:14.799 elif whence == os.SEEK_END:
2025-04-03 13:12:14.799 b_read_pos = -(pos_end+1 - i_pos)
2025-04-03 13:12:14.799 print(f' whence == os.SEEK_END: {b_read_pos=}')
2025-04-03 13:12:14.799 if -b_read_pos > b_gen_size:
2025-04-03 13:12:14.799 print(f' Can not use negative {b_read_pos=} for {whence=} and {b_gen_size=}')
2025-04-03 13:12:14.799 continue
2025-04-03 13:12:14.799 else:
2025-04-03 13:12:14.799 b_read_pos = i_pos
2025-04-03 13:12:14.800 print(f' whence == os.SEEK_SET: {b_read_pos=}')
2025-04-03 13:12:14.800
2025-04-03 13:12:14.800 print(f' FILE: f_binary_data.seek({b_read_pos}, {whence=})')
2025-04-03 13:12:14.800 f_binary_data.seek(b_read_pos, whence)
2025-04-03 13:12:14.800 b_read_cnt = pos_end+1 - i_pos
2025-04-03 13:12:14.800 print(f' FILE: {f_binary_data.tell()=}, attempt to read {b_read_cnt=} bytes starting from {i_pos=} using {whence=}')
2025-04-03 13:12:14.800 b_data_in_file = f_binary_data.read(b_read_cnt)
2025-04-03 13:12:14.800 print(f' FILE: completed read {b_read_cnt=} bytes starting from {i_pos=} using {whence=}. Result: {f_binary_data.tell()=}, {len(b_data_in_file)=}')
2025-04-03 13:12:14.800
2025-04-03 13:12:14.800 # Now do the same against DB (stream blob):
2025-04-03 13:12:14.800 print(f' BLOB: blob_reader_1.seek({b_read_pos}, {whence=})')
2025-04-03 13:12:14.800 > blob_reader_1.seek(b_read_pos, whence)
2025-04-03 13:12:14.800
2025-04-03 13:12:14.800 tests\functional\blob\test_small_blob_caching.py:162:
2025-04-03 13:12:14.800 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-04-03 13:12:14.800
2025-04-03 13:12:14.800 self = BlobReader[size=0], offset = 0, whence = 0
2025-04-03 13:12:14.800
2025-04-03 13:12:14.800 def seek(self, offset: int, whence: int=os.SEEK_SET) -> None:
2025-04-03 13:12:14.801 """Set the files current position, like stdios `fseek()`.
2025-04-03 13:12:14.801
2025-04-03 13:12:14.801 See:
2025-04-03 13:12:14.801 :meth:`io.IOBase.seek()` for details.
2025-04-03 13:12:14.801
2025-04-03 13:12:14.801 Arguments:
2025-04-03 13:12:14.801 offset: Offset from specified position.
2025-04-03 13:12:14.801 whence: Context for offset. Accepted values: os.SEEK_SET, os.SEEK_CUR or os.SEEK_END
2025-04-03 13:12:14.801
2025-04-03 13:12:14.801 Warning:
2025-04-03 13:12:14.801 If BLOB was NOT CREATED as `stream` BLOB, this method raises `DatabaseError`
2025-04-03 13:12:14.801 exception. This constraint is set by Firebird.
2025-04-03 13:12:14.801 """
2025-04-03 13:12:14.801 assert self._blob is not None
2025-04-03 13:12:14.801 > self.__pos = self._blob.seek(whence, offset)
2025-04-03 13:12:14.801
2025-04-03 13:12:14.801 C:\Python3x\Lib\site-packages\firebird\driver\core.py:3066:
2025-04-03 13:12:14.801 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-04-03 13:12:14.801
2025-04-03 13:12:14.801 self = <firebird.driver.interfaces.iBlob object at [hex]>, mode = 0
2025-04-03 13:12:14.802 offset = 0
2025-04-03 13:12:14.802
2025-04-03 13:12:14.802 def seek(self, mode: int, offset: int) -> int:
2025-04-03 13:12:14.802 "Replaces isc_seek_blob()"
2025-04-03 13:12:14.802 result = self.vtable.seek(self, self.status, mode, offset)
2025-04-03 13:12:14.802 > self._check()
2025-04-03 13:12:14.802
2025-04-03 13:12:14.802 C:\Python3x\Lib\site-packages\firebird\driver\interfaces.py:383:
2025-04-03 13:12:14.802 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2025-04-03 13:12:14.802
2025-04-03 13:12:14.802 self = <firebird.driver.interfaces.iBlob object at [hex]>
2025-04-03 13:12:14.802
2025-04-03 13:12:14.802 def _check(self) -> None:
2025-04-03 13:12:14.802 state = self.status.get_state()
2025-04-03 13:12:14.802 if StateFlag.ERRORS in state:
2025-04-03 13:12:14.802 > raise self.__report(DatabaseError, self.status.get_errors())
2025-04-03 13:12:14.802 E firebird.driver.types.DatabaseError: feature is not supported
2025-04-03 13:12:14.802
2025-04-03 13:12:14.802 C:\Python3x\Lib\site-packages\firebird\driver\interfaces.py:113: DatabaseError
2025-04-03 13:12:14.802 ---------------------------- Captured stdout setup ----------------------------
2025-04-03 13:12:14.803 Creating db: localhost:H:\QA\temp\qa2024.tmp\fbqa\test_11855\test.fdb [page_size=None, sql_dialect=None, charset='NONE', user=SYSDBA, password=masterkey]
2025-04-03 13:12:14.803 ---------------------------- Captured stdout call -----------------------------
2025-04-03 13:12:14.803 CLIENT_VERSION : WI-V5.0.3.1635 Firebird 5.0 HQbird
2025-04-03 13:12:14.803 con.info.version='5.0.3.1635', con.info.get_info(DbInfoCode.PROTOCOL_VERSION)=19
2025-04-03 13:12:14.803 Preparing data, b_range_mnemona='about_00k', b_len_checked_range=(0, 5)
2025-04-03 13:12:14.803
2025-04-03 13:12:14.803 Generate file with data to be stored further in blob field, b_len_checked_range=(0, 5), b_gen_size=0
2025-04-03 13:12:14.803
2025-04-03 13:12:14.803 i_pos=0
2025-04-03 13:12:14.803
2025-04-03 13:12:14.803 Start loop for whence in (os.SEEK_SET, os.SEEK_CUR, os.SEEK_END): f_binary_data.tell()=0, blob_reader_1.tell()=0
2025-04-03 13:12:14.803 whence == os.SEEK_SET: b_read_pos=0
2025-04-03 13:12:14.803 FILE: f_binary_data.seek(0, whence=0)
2025-04-03 13:12:14.803 FILE: f_binary_data.tell()=0, attempt to read b_read_cnt=6 bytes starting from i_pos=0 using whence=0
2025-04-03 13:12:14.803 FILE: completed read b_read_cnt=6 bytes starting from i_pos=0 using whence=0. Result: f_binary_data.tell()=0, len(b_data_in_file)=0
2025-04-03 13:12:14.803 BLOB: blob_reader_1.seek(0, whence=0)
|
3 #text |
act = <firebird.qa.plugin.Action pytest object at [hex]>
tmp_blob_file = WindowsPath('H:/QA/temp/qa2024.tmp/fbqa/test_11855/tmp_small_blob.dat')
capsys = <_pytest.capture.CaptureFixture pytest object at [hex]>
@pytest.mark.version('>=5.0.3')
def test_1(act: Action, tmp_blob_file: Path, capsys):
with act.db.connect() as con:
cur1 = con.cursor()
cur1.execute("select rdb$get_context('SYSTEM', 'CLIENT_VERSION') as client_version from rdb$database")
hdr=cur1.description
for r in cur1:
for i in range(0,len(hdr)):
print( hdr[i][0],':', r[i] )
print(f'{con.info.version=}, {con.info.get_info(DbInfoCode.PROTOCOL_VERSION)=}')
failed_count = 0
for b_range_mnemona, b_len_checked_range in CHECKED_LEN_RANGES.items():
print(f'Preparing data, {b_range_mnemona=}, {b_len_checked_range=}')
for b_gen_size in range(b_len_checked_range[0], b_len_checked_range[1]+1):
print(f'\nGenerate file with data to be stored further in blob field, {b_len_checked_range=}, {b_gen_size=}')
with open(tmp_blob_file, 'wb') as f_binary_data:
f_binary_data.write( bytearray( ''.join(random.choices(string.ascii_letters + string.digits, k = b_gen_size)).encode('ascii') ) )
with open(tmp_blob_file, 'rb') as f_binary_data:
cur1.execute("delete from bdata")
cur1.execute("insert into bdata(blob_fld) values (?)", (f_binary_data,))
con.commit()
cur1.stream_blobs.append('BLOB_FLD')
cur1.execute('select blob_fld from bdata')
blob_reader_1 = cur1.fetchone()[0]
pos_beg, pos_end = b_len_checked_range[:2]
b_read_cnt = 0
for i_pos in range(pos_beg, pos_end+1):
print(f'\n{i_pos=}', ' - *NOTE* WORK BEYOND EOF:' if i_pos > b_gen_size else '')
for whence in (os.SEEK_SET, os.SEEK_CUR, os.SEEK_END):
print(f'\n Start loop for whence in (os.SEEK_SET, os.SEEK_CUR, os.SEEK_END): {f_binary_data.tell()=}, {blob_reader_1.tell()=}')
if whence == os.SEEK_CUR:
f_binary_data.seek( -min(b_gen_size, (i_pos + b_read_cnt)), os.SEEK_CUR)
blob_reader_1.seek( -min(b_gen_size, (i_pos + b_read_cnt)), os.SEEK_CUR)
print(f' whence == os.SEEK_CUR --> move back for {-min(b_gen_size, (i_pos + b_read_cnt))=}. Result: {f_binary_data.tell()=}, {blob_reader_1.tell()=}')
elif whence == os.SEEK_END:
b_read_pos = -(pos_end+1 - i_pos)
print(f' whence == os.SEEK_END: {b_read_pos=}')
if -b_read_pos > b_gen_size:
print(f' Can not use negative {b_read_pos=} for {whence=} and {b_gen_size=}')
continue
else:
b_read_pos = i_pos
print(f' whence == os.SEEK_SET: {b_read_pos=}')
print(f' FILE: f_binary_data.seek({b_read_pos}, {whence=})')
f_binary_data.seek(b_read_pos, whence)
b_read_cnt = pos_end+1 - i_pos
print(f' FILE: {f_binary_data.tell()=}, attempt to read {b_read_cnt=} bytes starting from {i_pos=} using {whence=}')
b_data_in_file = f_binary_data.read(b_read_cnt)
print(f' FILE: completed read {b_read_cnt=} bytes starting from {i_pos=} using {whence=}. Result: {f_binary_data.tell()=}, {len(b_data_in_file)=}')
# Now do the same against DB (stream blob):
print(f' BLOB: blob_reader_1.seek({b_read_pos}, {whence=})')
> blob_reader_1.seek(b_read_pos, whence)
tests\functional\blob\test_small_blob_caching.py:162:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = BlobReader[size=0], offset = 0, whence = 0
def seek(self, offset: int, whence: int=os.SEEK_SET) -> None:
"""Set the file’s current position, like stdio‘s `fseek()`.
See:
:meth:`io.IOBase.seek()` for details.
Arguments:
offset: Offset from specified position.
whence: Context for offset. Accepted values: os.SEEK_SET, os.SEEK_CUR or os.SEEK_END
Warning:
If BLOB was NOT CREATED as `stream` BLOB, this method raises `DatabaseError`
exception. This constraint is set by Firebird.
"""
assert self._blob is not None
> self.__pos = self._blob.seek(whence, offset)
C:\Python3x\Lib\site-packages\firebird\driver\core.py:3066:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iBlob pytest object at [hex]>, mode = 0
offset = 0
def seek(self, mode: int, offset: int) -> int:
"Replaces isc_seek_blob()"
result = self.vtable.seek(self, self.status, mode, offset)
> self._check()
C:\Python3x\Lib\site-packages\firebird\driver\interfaces.py:383:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <firebird.driver.interfaces.iBlob pytest object at [hex]>
def _check(self) -> None:
state = self.status.get_state()
if StateFlag.ERRORS in state:
> raise self.__report(DatabaseError, self.status.get_errors())
E firebird.driver.types.DatabaseError: feature is not supported
C:\Python3x\Lib\site-packages\firebird\driver\interfaces.py:113: DatabaseError
|