Finding data in Euphoria databases
- Posted by ZNorQ <znorq at holhaug.com> Jul 17, 2006
- 565 views
I have plans to make use of Euphoria's database.e (EuDB) archive, and I've done some minor testing, but I haven't gotten around to really stress test it. But I've come as far as to see how it is build up - using 'keys' and 'data' sections for each record. Generally I create a key by using the db_table_size()+1 function, usually by adding some kind of prefix - like "COMP" for "COMPANIES", etc., but I found out that the database only have a built in search function on the key, and not the data itself. This makes me think that in order to find information effectively in typical fields where people would search for information should really be part of the key..? AFAIK, keys can't be changed after it's creation (which I see as a good thing), which again would make it difficult to use since this information can't be corrected if any punching mistakes where made. The only way I see to search for information in records data section now, is to loop through each record and 'find'ing or 'match'ing each data section with what-ever one would need to search for.
atom SearchIdx for cntrec = 1 to db_table_size() do if match("rds", db_record_data()) then SearchIdx = cnt exit end if end for
This is quite slow. Of course, one could limit the search by looking at the specific sequence element (field) taken from db_record_data() so that it dosen't search through the whole record, but it would still require the code to read the whole record before searching for the information. Question 1; Anyone got any experience using large amounts of data? How effective is EuDB in finding, inserting and deleting records? Question 2; Finding; What solution do you use? Kenneth