1. EDS request
- Posted by Mike Sabal <MikeS at NOTATIONS.COM> Mar 17, 2000
- 432 views
Four functions that would be really nice to have in database.e: global function db_lock(sequence path) global function db_unlock(sequence path) global function db_get_key(sequence key) global function db_next_key(sequence key) I expect that db_lock and db_unlock are fairly self-explanatory -- they = are needed only because the file id of each database file is private to = the include file as it should be. The global functions are needed to get = around this. As for db_get_key, what I am looking for is the ability to pass in a = partial key, and return the first key that matches. db_next_key would simply return whatever the next key after the given key = is. The problem is this: say I have the following keys: 011234567BLA 011234567WHI 011234567BLU 011234567RED 012345678BLA I want to get all the records whose keys start with "011234567". If I = don't know the last three letters, I can't get the key. Trying to do a = random search is unrealistic. And if I use the record numbers, a linear = search is too slow, and the records are unsorted. Any help (or revisions) = would be appreciated.
2. Re: EDS request
- Posted by Kat <gertie at ZEBRA.NET> Mar 17, 2000
- 407 views
- Last edited Mar 18, 2000
> > ----- Original Message ----- > From: "Mike Sabal" <MikeS at NOTATIONS.COM> > To: <EUPHORIA at LISTSERV.MUOHIO.EDU> > Sent: Friday, March 17, 2000 12:25 PM > Subject: EDS request > > > As for db_get_key, what I am looking for is the ability to pass in a partial > key, and return the first key that matches. > > db_next_key would simply return whatever the next key after the given key > is. > > The problem is this: say I have the following keys: > > 011234567BLA > 011234567WHI > 011234567BLU > 011234567RED > 012345678BLA > > I want to get all the records whose keys start with "011234567". If I don't > know the last three letters, I can't get the key. Trying to do a random > search is unrealistic. And if I use the record numbers, a linear search is > too slow, and the records are unsorted. Any help (or revisions) would be > appreciated. Wouldn't it be a good idea to have access to the key list and the applications that own them? That way you could concieveably tell the DB that since some application crashed, it should unlock the section it had locked. Same for if a application locks a section, crashes, restarts, and wants access to that section again. Kat
3. Re: EDS request
- Posted by Robert Craig <rds at ATTCANADA.NET> Mar 17, 2000
- 419 views
- Last edited Mar 18, 2000
Mike Sabal writes: > The problem is this: say I have the following keys: > > 011234567BLA > 011234567WHI > 011234567BLU > 011234567RED > 012345678BLA > > I want to get all the records whose keys start with "011234567". Use: db_find_key("011234567") db_find_key("012345678") These will both fail, but they will both return a negative number that indicates the position that these keys would occupy in the table if they were inserted. Use these negative results to set up a for loop, e.g. a = -a b = -b for rec = a to b-1 do ... end for db_find_key() uses binary search, so it's quite fast. This feature wasn't documented very well. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com