revDatabaseColumnNamed

Björnke von Gierke bvg at mac.com
Thu Jun 4 17:38:10 EDT 2009


On 4 Jun 2009, at 21:41, Mark Stuart wrote:
> Written by Björnke von Gierke on Thu Jun 4, 2009 - 09:32 AM CDT
>> Can anyone tell me how to store and retrieve binary data using sql,
>> without it being changed in between?
>
> Check out the Rev Dictionary for revDatafromQuery:
> local tImageData
> put the text of image "MyImage" into tImageData
> get revDataFromQuery(, , myID, "SELECT size FROM images WHERE  
> imagedata = :1", "*btImageData")
>
> local tImageDataArray
> put "*b" & the text of image "MyImage" into tImageDataArray[1]
> get revDataFromQuery(, , myId, "SELECT size FROM images WHERE  
> imagedata = :1", "tImageDataArray")

Uhm... I used revDataFromQuery in my example (replicated below). Note  
that my question is not about how to use binary as part of a query  
(which the examples from the dict are about), but how to store and  
retrieve binary by using sql, which i was unable to get to work.  
Additionally the dict entry you mention says (thus my comment of it  
being non-recommended):

--
Important: The revDataFromQuery function should not be used if any of  
the data being retrieved is binary, doing so will probably produce  
unexpected results.
--



my examples:
--
     --always the same query, "data" should be a binaryencoded array
      put "select data from liveData where name=:1" into theQuery

      --using revdatafromquery (not recommended by docu)
      put revdatafromquery("","",databaseID, theQuery,"theName") into  
theProp3

      --issuing revquerydatabase
      put revQueryDatabase(databaseID, theQuery, "theName") into x

      --using revDatabaseColumnNamed, no output variable
      --this is not recommended for binary data
      put revDatabaseColumnNamed(x,"data") into theProp2

      --using revDatabaseColumnNamed, with an output variable
      --this is recommended for binary data
      put revDatabaseColumnNamed(x,"data", "theProp") into x
--


any other ideas?
Björnke

-- 

official ChatRev page:
http://bjoernke.com/runrev/chatrev.php

Chat with other RunRev developers:
go stack URL "http://bjoernke.com/stacks/chatrev/chatrev1.3b3.rev"




More information about the use-livecode mailing list