diff --git a/src/ofxSQLite.cpp b/src/ofxSQLite.cpp index 6e3b4c5..278071e 100755 --- a/src/ofxSQLite.cpp +++ b/src/ofxSQLite.cpp @@ -5,6 +5,8 @@ #include "ofxSQLiteSelect.h" //#include "ofxSQLiteSimpler.h" +#include "ofLog.h" + ofxSQLite::ofxSQLite() :db_name("") { @@ -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) { @@ -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); } diff --git a/src/ofxSQLite.h b/src/ofxSQLite.h index bbd65b5..7957cbc 100755 --- a/src/ofxSQLite.h +++ b/src/ofxSQLite.h @@ -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);