Forum OpenACS Q&A: db_dml with -blob_files problems

Hallo,
I am trying to upload a blob in to the database by doing the folloing:

set small_thumbnail_name "/tmp/thumpnailimage"
set image_id 396892
  db_dml uploadblob -blob_files [list $small_thumbnail_name] "
            update gp_media
            set content3 = empty_blob()
            where gp_media_id = $image_id
            returning content1 into :1"

Like I saw in the http://philip.greenspun.com/doc/core-arch-guide/database-access-api

But then I get an error:Expected switch but encountered "/tmp/thumpnailimage" while executing " ...

If I try to put the switches at the end:
set small_thumbnail_name "/tmp/thumpnailimage"
set image_id 396892
  db_dml uploadblob "
            update gp_media
            set content3 = empty_blob()
            where gp_media_id = $image_id
            returning content1 into :1" -blob_files [list $small_thumbnail_name]

I get an error: ERROR: ora8.c:4103:stream_read_lob: error in `OCILobGetLength ()': Error - OCI_INVALID_HANDLE SQL: [nil] while executing "

I cannot understand what I am doing wrong.
Do you have any ideas?
Thanks,
Konstantinos

Collapse
Posted by Jeff Davis on
In the first bit you say content3 and in the return you say content1 (the second should be content3 as well).
Collapse
Posted by Konstantinos Kokkorogiannis on
DAMN ME.
Thanks a million.