Function open

Synopsis

#include <include/Database.h>

void open(std::string fname)

Description

No description yet.

Mentioned in

Source

Lines 20-36 in src/Database.cpp. Line 57 in include/Database.h.

void Database::open(std::string fname)
{
    sqlite3* db=NULL;

    try{
        //TODO UTF-8 string
        int rc=sqlite3_open(fname.c_str(), &db);
        if(rc!=SQLITE_OK)
            throw database_error( std::string("database error: ")+sqlite3_errmsg(db) );
        con=shared_connection(new autoclosed_con(db));

    }catch(std::runtime_error e){
        if(db)
            sqlite3_close(db);
        throw e;
    }
}





Add Discussion as Guest

Log in