Jump to content
Sign in to follow this  
Iczer

_SQLite_Open() return value understanding

Recommended Posts

Iczer

Is _SQLite_Open() return value (a database handle) can be equal to zero when everything is normal - without setting @error macro ?

first construction sometimes show "_SQLite_Open failed" but second is not

_SQLite_Startup($PathToSQLiteDLL)
If @error Then Return SetError(12 + MsgBox(16, "SQLite Error", "_SQLite_Startup failed"))
ConsoleWrite("_SQLite_Startup status: @error = " & @error & '; @extended = ' & @extended & @LF)
ConsoleWrite("_SQLite_LibVersion() = "&_SQLite_LibVersion()&@crlf)
$HTMLtoXMLDB = _SQLite_Open()
ConsoleWrite("_SQLite_Open status: @error = " & @error & '; @extended = ' & @extended & @LF)
If $HTMLtoXMLDB = 0 Then Return SetError(13 + MsgBox(16, "SQLite Error", "_SQLite_Open failed"))
_SQLite_Startup($PathToSQLiteDLL)
If @error Then Return SetError(12 + MsgBox(16, "SQLite Error", "_SQLite_Startup failed"))
ConsoleWrite("_SQLite_Startup status: @error = " & @error & '; @extended = ' & @extended & @LF)
ConsoleWrite("_SQLite_LibVersion() = "&_SQLite_LibVersion()&@crlf)
$HTMLtoXMLDB = _SQLite_Open()
$SQLiteOpenStatus_error = @error
$SQLiteOpenStatus_extended = @extended
ConsoleWrite("_SQLite_Open status: @error = " & $SQLiteOpenStatus_error & '; @extended = ' & $SQLiteOpenStatus_extended & @LF)
If $SQLiteOpenStatus_error Then Return SetError(13 + MsgBox(16, "SQLite Error", "_SQLite_Open failed"))

Share this post


Link to post
Share on other sites
Geir1983

According to the documentation if it returns a zero its a failure?

Success: a database handle. Failure: 0.

@error: -1 - SQLite Reported an Error (Check @extended Value)
1 - Error Calling SQLite API 'sqlite3_open_v2'
2 - Error while converting filename to UTF-8
3 - _SQLite_Startup() not yet called @extended: value can be compared against $SQLITE_* constants

Edited by Geir1983

Share this post


Link to post
Share on other sites
Iczer

that's why i'm asking :)

Share this post


Link to post
Share on other sites
jchd

I don't get any error. The connection handle is an actual pointer which can't be 0 if all goes right.

Which version of AutoIt and SQLite dll are you using?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Iczer

AutoIt - 3.3.10.2

SQLite dll - 3.8.5.0 from autoit site

if i comment this line - db (_SQLite_Exec(), _SQLite_GetTable() ) is working normally, without errors

Share this post


Link to post
Share on other sites
jchd

Which line do you have to comment to make your failing code example work?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Iczer

If $HTMLtoXMLDB = 0 Then ...

Share this post


Link to post
Share on other sites
jchd

That's odd. I can't reproduce what you're observing. Post a short self-contained repro please.

BTW, this:

#AutoIt3Wrapper_Run_AU3Check=n
#AutoIt3Wrapper_UseX64=y

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

_SQLite_Startup()
If @error Then Return SetError(12 + MsgBox(16, "SQLite Error", "_SQLite_Startup failed"))
Exit

works for x86 but running for x64 without the _x64.dll present (it should be downloaded) raises an error that I still have investigate later. After that the SciTE console shows a surprising error:

>Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\jc\Documents\AutoMAT\tmp\b.au3"    
--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
@@ Debug(257) : __SQLite_Download_SQLite3File : $URL = http://www.autoitscript.com/autoit3/files/beta/autoit/archive/sqlite/sqlite3_x64.dll
    $sTempfile = C:\Users\jc\AppData\Local\Temp\~rwqngow.dll
>Error: 13
"C:\Users\jc\Documents\AutoMAT\tmp\b.au3" (22) : ==> Invalid keyword at the start of this line.:
If @error Then Return SetError(12 + MsgBox(16, "SQLite Error", "_SQLite_Startup failed"))
If @error Then ^ ERROR
->17:59:10 AutoIt3.exe ended.rc:1

Running the script as x86 doesn't raise any issue, whether or not the dll already exists (AFAICT) for release or beta.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
UEZ

Same on my notebook running Win 8.1 x64.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites
water

You use Return but the statement is not within a function. Replace with Exit and the error should be gone.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
jchd

Argh, that was obvious (now that I see it). I copy/pasted code from the OP without suspecting that, looking elsewhere.

Now it remains to get why InetGet errors with 13 for x64...


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Jos

Argh, that was obvious (now that I see it). I copy/pasted code from the OP without suspecting that, looking elsewhere.

Now it remains to get why InetGet errors with 13 for x64...

Both answers are in the "other" thread ;)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
jchd

OK thanks. Not proud of that, but anyway...


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
jchd

Iczer,

The code you posted (which I blindly pasted) has the same issue Jos is talking about: you use Rturn but that line is outside a function.

The other issue your question raised is that the x64 version of the SQLite dll has the wrong filename in the download directory, but since you already use a dll path variable I guess it is no problem. Also you can download the x64 version and rename it yourself should you need it.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×