Version: SQLite 3.7.5 OS: Windows 7 Professional / Ubuntu 10.10 Compiler: gcc 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5) / Visual Studio 2010 Version 10.0.30319.1 [cl.exe(Version 16.00.30319.01)]
SQLite doesn't recognize the creation of a table for updating a prepared statement that could drop this table. I've written a small test to show the effect. At the end of this test the database named 'test' shouldn't have any tables except 'sqlite_master' but you will also find 'test'. Begin: #include <stdio.h> #include "sqlite3.h" int main(int argc,char* argv[]) { sqlite3 *db; sqlite3_stmt *create; sqlite3_stmt *drop; int ret=0; printf("Delete 'test'\n"); remove("test"); printf("Create 'test'\n"); ret = sqlite3_open("test",&db); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -1; } printf("Create prepared statement for table creation\n"); ret = sqlite3_prepare_v2(db,"Create Table test (a INTEGER)",-1,&create,0); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -2; } printf("Create prepared statement for table dropping\n"); ret = sqlite3_prepare_v2(db,"Drop Table If Exists test",-1,&drop,0); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -3; } printf("Create table 'test' by prepared statement\n"); ret = sqlite3_step(create); if(ret != SQLITE_DONE) { printf("%s",sqlite3_errmsg(db)); return -4; } ret = sqlite3_reset(create); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -5; } printf("Should drop table 'test' by prepared statement\n"); ret = sqlite3_step(drop); if(ret != SQLITE_DONE) { printf("%s",sqlite3_errmsg(db)); return -6; } ret = sqlite3_reset(drop); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -7; } ret = sqlite3_finalize(drop); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -8; } ret = sqlite3_finalize(create); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -9; } ret = sqlite3_close(db); if(ret != SQLITE_OK) { printf("%s",sqlite3_errmsg(db)); return -10; } printf("Now you can test 'test' if there is a table named 'test' where it shouldn't\n"); return 0; } End _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users