Passing Binary Data

This is the place to post technical queries about SQL Yoga

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, trevordevore

Post Reply
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 888
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Passing Binary Data

Post by trevordevore » Fri Oct 11, 2013 2:39 pm

[This post is an archive from the old SQL Yoga forums]

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
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 888
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Passing Binary Data

Post by trevordevore » Fri Oct 11, 2013 2:39 pm

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.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 888
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: Passing Binary Data

Post by trevordevore » Fri Oct 11, 2013 2:39 pm

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:
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

Post Reply

Return to “SQL Yoga”