Confused about storing arrays in a custom property

Bob Sneidar bobs at twft.com
Mon Aug 22 12:42:04 EDT 2011


I wonder if you shouldn't be using binary?

Bob


On Aug 21, 2011, at 11:35 AM, Pete wrote:

> Thanks Richard, writing to a file (an sqlite database actually) is exactly
> what I want to do.
> 
> However, I'm running into a problem with this.  I believe I have written the
> data correctly to the database as a BLOB column, but when I read it back
> from the database and use arraydecode to make it into an array again, I get
> a runtime error that just names the line and character with no indication of
> what the error is.
> 
> Here's what I do to put the data into the db and retrieve it.
> 
> Updating the DB:
> *
> *
> *put* "UPDATE qdProperties SET qdPropertyValue=CAST (:1 AS BLOB) WHERE
> qdPropertyID=5304" into mySQL
> revExecuteSQL 1,mySQL,"*bmyencodedarrayinput"
> 
> Getting the data back again:
> 
> *put* revQueryDatabase(1,"SELECT qdPropertyValue FROM qdProperties WHERE
> qdPropertyID=5304") into myRset
> *put* revDatabaseColumnNamed(myRset,"qdPropertyValue") intomyencodedarrayoutput
> *put* arraydecode(myencodedarrayoutput) into myNewArray
> 
> It's that last line of code that throws the run time error.
> 
> I'm pretty sure the runtime error is because the binary data that comes back
> from the db is not a valid encoded array but I have not used BLOB data in
> dbs before so not sure if what I am doing is the correct way to
> store/retrieve it.  If anyone has experience with this, would be grateful
> for some input.
> 
> 
> Thanks,
> 
> Molly's Revenge <http://www.mollysrevenge.com>
> 
> 
> 
> 
> On Sat, Aug 20, 2011 at 2:28 PM, Richard Gaskin
> <ambassador at fourthworld.com>wrote:
> 
>> Pete wrote:
>> 
>>> Next issue is using combine and split with multidimensional arrays.  It
>>> seems like they only work for a single dimension array.  I guess to use
>>> them
>>> with multidimensional arrays, you have to apply them to each level of
>>> array
>>> key?  Maybe a recursive function of some sort?
>>> 
>> 
>> Split and combine translate data to and from simple delimited lists, and
>> since lists aren't hierarchical by nature there is no meaningful action that
>> can be performed with those commands on multi-level data.
>> 
>> If the goal is to store an array on disk for later use, see the arrayEncode
>> and arrayDecode functions.
>> 
>> --
>> Richard Gaskin
>> Fourth World
>> LiveCode training and consulting: http://www.fourthworld.com
>> Webzine for LiveCode developers: http://www.LiveCodeJournal.com
>> LiveCode Journal blog: http://LiveCodejournal.com/**blog.irv<http://LiveCodejournal.com/blog.irv>
>> 
>> 
>> ______________________________**_________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>> 
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list