Sign in to follow this  
Followers 0
evilpacketmonkey

Typo in AutoIT Help _SQLite_GetTable?

2 posts in this topic

I want to make sure I in fact did spot a typo in the AutoIT help (I am too much a newbie to think I should just submit it as a bug).

In the help under _SQLite_GetTable

I think line 49 has an typo with ")" as I was getting an error message when attempting to run.

Comment it out and things work...

Would someone more senior make sure it's not a newbie mistake?

Thanks!

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

Local $aResult, $iRows, $iColumns, $iRval

_SQLite_Startup ()
If @error > 0 Then
    MsgBox(16, "SQLite Error", "SQLite.dll Can't be Loaded!")
    Exit - 1
EndIf
ConsoleWrite("_SQLite_LibVersion=" &_SQLite_LibVersion() & @CR)
_SQLite_Open (); Open a :memory: database
If @error > 0 Then
    MsgBox(16, "SQLite Error", "Can't Load Database!")
    Exit - 1
EndIf

;Example Table
;   Name        | Age
;   -----------------------
;   Alice      | 43
;   Bob      | 28
;   Cindy      | 21

If Not _SQLite_Exec (-1, "CREATE TEMP TABLE persons (Name, Age);") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Alice','43');") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Bob','28');") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())
If Not _SQLite_Exec (-1, "INSERT INTO persons VALUES ('Cindy','21');") = $SQLITE_OK Then _
        MsgBox(16, "SQLite Error", _SQLite_ErrMsg ())

; Query
$iRval = _SQLite_GetTable (-1, "SELECT * FROM persons;", $aResult, $iRows, $iColumns)
If $iRval = $SQLITE_OK Then
;~  $aResult Looks Like this:
;~    [0]   = 8
;~    [1]   = Name
;~    [2]   = Age
;~    [3]   = Alice
;~    [4]   = 43
;~    [5]   = Bob
;~    [6]   = 28
;~    [7]   = Cindy
;~    [8]   = 21
    _ArrayDisplay($aResult, "Query Result")
)
Else
    MsgBox(16, "SQLite Error: " & $iRval, _SQLite_ErrMsg ())
EndIf

_SQLite_Close ()
_SQLite_Shutdown ()

Share this post


Link to post
Share on other sites



Yes, you spotted it right.

I get the same results.

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  
Followers 0