MDCT,
Have you considered an SQLite solution?
kylomas
edit:
The following is an example of SQLite usage. It has nothing to do with your problem, it is simply an example of SQLite syntax, usage and speed, at a very simple level.
; *** Start added by AutoIt3Wrapper ***
#include <GUIConstantsEx.au3>
; *** End added by AutoIt3Wrapper ***
#include <sqlite.au3>
#AutoIt3Wrapper_Add_Constants=n
local $Parts_fl = @scriptdir & '\Parts.txt'
local $Parts_DB = @scriptdir & '\Parts.DB3'
;--------------------------------------------------------------------------------------------------------
; generate test file of 5,000 comma delimited items, 3 entries (cols) per line (row) if $refresh is true
;--------------------------------------------------------------------------------------------------------
local $refresh = true
if $refresh then filedelete($Parts_fl)
if not fileexists($Parts_fl) then
local $hfl = fileopen($Parts_fl,2)
if $hfl = -1 then
ConsoleWrite('File open failed' & @LF)
Exit
endif
local $str_out
for $1 = 1 to 5000
$str_out &= stringformat('%05i,M%05s,V%05s\n',$1,$1 & '-' & random(1,999,1),$1 & '-' & random(1,999,1))
Next
filewrite($hfl,$str_out)
fileclose($hfl)
$hfl = 0
endif
;---------------------------------------------------------------------------------------
; initialize SQLite and open Parts DB
;---------------------------------------------------------------------------------------
local $sqlstrt = _SQLite_Startup(), $st = timerinit()
if @error then
ConsoleWrite('error loading sqlite.dll' & @LF)
Exit
EndIf
local $hmemDB = _sqlite_open($Parts_DB)
if @error then
ConsoleWrite('Unable to open DB' & @LF)
_Exit()
EndIf
if $refresh then _reload()
func _reload()
; drop "parts" table if it exists, re-define and reload it
if _sqlite_exec(-1,'drop table if exists parts;') <> $sqlite_ok then
ConsoleWrite('Drop table failed' & @LF)
_exit()
Else
ConsoleWrite('Parts table dropped for refresh' & @LF)
endif
if _sqlite_exec(-1,'create table parts (SKU, Model, Version);') <> $sqlite_ok then
ConsoleWrite('Create Table Failed' & @LF)
_exit()
endif
local $fl_array
_filereadtoarray($Parts_fl,$fl_array)
switch @error
case 1
ConsoleWrite('Input file failed to open' & @LF)
_exit()
case 2
ConsoleWrite('Unable to split file' & @LF)
_exit()
EndSwitch
local $aLine, $sql
ProgressOn('Loading Parts Table','Please Wait')
_SQLite_Exec(-1, "begin immediate;")
for $1 = 1 to $fl_array[0]
progressset(($1/$fl_array[0])*100)
$aLine = stringsplit($fl_array[$1],',')
$sql = 'insert into parts values ('
for $2 = 1 to $aLine[0]
$sql &= '"' & $aLine[$2] & '",'
next
$sql = stringtrimright($sql,1)
$sql &= ');'
if _sqlite_exec(-1,$sql) <> $sqlite_ok Then
ConsoleWrite('Table insert failed STMT = ' & $sql & @LF)
_exit()
endif
next
_SQLite_Exec(-1, "commit;")
progressoff()
ConsoleWrite('Table loaded with ' & ubound($fl_array)- 1 & ' records in ' & round(timerdiff($st)/1000,3) & ' seconds' & @LF)
endfunc
;---------------------------------------------------------------------------------------
; display SKU query dialaog
;---------------------------------------------------------------------------------------
local $gui010 = guicreate('SKU Query Mini-APP Using SQLITE',300,170)
local $aSize = wingetclientsize($gui010)
guictrlcreatelabel('Enter SKU for Query',40,20,150,20)
guictrlsetfont(-1,10,600)
GUICtrlSetColor(-1,0xaa0000)
local $inp010 = guictrlcreateinput('',190,20,40,20)
local $lbl010 = guictrlcreatelabel('',70,60,250,50)
guictrlsetfont(-1,10,600,-1,'Courier New')
guictrlsetcolor(-1,0x000099)
local $btn010 = guictrlcreatebutton('Submit Query',10,$aSize[1]-30,$aSize[0]-20,20)
guictrlsetfont(-1,9,600)
local $dmy010 = GUICtrlCreateDummy()
guisetstate()
local $aAccelKeys[1][2] = [["{ENTER}", $dmy010]]
GUISetAccelerators($aAccelKeys)
local $aRow, $ret
while 1
switch guigetmsg()
case $gui_event_close
_exit()
case $btn010, $dmy010
_disp()
endswitch
wend
func _disp()
$ret = _SQLite_QuerySingleRow(-1,'select SKU,Model,Version from parts where SKU = "' & stringformat('%05s',guictrlread($inp010)) & '";', $aRow)
if $ret = $sqlite_ok then
guictrlsetdata($lbl010,stringformat('%-10s%5s\n%-10s%5s\n%-10s%5s','SKU',$aRow[0],'Model',$aRow[1],'Version',$aRow[2]))
Else
guictrlsetdata($lbl010,guictrlread($inp010) & ' Not Found')
endif
guictrlsetstate($inp010,$gui_focus)
endfunc
func _exit()
_SQLite_Close()
_SQLite_Shutdown()
exit
endfunc