I have 2 databases created and populated: 

> DBLee, my test database

> MiniMain, a subset copy of one of our production databases

 

>From the sqlite3 command prompt, I can run queries against both databases
and see the results. I can also enter the ".tables" command and see the
correct list of tables in each database. 

 

DBLee

sqlite> .tables

tb12  tb22

sqlite>

 

 

MiniMain

sqlite> .tables

Categories       InstallerFiles       Items           RequiredItems

ContentFiles    ItemCategories   RelatedItems

sqlite>

 

_________________________________________

 

I have written a small test program in C++ to perform proof of concepts.
The code is failing to execute any query against the MiniMain database
with the error message "SQL error: no such table: Categories". Categories
is one of 7 tables. The same failure results for all 7 tables and for all
simple queries ("Select.").

 

This is my source code:

 

int main( )

{

      sqlite3 *db;

      char *zErrMsg = 0;

      int rc;

 

      // Test Open

//    rc = sqlite3_open( "DBLee", & db );

      rc = sqlite3_open( "MiniMain", & db );

      if( rc )

      {

            assert( false );

            fprintf( stderr, "Can't open database: %s\n", sqlite3_errmsg(
db ) );

            sqlite3_close( db );

            Sleep( 5000 );

            return( 1 );

      }

      

      // Test SELECT

//    rc = sqlite3_exec( db, "SELECT * from tb12", callback, 0, &zErrMsg
);

      rc = sqlite3_exec( db, "SELECT * from Categories", callback, 0,
&zErrMsg );

      if( rc!=SQLITE_OK )

      {

            assert( false );

            fprintf( stderr, "SQL error: %s\n", zErrMsg );

            Sleep( 15000 );

            sqlite3_free( zErrMsg );

            return( 1 );

      }

 

 

 

The commented out lines execute correctly. The "SELECT * FROM Categories"
line always fails.

 

What could be the problem?

 

Thanks,

 

Lee Crain

Senior Software Engineer

DAZ 3D Productions

801-495-1777, x759 

 

Reply via email to