Re: [sqlite] Attaching an in-memory database

2011-08-27 Thread Abhinav Upadhyay
On Sat, Aug 27, 2011 at 9:52 PM, Simon Slavin wrote: > > On 27 Aug 2011, at 4:50pm, Abhinav Upadhyay wrote: > >> sqlite3_exec(db, "ATTACH DATABASE :memory AS metadb", NULL, NULL, &errmsg); > > Need a colon after 'memory': > > ATTACH DATABASE ':memory:' AS metadb; > > I don't think you need the quo

Re: [sqlite] Attaching an in-memory database

2011-08-27 Thread Simon Slavin
On 27 Aug 2011, at 4:50pm, Abhinav Upadhyay wrote: > sqlite3_exec(db, "ATTACH DATABASE :memory AS metadb", NULL, NULL, &errmsg); Need a colon after 'memory': ATTACH DATABASE ':memory:' AS metadb; I don't think you need the quotes I put in, I'm not sure. When in doubt, use the SQLite shell too

[sqlite] Attaching an in-memory database

2011-08-27 Thread Abhinav Upadhyay
Hi, I am trying to attach an in-memory database and then create a table in it. Here is the code that I am using: /* I have already opened a connection to a database before the following */ sqlite3_exec(db, "ATTACH DATABASE :memory AS metadb", NULL, NULL, &errmsg); if (errmsg != NULL) {