Modify

Opened 6 years ago

Closed 6 years ago

#2635 closed Bug (No Bug)

Sqlite don't work with windows 2008 R2

Reported by: raclius@… Owned by:
Milestone: Component: AutoIt
Version: 3.3.10.2 Severity: None
Keywords: Cc:

Description

Hi,
I have a strange behavior between sqlite and Windows 2008 R2

Sample of Autoit CHM :

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <MsgBoxConstants.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

This sample of Autoit don't work and return :

_SQLite_LibVersion=0
"F:\ObotAnalogs\New AutoIt v3 Script.au3" (26) : ==> Subscript used on non-accessible variable.:
MsgBox(0, "One of the values for key > 2:", $aRow[0])
MsgBox(0, "One of the values for key > 2:", $aRow ERROR

I have lot of scripts with sqlite who works in XP or Seven but no under Windows 2008 R2

Best regards
Mehdi

Attachments (0)

Change History (8)

comment:1 Changed 6 years ago by BrewManNH

_SQL_Startup attempts to download the SQLite.DLL file to the @SystemDir folder if it's not found in the @ScriptDir or the @WorkingDir. If you don't have access to that folder it won't download the dll, you should use @RequireAdmin if you need to have the script download the dll.

The best thing to do would be to put the dll file in the script directory instead of having the script attempt to download it. The help file does explain all of this.

comment:2 follow-up: Changed 6 years ago by Jpm

In fact if no .dll found a temporary .dll is supposed to be downloaded.
I don't know what Windows 2008 R2 does which makes the downloading bad

Just change _SQLite_Startup()
to
Local $sDll = _SQLite_Startup()
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$sDll' & @CRLF & @CRLF & 'Return:' & @CRLF & $sDll & @CRLF & @CRLF & '@error:' & @CRLF & @error & @CRLF & @CRLF & '@extended:' & @CRLF & @extended & ' (0x' & Hex(@extended) & ')') ;### Debug MSGBOX

to see what is going wrong in your environment

Windows8.1 32-bit/64-bit is OK for me

comment:3 in reply to: ↑ 2 Changed 6 years ago by anonymous

Replying to Jpm:

In fact if no .dll found a temporary .dll is supposed to be downloaded.
I don't know what Windows 2008 R2 does which makes the downloading bad

Just change _SQLite_Startup()
to
Local $sDll = _SQLite_Startup()
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$sDll' & @CRLF & @CRLF & 'Return:' & @CRLF & $sDll & @CRLF & @CRLF & '@error:' & @CRLF & @error & @CRLF & @CRLF & '@extended:' & @CRLF & @extended & ' (0x' & Hex(@extended) & ')') ;### Debug MSGBOX

to see what is going wrong in your environment

Windows8.1 32-bit/64-bit is OK for me

##################################
Thank you for your answers.
I copied the sqlite3.dll file in the same directory and I tried this:

#RequireAdmin
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <MsgBoxConstants.au3>

Local $hQuery, $aRow, $sMsg
Local $sSQliteDll
$sSQliteDll = _SQLite_Startup()

If @error Then

MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
"Not FOUND in @SystemDir, @WindowsDir, @ScriptDir or @WorkingDir")
Exit -1

EndIf

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

Result Sqlite3.dll can't be load but i don't understand why

#########################################
I also tried here and there ok :

#include <SQLite.au3>
#include <Constants.au3>

Local $sSQliteDll
$sSQliteDll = _SQLite_Startup()
If @error Then

MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!" & @CRLF & @CRLF & _
"Not FOUND in @SystemDir, @WindowsDir, @ScriptDir or @WorkingDir")
Exit -1

EndIf

MsgBox($MB_SYSTEMMODAL, "SQLite3.dll Loaded", $sSQliteDll & " (" & _SQLite_LibVersion() & ")")
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Shutdown()

comment:4 follow-up: Changed 6 years ago by Jpm

not using #include <SQLite.dll.au3> will use the SQLite3.dll you put in your dir
so the _SQLite_Startup() is OK.
to debug you can copy the SQLite.au" in your @scriptdir and change Inside _SQLite_Startup() to have the error cde of the download

			__SQLite_Download_SQLite3Dll($sDll_Filename, $vInlineVersion)
			If @error Then Return SetError(@error, @extended, "") ; download not successful === line added

PS I assume you get the SQLite3.dll from your XP/Seven environment

comment:5 Changed 6 years ago by jchd18

This belongs to the help forum.

comment:6 in reply to: ↑ 4 ; follow-up: Changed 6 years ago by anonymous

Replying to Jpm:

not using #include <SQLite.dll.au3> will use the SQLite3.dll you put in your dir
so the _SQLite_Startup() is OK.
to debug you can copy the SQLite.au" in your @scriptdir and change Inside _SQLite_Startup() to have the error cde of the download

			__SQLite_Download_SQLite3Dll($sDll_Filename, $vInlineVersion)
			If @error Then Return SetError(@error, @extended, "") ; download not successful === line added

PS I assume you get the SQLite3.dll from your XP/Seven environment

############################################

Thanks you for your help !

comment:7 in reply to: ↑ 6 Changed 6 years ago by anonymous

Replying to anonymous:

Replying to Jpm:

not using #include <SQLite.dll.au3> will use the SQLite3.dll you put in your dir
so the _SQLite_Startup() is OK.
to debug you can copy the SQLite.au" in your @scriptdir and change Inside _SQLite_Startup() to have the error cde of the download

			__SQLite_Download_SQLite3Dll($sDll_Filename, $vInlineVersion)
			If @error Then Return SetError(@error, @extended, "") ; download not successful === line added

PS I assume you get the SQLite3.dll from your XP/Seven environment

############################################

Thanks you for your help, everything works again !

comment:8 Changed 6 years ago by Jpm

  • Resolution set to No Bug
  • Status changed from new to closed

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.