20 #include "pedigree/native/config/Config.h" 26 void pedigree_config_getcolname(
27 size_t resultIdx,
size_t n,
char *buf,
size_t bufsz);
29 void pedigree_config_getstr_n(
30 size_t resultIdx,
size_t row,
size_t n,
char *buf,
size_t bufsz);
32 void pedigree_config_getstr_s(
33 size_t resultIdx,
size_t row,
const char *col,
char *buf,
size_t bufsz);
35 int pedigree_config_getnum_n(
size_t resultIdx,
size_t row,
size_t n);
37 int pedigree_config_getnum_s(
size_t resultIdx,
size_t row,
const char *col);
39 int pedigree_config_getbool_n(
size_t resultIdx,
size_t row,
size_t n);
41 int pedigree_config_getbool_s(
size_t resultIdx,
size_t row,
const char *col);
43 int pedigree_config_query(
const char *query);
45 void pedigree_config_freeresult(
size_t resultIdx);
47 int pedigree_config_numcols(
size_t resultIdx);
49 int pedigree_config_numrows(
size_t resultIdx);
51 int pedigree_config_was_successful(
size_t resultIdx);
53 void pedigree_config_get_error_message(
size_t resultIdx,
char *buf,
int buflen);
55 char *pedigree_config_escape_string(
const char *str);
58 Config::Result::~Result()
60 pedigree_config_freeresult(m_nResultIdx);
65 return !pedigree_config_was_successful(m_nResultIdx);
73 char *pBuffer =
new char[buffSz];
74 memset(pBuffer, 0, buffSz);
75 pedigree_config_get_error_message(m_nResultIdx, pBuffer, buffSz);
76 std::string str(pBuffer);
83 return pedigree_config_numrows(m_nResultIdx);
88 return pedigree_config_numcols(m_nResultIdx);
96 char *pBuffer =
new char[buffSz];
97 memset(pBuffer, 0, buffSz);
98 pedigree_config_getcolname(m_nResultIdx, col, pBuffer, buffSz);
99 std::string str(pBuffer);
109 char *pBuffer =
new char[buffSz];
110 memset(pBuffer, 0, buffSz);
111 pedigree_config_getstr_n(m_nResultIdx, row, col, pBuffer, buffSz);
112 std::string str(pBuffer);
119 return pedigree_config_getnum_n(m_nResultIdx, row, col);
124 return pedigree_config_getbool_n(m_nResultIdx, row, col);
132 char *pBuffer =
new char[buffSz];
133 memset(pBuffer, 0, buffSz);
134 pedigree_config_getstr_s(m_nResultIdx, row, col, pBuffer, buffSz);
135 std::string str(pBuffer);
142 return pedigree_config_getnum_s(m_nResultIdx, row, col);
147 return pedigree_config_getbool_s(m_nResultIdx, row, col);
157 int resultIdx = pedigree_config_query(sql);
164 return new Result(resultIdx);
size_t cols()
Returns the number of columns.
size_t rows()
Returns the number of rows.
std::string getColumnName(size_t col, size_t buffSz=256)
Returns the name of the col'th column.
std::string getStr(size_t row, size_t col, size_t buffSz=256)
Returns the value in column 'col' of the result, in string form.
size_t getNum(size_t row, size_t col)
Returns the value in column 'col' of the result, in number form.
Result * query(const char *sql)
bool succeeded()
Returns true if the result is valid, false if there was an error.
bool getBool(size_t row, size_t col)
Returns the value in column 'col' of the result, in boolean form.