select blob from mysql using firedac
I discoverd a big problem with Delphi 10.2.1 and firedac. A simple select on a blob field from MySQL failes.
I.E. "SELECT blob FROM table"
The issue was caused by the MySQL connector (wrong version) and not by fireDAC.
Sorry for the trouble caused.
At least you nailed it!
Document it for yourself for future implementations :-)
The issue happens before.
fdQuery.sql.Text := 'SELECT contentObject from pdf_table';
fdQuery.open; << fails with MySQL
I tried the same with SQLite and this seems to be working fine. So this is maybe a MySQL(connector) problem.
What I do with SQLite, I think it should work with any DB.
I store PDFs into a BLOB field. Here is how I retrieve one and save it to disk
// Save the PDF file to c:\
BlobStream := fdQuery.CreateBlobStream(fdQuery.FieldByName('contentObject'), bmRead);
with TFileStream.Create('c:\\contract.pdf', fmCreate) do