On Tue, Apr 28, 2009 at 3:25 AM, liubin liu <7101...@sina.com> wrote: > > Thanks! > > It sounds pretty good. But I don't understand it exactly. Could you write > down the sample codes? >
Please see the documentation here: http://sqlite.org/c3ref/funclist.html You'll have something along the lines of (just a sketch, obviously): typedef struct { sqlite3 *db; sqlite3_stmt *stmt; } my_handle_t; my_handle_t my_init() { sqlite3_open(); sqlite3_prepare(); return handle; } void my_exec(my_handle_t handle, int id) { sqlite3_bind_int(); /* Put in a loop or whatever: */ sqlite3_step(); /* After you've gotten all the result rows: */ sqlite3_reset(); } Your caller would then call my_init() once to get a handle, then call my_exec() a bunch of times using that handle. The way your example is doing it, _every_ time through the loop it does an exec(), which re-compiles the same SQL code (which is not a fast operation). There are plenty of other examples floating around on this mailing list, I'm sure - just do some digging. -- Matthew L. Creech _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users