database_8h_source.html 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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.9.1"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>openPilotLog: src/database/database.h Source File</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="resize.js"></script>
  14. <script type="text/javascript" src="navtreedata.js"></script>
  15. <script type="text/javascript" src="navtree.js"></script>
  16. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  17. <script type="text/javascript" src="search/searchdata.js"></script>
  18. <script type="text/javascript" src="search/search.js"></script>
  19. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  20. <link href="custom_dark_theme.css" rel="stylesheet" type="text/css"/>
  21. </head>
  22. <body>
  23. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  24. <div id="titlearea">
  25. <table cellspacing="0" cellpadding="0">
  26. <tbody>
  27. <tr style="height: 56px;">
  28. <td id="projectlogo"><img alt="Logo" src="icon_main.png"/></td>
  29. <td id="projectalign" style="padding-left: 0.5em;">
  30. <div id="projectname">openPilotLog
  31. </div>
  32. </td>
  33. </tr>
  34. </tbody>
  35. </table>
  36. </div>
  37. <!-- end header part -->
  38. <!-- Generated by Doxygen 1.9.1 -->
  39. <script type="text/javascript">
  40. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  41. var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
  42. /* @license-end */
  43. </script>
  44. <script type="text/javascript" src="menudata.js"></script>
  45. <script type="text/javascript" src="menu.js"></script>
  46. <script type="text/javascript">
  47. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  48. $(function() {
  49. initMenu('',true,false,'search.php','Search');
  50. $(document).ready(function() { init_search(); });
  51. });
  52. /* @license-end */</script>
  53. <div id="main-nav"></div>
  54. </div><!-- top -->
  55. <div id="side-nav" class="ui-resizable side-nav-resizable">
  56. <div id="nav-tree">
  57. <div id="nav-tree-contents">
  58. <div id="nav-sync" class="sync"></div>
  59. </div>
  60. </div>
  61. <div id="splitbar" style="-moz-user-select:none;"
  62. class="ui-resizable-handle">
  63. </div>
  64. </div>
  65. <script type="text/javascript">
  66. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  67. $(document).ready(function(){initNavTree('database_8h_source.html',''); initResizable(); });
  68. /* @license-end */
  69. </script>
  70. <div id="doc-content">
  71. <!-- window showing the filter options -->
  72. <div id="MSearchSelectWindow"
  73. onmouseover="return searchBox.OnSearchSelectShow()"
  74. onmouseout="return searchBox.OnSearchSelectHide()"
  75. onkeydown="return searchBox.OnSearchSelectKey(event)">
  76. </div>
  77. <!-- iframe showing the search results (closed by default) -->
  78. <div id="MSearchResultsWindow">
  79. <iframe src="javascript:void(0)" frameborder="0"
  80. name="MSearchResults" id="MSearchResults">
  81. </iframe>
  82. </div>
  83. <div class="header">
  84. <div class="headertitle">
  85. <div class="title">database.h</div> </div>
  86. </div><!--header-->
  87. <div class="contents">
  88. <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/*</span></div>
  89. <div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> *openPilotLog - A FOSS Pilot Logbook Application</span></div>
  90. <div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> *Copyright (C) 2020-2022 Felix Turowsky</span></div>
  91. <div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> *</span></div>
  92. <div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> *This program is free software: you can redistribute it and/or modify</span></div>
  93. <div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> *it under the terms of the GNU General Public License as published by</span></div>
  94. <div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> *the Free Software Foundation, either version 3 of the License, or</span></div>
  95. <div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> *(at your option) any later version.</span></div>
  96. <div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> *</span></div>
  97. <div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> *This program is distributed in the hope that it will be useful,</span></div>
  98. <div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> *but WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
  99. <div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span></div>
  100. <div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> *GNU General Public License for more details.</span></div>
  101. <div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> *</span></div>
  102. <div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment"> *You should have received a copy of the GNU General Public License</span></div>
  103. <div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment"> *along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;.</span></div>
  104. <div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment"> */</span></div>
  105. <div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#ifndef DATABASE_H</span></div>
  106. <div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#define DATABASE_H</span></div>
  107. <div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; </div>
  108. <div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#include &lt;QPair&gt;</span></div>
  109. <div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="preprocessor">#include &lt;QHash&gt;</span></div>
  110. <div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;<span class="preprocessor">#include &lt;QString&gt;</span></div>
  111. <div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;<span class="preprocessor">#include &lt;QDir&gt;</span></div>
  112. <div class="line"><a name="l00025"></a><span class="lineno"> 25</span>&#160;<span class="preprocessor">#include &lt;QSqlDatabase&gt;</span></div>
  113. <div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor">#include &lt;QSqlDriver&gt;</span></div>
  114. <div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;QSqlQuery&gt;</span></div>
  115. <div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;<span class="preprocessor">#include &lt;QSqlError&gt;</span></div>
  116. <div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;QSqlTableModel&gt;</span></div>
  117. <div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;<span class="preprocessor">#include &lt;QSqlQuery&gt;</span></div>
  118. <div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#include &lt;QSqlRecord&gt;</span></div>
  119. <div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor">#include &lt;QSqlField&gt;</span></div>
  120. <div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160; </div>
  121. <div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor">#include &quot;src/classes/paths.h&quot;</span></div>
  122. <div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#include &quot;src/opl.h&quot;</span></div>
  123. <div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;<span class="preprocessor">#include &quot;src/database/row.h&quot;</span></div>
  124. <div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160; </div>
  125. <div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160; </div>
  126. <div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160; </div>
  127. <div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="keyword">namespace </span><a class="code" href="namespace_o_p_l.html">OPL</a> {</div>
  128. <div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160; </div>
  129. <div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="comment">//using RowData_T = QHash&lt;QString, QVariant&gt;;</span></div>
  130. <div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160; </div>
  131. <div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor">#define DB OPL::Database::instance()</span></div>
  132. <div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160; </div>
  133. <div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html"> 57</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_o_p_l_1_1_database.html">Database</a> : <span class="keyword">public</span> QObject {</div>
  134. <div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160; </div>
  135. <div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="keyword">private</span>:</div>
  136. <div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160; Q_OBJECT</div>
  137. <div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160; <a class="code" href="class_o_p_l_1_1_database.html">Database</a>()</div>
  138. <div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160; : databaseFile(<a class="code" href="class_o_p_l_1_1_paths.html#a1636e1c04163319f63f56868142f1d1f">OPL::Paths::databaseFileInfo</a>())</div>
  139. <div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160; {}</div>
  140. <div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160; <span class="keyword">static</span> <a class="code" href="class_o_p_l_1_1_database.html">Database</a>* <span class="keyword">self</span>;</div>
  141. <div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160; <span class="keyword">const</span> QFileInfo databaseFile;</div>
  142. <div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160; QStringList tableNames;</div>
  143. <div class="line"><a name="l00067"></a><span class="lineno"> 67</span>&#160; QHash&lt;QString, QStringList&gt; tableColumns;</div>
  144. <div class="line"><a name="l00068"></a><span class="lineno"> 68</span>&#160; </div>
  145. <div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160; <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keyword">static</span> QString SQLITE_DRIVER = QStringLiteral(<span class="stringliteral">&quot;QSQLITE&quot;</span>);</div>
  146. <div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160; <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keyword">static</span> QList&lt;OPL::DbTable&gt; USER_TABLES = {</div>
  147. <div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160; OPL::DbTable::Flights,</div>
  148. <div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160; OPL::DbTable::Pilots,</div>
  149. <div class="line"><a name="l00073"></a><span class="lineno"> 73</span>&#160; OPL::DbTable::Tails</div>
  150. <div class="line"><a name="l00074"></a><span class="lineno"> 74</span>&#160; };</div>
  151. <div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160; <span class="keyword">inline</span> <span class="keyword">const</span> <span class="keyword">static</span> QList&lt;OPL::DbTable&gt; TEMPLATE_TABLES = {</div>
  152. <div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160; OPL::DbTable::Aircraft,</div>
  153. <div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160; OPL::DbTable::Airports,</div>
  154. <div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160; OPL::DbTable::Currencies,</div>
  155. <div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160; OPL::DbTable::Changelog,</div>
  156. <div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160; };</div>
  157. <div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160; </div>
  158. <div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160; </div>
  159. <div class="line"><a name="l00083"></a><span class="lineno"> 83</span>&#160;<span class="keyword">public</span>:</div>
  160. <div class="line"><a name="l00084"></a><span class="lineno"> 84</span>&#160; <a class="code" href="class_o_p_l_1_1_database.html">Database</a>(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_database.html">Database</a>&amp;) = <span class="keyword">delete</span>;</div>
  161. <div class="line"><a name="l00085"></a><span class="lineno"> 85</span>&#160; <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_database.html">Database</a>&amp;) = <span class="keyword">delete</span>;</div>
  162. <div class="line"><a name="l00086"></a><span class="lineno"> 86</span>&#160; <span class="keyword">static</span> <a class="code" href="class_o_p_l_1_1_database.html">Database</a>* instance();</div>
  163. <div class="line"><a name="l00087"></a><span class="lineno"> 87</span>&#160; </div>
  164. <div class="line"><a name="l00096"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#aa5b783822a603bdcfd1d8c93ba0af34b"> 96</a></span>&#160; QSqlError <a class="code" href="class_o_p_l_1_1_database.html#aa5b783822a603bdcfd1d8c93ba0af34b">lastError</a>;</div>
  165. <div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160; </div>
  166. <div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a15dbcef162931776a0bdf6610fdd4cde">connect</a>();</div>
  167. <div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160; </div>
  168. <div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_o_p_l_1_1_database.html#aceb1bb497d30d413f87d6541716a873b">disconnect</a>();</div>
  169. <div class="line"><a name="l00107"></a><span class="lineno"> 107</span>&#160; </div>
  170. <div class="line"><a name="l00112"></a><span class="lineno"> 112</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_o_p_l_1_1_database.html#a55a01dac1e447f7c41474a39d8f621ef">updateLayout</a>();</div>
  171. <div class="line"><a name="l00113"></a><span class="lineno"> 113</span>&#160; </div>
  172. <div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160; <span class="keyword">const</span> QString <a class="code" href="class_o_p_l_1_1_database.html#a6df6e6b98679011f747862ca48a3498c">version</a>() <span class="keyword">const</span>;</div>
  173. <div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160; </div>
  174. <div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160; <span class="keyword">const</span> QString <a class="code" href="class_o_p_l_1_1_database.html#a0b20bec0f8bef0277325492a1dee33ef">sqliteVersion</a>() <span class="keyword">const</span>;</div>
  175. <div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160; </div>
  176. <div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160; <span class="keyword">const</span> QStringList <a class="code" href="class_o_p_l_1_1_database.html#a9d09969956b08b86bf83277872354247">getTableNames</a>() <span class="keyword">const</span>;</div>
  177. <div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; </div>
  178. <div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; <span class="keyword">const</span> QStringList <a class="code" href="class_o_p_l_1_1_database.html#ac5b344097eeb2579da9bcfc7941d074c">getTableColumns</a>(<a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table_name) <span class="keyword">const</span>;</div>
  179. <div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; </div>
  180. <div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; <span class="keyword">static</span> QSqlDatabase <a class="code" href="class_o_p_l_1_1_database.html#a233943791f4bca3aa083f46562eb6d50">database</a>();</div>
  181. <div class="line"><a name="l00140"></a><span class="lineno"> 140</span>&#160; </div>
  182. <div class="line"><a name="l00146"></a><span class="lineno"> 146</span>&#160; QVector&lt;QVariant&gt; <a class="code" href="class_o_p_l_1_1_database.html#abf45cf7ba5d25bb5d8f8aac1105bb728">customQuery</a>(QString statement, <span class="keywordtype">int</span> return_values);</div>
  183. <div class="line"><a name="l00147"></a><span class="lineno"> 147</span>&#160; </div>
  184. <div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a69f4a4fa1e496e86224e87612edba548">exists</a>(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_row.html">OPL::Row</a> &amp;row);</div>
  185. <div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160; </div>
  186. <div class="line"><a name="l00157"></a><span class="lineno"> 157</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#aa342b9d852daecb85fb77ec2f19234a5">clear</a>();</div>
  187. <div class="line"><a name="l00158"></a><span class="lineno"> 158</span>&#160; </div>
  188. <div class="line"><a name="l00163"></a><span class="lineno"> 163</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#ad9aab9c8bc43009bbc2595409004e20b">commit</a>(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_row.html">OPL::Row</a> &amp;row);</div>
  189. <div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; </div>
  190. <div class="line"><a name="l00170"></a><span class="lineno"> 170</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#ad9aab9c8bc43009bbc2595409004e20b">commit</a>(<span class="keyword">const</span> QJsonArray &amp;json_arr, <span class="keyword">const</span> <a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table);</div>
  191. <div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160; </div>
  192. <div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#aa3bbfc0dd7ff7bd34c2c1c847f539168">insert</a>(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_row.html">OPL::Row</a> &amp;new_row);</div>
  193. <div class="line"><a name="l00176"></a><span class="lineno"> 176</span>&#160; </div>
  194. <div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a4938319e593b9e5d5a334f794301d873">update</a>(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_row.html">OPL::Row</a> &amp;updated_row);</div>
  195. <div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160; </div>
  196. <div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a29362ea9a2b1805d42e5ef7823c42e50">remove</a>(<span class="keyword">const</span> <a class="code" href="class_o_p_l_1_1_row.html">OPL::Row</a> &amp;row);</div>
  197. <div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; </div>
  198. <div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a6c2ebefc6cf6d948d64dfe71bec08540">removeMany</a>(<a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table, <span class="keyword">const</span> QList&lt;int&gt; &amp;row_id_list);</div>
  199. <div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160; </div>
  200. <div class="line"><a name="l00196"></a><span class="lineno"> 196</span>&#160; <a class="code" href="class_o_p_l_1_1_row.html">OPL::Row</a> <a class="code" href="class_o_p_l_1_1_database.html#ae38dc30cb955ffc0e3235e51104dd912">getRow</a>(<span class="keyword">const</span> <a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table, <span class="keyword">const</span> <span class="keywordtype">int</span> row_id);</div>
  201. <div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; </div>
  202. <div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; RowData_T <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(<span class="keyword">const</span> <a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table, <span class="keyword">const</span> <span class="keywordtype">int</span> row_id);</div>
  203. <div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; </div>
  204. <div class="line"><a name="l00206"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a2834aeb5c47bde300c898021eb9bbc48"> 206</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_pilot_entry.html">OPL::PilotEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#a2834aeb5c47bde300c898021eb9bbc48">getPilotEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  205. <div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; {</div>
  206. <div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Pilots, row_id);</div>
  207. <div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_pilot_entry.html">OPL::PilotEntry</a>(row_id, data);</div>
  208. <div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; }</div>
  209. <div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; </div>
  210. <div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a95340bb482ca788e748a597d013424ea"> 215</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_tail_entry.html">OPL::TailEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#a95340bb482ca788e748a597d013424ea">getTailEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  211. <div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; {</div>
  212. <div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Tails, row_id);</div>
  213. <div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_tail_entry.html">OPL::TailEntry</a>(row_id, data);</div>
  214. <div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; }</div>
  215. <div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; </div>
  216. <div class="line"><a name="l00224"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a84b40aff7668c0782ae25a8d07f60922"> 224</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_aircraft_entry.html">OPL::AircraftEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#a84b40aff7668c0782ae25a8d07f60922">getAircraftEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  217. <div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; {</div>
  218. <div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Aircraft, row_id);</div>
  219. <div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_aircraft_entry.html">OPL::AircraftEntry</a>(row_id, data);</div>
  220. <div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; }</div>
  221. <div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160; </div>
  222. <div class="line"><a name="l00233"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a568d32e69f438bc165a2a9c1477eaaed"> 233</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_flight_entry.html">OPL::FlightEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#a568d32e69f438bc165a2a9c1477eaaed">getFlightEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  223. <div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; {</div>
  224. <div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Flights, row_id);</div>
  225. <div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_flight_entry.html">OPL::FlightEntry</a>(row_id, data);</div>
  226. <div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; }</div>
  227. <div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; </div>
  228. <div class="line"><a name="l00242"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a9e7e61e354d4438dab48a39fb6de1777"> 242</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_simulator_entry.html">OPL::SimulatorEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#a9e7e61e354d4438dab48a39fb6de1777">getSimEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  229. <div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; {</div>
  230. <div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Simulators, row_id);</div>
  231. <div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_simulator_entry.html">OPL::SimulatorEntry</a>(row_id, data);</div>
  232. <div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; }</div>
  233. <div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; </div>
  234. <div class="line"><a name="l00251"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#affb40bf4566d45bdf2a68203b53be4db"> 251</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_currency_entry.html">OPL::CurrencyEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#affb40bf4566d45bdf2a68203b53be4db">getCurrencyEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  235. <div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; {</div>
  236. <div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Currencies, row_id);</div>
  237. <div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_currency_entry.html">OPL::CurrencyEntry</a>(row_id, data);</div>
  238. <div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160; }</div>
  239. <div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160; </div>
  240. <div class="line"><a name="l00260"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a56ae415d548dca9c6ab3cc0fe0bc818d"> 260</a></span>&#160; <span class="keyword">inline</span> <a class="code" href="class_o_p_l_1_1_airport_entry.html">OPL::AirportEntry</a> <a class="code" href="class_o_p_l_1_1_database.html#a56ae415d548dca9c6ab3cc0fe0bc818d">getAirportEntry</a>(<span class="keywordtype">int</span> row_id)</div>
  241. <div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160; {</div>
  242. <div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160; <span class="keyword">const</span> <span class="keyword">auto</span> data = <a class="code" href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">getRowData</a>(OPL::DbTable::Airports, row_id);</div>
  243. <div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160; <span class="keywordflow">return</span> <a class="code" href="class_o_p_l_1_1_airport_entry.html">OPL::AirportEntry</a>(row_id, data);</div>
  244. <div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160; }</div>
  245. <div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; </div>
  246. <div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160; <span class="keywordtype">int</span> <a class="code" href="class_o_p_l_1_1_database.html#aebf3371c149463c49e818999c427ce6a">getLastEntry</a>(<a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table);</div>
  247. <div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; </div>
  248. <div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; QList&lt;int&gt; <a class="code" href="class_o_p_l_1_1_database.html#a4eb45d764952d44a3c45f16aea2e26d7">getForeignKeyConstraints</a>(<span class="keywordtype">int</span> foreign_row_id, <a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table);</div>
  249. <div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160; </div>
  250. <div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160; QVector&lt;RowData_T&gt; <a class="code" href="class_o_p_l_1_1_database.html#a8145a21f5980cb3c55778fbe94ef52a0">getTable</a>(<a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a> table);</div>
  251. <div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160; </div>
  252. <div class="line"><a name="l00287"></a><span class="lineno"> 287</span>&#160; <span class="keyword">const</span> QList&lt;OPL::DbTable&gt; &amp;<a class="code" href="class_o_p_l_1_1_database.html#ac0db9f1a1817bb62302b17a22327bfeb">getUserTables</a>() <span class="keyword">const</span>;</div>
  253. <div class="line"><a name="l00288"></a><span class="lineno"> 288</span>&#160; </div>
  254. <div class="line"><a name="l00293"></a><span class="lineno"> 293</span>&#160; <span class="keyword">const</span> QList&lt;OPL::DbTable&gt; &amp;<a class="code" href="class_o_p_l_1_1_database.html#ad7cd939e58af8f1fd46f835ee34567e3">getTemplateTables</a>() <span class="keyword">const</span>;</div>
  255. <div class="line"><a name="l00294"></a><span class="lineno"> 294</span>&#160; </div>
  256. <div class="line"><a name="l00295"></a><span class="lineno"> 295</span>&#160; <span class="comment">// Maintenance and setup</span></div>
  257. <div class="line"><a name="l00296"></a><span class="lineno"> 296</span>&#160; </div>
  258. <div class="line"><a name="l00302"></a><span class="lineno"> 302</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a92c22cb18c5a23858edd38e0ed9d7117">createSchema</a>();</div>
  259. <div class="line"><a name="l00311"></a><span class="lineno"> 311</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a4be4811cb27c836070a6b8c09dee6a3b">importTemplateData</a>(<span class="keywordtype">bool</span> use_local_ressources);</div>
  260. <div class="line"><a name="l00312"></a><span class="lineno"> 312</span>&#160; </div>
  261. <div class="line"><a name="l00316"></a><span class="lineno"> 316</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a63af56a9fbd8cd0290494cc28d327824">resetUserData</a>();</div>
  262. <div class="line"><a name="l00317"></a><span class="lineno"> 317</span>&#160; </div>
  263. <div class="line"><a name="l00322"></a><span class="lineno"> 322</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a40cdc1cce81919c42f91e2e16a63df4a">createBackup</a>(<span class="keyword">const</span> QString&amp; dest_file);</div>
  264. <div class="line"><a name="l00323"></a><span class="lineno"> 323</span>&#160; </div>
  265. <div class="line"><a name="l00328"></a><span class="lineno"> 328</span>&#160; <span class="keywordtype">bool</span> <a class="code" href="class_o_p_l_1_1_database.html#a77003350c44e7c6e1c8c4316cc324496">restoreBackup</a>(<span class="keyword">const</span> QString&amp; backup_file);</div>
  266. <div class="line"><a name="l00329"></a><span class="lineno"> 329</span>&#160; </div>
  267. <div class="line"><a name="l00330"></a><span class="lineno"> 330</span>&#160; </div>
  268. <div class="line"><a name="l00331"></a><span class="lineno"> 331</span>&#160; </div>
  269. <div class="line"><a name="l00332"></a><span class="lineno"> 332</span>&#160;signals:</div>
  270. <div class="line"><a name="l00339"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#a8e99ff7cf4173ca1a87ede9acc02be00"> 339</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_o_p_l_1_1_database.html#a8e99ff7cf4173ca1a87ede9acc02be00">dataBaseUpdated</a>(<span class="keyword">const</span> <a class="code" href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">DbTable</a> table);</div>
  271. <div class="line"><a name="l00344"></a><span class="lineno"><a class="line" href="class_o_p_l_1_1_database.html#acc87b25e9ab6a6a6dce1883821292882"> 344</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_o_p_l_1_1_database.html#acc87b25e9ab6a6a6dce1883821292882">connectionReset</a>();</div>
  272. <div class="line"><a name="l00345"></a><span class="lineno"> 345</span>&#160;};</div>
  273. <div class="line"><a name="l00346"></a><span class="lineno"> 346</span>&#160; </div>
  274. <div class="line"><a name="l00347"></a><span class="lineno"> 347</span>&#160;} <span class="comment">// namespace OPL</span></div>
  275. <div class="line"><a name="l00348"></a><span class="lineno"> 348</span>&#160; </div>
  276. <div class="line"><a name="l00349"></a><span class="lineno"> 349</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// DATABASE_H</span></div>
  277. <div class="ttc" id="aclass_o_p_l_1_1_aircraft_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_aircraft_entry.html">OPL::AircraftEntry</a></div><div class="ttdoc">A Row representing an Aircraft entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:85</div></div>
  278. <div class="ttc" id="aclass_o_p_l_1_1_airport_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_airport_entry.html">OPL::AirportEntry</a></div><div class="ttdoc">A Row representing an Airport entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:155</div></div>
  279. <div class="ttc" id="aclass_o_p_l_1_1_currency_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_currency_entry.html">OPL::CurrencyEntry</a></div><div class="ttdoc">A Row representing a Currency entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:144</div></div>
  280. <div class="ttc" id="aclass_o_p_l_1_1_database_html"><div class="ttname"><a href="class_o_p_l_1_1_database.html">OPL::Database</a></div><div class="ttdoc">The DB class encapsulates the SQL database by providing fast access to hot database data.</div><div class="ttdef"><b>Definition:</b> database.h:57</div></div>
  281. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a0b20bec0f8bef0277325492a1dee33ef"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a0b20bec0f8bef0277325492a1dee33ef">OPL::Database::sqliteVersion</a></div><div class="ttdeci">const QString sqliteVersion() const</div><div class="ttdoc">Database::sqliteVersion returns the database sqlite version. See also dbRevision()</div><div class="ttdef"><b>Definition:</b> database.cpp:117</div></div>
  282. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a15dbcef162931776a0bdf6610fdd4cde"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a15dbcef162931776a0bdf6610fdd4cde">OPL::Database::connect</a></div><div class="ttdeci">bool connect()</div><div class="ttdoc">Connect to the database and populate database information.</div><div class="ttdef"><b>Definition:</b> database.cpp:26</div></div>
  283. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a233943791f4bca3aa083f46562eb6d50"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a233943791f4bca3aa083f46562eb6d50">OPL::Database::database</a></div><div class="ttdeci">static QSqlDatabase database()</div><div class="ttdoc">Can be used to access the database connection.</div><div class="ttdef"><b>Definition:</b> database.cpp:126</div></div>
  284. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a2834aeb5c47bde300c898021eb9bbc48"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a2834aeb5c47bde300c898021eb9bbc48">OPL::Database::getPilotEntry</a></div><div class="ttdeci">OPL::PilotEntry getPilotEntry(int row_id)</div><div class="ttdoc">retreives a PilotEntry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:206</div></div>
  285. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a29362ea9a2b1805d42e5ef7823c42e50"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a29362ea9a2b1805d42e5ef7823c42e50">OPL::Database::remove</a></div><div class="ttdeci">bool remove(const OPL::Row &amp;row)</div><div class="ttdoc">deletes an entry from the database.</div><div class="ttdef"><b>Definition:</b> database.cpp:186</div></div>
  286. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a3657d55721b0d3599ce6df55120017de"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a3657d55721b0d3599ce6df55120017de">OPL::Database::getRowData</a></div><div class="ttdeci">RowData_T getRowData(const OPL::DbTable table, const int row_id)</div><div class="ttdoc">retreive a Map of &lt;column name, column content&gt; for a specific row in the database.</div><div class="ttdef"><b>Definition:</b> database.cpp:427</div></div>
  287. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a40cdc1cce81919c42f91e2e16a63df4a"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a40cdc1cce81919c42f91e2e16a63df4a">OPL::Database::createBackup</a></div><div class="ttdeci">bool createBackup(const QString &amp;dest_file)</div><div class="ttdoc">Database::createBackup copies the currently used database to an external backup location provided by ...</div><div class="ttdef"><b>Definition:</b> database.cpp:582</div></div>
  288. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a4938319e593b9e5d5a334f794301d873"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a4938319e593b9e5d5a334f794301d873">OPL::Database::update</a></div><div class="ttdeci">bool update(const OPL::Row &amp;updated_row)</div><div class="ttdoc">Updates entry in database from existing entry tweaked by the user.</div><div class="ttdef"><b>Definition:</b> database.cpp:303</div></div>
  289. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a4be4811cb27c836070a6b8c09dee6a3b"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a4be4811cb27c836070a6b8c09dee6a3b">OPL::Database::importTemplateData</a></div><div class="ttdeci">bool importTemplateData(bool use_local_ressources)</div><div class="ttdoc">importTemplateData fills an empty database with the template data (Aircraft, Airports,...</div><div class="ttdef"><b>Definition:</b> database.cpp:666</div></div>
  290. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a4eb45d764952d44a3c45f16aea2e26d7"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a4eb45d764952d44a3c45f16aea2e26d7">OPL::Database::getForeignKeyConstraints</a></div><div class="ttdeci">QList&lt; int &gt; getForeignKeyConstraints(int foreign_row_id, OPL::DbTable table)</div><div class="ttdoc">returns a list of ROWID's in the flights table for which foreign key constraints exist.</div><div class="ttdef"><b>Definition:</b> database.cpp:472</div></div>
  291. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a55a01dac1e447f7c41474a39d8f621ef"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a55a01dac1e447f7c41474a39d8f621ef">OPL::Database::updateLayout</a></div><div class="ttdeci">void updateLayout()</div><div class="ttdoc">Updates the member variables tableNames and tableColumns with up-to-date layout information if the da...</div><div class="ttdef"><b>Definition:</b> database.cpp:92</div></div>
  292. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a568d32e69f438bc165a2a9c1477eaaed"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a568d32e69f438bc165a2a9c1477eaaed">OPL::Database::getFlightEntry</a></div><div class="ttdeci">OPL::FlightEntry getFlightEntry(int row_id)</div><div class="ttdoc">retreives a flight entry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:233</div></div>
  293. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a56ae415d548dca9c6ab3cc0fe0bc818d"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a56ae415d548dca9c6ab3cc0fe0bc818d">OPL::Database::getAirportEntry</a></div><div class="ttdeci">OPL::AirportEntry getAirportEntry(int row_id)</div><div class="ttdoc">Retreives an airport entry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:260</div></div>
  294. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a63af56a9fbd8cd0290494cc28d327824"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a63af56a9fbd8cd0290494cc28d327824">OPL::Database::resetUserData</a></div><div class="ttdeci">bool resetUserData()</div><div class="ttdoc">Delete all rows from the user data tables (flights, pliots, tails)</div><div class="ttdef"><b>Definition:</b> database.cpp:706</div></div>
  295. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a69f4a4fa1e496e86224e87612edba548"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a69f4a4fa1e496e86224e87612edba548">OPL::Database::exists</a></div><div class="ttdeci">bool exists(const OPL::Row &amp;row)</div><div class="ttdoc">Checks if an entry exists in the database, based on position data.</div><div class="ttdef"><b>Definition:</b> database.cpp:259</div></div>
  296. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a6c2ebefc6cf6d948d64dfe71bec08540"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a6c2ebefc6cf6d948d64dfe71bec08540">OPL::Database::removeMany</a></div><div class="ttdeci">bool removeMany(OPL::DbTable table, const QList&lt; int &gt; &amp;row_id_list)</div><div class="ttdoc">deletes a batch of entries from the database. Optimised for speed when deleting many entries....</div><div class="ttdef"><b>Definition:</b> database.cpp:217</div></div>
  297. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a6df6e6b98679011f747862ca48a3498c"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a6df6e6b98679011f747862ca48a3498c">OPL::Database::version</a></div><div class="ttdeci">const QString version() const</div><div class="ttdoc">Return the database revision number (not the sqlite version number).</div><div class="ttdef"><b>Definition:</b> database.cpp:65</div></div>
  298. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a77003350c44e7c6e1c8c4316cc324496"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a77003350c44e7c6e1c8c4316cc324496">OPL::Database::restoreBackup</a></div><div class="ttdeci">bool restoreBackup(const QString &amp;backup_file)</div><div class="ttdoc">Database::restoreBackup restores the database from a given backup file and replaces the currently act...</div><div class="ttdef"><b>Definition:</b> database.cpp:600</div></div>
  299. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a8145a21f5980cb3c55778fbe94ef52a0"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a8145a21f5980cb3c55778fbe94ef52a0">OPL::Database::getTable</a></div><div class="ttdeci">QVector&lt; RowData_T &gt; getTable(OPL::DbTable table)</div><div class="ttdoc">getTable returns all contents of a given table from the database</div><div class="ttdef"><b>Definition:</b> database.cpp:537</div></div>
  300. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a84b40aff7668c0782ae25a8d07f60922"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a84b40aff7668c0782ae25a8d07f60922">OPL::Database::getAircraftEntry</a></div><div class="ttdeci">OPL::AircraftEntry getAircraftEntry(int row_id)</div><div class="ttdoc">retreives a TailEntry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:224</div></div>
  301. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a8e99ff7cf4173ca1a87ede9acc02be00"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a8e99ff7cf4173ca1a87ede9acc02be00">OPL::Database::dataBaseUpdated</a></div><div class="ttdeci">void dataBaseUpdated(const DbTable table)</div><div class="ttdoc">updated is emitted whenever the database contents have been updated. This can be either a commit,...</div></div>
  302. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a92c22cb18c5a23858edd38e0ed9d7117"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a92c22cb18c5a23858edd38e0ed9d7117">OPL::Database::createSchema</a></div><div class="ttdeci">bool createSchema()</div><div class="ttdoc">Create or restore the database to its ready-to-use but empty state.</div><div class="ttdef"><b>Definition:</b> database.cpp:631</div></div>
  303. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a95340bb482ca788e748a597d013424ea"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a95340bb482ca788e748a597d013424ea">OPL::Database::getTailEntry</a></div><div class="ttdeci">OPL::TailEntry getTailEntry(int row_id)</div><div class="ttdoc">retreives a TailEntry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:215</div></div>
  304. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a9d09969956b08b86bf83277872354247"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a9d09969956b08b86bf83277872354247">OPL::Database::getTableNames</a></div><div class="ttdeci">const QStringList getTableNames() const</div><div class="ttdoc">Return the names of all tables in the database.</div><div class="ttdef"><b>Definition:</b> database.cpp:87</div></div>
  305. <div class="ttc" id="aclass_o_p_l_1_1_database_html_a9e7e61e354d4438dab48a39fb6de1777"><div class="ttname"><a href="class_o_p_l_1_1_database.html#a9e7e61e354d4438dab48a39fb6de1777">OPL::Database::getSimEntry</a></div><div class="ttdeci">OPL::SimulatorEntry getSimEntry(int row_id)</div><div class="ttdoc">retreives a Simulator entry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:242</div></div>
  306. <div class="ttc" id="aclass_o_p_l_1_1_database_html_aa342b9d852daecb85fb77ec2f19234a5"><div class="ttname"><a href="class_o_p_l_1_1_database.html#aa342b9d852daecb85fb77ec2f19234a5">OPL::Database::clear</a></div><div class="ttdeci">bool clear()</div><div class="ttdoc">clear resets the database, i.e. deletes all content in the tables containing userdata (pilots,...</div><div class="ttdef"><b>Definition:</b> database.cpp:288</div></div>
  307. <div class="ttc" id="aclass_o_p_l_1_1_database_html_aa3bbfc0dd7ff7bd34c2c1c847f539168"><div class="ttname"><a href="class_o_p_l_1_1_database.html#aa3bbfc0dd7ff7bd34c2c1c847f539168">OPL::Database::insert</a></div><div class="ttdeci">bool insert(const OPL::Row &amp;new_row)</div><div class="ttdoc">Create new entry in the databse based on UserInput.</div><div class="ttdef"><b>Definition:</b> database.cpp:346</div></div>
  308. <div class="ttc" id="aclass_o_p_l_1_1_database_html_aa5b783822a603bdcfd1d8c93ba0af34b"><div class="ttname"><a href="class_o_p_l_1_1_database.html#aa5b783822a603bdcfd1d8c93ba0af34b">OPL::Database::lastError</a></div><div class="ttdeci">QSqlError lastError</div><div class="ttdoc">Holds information about the last error that ocurred during a SQL operation. If the error type is QSql...</div><div class="ttdef"><b>Definition:</b> database.h:96</div></div>
  309. <div class="ttc" id="aclass_o_p_l_1_1_database_html_abf45cf7ba5d25bb5d8f8aac1105bb728"><div class="ttname"><a href="class_o_p_l_1_1_database.html#abf45cf7ba5d25bb5d8f8aac1105bb728">OPL::Database::customQuery</a></div><div class="ttdeci">QVector&lt; QVariant &gt; customQuery(QString statement, int return_values)</div><div class="ttdoc">Can be used to send a complex query to the database.</div><div class="ttdef"><b>Definition:</b> database.cpp:509</div></div>
  310. <div class="ttc" id="aclass_o_p_l_1_1_database_html_ac0db9f1a1817bb62302b17a22327bfeb"><div class="ttname"><a href="class_o_p_l_1_1_database.html#ac0db9f1a1817bb62302b17a22327bfeb">OPL::Database::getUserTables</a></div><div class="ttdeci">const QList&lt; OPL::DbTable &gt; &amp; getUserTables() const</div><div class="ttdoc">getUserTables returns a list of the of the tables that contain user-created data (flights,...</div><div class="ttdef"><b>Definition:</b> database.cpp:77</div></div>
  311. <div class="ttc" id="aclass_o_p_l_1_1_database_html_ac5b344097eeb2579da9bcfc7941d074c"><div class="ttname"><a href="class_o_p_l_1_1_database.html#ac5b344097eeb2579da9bcfc7941d074c">OPL::Database::getTableColumns</a></div><div class="ttdeci">const QStringList getTableColumns(OPL::DbTable table_name) const</div><div class="ttdoc">Return the names of a given table in the database.</div><div class="ttdef"><b>Definition:</b> database.cpp:82</div></div>
  312. <div class="ttc" id="aclass_o_p_l_1_1_database_html_acc87b25e9ab6a6a6dce1883821292882"><div class="ttname"><a href="class_o_p_l_1_1_database.html#acc87b25e9ab6a6a6dce1883821292882">OPL::Database::connectionReset</a></div><div class="ttdeci">void connectionReset()</div><div class="ttdoc">connectionReset is emitted whenever the database connection is reset, for example when creating or re...</div></div>
  313. <div class="ttc" id="aclass_o_p_l_1_1_database_html_aceb1bb497d30d413f87d6541716a873b"><div class="ttname"><a href="class_o_p_l_1_1_database.html#aceb1bb497d30d413f87d6541716a873b">OPL::Database::disconnect</a></div><div class="ttdeci">void disconnect()</div><div class="ttdoc">closes the database connection.</div><div class="ttdef"><b>Definition:</b> database.cpp:53</div></div>
  314. <div class="ttc" id="aclass_o_p_l_1_1_database_html_ad7cd939e58af8f1fd46f835ee34567e3"><div class="ttname"><a href="class_o_p_l_1_1_database.html#ad7cd939e58af8f1fd46f835ee34567e3">OPL::Database::getTemplateTables</a></div><div class="ttdeci">const QList&lt; OPL::DbTable &gt; &amp; getTemplateTables() const</div><div class="ttdoc">getTemplateTables returns a list of the tables that contain template data (aiports,...</div><div class="ttdef"><b>Definition:</b> database.cpp:72</div></div>
  315. <div class="ttc" id="aclass_o_p_l_1_1_database_html_ad9aab9c8bc43009bbc2595409004e20b"><div class="ttname"><a href="class_o_p_l_1_1_database.html#ad9aab9c8bc43009bbc2595409004e20b">OPL::Database::commit</a></div><div class="ttdeci">bool commit(const OPL::Row &amp;row)</div><div class="ttdoc">commits an entry to the database, calls either insert or update, based on position data</div><div class="ttdef"><b>Definition:</b> database.cpp:131</div></div>
  316. <div class="ttc" id="aclass_o_p_l_1_1_database_html_ae38dc30cb955ffc0e3235e51104dd912"><div class="ttname"><a href="class_o_p_l_1_1_database.html#ae38dc30cb955ffc0e3235e51104dd912">OPL::Database::getRow</a></div><div class="ttdeci">OPL::Row getRow(const OPL::DbTable table, const int row_id)</div><div class="ttdoc">retreive a Row from the database</div><div class="ttdef"><b>Definition:</b> database.cpp:395</div></div>
  317. <div class="ttc" id="aclass_o_p_l_1_1_database_html_aebf3371c149463c49e818999c427ce6a"><div class="ttname"><a href="class_o_p_l_1_1_database.html#aebf3371c149463c49e818999c427ce6a">OPL::Database::getLastEntry</a></div><div class="ttdeci">int getLastEntry(OPL::DbTable table)</div><div class="ttdoc">returns the ROWID for the newest entry in the respective table.</div><div class="ttdef"><b>Definition:</b> database.cpp:459</div></div>
  318. <div class="ttc" id="aclass_o_p_l_1_1_database_html_affb40bf4566d45bdf2a68203b53be4db"><div class="ttname"><a href="class_o_p_l_1_1_database.html#affb40bf4566d45bdf2a68203b53be4db">OPL::Database::getCurrencyEntry</a></div><div class="ttdeci">OPL::CurrencyEntry getCurrencyEntry(int row_id)</div><div class="ttdoc">Retreives a currency entry from the database. See row class for details.</div><div class="ttdef"><b>Definition:</b> database.h:251</div></div>
  319. <div class="ttc" id="aclass_o_p_l_1_1_flight_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_flight_entry.html">OPL::FlightEntry</a></div><div class="ttdoc">A Row representing a Flight entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:133</div></div>
  320. <div class="ttc" id="aclass_o_p_l_1_1_paths_html_a1636e1c04163319f63f56868142f1d1f"><div class="ttname"><a href="class_o_p_l_1_1_paths.html#a1636e1c04163319f63f56868142f1d1f">OPL::Paths::databaseFileInfo</a></div><div class="ttdeci">static const QFileInfo databaseFileInfo()</div><div class="ttdoc">returns a QFileInfo for the default database file.</div><div class="ttdef"><b>Definition:</b> paths.cpp:39</div></div>
  321. <div class="ttc" id="aclass_o_p_l_1_1_pilot_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_pilot_entry.html">OPL::PilotEntry</a></div><div class="ttdoc">A Row representing a Pilot entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:110</div></div>
  322. <div class="ttc" id="aclass_o_p_l_1_1_row_html"><div class="ttname"><a href="class_o_p_l_1_1_row.html">OPL::Row</a></div><div class="ttdoc">The Row class provides an interface for retreiving and submitting entries from the database.</div><div class="ttdef"><b>Definition:</b> row.h:46</div></div>
  323. <div class="ttc" id="aclass_o_p_l_1_1_simulator_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_simulator_entry.html">OPL::SimulatorEntry</a></div><div class="ttdoc">A Row representing a Simulator entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:122</div></div>
  324. <div class="ttc" id="aclass_o_p_l_1_1_tail_entry_html"><div class="ttname"><a href="class_o_p_l_1_1_tail_entry.html">OPL::TailEntry</a></div><div class="ttdoc">A Row representing a Tail (Registration) entry. See Row class for details.</div><div class="ttdef"><b>Definition:</b> row.h:96</div></div>
  325. <div class="ttc" id="anamespace_o_p_l_html"><div class="ttname"><a href="namespace_o_p_l.html">OPL</a></div><div class="ttdoc">A namespace to collect constants and enums used throughout the application.</div><div class="ttdef"><b>Definition:</b> paths.cpp:3</div></div>
  326. <div class="ttc" id="anamespace_o_p_l_html_ada86eb02cea54d91c8c11c9112ec1cf7"><div class="ttname"><a href="namespace_o_p_l.html#ada86eb02cea54d91c8c11c9112ec1cf7">OPL::DbTable</a></div><div class="ttdeci">DbTable</div><div class="ttdoc">Enumerates the tables in the database.</div><div class="ttdef"><b>Definition:</b> opl.h:122</div></div>
  327. </div><!-- fragment --></div><!-- contents -->
  328. </div><!-- doc-content -->
  329. <!-- start footer part -->
  330. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  331. <ul>
  332. <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_803ee67260c130b45d29089798491ab2.html">database</a></li><li class="navelem"><b>database.h</b></li>
  333. <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  334. </ul>
  335. </div>
  336. </body>
  337. </html>