To prepare a statement SQLite needs to read the information about schema of your database. So it should inevitably obtain a SHARED lock on the database while doing so. If you have another process having EXCLUSIVE or PENDING on the database then SQLite cannot read schema information and cannot finish prepare quickly.
At least that's how I understand it. Pavel On Tue, Apr 13, 2010 at 4:40 AM, liubin liu <7101...@sina.com> wrote: > > my program is blocked at the point of sqlite3_prepare_v2(*). Why? > > > 512 > 513 sqlite3_stmt *p_stmt = NULL; > 514 printf (" ####################### 500, %p, %s, %p\n", > g_db_base, sql, p_stmt); > 515 ret = sqlite3_prepare_v2 (g_db_base, sql, -1, &p_stmt, NULL); > 516 printf (" ####################### 501\n"); > 517 if (SQLITE_OK != ret) > > > the printf of line 514 done. > the printf of line 516 didn't done. > > -- > View this message in context: > http://old.nabble.com/why-block-at-sqlite3_prepare_v2%28*%29--tp28220519p28220519.html > Sent from the SQLite mailing list archive at Nabble.com. > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users