Jump to content

_SQLite_Open() return value understanding


Recommended Posts

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"))
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...