In my recent project I'm downloading a bunch of data, so I decided to store it in a SQLite database. NOTE: I'm using sqlite3_x64.dll
Everything is working just fine but I'm struggling with getting the Median value. SQLite has an Average function but not a Median one.
I googled but all of the provided solutions are way above my pay-grade. After some more searching I found 'extension-functions.c' on the SQLite site where Median is included. After almost an hour of struggling I was able to successfully compile it into a DLL.
So I downloaded @jchd's SQLiteExtLoad.au3 as seen here:
But I'm getting these errors:
"Path\SQLiteExtLoad.au3"(21,40) : warning: $g_hDll_SQLite: possibly used before declaration. Local $RetVal = DllCall($g_hDll_SQLite, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ "Path\SQLiteExtLoad.au3"(21,40) : error: $g_hDll_SQLite: undeclared global variable. Local $RetVal = DllCall($g_hDll_SQLite, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ So I tried, copying the function to my file and changing the DLL variable ($g_hDll_SQLite) directly to the DLL location (C:\...\.. .dll), but now this error fires
If __SQLite_hChk($hConn, 1) Then Return SetError(@error, 0, $SQLITE_MISUSE) To be honest, I don't know what to use as the $hConn - handle of connection.
I would appreciate any help, be it getting the median using SQLite queries or getting the DLL extension loaded using AutoIt.
EDIT: well, I suspect the $hConn variable refers to the return value of the _SQLite_Open function. Well, at least now _SQLite_EnableExtensions doesn't give errors. Now I run into problems with _SQLite_LoadExtension, which gives error -1, and extended 1. Apparently the 1 constant is a generic error where other error do not apply.
BTW, anybody knows whether I need to compile the extension DLL "into" x64 when I use a x64 SQLite? That might be the problem...
EDIT2: I recompiled the dll and tried it using the SQLite3.exe and it works, so I'm confident the extension DLL has been created correctly
..let's say I store in a mysql column "[1,2,11,12,123]".
How can I make s query to get all those rows that is 1, or is 12, etc ?
I'm using mysqlnd 5.0.11-dev - 20120503
Any advise on what technique I should use is welcomed
PS: ..I'm adding a comma to each end, as in [,1,2,11,12,123,] and will search with like %,12,% .
Not pretty but I'm in a hurry and can't come up with a better solution =/
I have been testing AutoIt 126.96.36.199 with SQLite, and the Help File examples. The examples that I have tested are throwing errors or not doing anything. I have sqlite3.dll, sqlite3_x64.dll, and sqlite3.exe in the directories with the testing script. I am copying the examples directly from the help file into a test script for testing with no edits. The _SQLite_GetTable2d example is returning an error ("Library used incorrectly") with each _SQLite_Exec command. The _SQLite_FastEncode example returns an empty dialog box. The _SQLite_Exec example only prints out the SQLite version, and nothing else in the SciTE console. Currently, I'm still searching for what is causing this issue. I'm on Windows 7 Enterprise 64-bit. Is anyone else having this issue?
I have SQLite setup within my AutoIT program...I'm trying to accomplish what should be a relatively simple task. I want to be able to return an array of 'table' names for an established database...I believe this might be possible using the '_SQLite_SQLiteExe' command...since it seems to be able to access SQLite schemas...? The ".tables" command is one of them...if I am not mistaken that command returns a list of all table names in the active database.
I am attempting the following:
#include <SQLite.au3> #include <SQLite.dll.au3> Global $hDb, $sIn, $sOut ... $sIn = ".tables" & @CRLF _SQLite_SQLiteExe($hDb, $sIn, $sOut) if @error == 0 Then ;Show Table (using SQLite3.dll) Else if @error == 2 Then ConsoleWrite("ERROR: Sqlite3.exe file not found" & @CRLF) Else ConsoleWrite("ERROR: @error=" & @error & " when calling _SQLite_SQLiteExe" & @CRLF) EndIf ;@error is "2"...OR NOT... EndIf ;@error is "0"...OR NOT... ... The error being thrown is "ERROR: Sqlite3.exe file not found" ...
Am I required to have the Sqlite3.exe installed in my directory (i.e. @ScriptsDir)...??? I do not have it in there at present because I did not believe it was necessary with the 'include' calls to "SQLite.au3" and "SQLite.dll.au3"...any advice appreciated. Thanks in advance.
I already have a formula which will select doublicates, but sometimes there might be entries with additional information starting after "-", which I now want to trim away.
Current formula is:
Select DISTINCT a.title, a.oid, a.size, a.disk from DB a, DB b where (a.title like b.title and a.oid <> b.oid)" & $ActiveDisks_Filter & " AND (a.comment <> 'Delete' AND b.comment <> 'Delete') Order by a.title ASC, a.size DESC; testwise I want to add a simple solution like left, but afterwards I get an error but I do not know why.
Select DISTINCT a.title, a.oid, a.size, a.disk from DB a, DB b where (left(a.title,15) like b.title and a.oid <> b.oid) Order by a.title ASC, a.size DESC; Error: near "(": syntax error: Finally I would like to insert intstr to search for "-" but currently I am not able to extend my current code =/
Thanks a lot for your help.
EDIT: hey, I managed it, left was not working also it was somehow shown that the tool knowed the comment. I did it now with substr+instr
(substr(a.title, 1, instr(a.title, ' - '))