> I assume that the sqlite3_prepare() / sqlite3_bind() combination results in
> faster performance than sqlite3_exec() for INSERT and UPDATE statements. But
> where can I find example code that uses prepare/bind? Googling didn't give
> any results.
You didn't say which language you're using...
Here's some c++:
sqlite3* db;
sqlite3_stmt *pStmt;
int rc;
string str;
string sql;
sql = "SELECT Created, Subject, Body FROM News";
sql += " WHERE Created > ?";
sql += " ORDER BY Created LIMIT 6";
// connect to database
rc = sqlite3_open( DB, &db );
if ( rc )
throw "Can't open database";
if ( sqlite3_prepare( db, sql.c_str(), sql.size(), &pStmt,
NULL ) != SQLITE_OK )
throw "Cannot prepare sql";
// bind is 1 based
sqlite3_bind_text( pStmt, 1, LastLogin.c_str(),
LastLogin.size(), SQLITE_STATIC );