0

I try to read BLOB data from a database file with Octave 6.2.0 and the mex-sqlite3-master package.

I am able to select and read any other data from my database file. For the column containing BLOB data it gives me the following:

octave> x=sqlite3('file.db', 'SELECT column FROM list'); error: sqlite3: unsupported column type

octave> x=sqlite3('file.db', 'SELECT column FROM list WHERE column=CAST(column AS TEXT)'); gives no error, however x with a dimension of 1x0.

The BLOB-data contains hexadecimal numbers. I am fine having them as string (and work my way further, no probs).

What can I do to extract the BLOB-data in a processable format?

Thanks for any hint!

Chris
  • 1
  • `select CAST(column AS TEXT) from bl;` is the correct form of that query. `WHERE` clause is used only to filter the results. – Cem May 15 '21 at 10:12
  • If you want to be sure it's not a "package" issue, you can always try using the system `sqlite3` directly, e.g. https://stackoverflow.com/a/59986894/4183191 – Tasos Papastylianou May 15 '21 at 19:50

2 Answers2

0

thanks a lot for your answers! I tried the "select CAST(column AS TEXT) from bl;" hint. It created an array of the expected size, however with empty cells.

Chris
  • 1
0

I think you might want:

SELECT hex(column) FROM list

instead of doing a CAST to TEXT.

See Sqlite: How to cast(data as TEXT) for BLOB.

Andrew Janke
  • 23,508
  • 5
  • 56
  • 85