p_usrloc_devel.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <?xml version="1.0" encoding='ISO-8859-1'?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!-- Include general documentation entities -->
  5. <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
  6. %docentities;
  7. ]>
  8. <!-- Module Developer's Guide -->
  9. <chapter>
  10. <chapterinfo>
  11. </chapterinfo>
  12. <title>Developer's Guide</title>
  13. <para>
  14. These are the primary functions that are used to perform the SQL queries.
  15. </para>
  16. <section>
  17. <title>
  18. <function moreinfo="none">load_ul_db_api(ul_db_api_t * api)</function>
  19. </title>
  20. <para>
  21. Import the <acronym>dbd</acronym> API, setup the master database connection.
  22. </para>
  23. <para>Meaning of the parameters is as follows:</para>
  24. <itemizedlist>
  25. <listitem>
  26. <para><emphasis>api</emphasis> - Pointer to distributed database API structure
  27. </para>
  28. </listitem>
  29. </itemizedlist>
  30. </section>
  31. <section>
  32. <title>
  33. <function moreinfo="none">int (* ul_db_insert_t) (str * table, str * first, str * second,
  34. db_key_t* _k, db_val_t* _v, int _n)</function>
  35. </title>
  36. <para>
  37. Lookup the first and if needed the second key, and insert the given values into the
  38. choosen databases.
  39. </para>
  40. <para>Meaning of the parameters is as follows:</para>
  41. <itemizedlist>
  42. <listitem>
  43. <para><emphasis>table</emphasis> - Pointer to the table name.
  44. </para>
  45. </listitem>
  46. <listitem>
  47. <para><emphasis>first</emphasis> - Pointer to the first key.
  48. </para>
  49. </listitem>
  50. <listitem>
  51. <para><emphasis>second</emphasis> - Pointer to the second key.
  52. </para>
  53. </listitem>
  54. <listitem>
  55. <para><emphasis>_k</emphasis> - Pointer to the inserted db keys.
  56. </para>
  57. </listitem>
  58. <listitem>
  59. <para><emphasis>_v</emphasis> - Pointer to the inserted db values.
  60. </para>
  61. </listitem>
  62. <listitem>
  63. <para><emphasis>_n</emphasis> - Number of key-value pairs in _k and _v parameters.
  64. </para>
  65. </listitem>
  66. </itemizedlist>
  67. </section>
  68. <section>
  69. <title>
  70. <function moreinfo="none">int (* ul_db_update_t) (str * table, str * first, str * second,
  71. db_key_t* _k, db_op_t * _op, db_val_t* _v, db_key_t* _uk,
  72. db_val_t* _uv, int _n, int _un);</function>
  73. </title>
  74. <para>
  75. Lookup the first and if needed the second key, and update the given values in the
  76. choosen databases.
  77. </para>
  78. <para>Meaning of the parameters is as follows:</para>
  79. <itemizedlist>
  80. <listitem>
  81. <para><emphasis>table</emphasis> - Pointer to the table name.
  82. </para>
  83. </listitem>
  84. <listitem>
  85. <para><emphasis>first</emphasis> - Pointer to the first key.
  86. </para>
  87. </listitem>
  88. <listitem>
  89. <para><emphasis>second</emphasis> - Pointer to the second key.
  90. </para>
  91. </listitem>
  92. <listitem>
  93. <para><emphasis>_k</emphasis> - Pointer to the db keys that will be matched.
  94. </para>
  95. </listitem>
  96. <listitem>
  97. <para><emphasis>_op</emphasis> - Pointer to the db options for this operation.
  98. </para>
  99. </listitem>
  100. <listitem>
  101. <para><emphasis>_v</emphasis> - Pointer to the db values that will be matched.
  102. </para>
  103. </listitem>
  104. <listitem>
  105. <para><emphasis>_uk</emphasis> - Pointer to the updated db keys.
  106. </para>
  107. </listitem>
  108. <listitem>
  109. <para><emphasis>_uv</emphasis> - Pointer to the updated db values.
  110. </para>
  111. </listitem>
  112. <listitem>
  113. <para><emphasis>_n</emphasis> - Number of key-value pairs in _k and _v parameters.
  114. </para>
  115. </listitem>
  116. <listitem>
  117. <para><emphasis>_un</emphasis> - Number of key-value pairs in _uk and _uv parameters.
  118. </para>
  119. </listitem>
  120. </itemizedlist>
  121. </section>
  122. <section>
  123. <title>
  124. <function moreinfo="none">int (* ul_db_insert_update_t) (str * table, str * first, str * second,
  125. db_key_t* _k, db_val_t* _v, int _n)</function>
  126. </title>
  127. <para>
  128. Lookup the first and if needed the second key, and insert on duplicate key update
  129. the given values in the choosen databases. This is like an insert, but update
  130. if the key already exist.
  131. </para>
  132. <para>Meaning of the parameters is as follows:</para>
  133. <itemizedlist>
  134. <listitem>
  135. <para><emphasis>table</emphasis> - Pointer to the table name.
  136. </para>
  137. </listitem>
  138. <listitem>
  139. <para><emphasis>first</emphasis> - Pointer to the first key.
  140. </para>
  141. </listitem>
  142. <listitem>
  143. <para><emphasis>second</emphasis> - Pointer to the second key.
  144. </para>
  145. </listitem>
  146. <listitem>
  147. <para><emphasis>_k</emphasis> - Pointer to the inserted or updated db keys.
  148. </para>
  149. </listitem>
  150. <listitem>
  151. <para><emphasis>_v</emphasis> - Pointer to the inserted or updated db values.
  152. </para>
  153. </listitem>
  154. <listitem>
  155. <para><emphasis>_n</emphasis> - Number of key-value pairs in _k and _v parameters.
  156. </para>
  157. </listitem>
  158. </itemizedlist>
  159. </section>
  160. <section>
  161. <title>
  162. <function moreinfo="none">int (* ul_db_replace_t) (str * table, str * first, str * second,
  163. db_key_t* _k, db_val_t* _v, int _n)</function>
  164. </title>
  165. <para>
  166. Lookup the first and if needed the second key, and replace the given values in the
  167. choosen databases.
  168. </para>
  169. <para>Meaning of the parameters is as follows:</para>
  170. <itemizedlist>
  171. <listitem>
  172. <para><emphasis>table</emphasis> - Pointer to the table name.
  173. </para>
  174. </listitem>
  175. <listitem>
  176. <para><emphasis>first</emphasis> - Pointer to the first key.
  177. </para>
  178. </listitem>
  179. <listitem>
  180. <para><emphasis>second</emphasis> - Pointer to the second key.
  181. </para>
  182. </listitem>
  183. <listitem>
  184. <para><emphasis>_k</emphasis> - Pointer to the replaced db keys.
  185. </para>
  186. </listitem>
  187. <listitem>
  188. <para><emphasis>_v</emphasis> - Pointer to the replaced db values.
  189. </para>
  190. </listitem>
  191. <listitem>
  192. <para><emphasis>_n</emphasis> - Number of key-value pairs in _k and _v parameters.
  193. </para>
  194. </listitem>
  195. </itemizedlist>
  196. </section>
  197. <section>
  198. <title>
  199. <function moreinfo="none">int (* ul_db_delete_t) (str * table, str * first, str * second,
  200. db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n)</function>
  201. </title>
  202. <para>
  203. Lookup the first and if needed the second key, and delete the given values into the
  204. choosen databases.
  205. </para>
  206. <para>Meaning of the parameters is as follows:</para>
  207. <itemizedlist>
  208. <listitem>
  209. <para><emphasis>table</emphasis> - Pointer to the table name.
  210. </para>
  211. </listitem>
  212. <listitem>
  213. <para><emphasis>first</emphasis> - Pointer to the first key.
  214. </para>
  215. </listitem>
  216. <listitem>
  217. <para><emphasis>second</emphasis> - Pointer to the second key.
  218. </para>
  219. </listitem>
  220. <listitem>
  221. <para><emphasis>_k</emphasis> - Pointer to the deleted db keys.
  222. </para>
  223. </listitem>
  224. <listitem>
  225. <para><emphasis>_op</emphasis> - Pointer to the db options for this operation.
  226. </para>
  227. </listitem>
  228. <listitem>
  229. <para><emphasis>_v</emphasis> - Pointer to the deleted db values.
  230. </para>
  231. </listitem>
  232. <listitem>
  233. <para><emphasis>_n</emphasis> - Number of key-value pairs in _k and _v parameters.
  234. </para>
  235. </listitem>
  236. </itemizedlist>
  237. </section>
  238. <section>
  239. <title>
  240. <function moreinfo="none">int (* ul_db_query_t) (str * table, str * first, str * second, db_con_t *** _r_h,
  241. db_key_t* _k, db_op_t* _op, db_val_t* _v, db_key_t* _c,
  242. int _n, int _nc, db_key_t _o, db_res_t** _r);</function>
  243. </title>
  244. <para>
  245. Lookup the first and if needed the second key, and performs a query in one of the
  246. choosen databases. The returned handle _r_h must be used to free the result
  247. set after the usage of the returned database entries, otherwise a memory leak
  248. will occur.You must call ul_db_free_result before you can call ul_db_query again!
  249. </para>
  250. <para>Meaning of the parameters is as follows:</para>
  251. <itemizedlist>
  252. <listitem>
  253. <para><emphasis>table</emphasis> - Pointer to the table name.
  254. </para>
  255. </listitem>
  256. <listitem>
  257. <para><emphasis>first</emphasis> - Pointer to the first key.
  258. </para>
  259. </listitem>
  260. <listitem>
  261. <para><emphasis>second</emphasis> - Pointer to the second key.
  262. </para>
  263. </listitem>
  264. <listitem>
  265. <para><emphasis>_r_h</emphasis> - Pointer to the result handle, to free the result.
  266. </para>
  267. </listitem>
  268. <listitem>
  269. <para><emphasis>_op</emphasis> - Pointer to the db options for this operation.
  270. </para>
  271. </listitem>
  272. <listitem>
  273. <para><emphasis>_k</emphasis> - Pointer to the queried db keys.
  274. </para>
  275. </listitem>
  276. <listitem>
  277. <para><emphasis>_v</emphasis> - Pointer to the queried db values.
  278. </para>
  279. </listitem>
  280. <listitem>
  281. <para><emphasis>_c</emphasis> - Pointer to the db keys that should be returned.
  282. </para>
  283. </listitem>
  284. <listitem>
  285. <para><emphasis>_n</emphasis> - Number of key-value pairs in _k and _v parameters.
  286. </para>
  287. </listitem>
  288. <listitem>
  289. <para><emphasis>_nc</emphasis> - Number of key-value pairs in _c parameter.
  290. </para>
  291. </listitem>
  292. <listitem>
  293. <para><emphasis>_o</emphasis> - Order by options for the query.
  294. </para>
  295. </listitem>
  296. <listitem>
  297. <para><emphasis>_nc</emphasis> - Pointer to the result set.
  298. </para>
  299. </listitem>
  300. </itemizedlist>
  301. </section>
  302. <section>
  303. <title>
  304. <function moreinfo="none">int (* ul_db_free_result_t)(db_con_t ** dbh, db_res_t * res);</function>
  305. </title>
  306. <para>
  307. Frees the given result set, .
  308. </para>
  309. <para>Meaning of the parameters is as follows:</para>
  310. <itemizedlist>
  311. <listitem>
  312. <para><emphasis>dbh</emphasis> - Pointer to the result handle.
  313. </para>
  314. </listitem>
  315. <listitem>
  316. <para><emphasis>res</emphasis> - Pointer to the result.
  317. </para>
  318. </listitem>
  319. </itemizedlist>
  320. </section>
  321. </chapter>