diff --git a/src/SQLiteCppUtils.cpp b/src/SQLiteCppUtils.cpp index 8142e45..4789068 100644 --- a/src/SQLiteCppUtils.cpp +++ b/src/SQLiteCppUtils.cpp @@ -31,13 +31,14 @@ namespace SQLite { -Json::Value SQLiteUtils::execute(SQLite::Statement& query) +ofJson SQLiteUtils::execute(SQLite::Statement& query) { - Json::Value columns; + + ofJson columns; while (query.executeStep()) { - Json::Value row; + ofJson row; for (int i = 0; i < query.getColumnCount(); ++i) { @@ -57,7 +58,7 @@ Json::Value SQLiteUtils::execute(SQLite::Statement& query) } case SQLITE_NULL: { - row[column.getName()] = Json::nullValue; + row[column.getName()] = nullptr; break; } case SQLITE_TEXT: @@ -83,8 +84,8 @@ Json::Value SQLiteUtils::execute(SQLite::Statement& query) } } } - - columns.append(row); + + columns.push_back(row); } // Reset the query to use it again. diff --git a/src/SQLiteCppUtils.h b/src/SQLiteCppUtils.h index b999698..4419b13 100644 --- a/src/SQLiteCppUtils.h +++ b/src/SQLiteCppUtils.h @@ -25,10 +25,8 @@ #pragma once - +#include "ofMain.h" #include "SQLiteCpp.h" -#include - namespace SQLite { @@ -36,12 +34,13 @@ namespace SQLite { class SQLiteUtils { public: + /// \brief Export SQLite results as JSON. /// /// Encodes BLOBs using BASE64. /// /// Throws exceptions. - static Json::Value execute(SQLite::Statement& query); + static ofJson execute(SQLite::Statement& query); };