Thanks Igor, So you prefer #1 instead of #2. Thanks, JP
________________________________ From: Igor Tandetnik <[email protected]> To: [email protected] Sent: Thursday, May 14, 2009 11:13:23 AM Subject: Re: [sqlite] Should use prepare/bind or just sqlite_exec. Joanne Pham <[email protected]> wrote: > I would like to update the database and there are two ways to do it > and I were wondering which way is better: > 1) Way 1 - used the sqlite3_preare, sqlite3_bind , sqlite3_step ... > > 2) Way #2 > q = "UPDATE logTable SET stale = 1 WHERE id = "; > sprintf(sqlStmt,"%s%d ",q,rpid); > sqlSt = sqlite3_exec(pDb, sqlStmt, NULL, 0, &errMsg) ; > > Which way is better in term of performance. I doubt you would detect any measurable performance difference on one-time execution. #1 is better for reasons other than performance. It also improves performance if you need to run the same query many times, perhaps with different parameters. Realize that sqlite3_exec simply calls sqlite3_preare, sqlite3_step et al internally. Igor Tandetnik _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

