嗨,我正在尝试在 winapi 线程中使用 sqlite,但 sqlite 准备语句不起作用我不知道为什么请帮忙看看我的代码 sqlite3_prepare_v2 没有返回 SQLITE_OK
DWORD WINAPI dloader(LPVOID lpParameter)
{
sqlite3 *db; // databse handler
sqlite3_stmt *stat; // statment ....
char *q;
q="INSERT INTO search (id,fname,fpath) VALUES (NULL,?,?)";
LPSTR f = (LPSTR)lpParameter, ff;
size_t s = lstrlen(f); DWORD bw;
cout<<"\nin loader";
if ((s > 0) && (lstrcmp(&f[s-4], ".jpg") == 0))
{
ff = PathFindFileNameA(f);
s = lstrlen(f);
if(sqlite3_prepare_v2(db, q, strlen(q), &stat, 0) == SQLITE_OK){
// Bind values
cout<<"\nvalues binded";
sqlite3_bind_text(stat, 1, ff, strlen(ff), 0); // file name
sqlite3_bind_text(stat, 2, f, strlen(f), 0); // file path + file name
sqlite3_step(stat); // prepare statemnt Ready
sqlite3_finalize(stat);
}
}
return 0;
}