Mark Wyszomierski wrote:
>    strSql.Format(_T("SELECT * FROM test")); 
>  
>    sqlite3_stmt *pStmt; 
>    const char *pszTailPointer; 
>    int nRetVal = sqlite3_prepare(db, strSql, strSql.GetLength(), 
> &pStmt, &pszTailPointer); 
>    if (nRetVal != SQLITE_OK) { 
>        TRACE("prepare fails!! [%i] [%s]\n", nRetVal, sqlite3_errmsg(db)); 
>        return false; 
>    } 
>  
>    nRetVal = sqlite3_step(pStmt); 
>    while (nRetVal == SQLITE_BUSY || nRetVal == SQLITE_ROW) { 
>        Sleep(100); 
>        // Try again. 
>        nRetVal = sqlite3_step(pStmt); 
>        // How do I get the information out of this returned record? 
>  
>        // By the way, why would we want a reset() in here? 
>      //  sqlite3_reset(pStmt); 
>    } 

Your error checking is all wrong. Try something like this...

   int nRetVal = sqlite3_prepare(db, strSql, strSql.GetLength(), &pStmt, 
&pszTailPointer); 
   if (nRetVal != SQLITE_OK) { 
       TRACE("prepare fails!! [%i] [%s]\n", nRetVal, sqlite3_errmsg(db)); 
       return false; 
   } 

   for ( ; ; ) {
      while((nRetVal = sqlite3_step(pStmt)) == SQLITE_BUSY) {
         Sleep(100);
         sqlite3_reset(pStmt);          // Not sure if this is needed
      }
      if (nRetVal != SQLITE_ROW)
         break;                         // No more rows, or an error
      // How do I get the information out of this returned record? 
 
      sqlite3_reset(pStmt);             // Ready for the next sqlite3_step
   } 



-- 
Nikki Locke, Trumphurst Ltd.      PC & Unix consultancy & programming
http://www.trumphurst.com/



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

Reply via email to