module-sql.html 15 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  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. </div>
  23. <h3 class="subsection-title">Methods</h3>
  24. <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>
  25. <div class="description">
  26. Execute SQL
  27. </div>
  28. <h5>Parameters:</h5>
  29. <table class="params">
  30. <thead>
  31. <tr>
  32. <th>Name</th>
  33. <th>Type</th>
  34. <th>Attributes</th>
  35. <th class="last">Description</th>
  36. </tr>
  37. </thead>
  38. <tbody>
  39. <tr>
  40. <td class="name"><code>query</code></td>
  41. <td class="type">
  42. <span class="param-type">string</span>
  43. </td>
  44. <td class="attributes">
  45. </td>
  46. <td class="description last">SQL query with ? used as parameter placeholder</td>
  47. </tr>
  48. <tr>
  49. <td class="name"><code>params</code></td>
  50. <td class="type">
  51. <span class="param-type">Array.&lt;object></span>
  52. </td>
  53. <td class="attributes">
  54. &lt;optional><br>
  55. </td>
  56. <td class="description last">array of params if needed</td>
  57. </tr>
  58. </tbody>
  59. </table>
  60. <dl class="details">
  61. <dt class="tag-source">Source:</dt>
  62. <dd class="tag-source"><ul class="dummy"><li>
  63. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line352">line 352</a>
  64. </li></ul></dd>
  65. </dl>
  66. <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>
  67. <div class="description">
  68. Get a first column in an array.
  69. </div>
  70. <h5>Parameters:</h5>
  71. <table class="params">
  72. <thead>
  73. <tr>
  74. <th>Name</th>
  75. <th>Type</th>
  76. <th>Attributes</th>
  77. <th class="last">Description</th>
  78. </tr>
  79. </thead>
  80. <tbody>
  81. <tr>
  82. <td class="name"><code>query</code></td>
  83. <td class="type">
  84. <span class="param-type">string</span>
  85. </td>
  86. <td class="attributes">
  87. </td>
  88. <td class="description last">SQL query with ? used as parameter placeholder</td>
  89. </tr>
  90. <tr>
  91. <td class="name"><code>params</code></td>
  92. <td class="type">
  93. <span class="param-type">Array.&lt;object></span>
  94. </td>
  95. <td class="attributes">
  96. &lt;optional><br>
  97. </td>
  98. <td class="description last">array of params if needed</td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. <dl class="details">
  103. <dt class="tag-source">Source:</dt>
  104. <dd class="tag-source"><ul class="dummy"><li>
  105. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line343">line 343</a>
  106. </li></ul></dd>
  107. </dl>
  108. <h5>Returns:</h5>
  109. <div class="param-desc">
  110. - array of first column of all returned rows
  111. </div>
  112. <dl>
  113. <dt>
  114. Type
  115. </dt>
  116. <dd>
  117. <span class="param-type">Array.&lt;object></span>
  118. </dd>
  119. </dl>
  120. <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>
  121. <div class="description">
  122. Get a map of first column mapping to second column.
  123. </div>
  124. <h5>Parameters:</h5>
  125. <table class="params">
  126. <thead>
  127. <tr>
  128. <th>Name</th>
  129. <th>Type</th>
  130. <th>Attributes</th>
  131. <th class="last">Description</th>
  132. </tr>
  133. </thead>
  134. <tbody>
  135. <tr>
  136. <td class="name"><code>query</code></td>
  137. <td class="type">
  138. <span class="param-type">string</span>
  139. </td>
  140. <td class="attributes">
  141. </td>
  142. <td class="description last">SQL query with ? used as parameter placeholder</td>
  143. </tr>
  144. <tr>
  145. <td class="name"><code>params</code></td>
  146. <td class="type">
  147. <span class="param-type">Array.&lt;object></span>
  148. </td>
  149. <td class="attributes">
  150. &lt;optional><br>
  151. </td>
  152. <td class="description last">array of params if needed</td>
  153. </tr>
  154. </tbody>
  155. </table>
  156. <dl class="details">
  157. <dt class="tag-source">Source:</dt>
  158. <dd class="tag-source"><ul class="dummy"><li>
  159. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line333">line 333</a>
  160. </li></ul></dd>
  161. </dl>
  162. <h5>Returns:</h5>
  163. <div class="param-desc">
  164. - map of first column to second column
  165. </div>
  166. <dl>
  167. <dt>
  168. Type
  169. </dt>
  170. <dd>
  171. <span class="param-type">object</span>
  172. </dd>
  173. </dl>
  174. <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>
  175. <div class="description">
  176. Get first returned row.
  177. </div>
  178. <h5>Parameters:</h5>
  179. <table class="params">
  180. <thead>
  181. <tr>
  182. <th>Name</th>
  183. <th>Type</th>
  184. <th>Attributes</th>
  185. <th class="last">Description</th>
  186. </tr>
  187. </thead>
  188. <tbody>
  189. <tr>
  190. <td class="name"><code>query</code></td>
  191. <td class="type">
  192. <span class="param-type">string</span>
  193. </td>
  194. <td class="attributes">
  195. </td>
  196. <td class="description last">SQL query with ? used as parameter placeholder</td>
  197. </tr>
  198. <tr>
  199. <td class="name"><code>params</code></td>
  200. <td class="type">
  201. <span class="param-type">Array.&lt;object></span>
  202. </td>
  203. <td class="attributes">
  204. &lt;optional><br>
  205. </td>
  206. <td class="description last">array of params if needed</td>
  207. </tr>
  208. </tbody>
  209. </table>
  210. <dl class="details">
  211. <dt class="tag-source">Source:</dt>
  212. <dd class="tag-source"><ul class="dummy"><li>
  213. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line309">line 309</a>
  214. </li></ul></dd>
  215. </dl>
  216. <h5>Returns:</h5>
  217. <div class="param-desc">
  218. - map of column name to column value
  219. </div>
  220. <dl>
  221. <dt>
  222. Type
  223. </dt>
  224. <dd>
  225. <span class="param-type">object</span>
  226. </dd>
  227. </dl>
  228. <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>
  229. <div class="description">
  230. Get all returned rows.
  231. </div>
  232. <h5>Parameters:</h5>
  233. <table class="params">
  234. <thead>
  235. <tr>
  236. <th>Name</th>
  237. <th>Type</th>
  238. <th>Attributes</th>
  239. <th class="last">Description</th>
  240. </tr>
  241. </thead>
  242. <tbody>
  243. <tr>
  244. <td class="name"><code>query</code></td>
  245. <td class="type">
  246. <span class="param-type">string</span>
  247. </td>
  248. <td class="attributes">
  249. </td>
  250. <td class="description last">SQL query with ? used as parameter placeholder</td>
  251. </tr>
  252. <tr>
  253. <td class="name"><code>params</code></td>
  254. <td class="type">
  255. <span class="param-type">Array.&lt;object></span>
  256. </td>
  257. <td class="attributes">
  258. &lt;optional><br>
  259. </td>
  260. <td class="description last">array of params if needed</td>
  261. </tr>
  262. </tbody>
  263. </table>
  264. <dl class="details">
  265. <dt class="tag-source">Source:</dt>
  266. <dd class="tag-source"><ul class="dummy"><li>
  267. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line320">line 320</a>
  268. </li></ul></dd>
  269. </dl>
  270. <h5>Returns:</h5>
  271. <div class="param-desc">
  272. - array of all rows, each row is a map of column name to column value
  273. </div>
  274. <dl>
  275. <dt>
  276. Type
  277. </dt>
  278. <dd>
  279. <span class="param-type">Array.&lt;object></span>
  280. </dd>
  281. </dl>
  282. <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>
  283. <div class="description">
  284. Get single value from the given query - first column from first returned row.
  285. </div>
  286. <h5>Parameters:</h5>
  287. <table class="params">
  288. <thead>
  289. <tr>
  290. <th>Name</th>
  291. <th>Type</th>
  292. <th>Attributes</th>
  293. <th class="last">Description</th>
  294. </tr>
  295. </thead>
  296. <tbody>
  297. <tr>
  298. <td class="name"><code>query</code></td>
  299. <td class="type">
  300. <span class="param-type">string</span>
  301. </td>
  302. <td class="attributes">
  303. </td>
  304. <td class="description last">SQL query with ? used as parameter placeholder</td>
  305. </tr>
  306. <tr>
  307. <td class="name"><code>params</code></td>
  308. <td class="type">
  309. <span class="param-type">Array.&lt;object></span>
  310. </td>
  311. <td class="attributes">
  312. &lt;optional><br>
  313. </td>
  314. <td class="description last">array of params if needed</td>
  315. </tr>
  316. </tbody>
  317. </table>
  318. <dl class="details">
  319. <dt class="tag-source">Source:</dt>
  320. <dd class="tag-source"><ul class="dummy"><li>
  321. <a href="services_sql.js.html">services/sql.js</a>, <a href="services_sql.js.html#line299">line 299</a>
  322. </li></ul></dd>
  323. </dl>
  324. <h5>Returns:</h5>
  325. <div class="param-desc">
  326. [object] - single value
  327. </div>
  328. </article>
  329. </section>
  330. </div>
  331. <nav>
  332. <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="ApiToken.html">ApiToken</a></li><li><a href="Attribute.html">Attribute</a></li><li><a href="BackendScriptApi.html">BackendScriptApi</a></li><li><a href="Branch.html">Branch</a></li><li><a href="Note.html">Note</a></li><li><a href="NoteRevision.html">NoteRevision</a></li><li><a href="Option.html">Option</a></li><li><a href="RecentNote.html">RecentNote</a></li></ul><h3><a href="global.html">Global</a></h3>
  333. </nav>
  334. <br class="clear">
  335. <footer>
  336. Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.7</a>
  337. </footer>
  338. <script> prettyPrint(); </script>
  339. <script src="scripts/linenumber.js"> </script>
  340. </body>
  341. </html>