netico-Bones-SQLite.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Documentation</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <base href="../">
  8. <link rel="icon" href="images/favicon.ico"/>
  9. <link rel="stylesheet" href="css/normalize.css">
  10. <link rel="stylesheet" href="css/base.css">
  11. <link rel="preconnect" href="https://fonts.gstatic.com">
  12. <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap" rel="stylesheet">
  13. <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro:wght@400;600;700&display=swap" rel="stylesheet">
  14. <link rel="stylesheet" href="css/template.css">
  15. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.12.0/css/all.min.css" integrity="sha256-ybRkN9dBjhcS2qrW1z+hfCxq+1aBdwyQM5wlQoQVt/0=" crossorigin="anonymous" />
  16. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-okaidia.css">
  17. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.css">
  18. <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.css">
  19. <script src="https://cdn.jsdelivr.net/npm/fuse.js@3.4.6"></script>
  20. <script src="https://cdn.jsdelivr.net/npm/css-vars-ponyfill@2"></script>
  21. <script src="js/search.js"></script>
  22. <script defer src="js/searchIndex.js"></script>
  23. </head>
  24. <body id="top">
  25. <header class="phpdocumentor-header phpdocumentor-section">
  26. <h1 class="phpdocumentor-title"><a href="" class="phpdocumentor-title__link">Documentation</a></h1>
  27. <input class="phpdocumentor-header__menu-button" type="checkbox" id="menu-button" name="menu-button" />
  28. <label class="phpdocumentor-header__menu-icon" for="menu-button">
  29. <i class="fas fa-bars"></i>
  30. </label>
  31. <section data-search-form class="phpdocumentor-search">
  32. <label>
  33. <span class="visually-hidden">Search for</span>
  34. <svg class="phpdocumentor-search__icon" width="21" height="20" viewBox="0 0 21 20" fill="none" xmlns="http://www.w3.org/2000/svg">
  35. <circle cx="7.5" cy="7.5" r="6.5" stroke="currentColor" stroke-width="2"/>
  36. <line x1="12.4892" y1="12.2727" x2="19.1559" y2="18.9393" stroke="currentColor" stroke-width="3"/>
  37. </svg>
  38. <input type="search" class="phpdocumentor-field phpdocumentor-search__field" placeholder="Loading .." disabled />
  39. </label>
  40. </section>
  41. <nav class="phpdocumentor-topnav">
  42. <ul class="phpdocumentor-topnav__menu">
  43. </ul>
  44. </nav>
  45. </header>
  46. <main class="phpdocumentor">
  47. <div class="phpdocumentor-section">
  48. <input class="phpdocumentor-sidebar__menu-button" type="checkbox" id="sidebar-button" name="sidebar-button" />
  49. <label class="phpdocumentor-sidebar__menu-icon" for="sidebar-button">
  50. Menu
  51. </label>
  52. <aside class="phpdocumentor-column -four phpdocumentor-sidebar">
  53. <section class="phpdocumentor-sidebar__category">
  54. <h2 class="phpdocumentor-sidebar__category-header">Namespaces</h2>
  55. <h4 class="phpdocumentor-sidebar__root-namespace">
  56. <a href="namespaces/netico.html" class="">netico</a>
  57. </h4>
  58. <ul class="phpdocumentor-list">
  59. <li>
  60. <a href="namespaces/netico-bones.html" class="">Bones</a>
  61. </li>
  62. </ul>
  63. </section>
  64. <section class="phpdocumentor-sidebar__category">
  65. <h2 class="phpdocumentor-sidebar__category-header">Packages</h2>
  66. <h4 class="phpdocumentor-sidebar__root-namespace">
  67. <a href="packages/bones.html" class="">bones</a>
  68. </h4>
  69. </section>
  70. <section class="phpdocumentor-sidebar__category">
  71. <h2 class="phpdocumentor-sidebar__category-header">Reports</h2>
  72. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/deprecated.html">Deprecated</a></h3>
  73. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/errors.html">Errors</a></h3>
  74. <h3 class="phpdocumentor-sidebar__root-package"><a href="reports/markers.html">Markers</a></h3>
  75. </section>
  76. <section class="phpdocumentor-sidebar__category">
  77. <h2 class="phpdocumentor-sidebar__category-header">Indices</h2>
  78. <h3 class="phpdocumentor-sidebar__root-package"><a href="indices/files.html">Files</a></h3>
  79. </section>
  80. </aside>
  81. <div class="phpdocumentor-column -eight phpdocumentor-content">
  82. <ul class="phpdocumentor-breadcrumbs">
  83. <li class="phpdocumentor-breadcrumb"><a href="namespaces/netico.html">netico</a></li>
  84. <li class="phpdocumentor-breadcrumb"><a href="namespaces/netico-bones.html">Bones</a></li>
  85. </ul>
  86. <article class="phpdocumentor-element -class">
  87. <h2 class="phpdocumentor-content__title">
  88. SQLite
  89. <div class="phpdocumentor-element__package">
  90. in package
  91. <ul class="phpdocumentor-breadcrumbs">
  92. <li class="phpdocumentor-breadcrumb"><a href="packages/bones.html">bones</a></li>
  93. </ul>
  94. </div>
  95. </h2>
  96. <aside class="phpdocumentor-element-found-in">
  97. <abbr class="phpdocumentor-element-found-in__file" title="src/Classes/SQLite.php"><a href="files/src-classes-sqlite.html"><abbr title="src/Classes/SQLite.php">SQLite.php</abbr></a></abbr>
  98. :
  99. <span class="phpdocumentor-element-found-in__line">28</span>
  100. </aside>
  101. <p class="phpdocumentor-summary">SQLite wrapper.</p>
  102. <section class="phpdocumentor-description"><p>This is just another SQLite database access wrapper class.
  103. It can establish connections to the SQLite database, execute SQL queries, and return results.
  104. Native drivers are great if you are only using one database in your application,
  105. so this class uses the native SQLite driver.</p>
  106. <pre class="prettyprint"><code class="prettyprint"> $db = new \netico\Bones\SQLite();
  107. $db-&gt;sql(&quot;SELECT * FROM pages ORDER BY [rowid] ASC;&quot;);
  108. $db-&gt;close();
  109. var_dump($db-&gt;data);
  110. </code></pre>
  111. </section>
  112. <h5 class="phpdocumentor-tag-list__heading" id="tags">
  113. Tags
  114. <a href="#tags" class="headerlink"><i class="fas fa-link"></i></a>
  115. </h5>
  116. <dl class="phpdocumentor-tag-list">
  117. <dt class="phpdocumentor-tag-list__entry">
  118. <span class="phpdocumentor-tag__name">link</span>
  119. </dt>
  120. <dd class="phpdocumentor-tag-list__definition">
  121. <a class="phpdocumentor-tag-link" href="https://git.lattuga.net/netico/code-library/src/master/Framework"> https://git.lattuga.net/netico/code-library/src/master/Framework </a>
  122. </dd>
  123. <dt class="phpdocumentor-tag-list__entry">
  124. <span class="phpdocumentor-tag__name">copyright</span>
  125. </dt>
  126. <dd class="phpdocumentor-tag-list__definition">
  127. <section class="phpdocumentor-description"><p>Copyright (c) 2016, 2022 netico <a href="mailto:netico@riseup.net">netico@riseup.net</a></p>
  128. </section>
  129. </dd>
  130. <dt class="phpdocumentor-tag-list__entry">
  131. <span class="phpdocumentor-tag__name">license</span>
  132. </dt>
  133. <dd class="phpdocumentor-tag-list__definition">
  134. <section class="phpdocumentor-description"><p>https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License</p>
  135. </section>
  136. </dd>
  137. <dt class="phpdocumentor-tag-list__entry">
  138. <span class="phpdocumentor-tag__name">author</span>
  139. </dt>
  140. <dd class="phpdocumentor-tag-list__definition">
  141. <section class="phpdocumentor-description"><p>netico <a href="mailto:netico@riseup.net">netico@riseup.net</a></p>
  142. </section>
  143. </dd>
  144. </dl>
  145. <h3 id="toc">
  146. Table of Contents
  147. <a href="#toc" class="headerlink"><i class="fas fa-link"></i></a>
  148. </h3>
  149. <dl class="phpdocumentor-table-of-contents">
  150. <dt class="phpdocumentor-table-of-contents__entry -property -public">
  151. <a href="classes/netico-Bones-SQLite.html#property_data">$data</a>
  152. <span>
  153. &nbsp;: array&lt;string|int, array&lt;string|int, mixed&gt;&gt; </span>
  154. </dt>
  155. <dd>This array contains the results of the query.</dd>
  156. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  157. <a href="classes/netico-Bones-SQLite.html#method___construct">__construct()</a>
  158. <span>
  159. &nbsp;: mixed </span>
  160. </dt>
  161. <dd>This method retrieves the SQLite database path from the configuration file
  162. and then opens a connection in read mode.</dd>
  163. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  164. <a href="classes/netico-Bones-SQLite.html#method_close">close()</a>
  165. <span>
  166. &nbsp;: void </span>
  167. </dt>
  168. <dd>This method closes the connection to the database.</dd>
  169. <dt class="phpdocumentor-table-of-contents__entry -method -public">
  170. <a href="classes/netico-Bones-SQLite.html#method_SQL">SQL()</a>
  171. <span>
  172. &nbsp;: void </span>
  173. </dt>
  174. <dd>It runs a SQL query on a given database and builds an array of the results.</dd>
  175. </dl>
  176. <section class="phpdocumentor-properties">
  177. <h3 class="phpdocumentor-elements__header" id="properties">
  178. Properties
  179. <a href="classes/netico-Bones-SQLite.html#properties" class="headerlink"><i class="fas fa-link"></i></a>
  180. </h3>
  181. <article
  182. class="
  183. phpdocumentor-element
  184. -property
  185. -public
  186. "
  187. >
  188. <h4 class="phpdocumentor-element__name" id="property_data">
  189. $data
  190. <a href="classes/netico-Bones-SQLite.html#property_data" class="headerlink"><i class="fas fa-link"></i></a>
  191. <span class="phpdocumentor-element__modifiers">
  192. </span>
  193. </h4>
  194. <aside class="phpdocumentor-element-found-in">
  195. <abbr class="phpdocumentor-element-found-in__file" title="src/Classes/SQLite.php"><a href="files/src-classes-sqlite.html"><abbr title="src/Classes/SQLite.php">SQLite.php</abbr></a></abbr>
  196. :
  197. <span class="phpdocumentor-element-found-in__line">35</span>
  198. </aside>
  199. <p class="phpdocumentor-summary">This array contains the results of the query.</p>
  200. <code class="phpdocumentor-code phpdocumentor-signature ">
  201. <span class="phpdocumentor-signature__visibility">public</span>
  202. <span class="phpdocumentor-signature__type">array&lt;string|int, array&lt;string|int, mixed&gt;&gt;</span>
  203. <span class="phpdocumentor-signature__name">$data</span>
  204. </code>
  205. </article>
  206. </section>
  207. <section class="phpdocumentor-methods">
  208. <h3 class="phpdocumentor-elements__header" id="methods">
  209. Methods
  210. <a href="classes/netico-Bones-SQLite.html#methods" class="headerlink"><i class="fas fa-link"></i></a>
  211. </h3>
  212. <article
  213. class="phpdocumentor-element
  214. -method
  215. -public
  216. "
  217. >
  218. <h4 class="phpdocumentor-element__name" id="method___construct">
  219. __construct()
  220. <a href="classes/netico-Bones-SQLite.html#method___construct" class="headerlink"><i class="fas fa-link"></i></a>
  221. </h4>
  222. <aside class="phpdocumentor-element-found-in">
  223. <abbr class="phpdocumentor-element-found-in__file" title="src/Classes/SQLite.php"><a href="files/src-classes-sqlite.html"><abbr title="src/Classes/SQLite.php">SQLite.php</abbr></a></abbr>
  224. :
  225. <span class="phpdocumentor-element-found-in__line">43</span>
  226. </aside>
  227. <p class="phpdocumentor-summary">This method retrieves the SQLite database path from the configuration file
  228. and then opens a connection in read mode.</p>
  229. <code class="phpdocumentor-code phpdocumentor-signature ">
  230. <span class="phpdocumentor-signature__visibility">public</span>
  231. <span class="phpdocumentor-signature__name">__construct</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
  232. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  233. <span class="phpdocumentor-signature__response_type">mixed</span>
  234. &mdash;
  235. </article>
  236. <article
  237. class="phpdocumentor-element
  238. -method
  239. -public
  240. "
  241. >
  242. <h4 class="phpdocumentor-element__name" id="method_close">
  243. close()
  244. <a href="classes/netico-Bones-SQLite.html#method_close" class="headerlink"><i class="fas fa-link"></i></a>
  245. </h4>
  246. <aside class="phpdocumentor-element-found-in">
  247. <abbr class="phpdocumentor-element-found-in__file" title="src/Classes/SQLite.php"><a href="files/src-classes-sqlite.html"><abbr title="src/Classes/SQLite.php">SQLite.php</abbr></a></abbr>
  248. :
  249. <span class="phpdocumentor-element-found-in__line">56</span>
  250. </aside>
  251. <p class="phpdocumentor-summary">This method closes the connection to the database.</p>
  252. <code class="phpdocumentor-code phpdocumentor-signature ">
  253. <span class="phpdocumentor-signature__visibility">public</span>
  254. <span class="phpdocumentor-signature__name">close</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">void</span></code>
  255. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  256. <span class="phpdocumentor-signature__response_type">void</span>
  257. &mdash;
  258. </article>
  259. <article
  260. class="phpdocumentor-element
  261. -method
  262. -public
  263. "
  264. >
  265. <h4 class="phpdocumentor-element__name" id="method_SQL">
  266. SQL()
  267. <a href="classes/netico-Bones-SQLite.html#method_SQL" class="headerlink"><i class="fas fa-link"></i></a>
  268. </h4>
  269. <aside class="phpdocumentor-element-found-in">
  270. <abbr class="phpdocumentor-element-found-in__file" title="src/Classes/SQLite.php"><a href="files/src-classes-sqlite.html"><abbr title="src/Classes/SQLite.php">SQLite.php</abbr></a></abbr>
  271. :
  272. <span class="phpdocumentor-element-found-in__line">67</span>
  273. </aside>
  274. <p class="phpdocumentor-summary">It runs a SQL query on a given database and builds an array of the results.</p>
  275. <code class="phpdocumentor-code phpdocumentor-signature ">
  276. <span class="phpdocumentor-signature__visibility">public</span>
  277. <span class="phpdocumentor-signature__name">SQL</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$query</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">void</span></code>
  278. <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
  279. <dl class="phpdocumentor-argument-list">
  280. <dt class="phpdocumentor-argument-list__entry">
  281. <span class="phpdocumentor-signature__argument__name">$query</span>
  282. : <span class="phpdocumentor-signature__argument__return-type">string</span>
  283. </dt>
  284. <dd class="phpdocumentor-argument-list__definition">
  285. </dd>
  286. </dl>
  287. <h5 class="phpdocumentor-return-value__heading">Return values</h5>
  288. <span class="phpdocumentor-signature__response_type">void</span>
  289. &mdash;
  290. </article>
  291. </section>
  292. <script type="text/javascript">
  293. function loadExternalCodeSnippets(line) {
  294. Array.prototype.slice.call(document.querySelectorAll('pre[data-src]')).forEach((pre) => {
  295. var src = pre.getAttribute('data-src').replace( /\\/g, '/');
  296. var extension = (src.match(/\.(\w+)$/) || [, ''])[1];
  297. var language = 'php';
  298. var code = document.createElement('code');
  299. code.className = 'language-' + language;
  300. pre.textContent = '';
  301. pre.setAttribute('data-line', line)
  302. code.textContent = 'Loading…';
  303. pre.appendChild(code);
  304. var xhr = new XMLHttpRequest();
  305. xhr.open('GET', src, true);
  306. xhr.onreadystatechange = function () {
  307. if (xhr.readyState == 4) {
  308. if (xhr.status < 400 && xhr.responseText) {
  309. code.textContent = xhr.responseText;
  310. Prism.highlightElement(code);
  311. }
  312. else if (xhr.status >= 400) {
  313. code.textContent = '✖ Error ' + xhr.status + ' while fetching file: ' + xhr.statusText;
  314. }
  315. else {
  316. code.textContent = '✖ Error: File does not exist, is empty or trying to view from localhost';
  317. }
  318. }
  319. };
  320. xhr.send(null);
  321. });
  322. }
  323. var modals = document.querySelectorAll("[data-modal]");
  324. modals.forEach(function (trigger) {
  325. trigger.addEventListener("click", function (event) {
  326. //event.preventDefault();
  327. const modal = document.getElementById(trigger.dataset.modal);
  328. modal.classList.add("phpdocumentor-modal__open");
  329. loadExternalCodeSnippets(trigger.dataset.line)
  330. const exits = modal.querySelectorAll("[data-exit-button]");
  331. exits.forEach(function (exit) {
  332. exit.addEventListener("click", function (event) {
  333. event.preventDefault();
  334. modal.classList.remove("phpdocumentor-modal__open");
  335. });
  336. });
  337. });
  338. });
  339. </script>
  340. </article>
  341. <section data-search-results class="phpdocumentor-search-results phpdocumentor-search-results--hidden">
  342. <section class="phpdocumentor-search-results__dialog">
  343. <header class="phpdocumentor-search-results__header">
  344. <h2 class="phpdocumentor-search-results__title">Search results</h2>
  345. <button class="phpdocumentor-search-results__close"><i class="fas fa-times"></i></button>
  346. </header>
  347. <section class="phpdocumentor-search-results__body">
  348. <ul class="phpdocumentor-search-results__entries"></ul>
  349. </section>
  350. </section>
  351. </section>
  352. </div>
  353. </div>
  354. <a href="classes/netico-Bones-SQLite.html#top" class="phpdocumentor-back-to-top"><i class="fas fa-chevron-circle-up"></i></a>
  355. </main>
  356. <script>
  357. cssVars({});
  358. </script>
  359. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/prism.min.js"></script>
  360. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/autoloader/prism-autoloader.min.js"></script>
  361. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-numbers/prism-line-numbers.min.js"></script>
  362. <script src="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/plugins/line-highlight/prism-line-highlight.min.js"></script>
  363. </body>
  364. </html>