module-sql.html 15 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>JSDoc: Module: sql</title>
  6. <script src="scripts/prettify/prettify.js"> </script>
  7. <script src="scripts/prettify/lang-css.js"> </script>
  8. <!--[if lt IE 9]>
  9. <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  10. <![endif]-->
  11. <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
  12. <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
  13. </head>
  14. <body>
  15. <div id="main">
  16. <h1 class="page-title">Module: sql</h1>
  17. <section>
  18. <header>
  19. </header>
  20. <article>
  21. <div class="container-overview">
  22. <dl class="details">
  23. <dt class="tag-source">Source:</dt>
  24. <dd class="tag-source"><ul class="dummy"><li>
  25. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line3">line 3</a>
  26. </li></ul></dd>
  27. </dl>
  28. </div>
  29. <h3 class="subsection-title">Methods</h3>
  30. <h4 class="name" id=".execute"><span class="type-signature">(static) </span>execute<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  31. <div class="description">
  32. Execute SQL
  33. </div>
  34. <h5>Parameters:</h5>
  35. <table class="params">
  36. <thead>
  37. <tr>
  38. <th>Name</th>
  39. <th>Type</th>
  40. <th>Attributes</th>
  41. <th class="last">Description</th>
  42. </tr>
  43. </thead>
  44. <tbody>
  45. <tr>
  46. <td class="name"><code>query</code></td>
  47. <td class="type">
  48. <span class="param-type">string</span>
  49. </td>
  50. <td class="attributes">
  51. </td>
  52. <td class="description last">SQL query with ? used as parameter placeholder</td>
  53. </tr>
  54. <tr>
  55. <td class="name"><code>params</code></td>
  56. <td class="type">
  57. <span class="param-type">Array.&lt;object></span>
  58. </td>
  59. <td class="attributes">
  60. &lt;optional><br>
  61. </td>
  62. <td class="description last">array of params if needed</td>
  63. </tr>
  64. </tbody>
  65. </table>
  66. <dl class="details">
  67. <dt class="tag-source">Source:</dt>
  68. <dd class="tag-source"><ul class="dummy"><li>
  69. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line377">line 377</a>
  70. </li></ul></dd>
  71. </dl>
  72. <h4 class="name" id=".getColumn"><span class="type-signature">(static) </span>getColumn<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array.&lt;object>}</span></h4>
  73. <div class="description">
  74. Get a first column in an array.
  75. </div>
  76. <h5>Parameters:</h5>
  77. <table class="params">
  78. <thead>
  79. <tr>
  80. <th>Name</th>
  81. <th>Type</th>
  82. <th>Attributes</th>
  83. <th class="last">Description</th>
  84. </tr>
  85. </thead>
  86. <tbody>
  87. <tr>
  88. <td class="name"><code>query</code></td>
  89. <td class="type">
  90. <span class="param-type">string</span>
  91. </td>
  92. <td class="attributes">
  93. </td>
  94. <td class="description last">SQL query with ? used as parameter placeholder</td>
  95. </tr>
  96. <tr>
  97. <td class="name"><code>params</code></td>
  98. <td class="type">
  99. <span class="param-type">Array.&lt;object></span>
  100. </td>
  101. <td class="attributes">
  102. &lt;optional><br>
  103. </td>
  104. <td class="description last">array of params if needed</td>
  105. </tr>
  106. </tbody>
  107. </table>
  108. <dl class="details">
  109. <dt class="tag-source">Source:</dt>
  110. <dd class="tag-source"><ul class="dummy"><li>
  111. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line368">line 368</a>
  112. </li></ul></dd>
  113. </dl>
  114. <h5>Returns:</h5>
  115. <div class="param-desc">
  116. - array of first column of all returned rows
  117. </div>
  118. <dl>
  119. <dt>
  120. Type
  121. </dt>
  122. <dd>
  123. <span class="param-type">Array.&lt;object></span>
  124. </dd>
  125. </dl>
  126. <h4 class="name" id=".getMap"><span class="type-signature">(static) </span>getMap<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {object}</span></h4>
  127. <div class="description">
  128. Get a map of first column mapping to second column.
  129. </div>
  130. <h5>Parameters:</h5>
  131. <table class="params">
  132. <thead>
  133. <tr>
  134. <th>Name</th>
  135. <th>Type</th>
  136. <th>Attributes</th>
  137. <th class="last">Description</th>
  138. </tr>
  139. </thead>
  140. <tbody>
  141. <tr>
  142. <td class="name"><code>query</code></td>
  143. <td class="type">
  144. <span class="param-type">string</span>
  145. </td>
  146. <td class="attributes">
  147. </td>
  148. <td class="description last">SQL query with ? used as parameter placeholder</td>
  149. </tr>
  150. <tr>
  151. <td class="name"><code>params</code></td>
  152. <td class="type">
  153. <span class="param-type">Array.&lt;object></span>
  154. </td>
  155. <td class="attributes">
  156. &lt;optional><br>
  157. </td>
  158. <td class="description last">array of params if needed</td>
  159. </tr>
  160. </tbody>
  161. </table>
  162. <dl class="details">
  163. <dt class="tag-source">Source:</dt>
  164. <dd class="tag-source"><ul class="dummy"><li>
  165. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line358">line 358</a>
  166. </li></ul></dd>
  167. </dl>
  168. <h5>Returns:</h5>
  169. <div class="param-desc">
  170. - map of first column to second column
  171. </div>
  172. <dl>
  173. <dt>
  174. Type
  175. </dt>
  176. <dd>
  177. <span class="param-type">object</span>
  178. </dd>
  179. </dl>
  180. <h4 class="name" id=".getRow"><span class="type-signature">(static) </span>getRow<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {object}</span></h4>
  181. <div class="description">
  182. Get first returned row.
  183. </div>
  184. <h5>Parameters:</h5>
  185. <table class="params">
  186. <thead>
  187. <tr>
  188. <th>Name</th>
  189. <th>Type</th>
  190. <th>Attributes</th>
  191. <th class="last">Description</th>
  192. </tr>
  193. </thead>
  194. <tbody>
  195. <tr>
  196. <td class="name"><code>query</code></td>
  197. <td class="type">
  198. <span class="param-type">string</span>
  199. </td>
  200. <td class="attributes">
  201. </td>
  202. <td class="description last">SQL query with ? used as parameter placeholder</td>
  203. </tr>
  204. <tr>
  205. <td class="name"><code>params</code></td>
  206. <td class="type">
  207. <span class="param-type">Array.&lt;object></span>
  208. </td>
  209. <td class="attributes">
  210. &lt;optional><br>
  211. </td>
  212. <td class="description last">array of params if needed</td>
  213. </tr>
  214. </tbody>
  215. </table>
  216. <dl class="details">
  217. <dt class="tag-source">Source:</dt>
  218. <dd class="tag-source"><ul class="dummy"><li>
  219. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line334">line 334</a>
  220. </li></ul></dd>
  221. </dl>
  222. <h5>Returns:</h5>
  223. <div class="param-desc">
  224. - map of column name to column value
  225. </div>
  226. <dl>
  227. <dt>
  228. Type
  229. </dt>
  230. <dd>
  231. <span class="param-type">object</span>
  232. </dd>
  233. </dl>
  234. <h4 class="name" id=".getRows"><span class="type-signature">(static) </span>getRows<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Array.&lt;object>}</span></h4>
  235. <div class="description">
  236. Get all returned rows.
  237. </div>
  238. <h5>Parameters:</h5>
  239. <table class="params">
  240. <thead>
  241. <tr>
  242. <th>Name</th>
  243. <th>Type</th>
  244. <th>Attributes</th>
  245. <th class="last">Description</th>
  246. </tr>
  247. </thead>
  248. <tbody>
  249. <tr>
  250. <td class="name"><code>query</code></td>
  251. <td class="type">
  252. <span class="param-type">string</span>
  253. </td>
  254. <td class="attributes">
  255. </td>
  256. <td class="description last">SQL query with ? used as parameter placeholder</td>
  257. </tr>
  258. <tr>
  259. <td class="name"><code>params</code></td>
  260. <td class="type">
  261. <span class="param-type">Array.&lt;object></span>
  262. </td>
  263. <td class="attributes">
  264. &lt;optional><br>
  265. </td>
  266. <td class="description last">array of params if needed</td>
  267. </tr>
  268. </tbody>
  269. </table>
  270. <dl class="details">
  271. <dt class="tag-source">Source:</dt>
  272. <dd class="tag-source"><ul class="dummy"><li>
  273. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line345">line 345</a>
  274. </li></ul></dd>
  275. </dl>
  276. <h5>Returns:</h5>
  277. <div class="param-desc">
  278. - array of all rows, each row is a map of column name to column value
  279. </div>
  280. <dl>
  281. <dt>
  282. Type
  283. </dt>
  284. <dd>
  285. <span class="param-type">Array.&lt;object></span>
  286. </dd>
  287. </dl>
  288. <h4 class="name" id=".getValue"><span class="type-signature">(static) </span>getValue<span class="signature">(query, params<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4>
  289. <div class="description">
  290. Get single value from the given query - first column from first returned row.
  291. </div>
  292. <h5>Parameters:</h5>
  293. <table class="params">
  294. <thead>
  295. <tr>
  296. <th>Name</th>
  297. <th>Type</th>
  298. <th>Attributes</th>
  299. <th class="last">Description</th>
  300. </tr>
  301. </thead>
  302. <tbody>
  303. <tr>
  304. <td class="name"><code>query</code></td>
  305. <td class="type">
  306. <span class="param-type">string</span>
  307. </td>
  308. <td class="attributes">
  309. </td>
  310. <td class="description last">SQL query with ? used as parameter placeholder</td>
  311. </tr>
  312. <tr>
  313. <td class="name"><code>params</code></td>
  314. <td class="type">
  315. <span class="param-type">Array.&lt;object></span>
  316. </td>
  317. <td class="attributes">
  318. &lt;optional><br>
  319. </td>
  320. <td class="description last">array of params if needed</td>
  321. </tr>
  322. </tbody>
  323. </table>
  324. <dl class="details">
  325. <dt class="tag-source">Source:</dt>
  326. <dd class="tag-source"><ul class="dummy"><li>
  327. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line324">line 324</a>
  328. </li></ul></dd>
  329. </dl>
  330. <h5>Returns:</h5>
  331. <div class="param-desc">
  332. [object] - single value
  333. </div>
  334. </article>
  335. </section>
  336. </div>
  337. <nav>
  338. <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-sql.html">sql</a></li></ul><h3>Classes</h3><ul><li><a href="AbstractBeccaEntity.html">AbstractBeccaEntity</a></li><li><a href="BAttachment.html">BAttachment</a></li><li><a href="BAttribute.html">BAttribute</a></li><li><a href="BBranch.html">BBranch</a></li><li><a href="BEtapiToken.html">BEtapiToken</a></li><li><a href="BNote.html">BNote</a></li><li><a href="BOption.html">BOption</a></li><li><a href="BRecentNote.html">BRecentNote</a></li><li><a href="BRevision.html">BRevision</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li></ul><h3>Global</h3><ul><li><a href="global.html#api">api</a></li></ul>
  339. </nav>
  340. <br class="clear">
  341. <footer>
  342. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.2</a>
  343. </footer>
  344. <script> prettyPrint(); </script>
  345. <script src="scripts/linenumber.js"> </script>
  346. </body>
  347. </html>