I’ve successfully followed the examples on the forum to upload an image into an SQL database then I am trying to retrieve the saved image from database and show it in image component in perspective. I tried different ways but none of them seems working. In db dataType is varbinary(Max).
I am trying;
query as:
SELECT CAST(’’ as xml).value(‘xs:base64Binary(sql:column(“file_stream”))’, ‘varchar(MAX)’) from
Files where name =‘Photo.png’
The above is wrong. v is not an array of bytes. It is a dataset. You need to access the row/column containing the blob. If the first row, as typical, your code should look like this:
ds = system.db.runNamedQuery(path)
v = ds.getValueAt(0, 'myBlobColumnName')
return {'contentType':'image/png','bytes':v}