SymbianMethods.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using System.Text;
  4. namespace System.Data.SQLiteClient.Native
  5. {
  6. internal class SymbianMethods : NativeMethods
  7. {
  8. public SymbianMethods(Encoding encoding) : base(encoding)
  9. {
  10. }
  11. #region INativeMethods Members
  12. protected override IntPtr libversion()
  13. {
  14. return sqlite3_libversion();
  15. }
  16. public override int strlen(IntPtr p)
  17. {
  18. return sqlite3_strlen(p);
  19. }
  20. public override IntPtr malloc(int size)
  21. {
  22. return sqlite3_malloc(size);
  23. }
  24. public override void free(IntPtr p)
  25. {
  26. sqlite3_free(p);
  27. }
  28. protected override SQLiteCode open(IntPtr filename, out IntPtr db)
  29. {
  30. return sqlite3_open(filename, out db);
  31. }
  32. protected override SQLiteCode errcode(IntPtr db)
  33. {
  34. return sqlite3_errcode(db);
  35. }
  36. protected override IntPtr errmsg(IntPtr db)
  37. {
  38. return sqlite3_errmsg(db);
  39. }
  40. protected override IntPtr errmsg16(IntPtr db)
  41. {
  42. return sqlite3_errmsg16(db);
  43. }
  44. protected override int close(IntPtr h)
  45. {
  46. return sqlite3_close(h);
  47. }
  48. protected override int exec(IntPtr h, IntPtr sql, IntPtr callback, IntPtr arg, out IntPtr errmsg)
  49. {
  50. return sqlite3_exec(h, sql, callback, arg, out errmsg);
  51. }
  52. protected override long last_insert_rowid(IntPtr h)
  53. {
  54. return sqlite3_last_insert_rowid(h);
  55. }
  56. protected override int changes(IntPtr h)
  57. {
  58. return sqlite3_changes(h);
  59. }
  60. protected override int total_changes(IntPtr h)
  61. {
  62. return sqlite3_total_changes(h);
  63. }
  64. protected override void busy_timeout(IntPtr h, int ms)
  65. {
  66. sqlite3_busy_timeout(h, ms);
  67. }
  68. protected override int prepare(IntPtr db, IntPtr zSql, int nBytes, out IntPtr ppVm, out IntPtr pzTail)
  69. {
  70. return sqlite3_prepare(db, zSql, nBytes, out ppVm, out pzTail);
  71. }
  72. public override int column_count(IntPtr pStmt)
  73. {
  74. return sqlite3_column_count(pStmt);
  75. }
  76. protected override IntPtr column_name(IntPtr pStmt, int iCol)
  77. {
  78. return sqlite3_column_name(pStmt, iCol);
  79. }
  80. protected override IntPtr column_name16(IntPtr pStmt, int iCol)
  81. {
  82. return sqlite3_column_name16(pStmt, iCol);
  83. }
  84. protected override IntPtr column_decltype(IntPtr pStmt, int i)
  85. {
  86. return sqlite3_column_decltype(pStmt, i);
  87. }
  88. protected override IntPtr column_decltype16(IntPtr pStmt, int iCol)
  89. {
  90. return sqlite3_column_decltype16(pStmt, iCol);
  91. }
  92. public override SQLiteCode step(IntPtr pStmt)
  93. {
  94. return sqlite3_step(pStmt);
  95. }
  96. public override int data_count(IntPtr pStmt)
  97. {
  98. return sqlite3_data_count(pStmt);
  99. }
  100. public override IntPtr column_blob(IntPtr pStmt, int iCol)
  101. {
  102. return sqlite3_column_blob(pStmt, iCol);
  103. }
  104. protected override int column_bytes(IntPtr pStmt, int iCol)
  105. {
  106. return sqlite3_column_bytes(pStmt, iCol);
  107. }
  108. protected override int column_bytes16(IntPtr pStmt, int iCol)
  109. {
  110. return sqlite3_column_bytes16(pStmt, iCol);
  111. }
  112. public override double column_double(IntPtr pStmt, int iCol)
  113. {
  114. return sqlite3_column_double(pStmt, iCol);
  115. }
  116. public override int column_int(IntPtr pStmt, int iCol)
  117. {
  118. return sqlite3_column_int(pStmt, iCol);
  119. }
  120. public override long column_int64(IntPtr pStmt, int iCol)
  121. {
  122. return sqlite3_column_int64(pStmt, iCol);
  123. }
  124. protected override IntPtr column_text(IntPtr pStmt, int iCol)
  125. {
  126. return sqlite3_column_text(pStmt, iCol);
  127. }
  128. protected override IntPtr column_text16(IntPtr pStmt, int iCol)
  129. {
  130. return sqlite3_column_text16(pStmt, iCol);
  131. }
  132. public override SQLiteType column_type(IntPtr pStmt, int iCol)
  133. {
  134. return sqlite3_column_type(pStmt, iCol);
  135. }
  136. public override SQLiteCode finalize(IntPtr h)
  137. {
  138. return sqlite3_finalize(h);
  139. }
  140. public override int reset(IntPtr h)
  141. {
  142. return sqlite3_reset(h);
  143. }
  144. protected override unsafe int bind_blob(IntPtr stmt, int idx, byte* val, int n, SQLiteDestructor destructor)
  145. {
  146. return sqlite3_bind_blob(stmt, idx, val, n, destructor);
  147. }
  148. public override int bind_double(IntPtr stmt, int idx, double val)
  149. {
  150. return sqlite3_bind_double(stmt, idx, val);
  151. }
  152. public override int bind_int(IntPtr stmt, int idx, int val)
  153. {
  154. return sqlite3_bind_int(stmt, idx, val);
  155. }
  156. public override int bind_int64(IntPtr stmt, int idx, long val)
  157. {
  158. return sqlite3_bind_int64(stmt, idx, val);
  159. }
  160. public override int bind_null(IntPtr stmt, int idx)
  161. {
  162. return sqlite3_bind_null(stmt, idx);
  163. }
  164. protected override int bind_text(IntPtr stmt, int idx, IntPtr val, int n, SQLiteDestructor destructor)
  165. {
  166. return sqlite3_bind_text(stmt, idx, val, n, destructor);
  167. }
  168. protected override int bind_text16(IntPtr stmt, int idx, IntPtr val, int n, SQLiteDestructor destructor)
  169. {
  170. return sqlite3_bind_text16(stmt, idx, val, n, destructor);
  171. }
  172. #endregion
  173. private const CallingConvention _Convention = (CallingConvention)4;
  174. [DllImport("sqlite.dll", EntryPoint = "#78", CallingConvention = _Convention)]
  175. private static extern IntPtr sqlite3_libversion();
  176. [DllImport("sqlite.dll", EntryPoint = "#123", CallingConvention = _Convention)]
  177. private static extern int sqlite3_strlen(IntPtr p);
  178. [DllImport("sqlite.dll", EntryPoint = "#81", CallingConvention = _Convention)]
  179. private static extern IntPtr sqlite3_malloc(int size);
  180. [DllImport("sqlite.dll", EntryPoint = "#70", CallingConvention = _Convention)]
  181. private static extern void sqlite3_free(IntPtr p);
  182. [DllImport("sqlite.dll", EntryPoint = "#86", CallingConvention = _Convention)]
  183. private static extern SQLiteCode sqlite3_open(IntPtr filename, out IntPtr db);
  184. [DllImport("sqlite.dll", EntryPoint = "#62", CallingConvention = _Convention)]
  185. private static extern SQLiteCode sqlite3_errcode(IntPtr db);
  186. [DllImport("sqlite.dll", EntryPoint = "#63", CallingConvention = _Convention)]
  187. private static extern IntPtr sqlite3_errmsg(IntPtr db);
  188. [DllImport("sqlite.dll", EntryPoint = "#64", CallingConvention = _Convention)]
  189. private static extern IntPtr sqlite3_errmsg16(IntPtr db);
  190. [DllImport("sqlite.dll", EntryPoint = "#27", CallingConvention = _Convention)]
  191. private static extern int sqlite3_close(IntPtr h);
  192. [DllImport("sqlite.dll", EntryPoint = "#65", CallingConvention = _Convention)]
  193. private static extern int sqlite3_exec(IntPtr h, IntPtr sql, IntPtr callback, IntPtr arg, out IntPtr errmsg);
  194. [DllImport("sqlite.dll", EntryPoint = "#77", CallingConvention = _Convention)]
  195. private static extern long sqlite3_last_insert_rowid(IntPtr h);
  196. [DllImport("sqlite.dll", EntryPoint = "#25", CallingConvention = _Convention)]
  197. private static extern int sqlite3_changes(IntPtr h);
  198. [DllImport("sqlite.dll", EntryPoint = "#126", CallingConvention = _Convention)]
  199. private static extern int sqlite3_total_changes(IntPtr h);
  200. [DllImport("sqlite.dll", EntryPoint = "#24", CallingConvention = _Convention)]
  201. private static extern void sqlite3_busy_timeout(IntPtr h, int ms);
  202. [DllImport("sqlite.dll", EntryPoint = "#90", CallingConvention = _Convention)]
  203. private static extern int sqlite3_prepare(IntPtr db, IntPtr zSql, int nBytes, out IntPtr ppVm, out IntPtr pzTail);
  204. [DllImport("sqlite.dll", EntryPoint = "#33", CallingConvention = _Convention)]
  205. private static extern int sqlite3_column_count(IntPtr pStmt);
  206. [DllImport("sqlite.dll", EntryPoint = "#41", CallingConvention = _Convention)]
  207. private static extern IntPtr sqlite3_column_name(IntPtr pStmt, int iCol);
  208. [DllImport("sqlite.dll", EntryPoint = "#42", CallingConvention = _Convention)]
  209. private static extern IntPtr sqlite3_column_name16(IntPtr pStmt, int iCol);
  210. [DllImport("sqlite.dll", EntryPoint = "#34", CallingConvention = _Convention)]
  211. private static extern IntPtr sqlite3_column_decltype(IntPtr pStmt, int i);
  212. [DllImport("sqlite.dll", EntryPoint = "#35", CallingConvention = _Convention)]
  213. private static extern IntPtr sqlite3_column_decltype16(IntPtr pStmt, int iCol);
  214. [DllImport("sqlite.dll", EntryPoint = "#122", CallingConvention = _Convention)]
  215. private static extern SQLiteCode sqlite3_step(IntPtr pStmt);
  216. [DllImport("sqlite.dll", EntryPoint = "#57", CallingConvention = _Convention)]
  217. private static extern int sqlite3_data_count(IntPtr pStmt);
  218. [DllImport("sqlite.dll", EntryPoint = "#30", CallingConvention = _Convention)]
  219. private static extern IntPtr sqlite3_column_blob(IntPtr pStmt, int iCol);
  220. [DllImport("sqlite.dll", EntryPoint = "#31", CallingConvention = _Convention)]
  221. private static extern int sqlite3_column_bytes(IntPtr pStmt, int iCol);
  222. [DllImport("sqlite.dll", EntryPoint = "#32", CallingConvention = _Convention)]
  223. private static extern int sqlite3_column_bytes16(IntPtr pStmt, int iCol);
  224. [DllImport("sqlite.dll", EntryPoint = "#36", CallingConvention = _Convention)]
  225. private static extern double sqlite3_column_double(IntPtr pStmt, int iCol);
  226. [DllImport("sqlite.dll", EntryPoint = "#38", CallingConvention = _Convention)]
  227. private static extern int sqlite3_column_int(IntPtr pStmt, int iCol);
  228. [DllImport("sqlite.dll", EntryPoint = "#39", CallingConvention = _Convention)]
  229. private static extern long sqlite3_column_int64(IntPtr pStmt, int iCol);
  230. [DllImport("sqlite.dll", EntryPoint = "#43", CallingConvention = _Convention)]
  231. private static extern IntPtr sqlite3_column_text(IntPtr pStmt, int iCol);
  232. [DllImport("sqlite.dll", EntryPoint = "#44", CallingConvention = _Convention)]
  233. private static extern IntPtr sqlite3_column_text16(IntPtr pStmt, int iCol);
  234. [DllImport("sqlite.dll", EntryPoint = "#45", CallingConvention = _Convention)]
  235. private static extern SQLiteType sqlite3_column_type(IntPtr pStmt, int iCol);
  236. [DllImport("sqlite.dll", EntryPoint = "#69", CallingConvention = _Convention)]
  237. private static extern SQLiteCode sqlite3_finalize(IntPtr h);
  238. [DllImport("sqlite.dll", EntryPoint = "#98", CallingConvention = _Convention)]
  239. private static extern int sqlite3_reset(IntPtr h);
  240. [DllImport("sqlite.dll", EntryPoint = "#4", CallingConvention = _Convention)]
  241. private unsafe static extern int sqlite3_bind_blob(IntPtr stmt, int idx, byte* val, int n, SQLiteDestructor destructor);
  242. [DllImport("sqlite.dll", EntryPoint = "#5", CallingConvention = _Convention)]
  243. private static extern int sqlite3_bind_double(IntPtr stmt, int idx, double val);
  244. [DllImport("sqlite.dll", EntryPoint = "#7", CallingConvention = _Convention)]
  245. private static extern int sqlite3_bind_int(IntPtr stmt, int idx, int val);
  246. [DllImport("sqlite.dll", EntryPoint = "#8", CallingConvention = _Convention)]
  247. private static extern int sqlite3_bind_int64(IntPtr stmt, int idx, long val);
  248. [DllImport("sqlite.dll", EntryPoint = "#10", CallingConvention = _Convention)]
  249. private static extern int sqlite3_bind_null(IntPtr stmt, int idx);
  250. [DllImport("sqlite.dll", EntryPoint = "#14", CallingConvention = _Convention)]
  251. private static extern int sqlite3_bind_text(IntPtr stmt, int idx, IntPtr val, int n, SQLiteDestructor destructor);
  252. [DllImport("sqlite.dll", EntryPoint = "#15", CallingConvention = _Convention)]
  253. private static extern int sqlite3_bind_text16(IntPtr stmt, int idx, IntPtr val, int n, SQLiteDestructor destructor);
  254. }
  255. }