SQLite: how to open existing database in memory

Ralph DiMola rdimola at evergreeninfo.net
Wed Oct 21 11:40:57 EDT 2015


I use the attach command all the time. Among other things it makes joins
across DBs possible.

Ralph DiMola
IT Director
Evergreen Information Services
rdimola at evergreeninfo.net

-----Original Message-----
From: use-livecode [mailto:use-livecode-bounces at lists.runrev.com] On Behalf
Of Bob Sneidar
Sent: Wednesday, October 21, 2015 11:28 AM
To: How to use LiveCode
Subject: Re: SQLite: how to open existing database in memory

Whaa? There is an ATTACH command?? I will look into this. Sounds like
something I might be able to use at some point. 

Bob S


> On Oct 17, 2015, at 11:56 , Peter Haworth <pete at lcsql.com> wrote:
> 
> I assume this is a single user application?  When you say you want to 
> make changes to the database, do you mean the user makes changes to 
> the data in the database using your application?  If the disk version 
> never changes then the next time the user runs your app, whatever 
> changes they made last time around will be gone - is that OK?
> 
> I'm not totally sure what you mean by "look into the database" but 
> assume you mean using anything other than your application.  There's 
> always going to be ways to do that using any of the sqlite admin 
> programs out there, unless you use one of the encryption add-ons for
sqlite.
> 
> If you want to continue down this path, then conceptually, here's one 
> way to get the disk based db into an in memory version.
> 
> 1.  Open the in memory database which will be completely empty.
> 2.  Use the ATTACH command to open the disk db over the same connection.
> Doing that involves assigning a name to identify the db which I'll 
> assume is "diskdb".  You'll use that in the next step.
> 3. For each table in the disk db, issue a CREATE TABLE AS command, 
> which will look something like this:  "CREATE main.TABLE Movies AS 
> SELECT * FROM diskdb.Movies"
> 4. Issue the command DETACH DATABASE diskdb
> 
> After that all your data will be in your in memory database and you 
> can access it just as in any other db.
> 
> Pete


_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list