Re: Confused about storing arrays in a custom property

2011-08-23 Thread Pete
No problem Bob, I'm learning fast that there are a LOT of variations between
SQL DB types!
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Tue, Aug 23, 2011 at 2:28 PM, Bob Sneidar  wrote:

> Oh right. I should read up before one hand typing something. :-)
>
> Bob
>
>
> On Aug 23, 2011, at 2:20 PM, Pete wrote:
>
> > Turns out there's an sqlite parameter that controls the max length
> > (SQLITE_MAX_LENGTH) - its default is 1 billion so I think I'm safe
> storing
> > encoded array information!
> >
> > You might be thinking of the mySQL CHAR data type size limit which is
> 255.
> >
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> >
> >
> >
> >
> > On Tue, Aug 23, 2011 at 1:54 PM, Bob Sneidar  wrote:
> >
> >> 255 if i am not mistaken. Larger and you need to use blobs
> >>
> >> bob
> >>
> >> On Aug 23, 2011, at 12:46 PM, Pete wrote:
> >>
> >>> Good point Jan, I will check on the max size of a TEXT column in sqlite
> >>> Pete
> >>> Molly's Revenge <http://www.mollysrevenge.com>
> >>>
> >>>
> >>>
> >>>
> >>> On Tue, Aug 23, 2011 at 12:22 PM, Jan Schenkel  >>> wrote:
> >>>
> >>>> Glad it helped - as for storing in a CLOB, that's just the database I
> >> use
> >>>> at the day-job, which makes a distinction between CLOB and BLOB for
> >> schema
> >>>> definition :-)
> >>>> It always depends on the size of the data, and some RDBMS's can be a
> bit
> >>>> fussy about the data definition and the supported size.
> >>>>
> >>>> Jan Schenkel.
> >>>> =
> >>>> Quartam Reports & PDF Library for LiveCode
> >>>> www.quartam.com
> >>>>
> >>>>
> >>>> =
> >>>> "As we grow older, we grow both wiser and more foolish at the same
> >> time."
> >>>> (La Rochefoucauld)
> >>>>
> >>>>
> >>>> - Original Message -
> >>>> From: Pete 
> >>>> To: How to use LiveCode 
> >>>> Cc:
> >>>> Sent: Monday, August 22, 2011 11:30 PM
> >>>> Subject: Re: Confused about storing arrays in a custom property
> >>>>
> >>>> Hi Jan,
> >>>> The base64Encode worked great, thanks for the tip!  I didn't need to
> >> store
> >>>> it as a CLOB type actually, just as regular text.
> >>>> Pete
> >>>> Molly's Revenge <http://www.mollysrevenge.com>
> >>>>
> >>>>
> >>>> ___
> >>>> use-livecode mailing list
> >>>> use-livecode@lists.runrev.com
> >>>> Please visit this url to subscribe, unsubscribe and manage your
> >>>> subscription preferences:
> >>>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>>>
> >>>>
> >>> ___
> >>> use-livecode mailing list
> >>> use-livecode@lists.runrev.com
> >>> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >>> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-23 Thread Bob Sneidar
Oh right. I should read up before one hand typing something. :-) 

Bob


On Aug 23, 2011, at 2:20 PM, Pete wrote:

> Turns out there's an sqlite parameter that controls the max length
> (SQLITE_MAX_LENGTH) - its default is 1 billion so I think I'm safe storing
> encoded array information!
> 
> You might be thinking of the mySQL CHAR data type size limit which is 255.
> 
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> 
> 
> 
> 
> On Tue, Aug 23, 2011 at 1:54 PM, Bob Sneidar  wrote:
> 
>> 255 if i am not mistaken. Larger and you need to use blobs
>> 
>> bob
>> 
>> On Aug 23, 2011, at 12:46 PM, Pete wrote:
>> 
>>> Good point Jan, I will check on the max size of a TEXT column in sqlite
>>> Pete
>>> Molly's Revenge <http://www.mollysrevenge.com>
>>> 
>>> 
>>> 
>>> 
>>> On Tue, Aug 23, 2011 at 12:22 PM, Jan Schenkel >> wrote:
>>> 
>>>> Glad it helped - as for storing in a CLOB, that's just the database I
>> use
>>>> at the day-job, which makes a distinction between CLOB and BLOB for
>> schema
>>>> definition :-)
>>>> It always depends on the size of the data, and some RDBMS's can be a bit
>>>> fussy about the data definition and the supported size.
>>>> 
>>>> Jan Schenkel.
>>>> =
>>>> Quartam Reports & PDF Library for LiveCode
>>>> www.quartam.com
>>>> 
>>>> 
>>>> =
>>>> "As we grow older, we grow both wiser and more foolish at the same
>> time."
>>>> (La Rochefoucauld)
>>>> 
>>>> 
>>>> - Original Message -
>>>> From: Pete 
>>>> To: How to use LiveCode 
>>>> Cc:
>>>> Sent: Monday, August 22, 2011 11:30 PM
>>>> Subject: Re: Confused about storing arrays in a custom property
>>>> 
>>>> Hi Jan,
>>>> The base64Encode worked great, thanks for the tip!  I didn't need to
>> store
>>>> it as a CLOB type actually, just as regular text.
>>>> Pete
>>>> Molly's Revenge <http://www.mollysrevenge.com>
>>>> 
>>>> 
>>>> ___
>>>> use-livecode mailing list
>>>> use-livecode@lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>>> 
>>>> 
>>> ___
>>> use-livecode mailing list
>>> use-livecode@lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-23 Thread Pete
Turns out there's an sqlite parameter that controls the max length
(SQLITE_MAX_LENGTH) - its default is 1 billion so I think I'm safe storing
encoded array information!

You might be thinking of the mySQL CHAR data type size limit which is 255.

Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Tue, Aug 23, 2011 at 1:54 PM, Bob Sneidar  wrote:

> 255 if i am not mistaken. Larger and you need to use blobs
>
> bob
>
> On Aug 23, 2011, at 12:46 PM, Pete wrote:
>
> > Good point Jan, I will check on the max size of a TEXT column in sqlite
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> >
> >
> >
> >
> > On Tue, Aug 23, 2011 at 12:22 PM, Jan Schenkel  >wrote:
> >
> >> Glad it helped - as for storing in a CLOB, that's just the database I
> use
> >> at the day-job, which makes a distinction between CLOB and BLOB for
> schema
> >> definition :-)
> >> It always depends on the size of the data, and some RDBMS's can be a bit
> >> fussy about the data definition and the supported size.
> >>
> >> Jan Schenkel.
> >> =
> >> Quartam Reports & PDF Library for LiveCode
> >> www.quartam.com
> >>
> >>
> >> =
> >> "As we grow older, we grow both wiser and more foolish at the same
> time."
> >> (La Rochefoucauld)
> >>
> >>
> >> - Original Message -
> >> From: Pete 
> >> To: How to use LiveCode 
> >> Cc:
> >> Sent: Monday, August 22, 2011 11:30 PM
> >> Subject: Re: Confused about storing arrays in a custom property
> >>
> >> Hi Jan,
> >> The base64Encode worked great, thanks for the tip!  I didn't need to
> store
> >> it as a CLOB type actually, just as regular text.
> >> Pete
> >> Molly's Revenge <http://www.mollysrevenge.com>
> >>
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-23 Thread Bob Sneidar
255 if i am not mistaken. Larger and you need to use blobs

bob

On Aug 23, 2011, at 12:46 PM, Pete wrote:

> Good point Jan, I will check on the max size of a TEXT column in sqlite
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
> 
> 
> 
> 
> On Tue, Aug 23, 2011 at 12:22 PM, Jan Schenkel wrote:
> 
>> Glad it helped - as for storing in a CLOB, that's just the database I use
>> at the day-job, which makes a distinction between CLOB and BLOB for schema
>> definition :-)
>> It always depends on the size of the data, and some RDBMS's can be a bit
>> fussy about the data definition and the supported size.
>> 
>> Jan Schenkel.
>> =
>> Quartam Reports & PDF Library for LiveCode
>> www.quartam.com
>> 
>> 
>> =
>> "As we grow older, we grow both wiser and more foolish at the same time."
>> (La Rochefoucauld)
>> 
>> 
>> ----- Original Message -
>> From: Pete 
>> To: How to use LiveCode 
>> Cc:
>> Sent: Monday, August 22, 2011 11:30 PM
>> Subject: Re: Confused about storing arrays in a custom property
>> 
>> Hi Jan,
>> The base64Encode worked great, thanks for the tip!  I didn't need to store
>> it as a CLOB type actually, just as regular text.
>> Pete
>> Molly's Revenge <http://www.mollysrevenge.com>
>> 
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-23 Thread Pete
Good point Jan, I will check on the max size of a TEXT column in sqlite
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Tue, Aug 23, 2011 at 12:22 PM, Jan Schenkel wrote:

> Glad it helped - as for storing in a CLOB, that's just the database I use
> at the day-job, which makes a distinction between CLOB and BLOB for schema
> definition :-)
> It always depends on the size of the data, and some RDBMS's can be a bit
> fussy about the data definition and the supported size.
>
> Jan Schenkel.
> =
> Quartam Reports & PDF Library for LiveCode
> www.quartam.com
>
>
> =
> "As we grow older, we grow both wiser and more foolish at the same time."
>  (La Rochefoucauld)
>
>
> - Original Message -
> From: Pete 
> To: How to use LiveCode 
> Cc:
> Sent: Monday, August 22, 2011 11:30 PM
> Subject: Re: Confused about storing arrays in a custom property
>
> Hi Jan,
> The base64Encode worked great, thanks for the tip!  I didn't need to store
> it as a CLOB type actually, just as regular text.
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-23 Thread Jan Schenkel
Glad it helped - as for storing in a CLOB, that's just the database I use at 
the day-job, which makes a distinction between CLOB and BLOB for schema 
definition :-)
It always depends on the size of the data, and some RDBMS's can be a bit fussy 
about the data definition and the supported size.

Jan Schenkel.
=
Quartam Reports & PDF Library for LiveCode
www.quartam.com


=
"As we grow older, we grow both wiser and more foolish at the same time."  (La 
Rochefoucauld)


- Original Message -
From: Pete 
To: How to use LiveCode 
Cc: 
Sent: Monday, August 22, 2011 11:30 PM
Subject: Re: Confused about storing arrays in a custom property

Hi Jan,
The base64Encode worked great, thanks for the tip!  I didn't need to store
it as a CLOB type actually, just as regular text.
Pete
Molly's Revenge <http://www.mollysrevenge.com>


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-22 Thread Pete
Hi Jan,
The base64Encode worked great, thanks for the tip!  I didn't need to store
it as a CLOB type actually, just as regular text.
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Mon, Aug 22, 2011 at 12:38 PM, Jan Schenkel wrote:

> You could 'base64Encode' the binary data before storing it, and
> base64decode it after retrieval from the database.
> That way you don't have to worry about BINARY, and can store it in a CLOB.
>
> HTH,
>
> Jan Schenkel.
> =
> Quartam Reports & PDF Library for LiveCode
> www.quartam.com
>
>
> =
> "As we grow older, we grow both wiser and more foolish at the same time."
>  (La Rochefoucauld)
>
>
> - Original Message -
> From: Pete 
> To: How to use LiveCode 
> Cc:
> Sent: Monday, August 22, 2011 8:28 PM
> Subject: Re: Confused about storing arrays in a custom property
>
> I do store it in a cprop for use during a single run but I have to preserve
> the value between runs so want to store it in an external file. I know
> there
> are ways to do that using separate stacks within standalones - I just
> prefer
> to use an external file rather than that method, especially if I already
> have one open for other purposes.
>
> Trevors' printKeys doesn't quite do the job unfortunately.  It doesn't
> print
> all the keys on each line, just indents depending on the key level.  In my
> case, I need the output for your example to be:
>
> abcdefxyz
> abcghiqrs
>
> I could probably have used PrintKeys and dealt with the indented format
> when
> recreating the array but it was fun coming up with the algorithm to produce
> the above output, plus it made the reassembly of the array very easy.
>
> Haven't had a chance to experiment with simulating a BINARY column in
> sqlite
> yet but if I find a way to do it, I'll probably go with that method.
>
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
>
> On Mon, Aug 22, 2011 at 10:51 AM, Bob Sneidar  wrote:
>
> > interesting. Trevor shared some time ago his printKeys() function so that
> > given:
> >put "xyz" into aData["abc"]["def"]
> >put "qrs" into adata["abc"]["ghi"]
> >put printkeys(aData)
> >
> > you would get:
> > abc
> > ghi: qrs
> > def: xyz
> >
> > A similar method could probably be devised to put the data back into an
> > array.
> >
> > All this seems like a lot of trouble though. Why not just store the array
> > in a custom property?
> > set the aArray of this card to aData -- or this stack if it is a single
> > array
> >
> > Bob
> >
> >
> > On Aug 22, 2011, at 10:29 AM, Pete wrote:
> >
> > > Thanks Andrew and Bob.  Unfortunately, I'm using an sqlite database and
> > as
> > > far as I can tell from the docs, it doesn't have a binary data type.  I
> > > could define a column as BINARY but it would end up as NUMERIC in
> > sqlite's
> > > world.  I'll give it a whirl though.
> > >
> > > I've actually now written a function to convert a multidimensional
> array
> > > into a string with one line for each of the first level keys and each
> > line
> > > containing the keys separated by tabs, ending up with the value in the
> > > lowest level key.  That way I can just store the text string in the db
> > > without a problem, and I also have a simple command to assemble the
> > strings
> > > into an array when I read them back from the db. So if
> > Array["abc"]["def"]
> > > contains "xyz", the resulting line would be "abcdefxyz".
> This
> > was
> > > the cause of my other recent posts about what happens when the last
> item
> > in
> > > a string is empty.  Provided some interesting recursion opportunities!
> > >
> > > Pete
> > > Molly's Revenge <http://www.mollysrevenge.com>
> > >
> > >
> > >
> > >
> > > On Mon, Aug 22, 2011 at 9:49 AM, Andrew Kluthe 
> > wrote:
> > >
> > >> It sounds to me like binary is the data type you want here.
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
> > >> Sent from the Revolution - User mailing list archive at Nabb

Re: Confused about storing arrays in a custom property

2011-08-22 Thread Pete
Thanks Jan.  I'll try that this afternoon and report back.
Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Mon, Aug 22, 2011 at 12:38 PM, Jan Schenkel wrote:

> You could 'base64Encode' the binary data before storing it, and
> base64decode it after retrieval from the database.
> That way you don't have to worry about BINARY, and can store it in a CLOB.
>
> HTH,
>
> Jan Schenkel.
> =
> Quartam Reports & PDF Library for LiveCode
> www.quartam.com
>
>
> =
> "As we grow older, we grow both wiser and more foolish at the same time."
>  (La Rochefoucauld)
>
>
> - Original Message -
> From: Pete 
> To: How to use LiveCode 
> Cc:
> Sent: Monday, August 22, 2011 8:28 PM
> Subject: Re: Confused about storing arrays in a custom property
>
> I do store it in a cprop for use during a single run but I have to preserve
> the value between runs so want to store it in an external file. I know
> there
> are ways to do that using separate stacks within standalones - I just
> prefer
> to use an external file rather than that method, especially if I already
> have one open for other purposes.
>
> Trevors' printKeys doesn't quite do the job unfortunately.  It doesn't
> print
> all the keys on each line, just indents depending on the key level.  In my
> case, I need the output for your example to be:
>
> abcdefxyz
> abcghiqrs
>
> I could probably have used PrintKeys and dealt with the indented format
> when
> recreating the array but it was fun coming up with the algorithm to produce
> the above output, plus it made the reassembly of the array very easy.
>
> Haven't had a chance to experiment with simulating a BINARY column in
> sqlite
> yet but if I find a way to do it, I'll probably go with that method.
>
>
> Pete
> Molly's Revenge <http://www.mollysrevenge.com>
>
>
>
>
> On Mon, Aug 22, 2011 at 10:51 AM, Bob Sneidar  wrote:
>
> > interesting. Trevor shared some time ago his printKeys() function so that
> > given:
> >put "xyz" into aData["abc"]["def"]
> >put "qrs" into adata["abc"]["ghi"]
> >put printkeys(aData)
> >
> > you would get:
> > abc
> > ghi: qrs
> > def: xyz
> >
> > A similar method could probably be devised to put the data back into an
> > array.
> >
> > All this seems like a lot of trouble though. Why not just store the array
> > in a custom property?
> > set the aArray of this card to aData -- or this stack if it is a single
> > array
> >
> > Bob
> >
> >
> > On Aug 22, 2011, at 10:29 AM, Pete wrote:
> >
> > > Thanks Andrew and Bob.  Unfortunately, I'm using an sqlite database and
> > as
> > > far as I can tell from the docs, it doesn't have a binary data type.  I
> > > could define a column as BINARY but it would end up as NUMERIC in
> > sqlite's
> > > world.  I'll give it a whirl though.
> > >
> > > I've actually now written a function to convert a multidimensional
> array
> > > into a string with one line for each of the first level keys and each
> > line
> > > containing the keys separated by tabs, ending up with the value in the
> > > lowest level key.  That way I can just store the text string in the db
> > > without a problem, and I also have a simple command to assemble the
> > strings
> > > into an array when I read them back from the db. So if
> > Array["abc"]["def"]
> > > contains "xyz", the resulting line would be "abcdefxyz".
> This
> > was
> > > the cause of my other recent posts about what happens when the last
> item
> > in
> > > a string is empty.  Provided some interesting recursion opportunities!
> > >
> > > Pete
> > > Molly's Revenge <http://www.mollysrevenge.com>
> > >
> > >
> > >
> > >
> > > On Mon, Aug 22, 2011 at 9:49 AM, Andrew Kluthe 
> > wrote:
> > >
> > >> It sounds to me like binary is the data type you want here.
> > >>
> > >> --
> > >> View this message in context:
> > >>
> >
> http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
> > >> Sent from the Revolution - User mailing list archive at Nabble.com.
> > >>
> > >> ___
> &g

Re: Confused about storing arrays in a custom property

2011-08-22 Thread Jan Schenkel
You could 'base64Encode' the binary data before storing it, and base64decode it 
after retrieval from the database.
That way you don't have to worry about BINARY, and can store it in a CLOB.
 
HTH,

Jan Schenkel.
=
Quartam Reports & PDF Library for LiveCode
www.quartam.com


=
"As we grow older, we grow both wiser and more foolish at the same time."  (La 
Rochefoucauld)


- Original Message -
From: Pete 
To: How to use LiveCode 
Cc: 
Sent: Monday, August 22, 2011 8:28 PM
Subject: Re: Confused about storing arrays in a custom property

I do store it in a cprop for use during a single run but I have to preserve
the value between runs so want to store it in an external file. I know there
are ways to do that using separate stacks within standalones - I just prefer
to use an external file rather than that method, especially if I already
have one open for other purposes.

Trevors' printKeys doesn't quite do the job unfortunately.  It doesn't print
all the keys on each line, just indents depending on the key level.  In my
case, I need the output for your example to be:

abcdefxyz
abcghiqrs

I could probably have used PrintKeys and dealt with the indented format when
recreating the array but it was fun coming up with the algorithm to produce
the above output, plus it made the reassembly of the array very easy.

Haven't had a chance to experiment with simulating a BINARY column in sqlite
yet but if I find a way to do it, I'll probably go with that method.


Pete
Molly's Revenge <http://www.mollysrevenge.com>




On Mon, Aug 22, 2011 at 10:51 AM, Bob Sneidar  wrote:

> interesting. Trevor shared some time ago his printKeys() function so that
> given:
>    put "xyz" into aData["abc"]["def"]
>    put "qrs" into adata["abc"]["ghi"]
>    put printkeys(aData)
>
> you would get:
> abc
>     ghi: qrs
>     def: xyz
>
> A similar method could probably be devised to put the data back into an
> array.
>
> All this seems like a lot of trouble though. Why not just store the array
> in a custom property?
> set the aArray of this card to aData -- or this stack if it is a single
> array
>
> Bob
>
>
> On Aug 22, 2011, at 10:29 AM, Pete wrote:
>
> > Thanks Andrew and Bob.  Unfortunately, I'm using an sqlite database and
> as
> > far as I can tell from the docs, it doesn't have a binary data type.  I
> > could define a column as BINARY but it would end up as NUMERIC in
> sqlite's
> > world.  I'll give it a whirl though.
> >
> > I've actually now written a function to convert a multidimensional array
> > into a string with one line for each of the first level keys and each
> line
> > containing the keys separated by tabs, ending up with the value in the
> > lowest level key.  That way I can just store the text string in the db
> > without a problem, and I also have a simple command to assemble the
> strings
> > into an array when I read them back from the db. So if
> Array["abc"]["def"]
> > contains "xyz", the resulting line would be "abcdefxyz".  This
> was
> > the cause of my other recent posts about what happens when the last item
> in
> > a string is empty.  Provided some interesting recursion opportunities!
> >
> > Pete
> > Molly's Revenge <http://www.mollysrevenge.com>
> >
> >
> >
> >
> > On Mon, Aug 22, 2011 at 9:49 AM, Andrew Kluthe 
> wrote:
> >
> >> It sounds to me like binary is the data type you want here.
> >>
> >> --
> >> View this message in context:
> >>
> http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
> >> Sent from the Revolution - User mailing list archive at Nabble.com.
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-22 Thread Pete
I do store it in a cprop for use during a single run but I have to preserve
the value between runs so want to store it in an external file. I know there
are ways to do that using separate stacks within standalones - I just prefer
to use an external file rather than that method, especially if I already
have one open for other purposes.

Trevors' printKeys doesn't quite do the job unfortunately.  It doesn't print
all the keys on each line, just indents depending on the key level.  In my
case, I need the output for your example to be:

abcdefxyz
abcghiqrs

I could probably have used PrintKeys and dealt with the indented format when
recreating the array but it was fun coming up with the algorithm to produce
the above output, plus it made the reassembly of the array very easy.

Haven't had a chance to experiment with simulating a BINARY column in sqlite
yet but if I find a way to do it, I'll probably go with that method.


Pete
Molly's Revenge 




On Mon, Aug 22, 2011 at 10:51 AM, Bob Sneidar  wrote:

> interesting. Trevor shared some time ago his printKeys() function so that
> given:
>put "xyz" into aData["abc"]["def"]
>put "qrs" into adata["abc"]["ghi"]
>put printkeys(aData)
>
> you would get:
> abc
> ghi: qrs
> def: xyz
>
> A similar method could probably be devised to put the data back into an
> array.
>
> All this seems like a lot of trouble though. Why not just store the array
> in a custom property?
> set the aArray of this card to aData -- or this stack if it is a single
> array
>
> Bob
>
>
> On Aug 22, 2011, at 10:29 AM, Pete wrote:
>
> > Thanks Andrew and Bob.  Unfortunately, I'm using an sqlite database and
> as
> > far as I can tell from the docs, it doesn't have a binary data type.  I
> > could define a column as BINARY but it would end up as NUMERIC in
> sqlite's
> > world.  I'll give it a whirl though.
> >
> > I've actually now written a function to convert a multidimensional array
> > into a string with one line for each of the first level keys and each
> line
> > containing the keys separated by tabs, ending up with the value in the
> > lowest level key.  That way I can just store the text string in the db
> > without a problem, and I also have a simple command to assemble the
> strings
> > into an array when I read them back from the db. So if
> Array["abc"]["def"]
> > contains "xyz", the resulting line would be "abcdefxyz".  This
> was
> > the cause of my other recent posts about what happens when the last item
> in
> > a string is empty.  Provided some interesting recursion opportunities!
> >
> > Pete
> > Molly's Revenge 
> >
> >
> >
> >
> > On Mon, Aug 22, 2011 at 9:49 AM, Andrew Kluthe 
> wrote:
> >
> >> It sounds to me like binary is the data type you want here.
> >>
> >> --
> >> View this message in context:
> >>
> http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
> >> Sent from the Revolution - User mailing list archive at Nabble.com.
> >>
> >> ___
> >> use-livecode mailing list
> >> use-livecode@lists.runrev.com
> >> Please visit this url to subscribe, unsubscribe and manage your
> >> subscription preferences:
> >> http://lists.runrev.com/mailman/listinfo/use-livecode
> >>
> >>
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-22 Thread Bob Sneidar
interesting. Trevor shared some time ago his printKeys() function so that given:
put "xyz" into aData["abc"]["def"]
put "qrs" into adata["abc"]["ghi"]
put printkeys(aData)

you would get:
abc
 ghi: qrs
 def: xyz

A similar method could probably be devised to put the data back into an array. 

All this seems like a lot of trouble though. Why not just store the array in a 
custom property? 
set the aArray of this card to aData -- or this stack if it is a single array

Bob


On Aug 22, 2011, at 10:29 AM, Pete wrote:

> Thanks Andrew and Bob.  Unfortunately, I'm using an sqlite database and as
> far as I can tell from the docs, it doesn't have a binary data type.  I
> could define a column as BINARY but it would end up as NUMERIC in sqlite's
> world.  I'll give it a whirl though.
> 
> I've actually now written a function to convert a multidimensional array
> into a string with one line for each of the first level keys and each line
> containing the keys separated by tabs, ending up with the value in the
> lowest level key.  That way I can just store the text string in the db
> without a problem, and I also have a simple command to assemble the strings
> into an array when I read them back from the db. So if Array["abc"]["def"]
> contains "xyz", the resulting line would be "abcdefxyz".  This was
> the cause of my other recent posts about what happens when the last item in
> a string is empty.  Provided some interesting recursion opportunities!
> 
> Pete
> Molly's Revenge 
> 
> 
> 
> 
> On Mon, Aug 22, 2011 at 9:49 AM, Andrew Kluthe  wrote:
> 
>> It sounds to me like binary is the data type you want here.
>> 
>> --
>> View this message in context:
>> http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
>> Sent from the Revolution - User mailing list archive at Nabble.com.
>> 
>> ___
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-22 Thread Pete
Thanks Andrew and Bob.  Unfortunately, I'm using an sqlite database and as
far as I can tell from the docs, it doesn't have a binary data type.  I
could define a column as BINARY but it would end up as NUMERIC in sqlite's
world.  I'll give it a whirl though.

I've actually now written a function to convert a multidimensional array
into a string with one line for each of the first level keys and each line
containing the keys separated by tabs, ending up with the value in the
lowest level key.  That way I can just store the text string in the db
without a problem, and I also have a simple command to assemble the strings
into an array when I read them back from the db. So if Array["abc"]["def"]
contains "xyz", the resulting line would be "abcdefxyz".  This was
the cause of my other recent posts about what happens when the last item in
a string is empty.  Provided some interesting recursion opportunities!

Pete
Molly's Revenge 




On Mon, Aug 22, 2011 at 9:49 AM, Andrew Kluthe  wrote:

> It sounds to me like binary is the data type you want here.
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-22 Thread Andrew Kluthe
It sounds to me like binary is the data type you want here.

--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/Confused-about-storing-arrays-in-a-custom-property-tp3757539p3760664.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-22 Thread Bob Sneidar
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 
> 
> 
> 
> 
> On Sat, Aug 20, 2011 at 2:28 PM, Richard Gaskin
> 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
>> 
>> 
>> __**_
>> use-livecode mailing list
>> use-livecode@lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/**mailman/listinfo/use-livecode
>> 
>> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


RE: Confused about storing arrays in a custom property

2011-08-22 Thread John Tregea
Hi Pete,

I have made extensive use of arrays as custom properties of all sorts of
objects and never ever had a problem. Unless someone else has found a way to
blow things up I think you are perfectly safe.

Regards

John

-Original Message-
From: use-livecode-boun...@lists.runrev.com
[mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of Pete
Sent: Sunday, 21 August 2011 5:46 AM
To: How to use LiveCode
Subject: Confused about storing arrays in a custom property

I read in the LC manual that it isn;t possible to store an array in a single
custom property, yet I have done that and it seems to work fine.  The
Inspector doesn't show the value, just a greyed out message about it being
an array.

Before I go any further down that path, is this a safe thing to do?

Pete
Molly's Revenge 
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1392 / Virus Database: 1520/3845 - Release Date: 08/19/11


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-21 Thread Pete
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 




On Sat, Aug 20, 2011 at 2:28 PM, Richard Gaskin
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
>
>
> __**_
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-20 Thread Richard Gaskin

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

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-20 Thread Pete
Great, thanks.

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?
Pete
Molly's Revenge 




On Sat, Aug 20, 2011 at 12:57 PM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

> Hi Pete,
>
> This part of the documentation is probably from the time before
> multidimensional arrays. When multidimensional arrays were introduced, we
> also got a way to store them as custom properties. Don't worry.
>
> --
> Kind regards,
>
> Mark Schonewille
> Economy-x-Talk
> Http://economy-x-talk.com
>
> Share the clipboard of your computer over a local network with Clipboard
> Link http://clipboardlink.economy-x-talk.com
>
>
> Op 20 aug. 2011 om 21:46 heeft Pete  het volgende
> geschreven:
>
> > I read in the LC manual that it isn;t possible to store an array in a
> single
> > custom property, yet I have done that and it seems to work fine.  The
> > Inspector doesn't show the value, just a greyed out message about it
> being
> > an array.
> >
> > Before I go any further down that path, is this a safe thing to do?
> >
> > Pete
> > Molly's Revenge 
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Confused about storing arrays in a custom property

2011-08-20 Thread Mark Schonewille
Hi Pete,

This part of the documentation is probably from the time before 
multidimensional arrays. When multidimensional arrays were introduced, we also 
got a way to store them as custom properties. Don't worry.

--
Kind regards,

Mark Schonewille
Economy-x-Talk
Http://economy-x-talk.com

Share the clipboard of your computer over a local network with Clipboard Link 
http://clipboardlink.economy-x-talk.com


Op 20 aug. 2011 om 21:46 heeft Pete  het volgende 
geschreven:

> I read in the LC manual that it isn;t possible to store an array in a single
> custom property, yet I have done that and it seems to work fine.  The
> Inspector doesn't show the value, just a greyed out message about it being
> an array.
> 
> Before I go any further down that path, is this a safe thing to do?
> 
> Pete
> Molly's Revenge 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode