Jump to content

SQLiteEx - Example Syntax Error?


Recommended Posts

Started messing around with SQLiteEx to see about using for a project I have in mind.

Downloaded and installed SQLiteEx, including the example script, but I get a syntax error upon execution...

so I started breaking down the SQL statement by commenting out parts of it and adding it back in a little at a time.

;Examples of work with SQLiteEx - simple SQLite interface for AutoIt

#Include 'SQLiteEx.au3'

$bVerbose = TRUE

;----------------------FIRST DATABASE--------------------------------------------------------------
$sDB_Earth          = 'earth_2012'
$sTableCountries    = 'countries'

$sSQL =  "CREATE TABLE " & $sTableCountries & " (country text, internet_users integer, population integer);" & @CR
$sSQL &= "INSERT INTO " & $sTableCountries & " (country, internet_users, population) VALUES " & @CR
$sSQL &= "('Brazil',        99357737,   193946886)," & @CR
$sSQL &= "('China',         568192066,  1343239923)"    & @CR
;$sSQL &= "('India',            151598994,  1205073612),"   & @CR
;$sSQL &= "('Japan',            100684474,  127368088),"    & @CR
;$sSQL &= "('Russia',       75926004,   142517670),"    & @CR
;$sSQL &= "('United States',    254295536,  313847465),"    & @CR
;$sSQL &= "('You are here', 2405518376, 7017846922)"    & @CR

Say('Deleting previous ' & $sDB_Earth & ' database: ' & _SQLiteEx_DropDatabase($sDB_Earth))

Say('Opening database ' & $sDB_Earth & ' and executing ' & $sSQL & ' Results: ' & _SQLiteEx_Open($sDB_Earth, $sSQL))

Creating the Table and inserting the values for one record worked w/o problem, but when I attempt to include the values for a second record, I get the syntax error message.  See attached screen shot of error.

I double checked the syntax and all looks good to me.  Does anyone have any ideas?




And the sign said 'Long Hairded Creepy People Need Not Apply' ... So I stuffed my hair up under my hat and I went in to ask him why?

Link to comment
Share on other sites

You'd better use the standard SQLite UDF.

Now "chained" inserts are only recently accepted by SQLite. Please download the most recent stable release and ascertain you use it over older version(s).

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

  • Recently Browsing   0 members

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