Sign in to follow this  
Followers 0
cag8f

SQLite dot commands

5 posts in this topic

I'd like to use Autoit to return the names of all the tables that exist in an SQLite database, as accomplished when I enter ".tables" at an SQLite command line.  However the simple code:

#include <file.au3>
#include <SQLite.au3>

_SQLite_Startup()

$dbpath = "D:\mydb.db"
$dbhandle = _SQLite_Open($dbpath)

_SQLite_Exec(-1,".tables")

_SQLite_Close()
_SQLite_Shutdown()

encounters an SQLite syntax error in the _SQLite_Exec line.  Can someone explain this to me, or point me to an explanation?  I know the SQLite dot commands behave/function a little differently than other SQLite commands, so I suspect this is related.

I also experience something that is probably related when I use a database management program.  I'm using SQLite Expert in Windows, and cannot get any dot commands (.tables, .help, etc) to work in it either.  

Share this post


Link to post
Share on other sites

Dot commands are specific to the command-line tool, sqlite3.exe and have nothing to do with SQL.

To list all table names in an SQLite DB, use this in Expert or with _SQLite_GetTable[2D]:

select name from sqlite_master where type = 'table';


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

Got it, thanks--that worked.  Is there any Autoit documentation regarding querying the master table?

Share this post


Link to post
Share on other sites

This is too specific for inclusion in our help file. See here for reference.


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

Thanks.

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