Sqlite creates an empty DB if your pathname does not point to one. Sqlite just passes the pathname you use in the sqlite3_open call to the underlying OS API.

PokerAce wrote:
I thought of that.  I did a search of my harddrive and it resulted in no
duplicate files.  In my code, I check if the file exists before trying to
open it.  Also, I debugged the application stepping through it line by line
and the directory path is fine.  Is there a problem in SQLite 3.4.2 with
long file names?


On 8/21/07, John Stanton <[EMAIL PROTECTED]> wrote:

PokerAce wrote:

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


Your filename is not the correct pathname for your existing database and
your program is creating a new, empty database.


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]

-----------------------------------------------------------------------------






-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to