Database vs Array (was: Filtering array vs plain list)

Shari shari at gypsyware.com
Sun Feb 3 09:40:01 EST 2008


Truthfully I've not considered databases.  I've never worked with 
one.  So I have NO concept of how you'd use one, install one, make it 
work for lots of folks with lots of computers, etc.

Here are my assumptions and questions, based on no actual knowledge. 
I know you will all correct the bad ones :-)  And I will learn 
something new :-)

1.  Would the user need to install something extra to use it?  If so, 
would it be a separate program from my app that I would have to deal 
with tech support if the user upgrades his system?  Thousands of 
people download my apps from around the world, so added tech support 
is a big bad.

2.  Is there a way to make it * part * of my app, running for both 
Mac and Windows without a bunch of hoo hah from me?  I don't use 
installers.  My apps are designed to launch, and create any separate 
files they need during initial launch.  Stacks that need to be 
updated (i.e. preferences, saved games, etc.) are stored compressed 
in custom properties, and on initial launch decompressed and saved to 
a writeable location.  That becomes the permanent prefs file or save 
file or whatever (which is what the database would be).  (Used to be 
able to just stick them in the program's folder but with all the new 
security issues, computers can't write to that location anymore :-( 
Can I do this with a database file?

3.  Can it be protected?

4.  Whereas filtering will happen and needs to be super fast, the 
most common thing I will be doing is changing the data as follows:

put "1286,5900,3422,9984" into myVar # this won't be done in one 
line, but as parts of other handlers

repeat for each item x in myVar
   subtract random(variable2) from myArray[x,cattledog]
   if myArray[x,cattledog] < 0 then
       doSomething
    end if
end repeat

This type of code will be the most common.  Also, moving data from 
cell to cell.  It must perceive columns and rows, and be able to move 
the data from myArray[23,67] to myArray[55,90].  Or at least my code 
needs to be able to think this way.

Can a database do this?  Pardon the question, I honestly don't know. 
Have never looked into the guts of a database :-)  It is alien 
technology to me :-)

(For anybody wondering the cattledog reference, our newest dog pound 
adoptee is an Australian Cattle Dog/Husky mix.  She's the apple of my 
eye and the biggest brat to boot.)

Shari



>  > Why are you writing off using a database?  I think you would find that
>>  for the amount of data you have and the way it's organized, it's going
>>  to be MUCH faster than anything you can do with arrays and scripts.
>>
>>  For example to select all the Red Sox fans born in 1960 you would write:
>>
>>  SELECT * FROM people WHERE baseballteam='Red Sox' AND birthyear='1960'
>>
>>  To use your example of changing the baseball team:
>>
>>  UPDATE people SET baseballteam='White Sox' WHERE baseballteam='Red Sox'
>>  AND birthyear='1960'
>
>
>And the scales fell from his eyes and Lo, he could see!  Thanks.
>
>What the database actually is giving you is a much more powerful filter
>command.  Filter is great but it doesn't do columns.  Its great but doesn't
>do real regex, only wildcards.  Yes indeed, why reinvent the wheel, just
>figure out the database commands.  If it were awk it might be different,
>where in effect you have a sort of built-in implicit filter with column
>addressing.  But in Rev sqlite has to be the way to go. 
>
>I sort of half knew this from using filter and switch to get reports done,
>which does work, but it runs to several pages to do quite simple things, but
>hadn't got it explicitly till reading this comment.
>
>Peter


-- 
WlND0WS and MAClNT0SH shareware games
BIackjack GoId
http://www.gypsyware.com



More information about the use-livecode mailing list