database_8cpp.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.10"/>
  7. <title>CoffeePi: database.cpp File Reference</title>
  8. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  9. <script type="text/javascript" src="jquery.js"></script>
  10. <script type="text/javascript" src="dynsections.js"></script>
  11. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  12. <script type="text/javascript" src="search/searchdata.js"></script>
  13. <script type="text/javascript" src="search/search.js"></script>
  14. <script type="text/javascript">
  15. $(document).ready(function() { init_search(); });
  16. </script>
  17. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  18. </head>
  19. <body>
  20. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  21. <div id="titlearea">
  22. <table cellspacing="0" cellpadding="0">
  23. <tbody>
  24. <tr style="height: 56px;">
  25. <td id="projectalign" style="padding-left: 0.5em;">
  26. <div id="projectname">CoffeePi
  27. </div>
  28. <div id="projectbrief">Coffee machine control for Raspberry Pi</div>
  29. </td>
  30. </tr>
  31. </tbody>
  32. </table>
  33. </div>
  34. <!-- end header part -->
  35. <!-- Generated by Doxygen 1.8.10 -->
  36. <script type="text/javascript">
  37. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  38. </script>
  39. <div id="navrow1" class="tabs">
  40. <ul class="tablist">
  41. <li><a href="index.html"><span>Main&#160;Page</span></a></li>
  42. <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
  43. <li class="current"><a href="files.html"><span>Files</span></a></li>
  44. <li>
  45. <div id="MSearchBox" class="MSearchBoxInactive">
  46. <span class="left">
  47. <img id="MSearchSelect" src="search/mag_sel.png"
  48. onmouseover="return searchBox.OnSearchSelectShow()"
  49. onmouseout="return searchBox.OnSearchSelectHide()"
  50. alt=""/>
  51. <input type="text" id="MSearchField" value="Search" accesskey="S"
  52. onfocus="searchBox.OnSearchFieldFocus(true)"
  53. onblur="searchBox.OnSearchFieldFocus(false)"
  54. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  55. </span><span class="right">
  56. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  57. </span>
  58. </div>
  59. </li>
  60. </ul>
  61. </div>
  62. <div id="navrow2" class="tabs2">
  63. <ul class="tablist">
  64. <li><a href="files.html"><span>File&#160;List</span></a></li>
  65. <li><a href="globals.html"><span>Globals</span></a></li>
  66. </ul>
  67. </div>
  68. <!-- window showing the filter options -->
  69. <div id="MSearchSelectWindow"
  70. onmouseover="return searchBox.OnSearchSelectShow()"
  71. onmouseout="return searchBox.OnSearchSelectHide()"
  72. onkeydown="return searchBox.OnSearchSelectKey(event)">
  73. </div>
  74. <!-- iframe showing the search results (closed by default) -->
  75. <div id="MSearchResultsWindow">
  76. <iframe src="javascript:void(0)" frameborder="0"
  77. name="MSearchResults" id="MSearchResults">
  78. </iframe>
  79. </div>
  80. </div><!-- top -->
  81. <div class="header">
  82. <div class="summary">
  83. <a href="#func-members">Functions</a> &#124;
  84. <a href="#var-members">Variables</a> </div>
  85. <div class="headertitle">
  86. <div class="title">database.cpp File Reference</div> </div>
  87. </div><!--header-->
  88. <div class="contents">
  89. <div class="textblock"><code>#include &lt;cstdio&gt;</code><br />
  90. <code>#include &lt;stdlib.h&gt;</code><br />
  91. <code>#include &lt;inttypes.h&gt;</code><br />
  92. <code>#include &lt;cstdarg&gt;</code><br />
  93. <code>#include &lt;cstring&gt;</code><br />
  94. <code>#include &lt;string&gt;</code><br />
  95. <code>#include &lt;stdexcept&gt;</code><br />
  96. <code>#include &lt;pthread.h&gt;</code><br />
  97. <code>#include &lt;sys/time.h&gt;</code><br />
  98. <code>#include &quot;sqlite/sqlite3.h&quot;</code><br />
  99. <code>#include &quot;<a class="el" href="global_8h_source.html">global.h</a>&quot;</code><br />
  100. <code>#include &quot;<a class="el" href="database_8h_source.html">database.h</a>&quot;</code><br />
  101. <code>#include &quot;<a class="el" href="logger_8h_source.html">logger.h</a>&quot;</code><br />
  102. </div><table class="memberdecls">
  103. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  104. Functions</h2></td></tr>
  105. <tr class="memitem:ac240bb02efe882b4e82da48676301d89"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#ac240bb02efe882b4e82da48676301d89">string_vsprintf</a> (const char *format, std::va_list args)</td></tr>
  106. <tr class="memdesc:ac240bb02efe882b4e82da48676301d89"><td class="mdescLeft">&#160;</td><td class="mdescRight">Helper function to allow the use of vsprintf() with a string See: <a href="http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output">http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output</a>. <a href="#ac240bb02efe882b4e82da48676301d89">More...</a><br /></td></tr>
  107. <tr class="separator:ac240bb02efe882b4e82da48676301d89"><td class="memSeparator" colspan="2">&#160;</td></tr>
  108. <tr class="memitem:acd0eb5a18168fa3c37fab8ed0958c043"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#acd0eb5a18168fa3c37fab8ed0958c043">string_sprintf</a> (const char *format,...) __attribute__((format(printf</td></tr>
  109. <tr class="memdesc:acd0eb5a18168fa3c37fab8ed0958c043"><td class="mdescLeft">&#160;</td><td class="mdescRight">Allows the format of printf but returns a string Source: <a href="http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output">http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output</a>. <a href="#acd0eb5a18168fa3c37fab8ed0958c043">More...</a><br /></td></tr>
  110. <tr class="separator:acd0eb5a18168fa3c37fab8ed0958c043"><td class="memSeparator" colspan="2">&#160;</td></tr>
  111. <tr class="memitem:a1885a74e6af3ee510f30f98e60372e3e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a1885a74e6af3ee510f30f98e60372e3e">sqlOpen</a> ()</td></tr>
  112. <tr class="memdesc:a1885a74e6af3ee510f30f98e60372e3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Opens and initializes a sqlite3 database connection. <a href="#a1885a74e6af3ee510f30f98e60372e3e">More...</a><br /></td></tr>
  113. <tr class="separator:a1885a74e6af3ee510f30f98e60372e3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  114. <tr class="memitem:a7264f51f982e908b32635e91e6dc0062"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a7264f51f982e908b32635e91e6dc0062">sqlClose</a> ()</td></tr>
  115. <tr class="memdesc:a7264f51f982e908b32635e91e6dc0062"><td class="mdescLeft">&#160;</td><td class="mdescRight">Closes the database connection. <a href="#a7264f51f982e908b32635e91e6dc0062">More...</a><br /></td></tr>
  116. <tr class="separator:a7264f51f982e908b32635e91e6dc0062"><td class="memSeparator" colspan="2">&#160;</td></tr>
  117. <tr class="memitem:afd88a963f835215b8dad9ee9e49866dc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#afd88a963f835215b8dad9ee9e49866dc">sqlExecute</a> (string query)</td></tr>
  118. <tr class="memdesc:afd88a963f835215b8dad9ee9e49866dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes a SQL statement. <a href="#afd88a963f835215b8dad9ee9e49866dc">More...</a><br /></td></tr>
  119. <tr class="separator:afd88a963f835215b8dad9ee9e49866dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
  120. <tr class="memitem:a53458fb936962d23efec505a545a9cb8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a53458fb936962d23efec505a545a9cb8">sqlExecute2</a> (char *query)</td></tr>
  121. <tr class="separator:a53458fb936962d23efec505a545a9cb8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  122. <tr class="memitem:aaed3fb776c9dc76d262df026803d3b8c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#aaed3fb776c9dc76d262df026803d3b8c">sqlSetup</a> ()</td></tr>
  123. <tr class="memdesc:aaed3fb776c9dc76d262df026803d3b8c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets up the database and creates the needed structure. <a href="#aaed3fb776c9dc76d262df026803d3b8c">More...</a><br /></td></tr>
  124. <tr class="separator:aaed3fb776c9dc76d262df026803d3b8c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  125. <tr class="memitem:aad0e803eda7a440a6063a447cfeca0cd"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#aad0e803eda7a440a6063a447cfeca0cd">sqlGetConf</a> (<a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a> id)</td></tr>
  126. <tr class="memdesc:aad0e803eda7a440a6063a447cfeca0cd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads a configuration key from the database. <a href="#aad0e803eda7a440a6063a447cfeca0cd">More...</a><br /></td></tr>
  127. <tr class="separator:aad0e803eda7a440a6063a447cfeca0cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
  128. <tr class="memitem:a1ce0ac0c58916c138a92d3282f569784"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a1ce0ac0c58916c138a92d3282f569784">sqlSetConf</a> (<a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a> id, uint64_t value)</td></tr>
  129. <tr class="memdesc:a1ce0ac0c58916c138a92d3282f569784"><td class="mdescLeft">&#160;</td><td class="mdescRight">Saves a configuration key to the database. <a href="#a1ce0ac0c58916c138a92d3282f569784">More...</a><br /></td></tr>
  130. <tr class="separator:a1ce0ac0c58916c138a92d3282f569784"><td class="memSeparator" colspan="2">&#160;</td></tr>
  131. <tr class="memitem:a437086982a7400d7205f3ab6600e6dcf"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a437086982a7400d7205f3ab6600e6dcf">inttochar</a> (uint8_t *guid)</td></tr>
  132. <tr class="memdesc:a437086982a7400d7205f3ab6600e6dcf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts the GUID from int to char array. <a href="#a437086982a7400d7205f3ab6600e6dcf">More...</a><br /></td></tr>
  133. <tr class="separator:a437086982a7400d7205f3ab6600e6dcf"><td class="memSeparator" colspan="2">&#160;</td></tr>
  134. <tr class="memitem:ad2d2a73c367513b8b71aff5546276a3c"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#ad2d2a73c367513b8b71aff5546276a3c">chartoint</a> (const unsigned char *guid)</td></tr>
  135. <tr class="memdesc:ad2d2a73c367513b8b71aff5546276a3c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts the GUID from char to int array. <a href="#ad2d2a73c367513b8b71aff5546276a3c">More...</a><br /></td></tr>
  136. <tr class="separator:ad2d2a73c367513b8b71aff5546276a3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  137. <tr class="memitem:a28dbbb9e24e2035535645629105aea46"><td class="memItemLeft" align="right" valign="top">uint8_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a28dbbb9e24e2035535645629105aea46">int64to8bit</a> (sqlite_int64 guid)</td></tr>
  138. <tr class="memdesc:a28dbbb9e24e2035535645629105aea46"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts the GUID from int64 to int8 array. <a href="#a28dbbb9e24e2035535645629105aea46">More...</a><br /></td></tr>
  139. <tr class="separator:a28dbbb9e24e2035535645629105aea46"><td class="memSeparator" colspan="2">&#160;</td></tr>
  140. <tr class="memitem:a99cc529fd785c752cd4b73ea7989521d"><td class="memItemLeft" align="right" valign="top">sqlite_int64&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a99cc529fd785c752cd4b73ea7989521d">int8to64bit</a> (uint8_t *guid)</td></tr>
  141. <tr class="separator:a99cc529fd785c752cd4b73ea7989521d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  142. <tr class="memitem:a5d0363e5d886e2c3e4bb5ca46d265ba7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#a5d0363e5d886e2c3e4bb5ca46d265ba7">sqltest</a> ()</td></tr>
  143. <tr class="separator:a5d0363e5d886e2c3e4bb5ca46d265ba7"><td class="memSeparator" colspan="2">&#160;</td></tr>
  144. </table><table class="memberdecls">
  145. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
  146. Variables</h2></td></tr>
  147. <tr class="memitem:ad6e663497d2c934364b3bcf07496b30b"><td class="memItemLeft" align="right" valign="top">sqlite3 *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8cpp.html#ad6e663497d2c934364b3bcf07496b30b">db</a></td></tr>
  148. <tr class="memdesc:ad6e663497d2c934364b3bcf07496b30b"><td class="mdescLeft">&#160;</td><td class="mdescRight">The database connector. <a href="#ad6e663497d2c934364b3bcf07496b30b">More...</a><br /></td></tr>
  149. <tr class="separator:ad6e663497d2c934364b3bcf07496b30b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  150. </table>
  151. <h2 class="groupheader">Function Documentation</h2>
  152. <a class="anchor" id="ad2d2a73c367513b8b71aff5546276a3c"></a>
  153. <div class="memitem">
  154. <div class="memproto">
  155. <table class="memname">
  156. <tr>
  157. <td class="memname">uint8_t* chartoint </td>
  158. <td>(</td>
  159. <td class="paramtype">const unsigned char *&#160;</td>
  160. <td class="paramname"><em>guid</em></td><td>)</td>
  161. <td></td>
  162. </tr>
  163. </table>
  164. </div><div class="memdoc">
  165. <p>Converts the GUID from char to int array. </p>
  166. <dl class="params"><dt>Parameters</dt><dd>
  167. <table class="params">
  168. <tr><td class="paramname">*guid</td><td>Pointer to the char GUID </td></tr>
  169. </table>
  170. </dd>
  171. </dl>
  172. <dl class="section return"><dt>Returns</dt><dd>pointer to the converted int array </dd></dl>
  173. </div>
  174. </div>
  175. <a class="anchor" id="a28dbbb9e24e2035535645629105aea46"></a>
  176. <div class="memitem">
  177. <div class="memproto">
  178. <table class="memname">
  179. <tr>
  180. <td class="memname">uint8_t* int64to8bit </td>
  181. <td>(</td>
  182. <td class="paramtype">sqlite_int64&#160;</td>
  183. <td class="paramname"><em>guid</em></td><td>)</td>
  184. <td></td>
  185. </tr>
  186. </table>
  187. </div><div class="memdoc">
  188. <p>Converts the GUID from int64 to int8 array. </p>
  189. <dl class="params"><dt>Parameters</dt><dd>
  190. <table class="params">
  191. <tr><td class="paramname">guid</td><td>64bit GUID </td></tr>
  192. </table>
  193. </dd>
  194. </dl>
  195. <dl class="section return"><dt>Returns</dt><dd>pointer to the converted int array </dd></dl>
  196. </div>
  197. </div>
  198. <a class="anchor" id="a99cc529fd785c752cd4b73ea7989521d"></a>
  199. <div class="memitem">
  200. <div class="memproto">
  201. <table class="memname">
  202. <tr>
  203. <td class="memname">sqlite_int64 int8to64bit </td>
  204. <td>(</td>
  205. <td class="paramtype">uint8_t *&#160;</td>
  206. <td class="paramname"><em>guid</em></td><td>)</td>
  207. <td></td>
  208. </tr>
  209. </table>
  210. </div><div class="memdoc">
  211. </div>
  212. </div>
  213. <a class="anchor" id="a437086982a7400d7205f3ab6600e6dcf"></a>
  214. <div class="memitem">
  215. <div class="memproto">
  216. <table class="memname">
  217. <tr>
  218. <td class="memname">char* inttochar </td>
  219. <td>(</td>
  220. <td class="paramtype">uint8_t *&#160;</td>
  221. <td class="paramname"><em>guid</em></td><td>)</td>
  222. <td></td>
  223. </tr>
  224. </table>
  225. </div><div class="memdoc">
  226. <p>Converts the GUID from int to char array. </p>
  227. <dl class="params"><dt>Parameters</dt><dd>
  228. <table class="params">
  229. <tr><td class="paramname">*guid</td><td>Pointer to the uint8_t GUID </td></tr>
  230. </table>
  231. </dd>
  232. </dl>
  233. <dl class="section return"><dt>Returns</dt><dd>pointer to the converted string </dd></dl>
  234. </div>
  235. </div>
  236. <a class="anchor" id="a7264f51f982e908b32635e91e6dc0062"></a>
  237. <div class="memitem">
  238. <div class="memproto">
  239. <table class="memname">
  240. <tr>
  241. <td class="memname">void sqlClose </td>
  242. <td>(</td>
  243. <td class="paramname"></td><td>)</td>
  244. <td></td>
  245. </tr>
  246. </table>
  247. </div><div class="memdoc">
  248. <p>Closes the database connection. </p>
  249. </div>
  250. </div>
  251. <a class="anchor" id="afd88a963f835215b8dad9ee9e49866dc"></a>
  252. <div class="memitem">
  253. <div class="memproto">
  254. <table class="memname">
  255. <tr>
  256. <td class="memname">int sqlExecute </td>
  257. <td>(</td>
  258. <td class="paramtype">string&#160;</td>
  259. <td class="paramname"><em>query</em></td><td>)</td>
  260. <td></td>
  261. </tr>
  262. </table>
  263. </div><div class="memdoc">
  264. <p>Executes a SQL statement. </p>
  265. <dl class="params"><dt>Parameters</dt><dd>
  266. <table class="params">
  267. <tr><td class="paramname">*query</td><td>SQL query string </td></tr>
  268. </table>
  269. </dd>
  270. </dl>
  271. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  272. </div>
  273. </div>
  274. <a class="anchor" id="a53458fb936962d23efec505a545a9cb8"></a>
  275. <div class="memitem">
  276. <div class="memproto">
  277. <table class="memname">
  278. <tr>
  279. <td class="memname">int sqlExecute2 </td>
  280. <td>(</td>
  281. <td class="paramtype">char *&#160;</td>
  282. <td class="paramname"><em>query</em></td><td>)</td>
  283. <td></td>
  284. </tr>
  285. </table>
  286. </div><div class="memdoc">
  287. </div>
  288. </div>
  289. <a class="anchor" id="aad0e803eda7a440a6063a447cfeca0cd"></a>
  290. <div class="memitem">
  291. <div class="memproto">
  292. <table class="memname">
  293. <tr>
  294. <td class="memname">uint64_t sqlGetConf </td>
  295. <td>(</td>
  296. <td class="paramtype"><a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a>&#160;</td>
  297. <td class="paramname"><em>id</em></td><td>)</td>
  298. <td></td>
  299. </tr>
  300. </table>
  301. </div><div class="memdoc">
  302. <p>Reads a configuration key from the database. </p>
  303. <dl class="params"><dt>Parameters</dt><dd>
  304. <table class="params">
  305. <tr><td class="paramname">id</td><td>Config ID key </td></tr>
  306. </table>
  307. </dd>
  308. </dl>
  309. <dl class="section return"><dt>Returns</dt><dd>value as integer (up to 64bit), 0 for not found </dd></dl>
  310. </div>
  311. </div>
  312. <a class="anchor" id="a1885a74e6af3ee510f30f98e60372e3e"></a>
  313. <div class="memitem">
  314. <div class="memproto">
  315. <table class="memname">
  316. <tr>
  317. <td class="memname">int sqlOpen </td>
  318. <td>(</td>
  319. <td class="paramname"></td><td>)</td>
  320. <td></td>
  321. </tr>
  322. </table>
  323. </div><div class="memdoc">
  324. <p>Opens and initializes a sqlite3 database connection. </p>
  325. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  326. </div>
  327. </div>
  328. <a class="anchor" id="a1ce0ac0c58916c138a92d3282f569784"></a>
  329. <div class="memitem">
  330. <div class="memproto">
  331. <table class="memname">
  332. <tr>
  333. <td class="memname">int sqlSetConf </td>
  334. <td>(</td>
  335. <td class="paramtype"><a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a>&#160;</td>
  336. <td class="paramname"><em>id</em>, </td>
  337. </tr>
  338. <tr>
  339. <td class="paramkey"></td>
  340. <td></td>
  341. <td class="paramtype">uint64_t&#160;</td>
  342. <td class="paramname"><em>value</em>&#160;</td>
  343. </tr>
  344. <tr>
  345. <td></td>
  346. <td>)</td>
  347. <td></td><td></td>
  348. </tr>
  349. </table>
  350. </div><div class="memdoc">
  351. <p>Saves a configuration key to the database. </p>
  352. <dl class="params"><dt>Parameters</dt><dd>
  353. <table class="params">
  354. <tr><td class="paramname">id</td><td>Config ID key </td></tr>
  355. <tr><td class="paramname">value</td><td>Integer value </td></tr>
  356. </table>
  357. </dd>
  358. </dl>
  359. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  360. </div>
  361. </div>
  362. <a class="anchor" id="aaed3fb776c9dc76d262df026803d3b8c"></a>
  363. <div class="memitem">
  364. <div class="memproto">
  365. <table class="memname">
  366. <tr>
  367. <td class="memname">int sqlSetup </td>
  368. <td>(</td>
  369. <td class="paramname"></td><td>)</td>
  370. <td></td>
  371. </tr>
  372. </table>
  373. </div><div class="memdoc">
  374. <p>Sets up the database and creates the needed structure. </p>
  375. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  376. </div>
  377. </div>
  378. <a class="anchor" id="a5d0363e5d886e2c3e4bb5ca46d265ba7"></a>
  379. <div class="memitem">
  380. <div class="memproto">
  381. <table class="memname">
  382. <tr>
  383. <td class="memname">void sqltest </td>
  384. <td>(</td>
  385. <td class="paramname"></td><td>)</td>
  386. <td></td>
  387. </tr>
  388. </table>
  389. </div><div class="memdoc">
  390. </div>
  391. </div>
  392. <a class="anchor" id="acd0eb5a18168fa3c37fab8ed0958c043"></a>
  393. <div class="memitem">
  394. <div class="memproto">
  395. <table class="memname">
  396. <tr>
  397. <td class="memname">std::string std::string string_sprintf </td>
  398. <td>(</td>
  399. <td class="paramtype">const char *&#160;</td>
  400. <td class="paramname"><em>format</em>, </td>
  401. </tr>
  402. <tr>
  403. <td class="paramkey"></td>
  404. <td></td>
  405. <td class="paramtype">&#160;</td>
  406. <td class="paramname"><em>...</em>&#160;</td>
  407. </tr>
  408. <tr>
  409. <td></td>
  410. <td>)</td>
  411. <td></td><td></td>
  412. </tr>
  413. </table>
  414. </div><div class="memdoc">
  415. <p>Allows the format of printf but returns a string Source: <a href="http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output">http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output</a>. </p>
  416. <dl class="section return"><dt>Returns</dt><dd>printf formatted string </dd></dl>
  417. <dl class="params"><dt>Parameters</dt><dd>
  418. <table class="params">
  419. <tr><td class="paramname">format</td><td>input string as char array </td></tr>
  420. </table>
  421. </dd>
  422. </dl>
  423. </div>
  424. </div>
  425. <a class="anchor" id="ac240bb02efe882b4e82da48676301d89"></a>
  426. <div class="memitem">
  427. <div class="memproto">
  428. <table class="memname">
  429. <tr>
  430. <td class="memname">std::string string_vsprintf </td>
  431. <td>(</td>
  432. <td class="paramtype">const char *&#160;</td>
  433. <td class="paramname"><em>format</em>, </td>
  434. </tr>
  435. <tr>
  436. <td class="paramkey"></td>
  437. <td></td>
  438. <td class="paramtype">std::va_list&#160;</td>
  439. <td class="paramname"><em>args</em>&#160;</td>
  440. </tr>
  441. <tr>
  442. <td></td>
  443. <td>)</td>
  444. <td></td><td></td>
  445. </tr>
  446. </table>
  447. </div><div class="memdoc">
  448. <p>Helper function to allow the use of vsprintf() with a string See: <a href="http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output">http://codereview.stackexchange.com/questions/52522/mimic-sprintf-with-stdstring-output</a>. </p>
  449. </div>
  450. </div>
  451. <h2 class="groupheader">Variable Documentation</h2>
  452. <a class="anchor" id="ad6e663497d2c934364b3bcf07496b30b"></a>
  453. <div class="memitem">
  454. <div class="memproto">
  455. <table class="memname">
  456. <tr>
  457. <td class="memname">sqlite3* db</td>
  458. </tr>
  459. </table>
  460. </div><div class="memdoc">
  461. <p>The database connector. </p>
  462. </div>
  463. </div>
  464. </div><!-- contents -->
  465. <!-- start footer part -->
  466. <hr class="footer"/><address class="footer"><small>
  467. Generated by &#160;<a href="http://www.doxygen.org/index.html">
  468. <img class="footer" src="doxygen.png" alt="doxygen"/>
  469. </a> 1.8.10
  470. </small></address>
  471. </body>
  472. </html>