Jump to content

Actions on 2 sqlite dbs


ivan
 Share

Recommended Posts

I was wondering if anyone has successfully tried to use 2 (or more) sqlite dbs simultaneously with the sqlite UDF. There are many scenarios where this could be desirable.

For instance, suppose you have a memory db that stores and manipulates temporary data that is only required at run time, and you want to store only a subset of that data in a file db, say, when the user presses a save button, or something of the sort. Or maybe you want to verify if the permanent database already contains the data, for example:

select * from temp.table1 as t
inner join perm.table1 as p on p.pk = t.pk
where t.col=match_condition;

I can't quite figure out how the handle to temp can be passed to query perm, or the other way around. You can certainly use sqlite udf to attach the dbs using sqlite3.exe and generate a script that runs your query, but I'd rather not walk through that alley if a superior solution already exists

Any thoughts anyone?

As always, any help or advice will be greatly appreciated.

Regards,

Ivan.

Link to comment
Share on other sites

It's brain dead easy to open several databases simultaneously using the standard UDF, but doing so doesn't allow you to perform queries like you show. Leave the command-line tool (sqlite3.exe) alone, it's not needed.

Fortunately you can ATTACH one or more database to an already open one. From then, you can indeed construct queries using tables from all attached DBs. Look at the SQL documentation on the SQLite site.

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...