christian.langers
asked this on December 26, 2009 08:39
Hi again,
Is it possible with SQL Yoga to pass binary data (I have a picture field in the Valentina DB) into the DB ?
If yes, how ?
Thx,
Christian
Comments
Trevor DeVore
Blue Mango Learning Systems
SQL Yoga attempts to work with binary data in a seamless fashion. Assuming you have defined your database column as a binary type then you should be able to insert the binary data as-is without doing anything special.
If you are having trouble then post your code along with info on your db schema and we can troubleshoot.
December 28, 2009 10:53
christian.langers
I think I discovered the problem :
--> passing binary data to an encrypted Valentina DB is not working (unencrypted Db is ok)
The problem is that I rely on encryption...
The code is really straightforward...
put sqlrecord_createObject("Picts") into theRecordA
answer file ""
put URL("binfile:"&it) into tPicBlob
put the ticks into tId
sqlrecord_set theRecordA,"pic",tBlob
sqlrecord_set theRecordA,"id",tId
sqlrecord_create theRecordA
The DB schema is pretty simple too (as I tried this in a little test stack):
tables
Picts
field order: Pic,id
primary key: id
fields
Pic
meta type: text
name: Pic
signed: false
type: PICTURE
default value: NULL
primary key: false
accepts null: true
limit:
id
meta type: sequence
name: id
signed: false
type: sequence
default value: NULL
primary key: true
accepts null: false
limit:
RecID
meta type: sequence
name: RecID
signed: false
default value:
December 28, 2009 15:30
Trevor DeVore
Blue Mango Learning Systems
If the code works when the db is not encrypted but fails when the db is encrypted then I'm inclined to say that there is a bug in the Valentina database external. Can you send me the test stack so I can run some tests? I can then run it by the Valentina folks.
December 28, 2009 15:33
Trevor DeVore
Blue Mango Learning Systems
The solution to this problem was changing the field type from Picture to Blob in Valentina. Image data was correctly stored and retrieved from Valentina once this was done.
Comments
SQL Yoga attempts to work with binary data in a seamless fashion. Assuming you have defined your database column as a binary type then you should be able to insert the binary data as-is without doing anything special.
If you are having trouble then post your code along with info on your db schema and we can troubleshoot.
I think I discovered the problem :
--> passing binary data to an encrypted Valentina DB is not working (unencrypted Db is ok)
The problem is that I rely on encryption...
The code is really straightforward...
put sqlrecord_createObject("Picts") into theRecordA
answer file ""
put URL("binfile:"&it) into tPicBlob
put the ticks into tId
sqlrecord_set theRecordA,"pic",tBlob
sqlrecord_set theRecordA,"id",tId
sqlrecord_create theRecordA
The DB schema is pretty simple too (as I tried this in a little test stack):
tables
Picts
field order: Pic,id
primary key: id
fields
Pic
meta type: text
name: Pic
signed: false
type: PICTURE
default value: NULL
primary key: false
accepts null: true
limit:
id
meta type: sequence
name: id
signed: false
type: sequence
default value: NULL
primary key: true
accepts null: false
limit:
RecID
meta type: sequence
name: RecID
signed: false
default value:
If the code works when the db is not encrypted but fails when the db is encrypted then I'm inclined to say that there is a bug in the Valentina database external. Can you send me the test stack so I can run some tests? I can then run it by the Valentina folks.
The solution to this problem was changing the field type from Picture to Blob in Valentina. Image data was correctly stored and retrieved from Valentina once this was done.