Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/ofxSQLite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include "ofxSQLiteSelect.h"
//#include "ofxSQLiteSimpler.h"

#include "ofLog.h"

ofxSQLite::ofxSQLite()
:db_name("")
{
Expand All @@ -17,14 +19,16 @@ ofxSQLite::ofxSQLite(std::string sDB):db_name(sDB) {
setup(sDB);
}

void ofxSQLite::setup(std::string sDB) {
bool ofxSQLite::setup(std::string sDB) {
db_name = sDB;
db_file = sDB;
if (SQLITE_OK != sqlite3_open(db_file.c_str(), &db)) {
cout << sqlite3_errmsg(db);
exit(1);
ofLogError("ofxSQLite") << sqlite3_errmsg(db);
return false;
}
cout << "opened:" << db_file << endl;

ofLogNotice("ofxSQLite") << "Opened:" << db_file << endl;
return true;
}

int ofxSQLite::simpleQuery(const char* pSQL) {
Expand All @@ -40,6 +44,7 @@ ofxSQLiteInsert ofxSQLite::insert(std::string sTable) {
ofxSQLiteInsert insert = ofxSQLiteInsert(db, sTable);
return insert;
}

ofxSQLiteUpdate ofxSQLite::update(std::string sTable) {
return ofxSQLiteUpdate(db, sTable);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ofxSQLite.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ofxSQLite {
public:
ofxSQLite();
ofxSQLite(std::string sDB);
void setup(std::string sDB);
bool setup(std::string sDB);
ofxSQLiteInsert insert(std::string sTable);
ofxSQLiteUpdate update(std::string sTable);
ofxSQLiteDelete remove(std::string sTable);
Expand Down