When executing the attached python-demo I get the following error:
Traceback (most recent call last):
File "D:\Entwicklung\k4\firebird\entw\standard\tmp\saveBlobToFile.py", line 15, in <module>
pic.write( readerA.read() )
File "C:\Apps\Python\lib\site-packages\fdb\fbcore.py", line 4751, in read
File "C:\Apps\Python\lib\site-packages\fdb\fbcore.py", line 4694, in __BLOB_get
fdb.fbcore.DatabaseError: ('BlobReader.__BLOB_get/isc_get_segment:\n- SQLCODE: 101\n- segment buffer length shorter than expected', 101, 335544366)
The error only happens for blobs > 64kB.
-- Analysis (fdb, version 1.7)
The error is reported from line 4694 in fbcore.py.
As it seems it will always happen when there is more than one segment to read.
Segments seem to have predefined a size of 64k, hence the program works for blobs < 64k.
The behaviour is caused by the setting line 4676:
allow_incomplete_segment_read = False
Setting this variable to "False" forces the code to always raise an exception
as soon as more than one segment has to be read.
Since this variable is never changed in the programm, the result is guaranteed.
There is a simple workaround: change line 4676 to
allow_incomplete_segment_read = True
For my application this is enough and everything works fine.
This can be seen by executing the attached python-file again after
changing line 4676 accordingly. The jpeg image is now successfully exported.
I have not further examined what was intended by the code, so I have no idea
if this is already a solution.
PS: Thanks for making the fdb module! Regardless of the reported bug fdb is great work
and its existence very much appreciated!