Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 1.41 KB | None | 0 0
  1. #include <SQLite.au3>
  2. #include <SQLite.dll.au3>
  3.  
  4. $file=FileRead(@ScriptDir&'\1.txt')
  5. $str=StringRegExp($file,'[^;:\r\n]+',3)
  6.  
  7.  
  8. Local $aResults, $iRows, $iColumns
  9.  
  10.             _SQLite_Startup()
  11.             Select
  12.                 Case @error
  13.                     MsgBox(32, '', 'невозможно работать с db')
  14.                     Exit 1111
  15.             EndSelect
  16.             $hDb_mem = _SQLite_Open()
  17.  
  18.  
  19.     _SQLite_Exec($hDb_mem, 'create table if not exists t1 (a,b,c text);')
  20.     _SQLite_Exec($hDb_mem, 'create table if not exists t2 (a,b,c text);')
  21.     $zzz=''
  22.     For $i = 0 To UBound($str)-1 Step 3
  23.         $zzz&='insert into t1 values ("' & $str[$i] & '","' & $str[$i+1] & '","' & $str[$i+2]& '");'
  24.     Next
  25.     $file=FileRead(@ScriptDir&'\2.txt')
  26.     $str1=StringRegExp($file,'[^;:\r\n]+',3)
  27.     For $i = 0 To UBound($str1)-1 Step 3
  28.         $zzz&='insert into t2 values ("' & $str1[$i] & '","' & $str1[$i+1] & '","' & $str1[$i+2]& '");'
  29.     Next
  30.     _SQLite_Exec($hDb_mem, "begin;")
  31.     _SQLite_Exec($hDb_mem, $zzz)
  32.     _SQLite_Exec($hDb_mem, "commit;")
  33.  
  34.     _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)
  35.     $zzz=''
  36.     For $i = 1 To  UBound($aResults)-1
  37.         $zzz&=$aResults[$i][0]&':'&$aResults[$i][1]& @CRLF
  38.     Next
  39.     FileWrite(@ScriptDir&'\result.txt',$zzz)
  40. _SQLite_Close($hDb_mem)
  41. _SQLite_Shutdown()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement