Kaarafin Posted June 14, 2008 Posted June 14, 2008 This scipt ownd. Really nice job. TY. Make game a lot easier.
ivan Posted June 19, 2008 Posted June 19, 2008 (edited) Dear ptrex:compiling with beta 3.2.13.2 I get ERROR: undefined macro because the library uses @ProcessorArch instead of @OSArch.Made a note on the help and support forum topic bug in @ProcessorArch RegardsIVAN Edited June 19, 2008 by ivan Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
ptrex Posted June 20, 2008 Author Posted June 20, 2008 @ivan Thanks for the update. Can you tell me where in the lib this is used ? I couldn't find it immediately. regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
ivan Posted June 20, 2008 Posted June 20, 2008 Sure, in the file "SQLite.dll.au3", line 7 reads If @ProcessorArch <> "X86" Then and i get the compile error: >"H:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /beta /in "H:\Documents and Settings\iap\Desktop\banks\banks\DataBank_vz4.au3" /autoit3dir "H:\Program Files\AutoIt3\beta" +>13:29:28 Starting AutoIt3Wrapper v.1.10.1.7 Environment(Language:0409 Keyboard:0000080A OS:WIN_XP/Service Pack 2 CPU:X86) >Running AU3Check (1.54.13.0) from:H:\Program Files\AutoIt3\beta H:\Program Files\AutoIt3\beta\Include\SQLite.dll.au3(7,20) : ERROR: undefined macro. If @ProcessorArch <> ~~~~~~~~~~~~~~~~~~^ H:\Documents and Settings\iap\Desktop\banks\banks\DataBank_vz4.au3 - 1 error(s), 0 warning(s) !>13:29:30 AU3Check ended.rc:2 >Exit code: 0 Time: 4.223 Regards, IVAN Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
weaponx Posted June 20, 2008 Posted June 20, 2008 Hi, I am new with AutoIt and I like it very much. About the SQL UDF, I would like know how I can read the last record in the database without reading each record. I am using this code and I think there is a better way. pardon me if I am not using the right forum/format. CODELocal $TxList, $lNo _SQlite_Query($DataBase, "SELECT * FROM Daily ORDER BY TxNo ;", $Query) While _SQLite_FetchData($Query, $TxList) = $SQLITE_OK $lNo = $TxList[0] WEnd _SQLite_QueryFinalize($Query) Return($lNo) A little late but also a different approach. This will work on columns containing numbers or strings. opt("MustDeclareVars", 1) #include <SQLite.au3> Local $hQuery, $aRow, $sMsg,$d $d = _SQLite_Startup () $d = _SQLite_Open () ; open :memory: Database $d = _SQLite_Exec (Default, "CREATE TABLE aTest (a,b,c);") ; CREATE a Table $d = _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") ; INSERT Data $d = _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');") ; INSERT Data $d = _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');") ; INSERT Data $d = _SQlite_Query (-1, "SELECT MAX(a) FROM aTest;", $hQuery) ; the query While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK $sMsg &= $aRow[0] WEnd _SQLite_Exec (-1, "DROP TABLE aTest;") ; Remove the table ConsoleWrite($sMsg & @CR) _SQLite_Close() _SQLite_Shutdown()
Mattraks Posted July 21, 2008 Posted July 21, 2008 (edited) Just a quick question but just to clear this up, does this work if you already have a SQL database and stuff? Cause I'm not sure where it has the thing to connect to a specific database with user of X and pass of Y and then select schema of Z. Can someone just tell me if that does work with this?EDIT: Found what i needed. http://www.autoitscript.com/forum/index.php?showtopic=20814 Edited July 21, 2008 by Mattraks
Edek Posted August 11, 2008 Posted August 11, 2008 LiteX has been moved to assembla:https://www.assembla.com/spaces/litexNow you can easily browse LiteX sources in SVN repository.
ptrex Posted August 11, 2008 Author Posted August 11, 2008 @Edek Thanks for the update. I also noticed that the milage of this thread went over 100.000 !! regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
wraithdu Posted September 5, 2008 Posted September 5, 2008 (edited) Maybe I'm missing something very simple, but is there a way to save a "memory" db to a file db? And I don't mean just exporting the data manually, I mean to actually save the whole db to a file so it may be opened again later by SQLite. Basically the same functionality as the .dump command - I need to .dump the memory db, then I can call _SQLite_SQLiteExe("new.db", $out_from_dump, $out). In reverse, is there a way to load a file db into a "memory" db? I think when you open a file db with SQLite all changes are then made to the file directly. I ask because it's faster to work in memory, but it's essential to be able to save that DB to a file for later use. Edited September 5, 2008 by wraithdu
ptrex Posted September 5, 2008 Author Posted September 5, 2008 @wraithdu Not that I know of. Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
JorgeW Posted September 19, 2008 Posted September 19, 2008 @wraithdu: I had the same issue. The in-memory database is incredibly fast but needed this db for later use. Unfortunately, I couldn't find a copy either but in the SQLite documentation I found the "ATTACH DATABASE" thingy and gave it a try. It works very well without array manipulation for me. You may want to test it... I came up with the following function that takes the memory database and insert the tables into the file based database. Both database structures are identical (same table and column names). Func WriteMemDb2File(ByRef $objMemDbConn, ByRef $objFileDbConn, $strDbFileName) $strResult = _SQLite_Exec($objMemDbConn, "ATTACH DATABASE '" & $strDbFileName & "' AS FileDb;") $strResult = _SQLite_Exec($objMemDbConn, "INSERT INTO FileDb.File_Elements SELECT * FROM File_Elements;") $strResult = _SQLite_Exec($objMemDbConn, "INSERT INTO FileDb.Raw_File SELECT * FROM Raw_File;") $strResult = _SQLite_Exec($objMemDbConn, "DETACH DATABASE FileDb;") Return 1 EndFunc
wraithdu Posted September 26, 2008 Posted September 26, 2008 (edited) This is cool. Quick question. Are 'File_Elements' and 'Raw_File' special tables in SQlite, or specific to your DB? Oh, and do you have to _SQLite_Open() the new file DB first, or does ATTACH automatically create it? Edited September 26, 2008 by wraithdu
rroot Posted October 23, 2008 Posted October 23, 2008 @Edek If you're the one who develops it, thank you for litex. I absolutely love that library!
microsoft Posted December 21, 2008 Posted December 21, 2008 (edited) Thanks of this job Edited December 21, 2008 by microsoft
ivan Posted January 13, 2009 Posted January 13, 2009 I think I found an error in the help file example for the _SQLite_SQLiteExe function. Without calling _SQLite_Startup() before _SQLite_SQLiteExe I get an @error=1 (cannot create the db). It reads: expandcollapse popup#include <SQLite.au3> #include <SQLite.dll.au3> #include <file.au3> ;Filenames Local $sTsvFile = FileGetShortName(_TempFile(@ScriptDir,"~",".tsv")) Local $sDbFile = FileGetShortName(_TempFile(@ScriptDir,"~",".db")) ;Create Tsv File FileWriteLine($sTsvFile,"a" & @TAB & "b" & @TAB & "c") FileWriteLine($sTsvFile,"a1" & @TAB & "b1" & @TAB & "c1") FileWriteLine($sTsvFile,"a2" & @TAB & "b2" & @TAB & "c2") ;import (using SQLite3.exe) Local $sIn,$sOut,$i, $sCreate = "CREATE TABLE TblImport ("; for $i = 1 To _StringCountOccurance(FileReadLine($sTsvFile,1),@TAB) + 1 $sCreate &= "Column_" & $i & "," Next $sCreate = StringTrimRight($sCreate,1) & ");" $sIn = $sCreate & @CRLF; Create Table $sIn &= ".separator \t" & @CRLF; Select @TAB as Separator $sIn &= ".import '" & $sTsvFile & "' TblImport" & @CRLF _SQLite_SQLiteExe($sDbFile,$sIn,$sOut,-1,true) If @error = 0 Then ;Show Table (using SQLite3.dll) Local $iRows,$iColumns,$aRes _SQLite_Startup() ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CR) _SQLite_Open($sDbFile) _SQLite_GetTable2d(-1,"SELECT ROWID,* FROM TblImport;",$aRes,$iRows,$iColumns) _SQLite_Display2DResult($aRes); Output to Console _SQLite_Close() _SQLite_Shutdown() Else If @error = 2 Then ConsoleWrite("ERROR: Sqlite3.exe file not found" & @LF) Else ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @LF) EndIf EndIf ;Remove Temp Files FileDelete($sTsvFile) FileDelete($sDbFile) ;~ Output: ;~ rowid Column_1 Column_2 Column_3 ;~ 1 a b c ;~ 2 a1 b1 c1 ;~ 3 a2 b2 c2 Func _StringCountOccurance($sSearchString,$sSubString,$fCaseSense = 0); Returns Number of $sSubString in $sSearchString Local $iOccCnt = 1 Do If StringInStr($sSearchString,$sSubString,$fCaseSense,$iOccCnt) > 0 Then $iOccCnt += 1 Else ExitLoop EndIf Until 0 Return $iOccCnt - 1 EndFunc and should read: expandcollapse popup#include <SQLite.au3> #include <SQLite.dll.au3> #include <file.au3> ;Filenames Local $sTsvFile = FileGetShortName(_TempFile(@ScriptDir,"~",".tsv")) Local $sDbFile = FileGetShortName(_TempFile(@ScriptDir,"~",".db")) ;Create Tsv File FileWriteLine($sTsvFile,"a" & @TAB & "b" & @TAB & "c") FileWriteLine($sTsvFile,"a1" & @TAB & "b1" & @TAB & "c1") FileWriteLine($sTsvFile,"a2" & @TAB & "b2" & @TAB & "c2") ;import (using SQLite3.exe) Local $sIn,$sOut,$i, $sCreate = "CREATE TABLE TblImport ("; for $i = 1 To _StringCountOccurance(FileReadLine($sTsvFile,1),@TAB) + 1 $sCreate &= "Column_" & $i & "," Next $sCreate = StringTrimRight($sCreate,1) & ");" $sIn = $sCreate & @CRLF; Create Table $sIn &= ".separator \t" & @CRLF; Select @TAB as Separator $sIn &= ".import '" & $sTsvFile & "' TblImport" & @CRLF _SQLite_Startup() _SQLite_SQLiteExe($sDbFile,$sIn,$sOut,-1,true) If @error = 0 Then ;Show Table (using SQLite3.dll) Local $iRows,$iColumns,$aRes _SQLite_Startup() ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CR) _SQLite_Open($sDbFile) _SQLite_GetTable2d(-1,"SELECT ROWID,* FROM TblImport;",$aRes,$iRows,$iColumns) _SQLite_Display2DResult($aRes); Output to Console _SQLite_Close() _SQLite_Shutdown() Else If @error = 2 Then ConsoleWrite("ERROR: Sqlite3.exe file not found" & @LF) Else ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @LF) EndIf EndIf ;Remove Temp Files FileDelete($sTsvFile) FileDelete($sDbFile) ;~ Output: ;~ rowid Column_1 Column_2 Column_3 ;~ 1 a b c ;~ 2 a1 b1 c1 ;~ 3 a2 b2 c2 Func _StringCountOccurance($sSearchString,$sSubString,$fCaseSense = 0); Returns Number of $sSubString in $sSearchString Local $iOccCnt = 1 Do If StringInStr($sSearchString,$sSubString,$fCaseSense,$iOccCnt) > 0 Then $iOccCnt += 1 Else ExitLoop EndIf Until 0 Return $iOccCnt - 1 EndFunc Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
ptrex Posted January 14, 2009 Author Posted January 14, 2009 @ivanIndead this is a problem.But then the SQLStartup in here can disappear.If @error = 0 Then ;Show Table (using SQLite3.dll) Local $iRows,$iColumns,$aRes _SQLite_Startup() <------------------ remove ?!ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CR) _SQLite_Open($sDbFile) _SQLite_GetTable2d(-1,"SELECT ROWID,* FROM TblImport;",$aRes,$iRows,$iColumns) _SQLite_Display2DResult($aRes); Output to Console _SQLite_Close() _SQLite_Shutdown()Else If @error = 2 Then ConsoleWrite("ERROR: Sqlite3.exe file not found" & @LF) Else ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @LF) EndIfEndIfBest is to post a ccrrect working version as a bug section of AU3.Regardsptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
ivan Posted January 14, 2009 Posted January 14, 2009 @ivanIndead this is a problem.But then the SQLStartup in here can disappear.Best is to post a ccrrect working version as a bug section of AU3.RegardsptrexThanks ptrex.I installed AutoIt v3.3.0.0 and I am having trouble with _SQLite_Query. I wanted to confirm with other users if the same was happening before posting to the bug section of AU3. Specifically, this function returns a value $SQLITE_MISUSE = 21 ; /* Library used incorrectly */When I am absolutely sure I use it correctly. In fact the same happens with the example provided in the help file for the function _SQLite_Query... Anyone having the same trouble? For now, I'm switching to an older version of autoit, as I need to get a script working before 9:00 am tomorrow.Regards,IVAN Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
ptrex Posted January 15, 2009 Author Posted January 15, 2009 @Ivan Sorry I am not usng the AutoIt v3.3.0.0 version yet. So I can't test for now. Maybe some other users. Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
ivan Posted January 17, 2009 Posted January 17, 2009 @IvanSorry I am not usng the AutoIt v3.3.0.0 version yet. So I can't test for now.Maybe some other users.RegardsptrexPtrex,Thanks for your concern. My passion for autoit has me permanently downloading the newest versions and the betas, which means I often find myself having to revert to other versions when I stump into something I do not expect. I can't post it as a bug as I no longer have the latest autoit version installed. As soon as I finish a scriptwhich is taking longer than I first expected, I'll test it again, to see if it requires fixing.Regards,IVAN Think out of the boxGrabber: Yet another WinInfo tool_CSVLib (still alpha)Dynamic html in au3
panlatv Posted March 15, 2009 Posted March 15, 2009 (edited) Hello all, and sorry for my bad english.I have a problem, i know it's a usual question: In a dos console all it's ok (sql3.exe), but if i use autoit :_SQLite_Exec (-1,"INSERT INTO test (letter) values ("&chr(39)&"à"&chr(39)&");" )The " à " is transformed in "Ó"It's the same for "é" = "Ú"...So what can i do ? thank you __________________Edit:Ok, it's not perfect, but it's a solution:I use stringremplace:$data = StringReplace ( $data, "é","é" ) $data = StringReplace ( $data, "è","è" ) $data = StringReplace ( $data, "ë","ë" ) $data = StringReplace ( $data, "ê","ê" ) $data = StringReplace ( $data, "à","à" ) $data = StringReplace ( $data, "ù","ù" ) $data = StringReplace ( $data, "ô","ô" ) $data = StringReplace ( $data, "œ","œ") $data = StringReplace ( $data, "ï","ï") $data = StringReplace ( $data, "î","î") $data = StringReplace ( $data, "ç","ç") $data = StringReplace ( $data, "û","û") $data = StringReplace ( $data, "ü","ü") $data = StringReplace ( $data, "«","«") $data = StringReplace ( $data, "»","»") $data = StringReplace ( $data, "½","½") ... Edited March 15, 2009 by panlatv
Recommended Posts