[Ann] xaLib - library to extract data from an array.
Alex Tweedly
alex at tweedly.net
Wed Apr 18 10:00:46 EDT 2018
Bob Sneidar and Richard Gaskin said :
> > Essentially it's for finding things in an array. You might say I could
> > do the same thing by iterating through all the elements of an array,
> > but what if I wanted to do multiple queries? It's easier for me to
> > write SQL queries than it is to code repeat loops.
>
> I hear ya'. I find myself tempted way more than I have time for to
> write an xquery-like library for working with arrays. We could sure use
> one.
So, I was tempted too :-)
But I decide there was no need for the complexity of xquery, and it was
better to keep it simple, along the lines of Andre's DBLib, or
revIgniter's Database lIbrary.
Hence : xaLib - eXtract from an Array Library
which can be found (I hope) at github.com/alextweedly/xalib
(I may not have done everything right on github - please let me know if
I need to fix anything).
There a script-only library, and a very simple test/demo stack as well
as some basic documentation.
Summary:
the data is held in a LC array. You
- (optionally) specify the matching criteria (by a series of calls to
xaWhere)
- (optionally) specify the ordering needed (by a series of calls to
xaOrderBy)
- (optionally) name that query for later re-use (xaNameQuery)
- then run the query by calling xaQuery, which returns the set of keys
matching your needs.
- (optionally) make a copy of the 'interesting' data (but usually
better not to do this).
Any suggestions / comments / contributions welcomed.
-- Alex.
More information about the use-livecode
mailing list