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!

2
  • select CAST(column AS TEXT) from bl; is the correct form of that query. WHERE clause is used only to filter the results. Commented May 15, 2021 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. stackoverflow.com/a/59986894/4183191 Commented May 15, 2021 at 19:50

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

2 Comments

Hi Andrew, thank you for your answer. I tried it, and it still gives me an empty array of the expected size...
Hmmm, that's surprising! I'll try to reproduce this on a sqlite setup on my box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.