无法创建 TABLE;为什么这段代码会失败?
Unable to CREATE TABLE; why does this code fail?
我对 SQLite v3.22.0 和 AutoIt v3.3.14.3 有疑问。尝试创建数据库有效,但未创建 table。我使用 AutoIt 示例代码:
#include <MsgBoxConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $hQuery, $aRow, $sMsg
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_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($MB_SYSTEMMODAL, "SQLite", "Get Data using a Query : " & $sMsg)
_SQLite_Close()
_SQLite_Shutdown()
; Output:
; Hello World
如果我请求 SQLite 错误,我得到 "Library used incorrectly"。这种情况下有什么问题?
Whats the problem in this case?
根据Documentation - Script breaking changes:
_SQLite_Startup()
function no longer automatically downloads the SQLite DLL files from autoitscript.com. Most users were completely unaware that this download was occuring on each script run and it was also a severe bandwidth hog for the website. The SQLite DLLs must now be manually download. See the _SQLite_Startup()
documentation for details.
如果省略了_SQLite_Startup()
的第一个参数,则此函数的dll文件必须位于@SystemDir
、@WindowsDir
、@ScriptDir
或@WorkingDir
成功。
- Download
sqlite3.dll
,
- 删除
#include <SQLite.dll.au3>
,然后
- 为
_SQLite_Startup()
的第一个参数提供 dll 文件的位置(如果存在于前面提到的四个位置之一,则为冗余)。
.
AutoIt v3.3.14.3 has a bug; install AutoIt v3.3.14.2 or get the bug-fix.
我对 SQLite v3.22.0 和 AutoIt v3.3.14.3 有疑问。尝试创建数据库有效,但未创建 table。我使用 AutoIt 示例代码:
#include <MsgBoxConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
Local $hQuery, $aRow, $sMsg
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_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($MB_SYSTEMMODAL, "SQLite", "Get Data using a Query : " & $sMsg)
_SQLite_Close()
_SQLite_Shutdown()
; Output:
; Hello World
如果我请求 SQLite 错误,我得到 "Library used incorrectly"。这种情况下有什么问题?
Whats the problem in this case?
根据Documentation - Script breaking changes:
_SQLite_Startup()
function no longer automatically downloads the SQLite DLL files from autoitscript.com. Most users were completely unaware that this download was occuring on each script run and it was also a severe bandwidth hog for the website. The SQLite DLLs must now be manually download. See the_SQLite_Startup()
documentation for details.
如果省略了_SQLite_Startup()
的第一个参数,则此函数的dll文件必须位于@SystemDir
、@WindowsDir
、@ScriptDir
或@WorkingDir
成功。
- Download
sqlite3.dll
, - 删除
#include <SQLite.dll.au3>
,然后 - 为
_SQLite_Startup()
的第一个参数提供 dll 文件的位置(如果存在于前面提到的四个位置之一,则为冗余)。
AutoIt v3.3.14.3 has a bug; install AutoIt v3.3.14.2 or get the bug-fix.