Updating Data Substacks
yvescoppe at skynet.be
Fri Jul 12 06:49:00 CDT 2002
>Dan Shafer asks:
>>> Good) Keep your data separate from the UI. This way you can update the UI
>>> independently of the data.
>> Thanks for the fast reply, Scott.
>> But this would require storing it in a text file and managing all the
>> data manipulation stuff or alternatively using a database, right? If
>> I have to do those things to keep data from being munged when I
>> upgrade the app, I might just as well use a conventional programming
>> environment! Transparency of data storage is crucial to stackware
>The UNIX and Windows restriction of executables being unable to write to
>themselves (Rev carries this forward to Mac OS as well for consistency) does
>require some re-thinking of data storage if you're used to working in
>Fortunately Rev makes it easy:
>You could store your data in an external text file, but then you'd have to
>parse it to have any useful structure to it.
>If the nature of your data suggests a need for more structure than a single
>block of text, you could use a separate stack file for data storage.
>The main benefit of using a stack file as opposed to a text file is the
>hierarchical structure afforded with objects and their custom properties.
>Remember that every Rev object can have custom properties, and even multiple
>sets of custom properties. Accessing these is very fast -- much faster than
>fields, and only a tiny bit slower than globals. You can use array notation
>if you like, and they can store binary data as well as text.
>Since a new stack file contains one card in one mainstack, you instantly get
>this rich structure for organizing your data (for just 363 bytes of
I'm busy with the development of a big database. I do it with text files
with the :
put <my variable> into URL("file:"<filepath>)
put URL("file:"<filepath>) into <my variable>
It's very easy and very fast
Afterwards the parsing with
repeat for each... makes it also very fast.
You also need to build your own indexes when saving your data to text
files for retrieving your searches quickly afterwards.
Hope this helps.
Email : yvescoppe at skynet.be
More information about the use-livecode