Passing Binary Data

This is the place to post technical queries about SQL Yoga

Moderators: FourthWorld, heatherlaine, Klaus, robinmiller, trevordevore

Post Reply
trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
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 - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
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 - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
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 - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply

Return to “SQL Yoga”