SQLite Forum

Timeline
Login

2 forum posts by user rob.lake

2021-09-15
13:04 Reply: In memory db actually creating file (artifact: 871a33c3ec user: rob.lake)

Thanks, that's exactly what I'm looking for.

2021-09-14
19:16 Post: In memory db actually creating file (artifact: 0fa72cda19 user: rob.lake)

I'm using sqlite3, built from source, to create an in memory database but sqlite3 is creating a file in the working directory. Here's a simple program that I used to show the issue.

#include <sqlite3.h>

int main(int argc, char** argv)
{
    sqlite3* db;
    sqlite3_open("file:memdb1?mode=memory&cache=shared", &db);
    const char* sql = "CREATE TABLE IF NOT EXISTS TEST (ID INT);"
                      "INSERT INTO TEST VALUES (1), (2);";

    sqlite3_exec(db, sql, 0, 0, 0);
    sqlite3_close(db);
    return 0;
}

When I use the sqlite3 lib packaged with Ubuntu 20.04 a file is not created. Has anybody had this issue when using sqlite built from source?