CoffeePi
Coffee machine control for Raspberry Pi
|
#include <cstdio>
#include <stdlib.h>
#include <inttypes.h>
#include <cstdarg>
#include <cstring>
#include <string>
#include <stdexcept>
#include <pthread.h>
#include <sys/time.h>
#include "sqlite/sqlite3.h"
#include "global.h"
#include "database.h"
#include "logger.h"
Functions | |
std::string | string_vsprintf (const char *format, std::va_list args) |
Helper function to allow the use of vsprintf() with a string See: http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output. More... | |
std::string | string_sprintf (const char *format,...) __attribute__((format(printf |
Allows the format of printf but returns a string Source: http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output. More... | |
int | sqlOpen () |
Opens and initializes a sqlite3 database connection. More... | |
void | sqlClose () |
Closes the database connection. More... | |
int | sqlExecute (string query) |
Executes a SQL statement. More... | |
int | sqlExecute2 (char *query) |
int | sqlSetup () |
Sets up the database and creates the needed structure. More... | |
uint64_t | sqlGetConf (config_key_t id) |
Reads a configuration key from the database. More... | |
int | sqlSetConf (config_key_t id, uint64_t value) |
Saves a configuration key to the database. More... | |
char * | inttochar (uint8_t *guid) |
Converts the GUID from int to char array. More... | |
uint8_t * | chartoint (const unsigned char *guid) |
Converts the GUID from char to int array. More... | |
uint8_t * | int64to8bit (sqlite_int64 guid) |
Converts the GUID from int64 to int8 array. More... | |
sqlite_int64 | int8to64bit (uint8_t *guid) |
void | sqltest () |
Variables | |
sqlite3 * | db |
The database connector. More... | |
uint8_t* chartoint | ( | const unsigned char * | guid | ) |
Converts the GUID from char to int array.
*guid | Pointer to the char GUID |
uint8_t* int64to8bit | ( | sqlite_int64 | guid | ) |
Converts the GUID from int64 to int8 array.
guid | 64bit GUID |
sqlite_int64 int8to64bit | ( | uint8_t * | guid | ) |
char* inttochar | ( | uint8_t * | guid | ) |
Converts the GUID from int to char array.
*guid | Pointer to the uint8_t GUID |
void sqlClose | ( | ) |
Closes the database connection.
int sqlExecute | ( | string | query | ) |
Executes a SQL statement.
*query | SQL query string |
int sqlExecute2 | ( | char * | query | ) |
uint64_t sqlGetConf | ( | config_key_t | id | ) |
Reads a configuration key from the database.
id | Config ID key |
int sqlOpen | ( | ) |
Opens and initializes a sqlite3 database connection.
int sqlSetConf | ( | config_key_t | id, |
uint64_t | value | ||
) |
Saves a configuration key to the database.
id | Config ID key |
value | Integer value |
int sqlSetup | ( | ) |
Sets up the database and creates the needed structure.
void sqltest | ( | ) |
std::string std::string string_sprintf | ( | const char * | format, |
... | |||
) |
Allows the format of printf but returns a string Source: http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output.
format | input string as char array |
std::string string_vsprintf | ( | const char * | format, |
std::va_list | args | ||
) |
Helper function to allow the use of vsprintf() with a string See: http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output.
sqlite3* db |
The database connector.