SQLite: how to open existing database in memory
Peter Haworth
pete at lcsql.com
Sat Oct 17 13:03:32 EDT 2015
You could but I can't think of a reason to do that offhand. As Mark said,
most sqlite activity occurs in memory so unless you have a huge db that
results in a lot of paging activity, you're basically working in memory
anyway.
If you really wanted to copy a disk based db to an in-memory db, you could
use the CREATE TABLE AS option to copy each table over. It allows you
specify a SELECT statement where the the named columns are created in the
new table and the data for those columns is copied over from the selected
table to the new one.
Pete
lcSQL Software <http://www.lcsql.com>
Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
On Sat, Oct 17, 2015 at 9:54 AM, Paul Dupuis <paul at researchware.com> wrote:
> On 10/17/2015 12:25 PM, Peter Haworth wrote:
> > Sorry, I should have looked at your syntax more closely.
> >
> > You can't open an existing database as an in memory database. If you
> want
> > to open an in memory database, the revopendatabase syntax is
> > revOpenDatabase("sqlite",":memory:") and it will be a brand new, empty
> > database with no tables. The syntax you used would have created a disk
> > database file named /Users/Dev/Documents/Ratings.db3:memory: with no
> tables
> > in it, hence the error message you got.
> >
> > Hope that explains it better.
> >
>
> Could you create a new, empty, in memory data base and open the disk
> based existing database and copy its contents to the new memory
> database? Does sqlLite provide any easy command for copying a database
> or the contents of a database to another?
>
>
> _______________________________________________
> 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