Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SQLite.au3>
- #include <SQLite.dll.au3>
- $file=FileRead(@ScriptDir&'\1.txt')
- $str=StringRegExp($file,'[^;:\r\n]+',3)
- Local $aResults, $iRows, $iColumns
- _SQLite_Startup()
- Select
- Case @error
- MsgBox(32, '', 'невозможно работать с db')
- Exit 1111
- EndSelect
- $hDb_mem = _SQLite_Open()
- _SQLite_Exec($hDb_mem, 'create table if not exists t1 (a,b,c text);')
- _SQLite_Exec($hDb_mem, 'create table if not exists t2 (a,b,c text);')
- $zzz=''
- For $i = 0 To UBound($str)-1 Step 3
- $zzz&='insert into t1 values ("' & $str[$i] & '","' & $str[$i+1] & '","' & $str[$i+2]& '");'
- Next
- $file=FileRead(@ScriptDir&'\2.txt')
- $str1=StringRegExp($file,'[^;:\r\n]+',3)
- For $i = 0 To UBound($str1)-1 Step 3
- $zzz&='insert into t2 values ("' & $str1[$i] & '","' & $str1[$i+1] & '","' & $str1[$i+2]& '");'
- Next
- _SQLite_Exec($hDb_mem, "begin;")
- _SQLite_Exec($hDb_mem, $zzz)
- _SQLite_Exec($hDb_mem, "commit;")
- _SQLite_GetTable2d($hDb_mem, 'select t1.a,t2.c from t1,t2 where t1.b=t2.a and t1.c=t2.b;', $aResults, $iRows, $iColumns)
- $zzz=''
- For $i = 1 To UBound($aResults)-1
- $zzz&=$aResults[$i][0]&':'&$aResults[$i][1]& @CRLF
- Next
- FileWrite(@ScriptDir&'\result.txt',$zzz)
- _SQLite_Close($hDb_mem)
- _SQLite_Shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement