I'm using SQLite version 3.4.2 and for some reason, I cannot read from any
SQLite databases.

When I create the database, all the create and insert statements execute
with no problems, and by using SQLite Database Browser, I can see that the
tables are there and that they are populated.  However, whenever I try to
run a select statement, I get the error "no such table: <tablename>".
Again, looking in the browser, the table is there, it's just not visible to
my application.

I did some investigating and found that a "select * from sqlite_master"
returns 0 rows.  However, doing that in the browser, once again, returns all
the information you'd expect.  I've spent hours searching for the solution
to this, stepping through each line of code, but everything seems to be in
proper order.  I've even tried connecting to SQLite databases created by
other applications and get the same result when selecting from the
sqlite_master table.

Here's my connection code:

int sqlErr = sqlite3_open(filename, &m_conn);
if( sqlErr != SQLITE_OK ) {
    return (false);
}


Here is my prepare code:

sqlite3_stmt* sqlStmt;
const char* sqlTail = 0;

if( sqlite3_prepare(m_conn, query, queryLength, &sqlStmt, &sqlTail) !=
SQLITE_OK ) {
    return (false);
}

Here is my step code:

bool loop = true;
while(loop) {
    switch( sqlite3_step(rs) )
    {
    case SQLITE_DONE:
        loop = false;
        break;

    case SQLITE_ROW:
        // process row stuff here
        break;

    case SQLITE_ERROR:
        // handle...
        loop = false;
        break;

    case SQLITE_MISUSE:
        // handle...
        loop = false;
        break;
    }
}

I've cut some unnecessary code from the snippets, but that's the important
stuff.  If anyone has any idea what is going on here, please let me know.

Josh

Reply via email to