database_8h.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  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.h 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="#enum-members">Enumerations</a> &#124;
  84. <a href="#func-members">Functions</a> </div>
  85. <div class="headertitle">
  86. <div class="title">database.h File Reference</div> </div>
  87. </div><!--header-->
  88. <div class="contents">
  89. <div class="textblock"><code>#include &lt;string&gt;</code><br />
  90. <code>#include &lt;stdexcept&gt;</code><br />
  91. <code>#include &lt;cstdio&gt;</code><br />
  92. <code>#include &lt;stdlib.h&gt;</code><br />
  93. <code>#include &lt;inttypes.h&gt;</code><br />
  94. <code>#include &lt;cstdarg&gt;</code><br />
  95. <code>#include &quot;sqlite/sqlite3.h&quot;</code><br />
  96. </div>
  97. <p><a href="database_8h_source.html">Go to the source code of this file.</a></p>
  98. <table class="memberdecls">
  99. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
  100. Enumerations</h2></td></tr>
  101. <tr class="memitem:ae1822373f950fb4881633b7ec843f4df"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a> { <br />
  102. &#160;&#160;<a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfaadc75f07a97300078de1c92bf6414827">CRC</a> = 1,
  103. <a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfababedca157bd5e1f8c299e61c197f62f">AliveCRC</a> = 2,
  104. <a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfa8408e147e8a938136f8a861d49dc9424">lastTC1</a> = 3,
  105. <a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfa59e22dd6cca23a1fc16c27b051e515b5">lastTC2</a> = 4,
  106. <br />
  107. &#160;&#160;<a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfa3e3cdc9f9da298c1b6d46c49b1421848">lastTC3</a> = 5,
  108. <a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfa6e580e65e5c126a239a8e27157ec96a4">lastTerm</a> = 6,
  109. <a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4dfa221e2bd4755481003e8fe6ca37c66eb1">testSlowCnt</a> = 7
  110. <br />
  111. }<tr class="separator:ae1822373f950fb4881633b7ec843f4df"><td class="memSeparator" colspan="2">&#160;</td></tr>
  112. </td></tr>
  113. </table><table class="memberdecls">
  114. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
  115. Functions</h2></td></tr>
  116. <tr class="memitem:a1885a74e6af3ee510f30f98e60372e3e"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a1885a74e6af3ee510f30f98e60372e3e">sqlOpen</a> ()</td></tr>
  117. <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>
  118. <tr class="separator:a1885a74e6af3ee510f30f98e60372e3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  119. <tr class="memitem:a7264f51f982e908b32635e91e6dc0062"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a7264f51f982e908b32635e91e6dc0062">sqlClose</a> ()</td></tr>
  120. <tr class="memdesc:a7264f51f982e908b32635e91e6dc0062"><td class="mdescLeft">&#160;</td><td class="mdescRight">Closes the database connection. <a href="#a7264f51f982e908b32635e91e6dc0062">More...</a><br /></td></tr>
  121. <tr class="separator:a7264f51f982e908b32635e91e6dc0062"><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_8h.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:afd88a963f835215b8dad9ee9e49866dc"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#afd88a963f835215b8dad9ee9e49866dc">sqlExecute</a> (string query)</td></tr>
  126. <tr class="memdesc:afd88a963f835215b8dad9ee9e49866dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Executes a SQL statement. <a href="#afd88a963f835215b8dad9ee9e49866dc">More...</a><br /></td></tr>
  127. <tr class="separator:afd88a963f835215b8dad9ee9e49866dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
  128. <tr class="memitem:a6ad9c375b101ce2cb461975eb2748b93"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a6ad9c375b101ce2cb461975eb2748b93">sqlInsertNode</a> (uint8_t *guid, bool terminal)</td></tr>
  129. <tr class="separator:a6ad9c375b101ce2cb461975eb2748b93"><td class="memSeparator" colspan="2">&#160;</td></tr>
  130. <tr class="memitem:ae28580072312f213d923d9b145e3dc90"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#ae28580072312f213d923d9b145e3dc90">sqlReadNodes</a> ()</td></tr>
  131. <tr class="separator:ae28580072312f213d923d9b145e3dc90"><td class="memSeparator" colspan="2">&#160;</td></tr>
  132. <tr class="memitem:a437086982a7400d7205f3ab6600e6dcf"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a437086982a7400d7205f3ab6600e6dcf">inttochar</a> (uint8_t *guid)</td></tr>
  133. <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>
  134. <tr class="separator:a437086982a7400d7205f3ab6600e6dcf"><td class="memSeparator" colspan="2">&#160;</td></tr>
  135. <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_8h.html#ad2d2a73c367513b8b71aff5546276a3c">chartoint</a> (const unsigned char *guid)</td></tr>
  136. <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>
  137. <tr class="separator:ad2d2a73c367513b8b71aff5546276a3c"><td class="memSeparator" colspan="2">&#160;</td></tr>
  138. <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_8h.html#a28dbbb9e24e2035535645629105aea46">int64to8bit</a> (sqlite_int64 guid)</td></tr>
  139. <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>
  140. <tr class="separator:a28dbbb9e24e2035535645629105aea46"><td class="memSeparator" colspan="2">&#160;</td></tr>
  141. <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_8h.html#a99cc529fd785c752cd4b73ea7989521d">int8to64bit</a> (uint8_t *guid)</td></tr>
  142. <tr class="separator:a99cc529fd785c752cd4b73ea7989521d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  143. <tr class="memitem:a5d0363e5d886e2c3e4bb5ca46d265ba7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a5d0363e5d886e2c3e4bb5ca46d265ba7">sqltest</a> ()</td></tr>
  144. <tr class="separator:a5d0363e5d886e2c3e4bb5ca46d265ba7"><td class="memSeparator" colspan="2">&#160;</td></tr>
  145. <tr class="memitem:a6c0bc3256310fd400a26243d8a8f1652"><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a6c0bc3256310fd400a26243d8a8f1652">string_sprintf</a> (const char *format,...)</td></tr>
  146. <tr class="memdesc:a6c0bc3256310fd400a26243d8a8f1652"><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="#a6c0bc3256310fd400a26243d8a8f1652">More...</a><br /></td></tr>
  147. <tr class="separator:a6c0bc3256310fd400a26243d8a8f1652"><td class="memSeparator" colspan="2">&#160;</td></tr>
  148. <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_8h.html#aad0e803eda7a440a6063a447cfeca0cd">sqlGetConf</a> (<a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a> id)</td></tr>
  149. <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>
  150. <tr class="separator:aad0e803eda7a440a6063a447cfeca0cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
  151. <tr class="memitem:a1ce0ac0c58916c138a92d3282f569784"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="database_8h.html#a1ce0ac0c58916c138a92d3282f569784">sqlSetConf</a> (<a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a> id, uint64_t value)</td></tr>
  152. <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>
  153. <tr class="separator:a1ce0ac0c58916c138a92d3282f569784"><td class="memSeparator" colspan="2">&#160;</td></tr>
  154. </table>
  155. <h2 class="groupheader">Enumeration Type Documentation</h2>
  156. <a class="anchor" id="ae1822373f950fb4881633b7ec843f4df"></a>
  157. <div class="memitem">
  158. <div class="memproto">
  159. <table class="memname">
  160. <tr>
  161. <td class="memname">enum <a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a></td>
  162. </tr>
  163. </table>
  164. </div><div class="memdoc">
  165. <table class="fieldtable">
  166. <tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfaadc75f07a97300078de1c92bf6414827"></a>CRC&#160;</td><td class="fielddoc">
  167. </td></tr>
  168. <tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfababedca157bd5e1f8c299e61c197f62f"></a>AliveCRC&#160;</td><td class="fielddoc">
  169. </td></tr>
  170. <tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfa8408e147e8a938136f8a861d49dc9424"></a>lastTC1&#160;</td><td class="fielddoc">
  171. </td></tr>
  172. <tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfa59e22dd6cca23a1fc16c27b051e515b5"></a>lastTC2&#160;</td><td class="fielddoc">
  173. </td></tr>
  174. <tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfa3e3cdc9f9da298c1b6d46c49b1421848"></a>lastTC3&#160;</td><td class="fielddoc">
  175. </td></tr>
  176. <tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfa6e580e65e5c126a239a8e27157ec96a4"></a>lastTerm&#160;</td><td class="fielddoc">
  177. </td></tr>
  178. <tr><td class="fieldname"><a class="anchor" id="ae1822373f950fb4881633b7ec843f4dfa221e2bd4755481003e8fe6ca37c66eb1"></a>testSlowCnt&#160;</td><td class="fielddoc">
  179. </td></tr>
  180. </table>
  181. </div>
  182. </div>
  183. <h2 class="groupheader">Function Documentation</h2>
  184. <a class="anchor" id="ad2d2a73c367513b8b71aff5546276a3c"></a>
  185. <div class="memitem">
  186. <div class="memproto">
  187. <table class="memname">
  188. <tr>
  189. <td class="memname">uint8_t* chartoint </td>
  190. <td>(</td>
  191. <td class="paramtype">const unsigned char *&#160;</td>
  192. <td class="paramname"><em>guid</em></td><td>)</td>
  193. <td></td>
  194. </tr>
  195. </table>
  196. </div><div class="memdoc">
  197. <p>Converts the GUID from char to int array. </p>
  198. <dl class="params"><dt>Parameters</dt><dd>
  199. <table class="params">
  200. <tr><td class="paramname">*guid</td><td>Pointer to the char GUID </td></tr>
  201. </table>
  202. </dd>
  203. </dl>
  204. <dl class="section return"><dt>Returns</dt><dd>pointer to the converted int array </dd></dl>
  205. </div>
  206. </div>
  207. <a class="anchor" id="a28dbbb9e24e2035535645629105aea46"></a>
  208. <div class="memitem">
  209. <div class="memproto">
  210. <table class="memname">
  211. <tr>
  212. <td class="memname">uint8_t* int64to8bit </td>
  213. <td>(</td>
  214. <td class="paramtype">sqlite_int64&#160;</td>
  215. <td class="paramname"><em>guid</em></td><td>)</td>
  216. <td></td>
  217. </tr>
  218. </table>
  219. </div><div class="memdoc">
  220. <p>Converts the GUID from int64 to int8 array. </p>
  221. <dl class="params"><dt>Parameters</dt><dd>
  222. <table class="params">
  223. <tr><td class="paramname">guid</td><td>64bit GUID </td></tr>
  224. </table>
  225. </dd>
  226. </dl>
  227. <dl class="section return"><dt>Returns</dt><dd>pointer to the converted int array </dd></dl>
  228. </div>
  229. </div>
  230. <a class="anchor" id="a99cc529fd785c752cd4b73ea7989521d"></a>
  231. <div class="memitem">
  232. <div class="memproto">
  233. <table class="memname">
  234. <tr>
  235. <td class="memname">sqlite_int64 int8to64bit </td>
  236. <td>(</td>
  237. <td class="paramtype">uint8_t *&#160;</td>
  238. <td class="paramname"><em>guid</em></td><td>)</td>
  239. <td></td>
  240. </tr>
  241. </table>
  242. </div><div class="memdoc">
  243. </div>
  244. </div>
  245. <a class="anchor" id="a437086982a7400d7205f3ab6600e6dcf"></a>
  246. <div class="memitem">
  247. <div class="memproto">
  248. <table class="memname">
  249. <tr>
  250. <td class="memname">char* inttochar </td>
  251. <td>(</td>
  252. <td class="paramtype">uint8_t *&#160;</td>
  253. <td class="paramname"><em>guid</em></td><td>)</td>
  254. <td></td>
  255. </tr>
  256. </table>
  257. </div><div class="memdoc">
  258. <p>Converts the GUID from int to char array. </p>
  259. <dl class="params"><dt>Parameters</dt><dd>
  260. <table class="params">
  261. <tr><td class="paramname">*guid</td><td>Pointer to the uint8_t GUID </td></tr>
  262. </table>
  263. </dd>
  264. </dl>
  265. <dl class="section return"><dt>Returns</dt><dd>pointer to the converted string </dd></dl>
  266. </div>
  267. </div>
  268. <a class="anchor" id="a7264f51f982e908b32635e91e6dc0062"></a>
  269. <div class="memitem">
  270. <div class="memproto">
  271. <table class="memname">
  272. <tr>
  273. <td class="memname">void sqlClose </td>
  274. <td>(</td>
  275. <td class="paramname"></td><td>)</td>
  276. <td></td>
  277. </tr>
  278. </table>
  279. </div><div class="memdoc">
  280. <p>Closes the database connection. </p>
  281. </div>
  282. </div>
  283. <a class="anchor" id="afd88a963f835215b8dad9ee9e49866dc"></a>
  284. <div class="memitem">
  285. <div class="memproto">
  286. <table class="memname">
  287. <tr>
  288. <td class="memname">int sqlExecute </td>
  289. <td>(</td>
  290. <td class="paramtype">string&#160;</td>
  291. <td class="paramname"><em>query</em></td><td>)</td>
  292. <td></td>
  293. </tr>
  294. </table>
  295. </div><div class="memdoc">
  296. <p>Executes a SQL statement. </p>
  297. <dl class="params"><dt>Parameters</dt><dd>
  298. <table class="params">
  299. <tr><td class="paramname">*query</td><td>SQL query string </td></tr>
  300. </table>
  301. </dd>
  302. </dl>
  303. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  304. </div>
  305. </div>
  306. <a class="anchor" id="aad0e803eda7a440a6063a447cfeca0cd"></a>
  307. <div class="memitem">
  308. <div class="memproto">
  309. <table class="memname">
  310. <tr>
  311. <td class="memname">uint64_t sqlGetConf </td>
  312. <td>(</td>
  313. <td class="paramtype"><a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a>&#160;</td>
  314. <td class="paramname"><em>id</em></td><td>)</td>
  315. <td></td>
  316. </tr>
  317. </table>
  318. </div><div class="memdoc">
  319. <p>Reads a configuration key from the database. </p>
  320. <dl class="params"><dt>Parameters</dt><dd>
  321. <table class="params">
  322. <tr><td class="paramname">id</td><td>Config ID key </td></tr>
  323. </table>
  324. </dd>
  325. </dl>
  326. <dl class="section return"><dt>Returns</dt><dd>value as integer (up to 64bit), 0 for not found </dd></dl>
  327. </div>
  328. </div>
  329. <a class="anchor" id="a6ad9c375b101ce2cb461975eb2748b93"></a>
  330. <div class="memitem">
  331. <div class="memproto">
  332. <table class="memname">
  333. <tr>
  334. <td class="memname">int sqlInsertNode </td>
  335. <td>(</td>
  336. <td class="paramtype">uint8_t *&#160;</td>
  337. <td class="paramname"><em>guid</em>, </td>
  338. </tr>
  339. <tr>
  340. <td class="paramkey"></td>
  341. <td></td>
  342. <td class="paramtype">bool&#160;</td>
  343. <td class="paramname"><em>terminal</em>&#160;</td>
  344. </tr>
  345. <tr>
  346. <td></td>
  347. <td>)</td>
  348. <td></td><td></td>
  349. </tr>
  350. </table>
  351. </div><div class="memdoc">
  352. </div>
  353. </div>
  354. <a class="anchor" id="a1885a74e6af3ee510f30f98e60372e3e"></a>
  355. <div class="memitem">
  356. <div class="memproto">
  357. <table class="memname">
  358. <tr>
  359. <td class="memname">int sqlOpen </td>
  360. <td>(</td>
  361. <td class="paramname"></td><td>)</td>
  362. <td></td>
  363. </tr>
  364. </table>
  365. </div><div class="memdoc">
  366. <p>Opens and initializes a sqlite3 database connection. </p>
  367. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  368. </div>
  369. </div>
  370. <a class="anchor" id="ae28580072312f213d923d9b145e3dc90"></a>
  371. <div class="memitem">
  372. <div class="memproto">
  373. <table class="memname">
  374. <tr>
  375. <td class="memname">int sqlReadNodes </td>
  376. <td>(</td>
  377. <td class="paramname"></td><td>)</td>
  378. <td></td>
  379. </tr>
  380. </table>
  381. </div><div class="memdoc">
  382. </div>
  383. </div>
  384. <a class="anchor" id="a1ce0ac0c58916c138a92d3282f569784"></a>
  385. <div class="memitem">
  386. <div class="memproto">
  387. <table class="memname">
  388. <tr>
  389. <td class="memname">int sqlSetConf </td>
  390. <td>(</td>
  391. <td class="paramtype"><a class="el" href="database_8h.html#ae1822373f950fb4881633b7ec843f4df">config_key_t</a>&#160;</td>
  392. <td class="paramname"><em>id</em>, </td>
  393. </tr>
  394. <tr>
  395. <td class="paramkey"></td>
  396. <td></td>
  397. <td class="paramtype">uint64_t&#160;</td>
  398. <td class="paramname"><em>value</em>&#160;</td>
  399. </tr>
  400. <tr>
  401. <td></td>
  402. <td>)</td>
  403. <td></td><td></td>
  404. </tr>
  405. </table>
  406. </div><div class="memdoc">
  407. <p>Saves a configuration key to the database. </p>
  408. <dl class="params"><dt>Parameters</dt><dd>
  409. <table class="params">
  410. <tr><td class="paramname">id</td><td>Config ID key </td></tr>
  411. <tr><td class="paramname">value</td><td>Integer value </td></tr>
  412. </table>
  413. </dd>
  414. </dl>
  415. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  416. </div>
  417. </div>
  418. <a class="anchor" id="aaed3fb776c9dc76d262df026803d3b8c"></a>
  419. <div class="memitem">
  420. <div class="memproto">
  421. <table class="memname">
  422. <tr>
  423. <td class="memname">int sqlSetup </td>
  424. <td>(</td>
  425. <td class="paramname"></td><td>)</td>
  426. <td></td>
  427. </tr>
  428. </table>
  429. </div><div class="memdoc">
  430. <p>Sets up the database and creates the needed structure. </p>
  431. <dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>
  432. </div>
  433. </div>
  434. <a class="anchor" id="a5d0363e5d886e2c3e4bb5ca46d265ba7"></a>
  435. <div class="memitem">
  436. <div class="memproto">
  437. <table class="memname">
  438. <tr>
  439. <td class="memname">void sqltest </td>
  440. <td>(</td>
  441. <td class="paramname"></td><td>)</td>
  442. <td></td>
  443. </tr>
  444. </table>
  445. </div><div class="memdoc">
  446. </div>
  447. </div>
  448. <a class="anchor" id="a6c0bc3256310fd400a26243d8a8f1652"></a>
  449. <div class="memitem">
  450. <div class="memproto">
  451. <table class="memname">
  452. <tr>
  453. <td class="memname">std::string string_sprintf </td>
  454. <td>(</td>
  455. <td class="paramtype">const char *&#160;</td>
  456. <td class="paramname"><em>format</em>, </td>
  457. </tr>
  458. <tr>
  459. <td class="paramkey"></td>
  460. <td></td>
  461. <td class="paramtype">&#160;</td>
  462. <td class="paramname"><em>...</em>&#160;</td>
  463. </tr>
  464. <tr>
  465. <td></td>
  466. <td>)</td>
  467. <td></td><td></td>
  468. </tr>
  469. </table>
  470. </div><div class="memdoc">
  471. <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>
  472. <dl class="section return"><dt>Returns</dt><dd>printf formatted string </dd></dl>
  473. <dl class="params"><dt>Parameters</dt><dd>
  474. <table class="params">
  475. <tr><td class="paramname">format</td><td>input string as char array </td></tr>
  476. </table>
  477. </dd>
  478. </dl>
  479. </div>
  480. </div>
  481. </div><!-- contents -->
  482. <!-- start footer part -->
  483. <hr class="footer"/><address class="footer"><small>
  484. Generated by &#160;<a href="http://www.doxygen.org/index.html">
  485. <img class="footer" src="doxygen.png" alt="doxygen"/>
  486. </a> 1.8.10
  487. </small></address>
  488. </body>
  489. </html>