Jump to content
Sign in to follow this  
sshrum

Creating a qausi-SQL 100% AutoIT array filter

Recommended Posts

sshrum

I'm writting a array filtering function for my AutoIT projects and I want to create a syntax language for query-ing. Recently, most of the projects I'm working on use 2 dimensional arrays with column headers at the top. My need for a qausi-SQL AutoIT-based array query function had risen to the top of my to-do list.

I'm *familiar* with SQL statements and internet search engines. I'd like to create a happy medium between these; something easy to use: (+this -that) but at the same time a bit more giving when attempting more complex searches (+author:Chicane playcount<10)

I've been working with other users on a REGEX based version but don't think it will give me the kind of control that I want without mastering REGEX :) (I might be wrong here, if so someone please let me know)

Here a (very small) sample of what I'm working with:

metadata.arr
=========
author|title|playcount
chicane|daylight|30
bt|Ima|10
no doubt|tragic kingdom|3
oingo boingo|insanity|100000

The entire contents of the file get loaded into an array where [0][0] is the row total and [1][x] contains the column headers. So far I've just been experimenting but want to make sure I cover all my bases. I've come up with a few operators for searches:

TERM OPERATORS (and, not, & or)

this that
   = full array search; record can have 'this' OR 'that' in a field (stringinstr)
+this 
   = full array search; record must have 'this' in any field (stringinstr)
-this 
   = full array search; record must NOT have 'this' in any field (! stringinstr)

FIELD-CENTRIC SWITCHES (contains, equals, greater than, less than)

author:bt
   = column-specific search; author field contains 'bt' (stringinstr)
author=bt
   = column-specific search; author field equals 'bt' (==)
playcount>20
   = column-specific search; playcount field greater than '20' (>)
playcount<20
   = column-specific search; playcount field less than '20' (<)

Granted, I've omitted >=, <= as I figured I can live without these (if I need something like 50 or higher I can do a >49 search). In addition, term operators can be used with switches as well like this:

+author:bt -author:doubt
   = column-specific search; author field contains 'bt' (stringinstr) and author field can NOT contain 'doubt' (! stringinstr)

So far I got most of the bases I can think of covered...but there's always something you forget...

Anyone like to chime in on this and/or have a good links to a mid-level programmer primer on how search engines work and coding considerations when creating such a beast?

TIA


Sean Shrum :: http://www.shrum.net

All my published AU3-based apps and utilities

'Make it idiot-proof, and someone will make a better idiot'

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×