November 25, 2020, 05:22:10 AM

Author Topic: [bb] SQLite 3 decls by HappyCat [ 1+ years ago ]  (Read 703 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] SQLite 3 decls by HappyCat [ 1+ years ago ]
« on: June 29, 2017, 12:28:39 AM »
Title : SQLite 3 decls
Author : HappyCat
Posted : 1+ years ago

Description : Here's a .decls for SQLite 3.

<a href="../logs/userlogbb9c.html?user=382&log=508" target="_blank">Wrapper functions[/url] are also available.


Code :
Code: BlitzBasic
  1. ; Tested with SQLite version 3.2.2
  2.  
  3. ; SQLite3 available from:    http://www.sqlite.org
  4. ; SQLite3 API documentation: http://www.sqlite.org/capi3ref.html
  5.  
  6. .lib "sqlite3.dll"
  7.  
  8.  
  9. ; SQLLite3 Functions Included --------------------------------------------------
  10.  
  11. ; sqlite3_bind_blob
  12. ; sqlite3_bind_double
  13. ; sqlite3_bind_int
  14. ; sqlite3_bind_null
  15. ; sqlite3_bind_parameter_count
  16. ; sqlite3_bind_parameter_index
  17. ; sqlite3_bind_parameter_name
  18. ; sqlite3_bind_text
  19. ; sqlite3_busy_timeout
  20. ; sqlite3_changes
  21. ; sqlite3_close
  22. ; sqlite3_column_blob
  23. ; sqlite3_column_bytes
  24. ; sqlite3_column_count
  25. ; sqlite3_column_decltype
  26. ; sqlite3_column_double
  27. ; sqlite3_column_int
  28. ; sqlite3_column_name
  29. ; sqlite3_column_text
  30. ; sqlite3_column_type
  31. ; sqlite3_complete
  32. ; sqlite3_data_count
  33. ; sqlite3_db_handle
  34. ; sqlite3_errcode
  35. ; sqlite3_errmsg
  36. ; sqlite3_exec
  37. ; sqlite3_expired
  38. ; sqlite3_finalize
  39. ; sqlite3_get_autocommit
  40. ; sqlite3_interrupt
  41. ; sqlite3_last_insert_rowid
  42. ; sqlite3_libversion
  43. ; sqlite3_open
  44. ; sqlite3_prepare
  45. ; sqlite3_reset
  46. ; sqlite3_step
  47. ; sqlite3_total_changes
  48. ; sqlite3_transfer_bindings
  49.  
  50.  
  51. ; Notes --------------------------------------------------------------
  52.  
  53. ; For functions that return a handle as an out parameter (ie. the
  54. ; Handle* parameters of SQLite3_Open and SQLite3_Prepare)
  55. ; declare a Type with a single integer field, for example:
  56.  
  57. ;       Type HandleContainer
  58. ;               Field TheHandle
  59. ;       End Type
  60.  
  61. ; then pass an instance of the Type in as the required parameter.
  62. ; When it's done the integer field of the instance will contain the
  63. ; handle that you have to pass into the other functions.
  64.  
  65.  
  66. ; Opening and Closing ------------------------------------------------
  67.  
  68. SQLite3_Open%(Filename$, DatabaseHandle*) : "sqlite3_open"
  69. SQLite3_Close%(DatabaseHandle) : "sqlite3_close"
  70.  
  71.  
  72. ; Misc ---------------------------------------------------------------
  73.  
  74. SQLite3_LibVersion$() : "sqlite3_libversion"
  75. SQLite3_Busy_TimeOut%(DatabaseHandle, TimeOut): "sqlite3_busy_timeout"
  76. SQLite3_Get_AutoCommit%(DatabaseHandle) : "sqlite3_get_autocommit"
  77. SQLite3_Interrupt(DatabaseHandle) : "sqlite3_interrupt"
  78.  
  79.  
  80. ; Errors -------------------------------------------------------------
  81.  
  82. SQLite3_ErrCode%(DatabaseHandle) : "sqlite3_errcode"
  83. SQLite3_ErrMsg$(DatabaseHandle) : "sqlite3_errmsg"
  84.  
  85. ; Always seems to return 0.
  86. SQLite3_Complete%(SQL$) : "sqlite3_complete"
  87.  
  88.  
  89. ; Executing SQL without results --------------------------------------
  90.  
  91. ; As Blitz3D doesn't have function pointers the CallBack is pointless
  92. ; and this can only really be used for result-less SQL statements.
  93. ; Also, I've never got the Error return to work. So just pass in
  94. ; zeros for the last three parameters and use SQLite3_ErrMsg if you
  95. ; need to get the error message.
  96. SQLite3_Exec%(DatabaseHandle, SQL$, CallBack, FirstParam, Error) : "sqlite3_exec"
  97.  
  98. SQLite3_Changes%(DatabaseHandle): "sqlite3_changes"
  99. SQLite3_Total_Changes%(DatabaseHandle) : "sqlite3_total_changes"
  100. SQLite3_Last_Insert_RowID%(DatabaseHandle): "sqlite3_last_insert_rowid"
  101.  
  102.  
  103. ; Executing SQL with results -----------------------------------------
  104.  
  105. ; Never got the SQLTail to work so just pass in a zero.
  106. SQLite3_Prepare%(DatabaseHandle, SQL$, LengthOfSQL, StatementHandle*, SQLTail) : "sqlite3_prepare"
  107.  
  108. SQLite3_Step%(StatementHandle) : "sqlite3_step"
  109. SQLite3_Reset%(StatementHandle) : "sqlite3_reset"
  110. SQLite3_Finalize%(StatementHandle) : "sqlite3_finalize"
  111. SQLite3_Data_Count%(StatementHandle) : "sqlite3_data_count"
  112. SQLite3_DB_Handle%(StatementHandle) : "sqlite3_db_handle"
  113.  
  114. ; Probably not required as none of the functions that can cause a
  115. ; statement to expire are included here.
  116. SQLite3_Expired%(StatementHandle): "sqlite3_expired"
  117.  
  118.  
  119. ; SQL Parameter Binding ----------------------------------------------
  120.  
  121. SQLite3_Bind_Parameter_Count%(StatementHandle): "sqlite3_bind_parameter_count"
  122. SQLite3_Bind_Parameter_Index%(StatementHandle, ParameterName$): "sqlite3_bind_parameter_index"
  123. SQLite3_Bind_Parameter_Name$(StatementHandle, ParameterIndex): "sqlite3_bind_parameter_name"
  124.  
  125. ; Never tested this for real, but it should work.
  126. SQLite3_Transfer_Bindings%(StatementHandle1, StatementHandle2): "sqlite3_transfer_bindings"
  127.  
  128. SQLite3_Bind_Null%(StatementHandle, Index) : "sqlite3_bind_null"
  129. SQLite3_Bind_Int%(StatementHandle, Index, Value) : "sqlite3_bind_int"
  130.  
  131. ; If you pass -1 for LengthOfText it will work it out for itself.
  132. ; Pass a zero in for Destructor.
  133. SQLite3_Bind_Text%(StatementHandle, Index, Value$, LengthOfText, Destructor) : "sqlite3_bind_text"
  134.  
  135. ; Never tried this so it probably won't work.
  136. ; Pass a zero in for Destructor.
  137. SQLite3_Bind_Blob%(StatementHandle, Index, Value, LengthOfBlob, Destructor) : "sqlite3_bind_blob"
  138.  
  139. ; Doesn't seem to work unfortunately.
  140. SQLite3_Bind_Double%(StatementHandle, Index, Value#) : "sqlite3_bind_double"
  141.  
  142.  
  143. ; Getting values from executed SQL  ----------------------------------
  144.  
  145. SQLite3_Column_Count%(StatementHandle): "sqlite3_column_count"
  146. SQLite3_Column_Name$(StatementHandle, ColumnIndex) : "sqlite3_column_name"
  147. SQLite3_Column_Type%(StatementHandle, ColumnIndex) : "sqlite3_column_type"
  148. SQLite3_Column_DeclType$(StatementHandle, ColumnIndex) : "sqlite3_column_decltype"
  149. SQLite3_Column_Int%(StatementHandle, ColumnIndex) : "sqlite3_column_int"
  150. SQLite3_Column_Double#(StatementHandle, ColumnIndex) : "sqlite3_column_double"
  151. SQLite3_Column_Text$(StatementHandle, ColumnIndex) : "sqlite3_column_text"
  152. SQLite3_Column_Bytes%(StatementHandle, ColumnIndex) : "sqlite3_column_bytes"
  153.  
  154. ; Never tried this so it probably won't work.
  155. SQLite3_Column_Blob%(StatementHandle, ColumnIndex) : "sqlite3_column_blob"
  156.  
  157.  
  158. ; SQLite3 Functions Not Included --------------------------------------
  159.  
  160. ; The following SQLite3 functions have not been included here:
  161.  
  162. ; sqlite3_aggregate_context     - used by user defined functions, which aren't included here
  163. ; sqlite3_aggregate_count       - used by user defined functions, which aren't included here
  164. ; sqlite3_bind_int64            - Int64 means nothing to Blitz, use Int version instead
  165. ; sqlite3_bind_text16           - UTF16 means nothing to Blitz, use normal version instead
  166. ; sqlite3_busy_handler          - requires function pointers, which Blitz doesn't have
  167. ; sqlite3_clear_bindings        - just didn't work, claimed that function didn't exist in the .dll
  168. ; sqlite3_collation_needed      - requires function pointers, which Blitz doesn't have
  169. ; sqlite3_collation_needed16    - requires function pointers, which Blitz doesn't have
  170. ; sqlite3_column_bytes16        - UTF16 means nothing to Blitz, use normal version instead
  171. ; sqlite3_column_decltype16     - UTF16 means nothing to Blitz, use normal version instead
  172. ; sqlite3_column_int64          - Int64 means nothing to Blitz, use Int version instead
  173. ; sqlite3_column_name16         - UTF16 means nothing to Blitz, use normal version instead
  174. ; sqlite3_column_text16         - UTF16 means nothing to Blitz, use normal version instead
  175. ; sqlite3_commit_hook           - requires function pointers, which Blitz doesn't have
  176. ; sqlite3_complete16            - UTF16 means nothing to Blitz, use normal version instead
  177. ; sqlite3_create_collation      - requires function pointers, which Blitz doesn't have
  178. ; sqlite3_create_collation16    - requires function pointers, which Blitz doesn't have
  179. ; sqlite3_create_function       - requires function pointers, which Blitz doesn't have
  180. ; sqlite3_create_function16     - requires function pointers, which Blitz doesn't have
  181. ; sqlite3_errmsg16              - UTF16 means nothing to Blitz, use normal version instead
  182. ; sqlite3_free                  - only really required by C
  183. ; sqlite3_get_table             - couldn't work out how to get the data out
  184. ; sqlite3_free_table            - not required as I couldn't get sqlite3_get_table to work
  185. ; sqlite3_global_recover        - only really required by C
  186. ; sqlite3_mprintf               - only really required by C
  187. ; sqlite3_open16                - UTF16 means nothing to Blitz, use normal version instead
  188. ; sqlite3_prepare16             - UTF16 means nothing to Blitz, use normal version instead
  189. ; sqlite3_progress_handler      - requires function pointers, which Blitz doesn't have
  190. ; sqlite3_result_blob           - used by user defined functions, which aren't included here
  191. ; sqlite3_result_double         - used by user defined functions, which aren't included here
  192. ; sqlite3_result_error          - used by user defined functions, which aren't included here
  193. ; sqlite3_result_error16        - used by user defined functions, which aren't included here
  194. ; sqlite3_result_int            - used by user defined functions, which aren't included here
  195. ; sqlite3_result_int64          - used by user defined functions, which aren't included here
  196. ; sqlite3_result_null           - used by user defined functions, which aren't included here
  197. ; sqlite3_result_text           - used by user defined functions, which aren't included here
  198. ; sqlite3_result_text16         - used by user defined functions, which aren't included here
  199. ; sqlite3_result_text16be       - used by user defined functions, which aren't included here
  200. ; sqlite3_result_text16le       - used by user defined functions, which aren't included here
  201. ; sqlite3_result_value          - used by user defined functions, which aren't included here
  202. ; sqlite3_set_authorizer        - requires function pointers, which Blitz doesn't have
  203. ; sqlite3_sleep                 - just didn't work, claimed that function didn't exist in the .dll
  204. ; sqlite3_trace                 - requires function pointers, which Blitz doesn't have
  205. ; sqlite3_user_data             - used by user defined functions, which aren't included here
  206. ; sqlite3_value_blob            - used by user defined functions, which aren't included here
  207. ; sqlite3_value_bytes           - used by user defined functions, which aren't included here
  208. ; sqlite3_value_bytes16         - used by user defined functions, which aren't included here
  209. ; sqlite3_value_double          - used by user defined functions, which aren't included here
  210. ; sqlite3_value_int             - used by user defined functions, which aren't included here
  211. ; sqlite3_value_int64           - used by user defined functions, which aren't included here
  212. ; sqlite3_value_text            - used by user defined functions, which aren't included here
  213. ; sqlite3_value_text16          - used by user defined functions, which aren't included here
  214. ; sqlite3_value_text16be        - used by user defined functions, which aren't included here
  215. ; sqlite3_value_text16le        - used by user defined functions, which aren't included here
  216. ; sqlite3_value_type            - used by user defined functions, which aren't included here
  217. ; sqlite3_vmprintf              - only really required by C


Comments :


RustyKristi(Posted 1+ years ago)

 This is a mirror exact copy of the lib for posterity:<a href="http://www.mediafire.com/download/82ih4mawri46vnj/SQLite3.zip" target="_blank">http://www.mediafire.com/download/82ih4mawri46vnj/SQLite3.zip[/url]


 

SimplePortal 2.3.6 © 2008-2014, SimplePortal