Here is a small code sample.

Open the database and then:

  Result = sqlite3_prepare_v2(hdb,
       "select Name, FilePrefix from Application", 100, &hstmt, 0);
  if (Result != SQLITE_OK) {
    fprintf(stderr,
      "cannot select from Application table. Error Code: %d\n", Result);
    exit(1);
  }

  do {
    Result = sqlite3_step(hstmt);
    if (Result == SQLITE_ROW) {

... handle row data using the sqlite3_column_xxx functions

    }
  } while (Result == SQLITE_ROW);

  if (Result == SQLITE_DONE) {
    Result = SQLITE_OK;
  }
  else {
    fprintf(stderr,"Error Code: %d\n", Result);
  }
  sqlite3_finalize(hstmt);
  sqlite3_close(hdb);


On Thu, 2007-11-29 at 14:03 -0500, Wilson, Ron wrote:
> So a friend of mine was asking me how to get started using SQlite, so I
> pointed him here:
> 
> http://www.sqlite.org/quickstart.html 
> 
> This page still shows the old callback method for usign sqlite3_exec().
> I actually haven't used SQlite in quite a long time, but judging from
> recent list topics, this is no longer the preferred method.  So where do
> I point my friend for using sqlite3_prepare_v2() etc.?  I've seen a few
> posts (long since deleted from my inbox) that had basic outlines.  Could
> someone please post a basic code snipit for open/query/close using the
> newer interface, i.e. avoiding the callback usage?  Perhaps the
> quickstart guide (above) could use an update as well?
> 
> RW
> 
> Ron Wilson, Senior Engineer, MPR Associates, 518.831.7546
> 
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
> 


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

Reply via email to