0

While developing for iphone i get “EXC_BAD_ACCESS” when doing

    sqlite3         *memory_db;
    if (sqlite3_open(":memory:", &memory_db) != SQLITE_OK)
    {
        sqlite3_close(memory_db);
        NSAssert(0, @"Failed to open in-memory database");
}

also doing

    NSString * memory_db_filename = @":memory:";
    if (sqlite3_open([memory_db_filename UTF8String], &memory_db) != SQLITE_OK)
    {
        sqlite3_close(memory_db);
        NSAssert(0, @"Failed to open in-memory database");
    }

does not help. Are in-memory sqlite3 databases not available on the iphone?

Any comments are appreciated!

  • ':memory:' seems like an odd name for a filename, are you sure it can be created? Why not just called it memory.db or something similar? – djhworld May 28 '10 at 18:00
  • Please post more details about the crash you are seeing (e.g., line number, stack trace, etc.) – fbrereto May 28 '10 at 19:12
  • ':memory:' is intended to create an in-memory database. good idea with line number, after checking, i realize the error came from a wrong string with format a few lines further. many thanks!!! – sdnf189uwebf18ubwe8fbas May 28 '10 at 19:46

2 Answers2

1

EXC_BAD_ACCESS is not an SQLite3 error code. See this SO question.

Community
  • 1
  • 1
Doug Currie
  • 40,708
  • 1
  • 95
  • 119
1

:memory: and database are directly supported by ALL sqlite implementations

SchmitzIT
  • 9,227
  • 9
  • 65
  • 92
ejes
  • 11
  • 1