sqlite drop table c ++

时间:2014-02-07 12:10:36

标签: c++ sqlite

以下代码的问题在哪里?它不能掉我的桌子。当我从sql浏览器(在同一个数据库)上删除时 - 一切正常。

int rcc = sqlite3_open_v2(str_sessions_file.c_str(), &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL );
if ( SQLITE_OK != rcc)
{
    fprintf (stderr, "Can't open database: %s\n", sqlite3_errmsg (db));
    sqlite3_close (db);
    return;
}


// Drop 
std::string sql_dropatable = "DROP TABLE IF EXISTS sessions";   


if( sqlite3_exec(db, sql_dropatable.c_str(), 0, 0, 0) != SQLITE_OK ) { // or == -- same effect
    std::cout << "SQLite can't drop sessions table" << std::endl;
    sqlite3_close (db);
    //exit (1); 
    return; 
}

0 个答案:

没有答案