jorgeng Posted May 27, 2008 Posted May 27, 2008 (edited) Hello! I have managed to do a tcp send. I was happy but then get new info that for every tcp send i will have to store information about customer and data sent in a database, table. I have read help-file that autoit supports sql commands but for what i can see there is only possible to have a table in memory. Is it possible to create an sql table and to insert of rows, update from autoit and store it on disk? I'm thinking of sqlite, see example: #include <SQLite.au3> #include <SQLite.dll.au3> Local $hQuery, $aRow, $sMsg _SQLite_Startup () _SQLite_Open () ; open :memory: Database _SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);") ; CREATE a Table _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") ; INSERT Data _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');") ; INSERT Data _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');") ; INSERT Data _SQlite_Query (-1, "SELECT c FROM aTest ORDER BY a;", $hQuery) ; the query While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK $sMsg &= $aRow[0] WEnd ;_SQLite_Exec (-1, "DROP TABLE aTest;") ; Remove the table MsgBox(0,"SQLite","Get Data using a Query : " & $sMsg ) _SQLite_Close() _SQLite_Shutdown() ;~ Output: ;~ ;~ Hello World Edited May 27, 2008 by jorgeng
ChrisL Posted May 27, 2008 Posted May 27, 2008 Hello! I have managed to do a tcp send. I was happy but then get new info that for every tcp send i will have to store information about customer and data sent in a database, table. I have read help-file that autoit supports sql commands but for what i can see there is only possible to have a table in memory. Is it possible to create an sql table and to insert of rows, update from autoit and store it on disk? I'm thinking of sqlite, see example: #include <SQLite.au3> #include <SQLite.dll.au3> Local $hQuery, $aRow, $sMsg _SQLite_Startup () _SQLite_Open () ; open :memory: Database _SQLite_Exec (-1, "CREATE TABLE aTest (a,b,c);") ; CREATE a Table _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") ; INSERT Data _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3',' ');") ; INSERT Data _SQLite_Exec (-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hello');") ; INSERT Data _SQlite_Query (-1, "SELECT c FROM aTest ORDER BY a;", $hQuery) ; the query While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK $sMsg &= $aRow[0] WEnd ;_SQLite_Exec (-1, "DROP TABLE aTest;") ; Remove the table MsgBox(0,"SQLite","Get Data using a Query : " & $sMsg ) _SQLite_Close() _SQLite_Shutdown() ;~ Output: ;~ ;~ Hello World _SQLite_Open ("c:\MyTable.db") will open it as a file [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire
ptrex Posted May 27, 2008 Posted May 27, 2008 @jorgeng A good approach might be the you open a "In Memory DB" AND a "Physical DB" The in memory DB can be used to keep track of who is connected over TCP. Also you can write back the info who logged on and what query was run, etc. The Query of course should be processed against the physical DB. Once the query is executed properly you can delete it back from the In Memory DB. This way the In Memory DB functions as a Queue and logging DB. I hope this can help. 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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now