Loading image data from DB
chris bohnert
chris at altuit.com
Wed Apr 5 22:32:39 EDT 2006
The only way i've ever been able to get this to work is by using the
variable binding when inserting data into the blob. By using the "*b"
prefix on the variable name in the execute parameter the binary encoding
routines kick in.
put the imageData of image "picImage" into tBits
put the text of field "strPicName" into tName
get revdb_execute(tconnectionid, "insert into limage(name,imageData)
values(:1,:2)","tName","*btBits")
then when returning the data i do
put "select name,imageData from limage where name='" & tImgName &"'"
into tsql
put revdb_queryblob(tconnectionid,tsql) into tRS
if not revdb_iseof(tRS) then
put revDatabaseColumnNamed(tRS,"name",tPicName)
set the text of field "strPicName" to tPicName
put revDatabaseColumnNamed(tRS,"imageData",tImageDat)
set the imagedata of image "picImage" to tImageDat
answer "got a result"
end if
--
cb
Devin Asay wrote:
>
> On Apr 5, 2006, at 5:43 PM, Trevor DeVore wrote:
>
>>
>> On Apr 5, 2006, at 3:37 PM, Devin Asay wrote:
>>
>>> I know this can be done, but it's got me stumped. Nothing conclusive
>>> from archives.
>>>
>>> I want to store image data in a mysql database and then show it in
>>> an image object in Rev. I successfully loaded an image into a field
>>> of type longblob. I know the data is there and that it's valid.
>>>
>>> ...
>>> Has anyone successfully done this who can share the secret to making
>>> it work?
>>
>> Devin,
>>
>> I think there is a bug when retrieving binary data using the mysql
>> driver. If you get it to work I would like to know. I messed with
>> this briefly the other day and couldn't get the binary data out that
>> I put in.
>>
>> --Trevor DeVore
>
> Well, at least I'm not alone in this. What puzzles me is that it works
> flawlessly when I set up an automatic query in Database Query Manager.
> I tried and failed to find the script that executes the query in the
> DQM stacks. I'll Bugzilla this if there isn't already a bug report on
> it. Anyone know?
>
> Devin
>
> Devin Asay
> Humanities Technology and Research Support Center
> Brigham Young University
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
>
> --No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.385 / Virus Database: 268.3.5/301 - Release Date: 4/4/2006
>
>
More information about the use-livecode
mailing list