Hi apolinar,
I found a way, to extract the blob text from a firebird database, it's do the job but ... is not pretty nice.
I'm involved in one project to extract data from a Firebird database and to generate some .txt lists based on the extracted data.
I use Flamerobin to manage the database
What we have and what we don't know:
1. We have a Firebird database
2. We don't know in witch version of Firebird is created
3. We don't know what charset is used during the creation of the database
4. We know that the input language is cyrillic
5. We have some problematic blob fields that are displayed ok in grids, in some tables, and as garbage in others (observation: all blob fields are text blobs of subtype=1).
What we found
1. We found that the charset that is used during the creation of the database is UTF8
2. We found that when use the UTF8 charset as default for the database, blob fields, in some tables, are displayed ok in grid, but if use the WIN1251 charset the things become the opposite. The ok displayed blob fields become as garbage and the early problematic fields become now readable. Seems that is there a collision between the defined chares and the input charset. So if we want to export them we have to change the default charset in the database registration info depending of the problematic tables.
Exporting tables
1. Exporting as .csv files
We presume that we have choose the right charset for reading all the fields in the table, blob also.
All the fields are nicely exported except the blob fields.
A blob field can contains more lines of text, so what's happened after exporting.
We get a .csv file witch can be edited in notepad line by line.We have to notice that the record lines are with tabs or with some other char and nicely delimited, but somewhere we can find some line with some text that doesn't seems to be records, just a line of pure text with no delimiters. They are the second, the third, ... blob line from the above last record we seen, all because blob fields can contain more different lines of text. Very impractical from this point of view.
2. Exporting as .html files
All it's ok and all the line in a blob field are grouped in one cell so we can see what's happened, just how to read them?. No harbour example
What we can do to get the data in a managable state?
I have tried to import the .html file in excel and through my app to read the the .xsl file and put the data in a .dbf database. All is ok for the normal fields except that I have to manage sometimes two or more records of blob lines data.
I have tried also to work with the .csv files and found a way to put the blob directly in a temporary .dbf using APPEND FROM temp.csv SDF and than make some manipulation to get the hole blob lines in one record.
At the end, I used your suggestion to directly get the normal data from the firebird database, with FBConnect() and FBGetData(), and when is the time to get the blob data for that record, it is taken from the .csv>.dbf database that must have the same number of records as the firebird table that we work with.
Not nice, but works and is faster rather than reading and converting .xsl files.
The database for the .csv imput is created as
DBCREATE("priv1",{ { "a1","C",254,0 }, { "a2","C",254,0 }, { "a3","C",254,0 }, { "a4","C",254,0 }, { "a5","C",254,0 }, { "a6","C",254,0 } })
or more fields depending of the blob lenght that we can expect.
We than fill the .dbf with
APPEND FROM temp.csv SDF
so the blob line is automatically divided trough the fileds of the dbf.
What we can do with the second line and so on?
well ... when exporting from the firebird database I exported only the ID and the blob field with ";" as field delimiter. The blobs second,... line/s of the blob text in the .csv have no ID number and no ";' so that lines can be later considered not as new record line but a line that belongs to the above record line in .csv.
Also another thing, it's very hard or impossible to change the charset of a blob column or even directly edit and change the text in it, at list with Flamerobin.
That's all for now.
There are examples on the net of how reading blobs but not applicable to harbour.
Maybe the FBGetBlob() does all the thing, but haven't found any documentation of how it work, yet.
Hope that is useful to someone
Zoran