13 #include <sql_buffer.h> 15 #include <rapidjson/document.h> 18 WARNING: THIS FILE IS NOT USED
20 #define READINGS_TABLE "readings" 21 #define READINGS_TABLE_MEM READINGS_TABLE "_1" 27 bool retrieveReadings(
const std::string& condition,
28 std::string& resultSet);
31 std::string& resultSet);
32 unsigned int purgeReadings(
unsigned long age,
unsigned int flags,
33 unsigned long sent, std::string& results);
34 long tableSize(
const std::string& table);
35 void setTrace(
bool flag) { m_logSQL = flag; };
36 static bool formatDate(
char *formatted_date,
size_t formatted_date_size,
const char *date);
37 unsigned int purgeReadingsAsset(
const std::string& asset);
39 bool loadDatabase(
const std::string& filname);
40 bool saveDatabase(
const std::string& filname);
41 void setPurgeBlockSize(
unsigned long purgeBlockSize)
43 m_purgeBlockSize = purgeBlockSize;
46 int SQLexec(sqlite3 *db,
const char *sql,
47 int (*callback)(
void*,
int,
char**,
char**),
48 void *cbArg,
char **errmsg);
50 void raiseError(
const char *operation,
const char *reason,...);
52 int mapResultSet(
void *res, std::string& resultSet);
53 bool jsonWhereClause(
const rapidjson::Value& whereClause,
SQLBuffer&,
bool convertLocaltime =
false);
54 bool jsonModifiers(
const rapidjson::Value&,
SQLBuffer&);
55 bool jsonAggregates(
const rapidjson::Value&,
56 const rapidjson::Value&,
59 bool isTableReading =
false);
61 char *trim(
char *str);
62 const std::string escape(
const std::string&);
63 bool applyColumnDateTimeFormat(sqlite3_stmt *pStmt,
65 std::string& newDate);
66 void logSQL(
const char *,
const char *);
67 unsigned long m_purgeBlockSize;
~Connection()
Destructor for the database connection.
Definition: connection.cpp:373
Buffer class designed to hold SQL statement that can as required but have minimal copy semantics...
Definition: sql_buffer.h:22
static bool formatDate(char *formatted_date, size_t formatted_date_size, const char *date)
Format a date to a fixed format with milliseconds, microseconds and timezone expressed, examples :
Definition: connection.cpp:1496
Connection()
Create a database connection.
Definition: connection.cpp:335
bool vacuum()
Execute a SQLite VACUUM command on the database.
Definition: connection.cpp:3849
void setTrace(bool flag)
Enable or disable the tracing of SQL statements.
Definition: connection.h:50
Definition: connection.h:32
unsigned int purgeReadings(unsigned long age, unsigned int flags, unsigned long sent, std::string &results)
Purge readings from the reading table.
Definition: connection.cpp:1782
int appendReadings(const char *readings)
Append a set of readings to the readings table.
Definition: connection.cpp:1597
bool fetchReadings(unsigned long id, unsigned int blksize, std::string &resultSet)
Fetch a block of readings from the reading table.
Definition: connection.cpp:1757