SqliteTools.cpp 500 Bytes
Newer Older
1 2 3 4
#include <iostream>

#include "SqliteTools.h"

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
5
bool SqliteTools::CreateTable( sqlite3 *db, const char* request )
6 7
{
    sqlite3_stmt* stmt;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
8
    int res = sqlite3_prepare_v2( db, request, -1, &stmt, NULL );
9 10 11 12 13 14 15 16 17 18
    if ( res != SQLITE_OK )
    {
        std::cerr << "Failed to execute request: " << request << std::endl;
        return false;
    }
    res = sqlite3_step( stmt );
    while ( res != SQLITE_DONE && res != SQLITE_ERROR )
        res = sqlite3_step( stmt );
    return res == SQLITE_DONE;
}