common.bmx 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. ' Copyright (c) 2007-2022 Bruce A Henderson
  2. ' All rights reserved.
  3. '
  4. ' Redistribution and use in source and binary forms, with or without
  5. ' modification, are permitted provided that the following conditions are met:
  6. ' * Redistributions of source code must retain the above copyright
  7. ' notice, this list of conditions and the following disclaimer.
  8. ' * Redistributions in binary form must reproduce the above copyright
  9. ' notice, this list of conditions and the following disclaimer in the
  10. ' documentation and/or other materials provided with the distribution.
  11. ' * Neither the auther nor the names of its contributors may be used to
  12. ' endorse or promote products derived from this software without specific
  13. ' prior written permission.
  14. '
  15. ' THIS SOFTWARE IS PROVIDED BY Bruce A Henderson ``AS IS'' AND ANY
  16. ' EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  17. ' WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. ' DISCLAIMED. IN NO EVENT SHALL Bruce A Henderson BE LIABLE FOR ANY
  19. ' DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  20. ' (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21. ' LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  22. ' ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. ' (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  24. ' SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. '
  26. SuperStrict
  27. Import BRL.Blitz
  28. ?linux
  29. Import "-L/usr/lib/mysql"
  30. Import "-lmariadb"
  31. Import "/usr/include/mysql/*.h"
  32. ?win32
  33. Import "-lmariadb"
  34. Import "include/*.h"
  35. ?macos
  36. 'Import "-L/usr/local/mysql/lib"
  37. Import "-lmariadb"
  38. Import "-lz"
  39. 'Import "/usr/local/mysql/include/*.h"
  40. ?
  41. Import "glue.c"
  42. Const MYSQL_TYPE_DECIMAL:Int = 0
  43. Const MYSQL_TYPE_TINY:Int = 1
  44. Const MYSQL_TYPE_SHORT:Int = 2
  45. Const MYSQL_TYPE_LONG:Int = 3
  46. Const MYSQL_TYPE_FLOAT:Int = 4
  47. Const MYSQL_TYPE_DOUBLE:Int = 5
  48. Const MYSQL_TYPE_NULL:Int = 6
  49. Const MYSQL_TYPE_TIMESTAMP:Int = 7
  50. Const MYSQL_TYPE_LONGLONG:Int = 8
  51. Const MYSQL_TYPE_INT24:Int = 9
  52. Const MYSQL_TYPE_DATE:Int = 10
  53. Const MYSQL_TYPE_TIME:Int = 11
  54. Const MYSQL_TYPE_DATETIME:Int = 12
  55. Const MYSQL_TYPE_YEAR:Int = 13
  56. Const MYSQL_TYPE_NEWDATE:Int = 14
  57. Const MYSQL_TYPE_VARCHAR:Int = 15
  58. Const MYSQL_TYPE_BIT:Int = 16
  59. Const MYSQL_TYPE_JSON:Int = 245
  60. Const MYSQL_TYPE_NEWDECIMAL:Int = 246
  61. Const MYSQL_TYPE_ENUM:Int = 247
  62. Const MYSQL_TYPE_SET:Int = 248
  63. Const MYSQL_TYPE_TINY_BLOB:Int = 249
  64. Const MYSQL_TYPE_MEDIUM_BLOB:Int = 250
  65. Const MYSQL_TYPE_LONG_BLOB:Int = 251
  66. Const MYSQL_TYPE_BLOB:Int = 252
  67. Const MYSQL_TYPE_VAR_STRING:Int = 253
  68. Const MYSQL_TYPE_STRING:Int = 254
  69. Const MYSQL_TYPE_GEOMETRY:Int = 255
  70. ?win32
  71. Extern "win32"
  72. ?linux
  73. Extern
  74. ?macos
  75. Extern
  76. ?
  77. Function mysql_close(handle:Byte Ptr)
  78. Function mysql_ping:Int(handle:Byte Ptr)
  79. Function mysql_query:Int(handle:Byte Ptr, query:Byte Ptr)
  80. Function mysql_errno:Int(handle:Byte Ptr)
  81. Function mysql_error:Byte Ptr(handle:Byte Ptr)
  82. Function mysql_init:Byte Ptr(h:Int = 0)
  83. Function mysql_get_client_version:Int()
  84. Function mysql_real_connect:Int(handle:Byte Ptr, host:Byte Ptr, user:Byte Ptr, ..
  85. passwd:Byte Ptr, db:Byte Ptr, port:Int, unix_socket:Byte Ptr, client_flag:Int)
  86. Function mysql_select_db:Int(handle:Byte Ptr, db:Byte Ptr)
  87. Function mysql_set_character_set(handle:Byte Ptr, text:Byte Ptr)
  88. Function mysql_get_server_version:Int(handle:Byte Ptr)
  89. Function mysql_real_query:Int(handle:Byte Ptr, query:Byte Ptr, size:Int)
  90. Function mysql_store_result:Byte Ptr(handle:Byte Ptr)
  91. Function mysql_field_count:Int(handle:Byte Ptr)
  92. Function mysql_fetch_field_direct:Byte Ptr(handle:Byte Ptr, index:Int)
  93. Function mysql_stmt_fetch:Int(stmt:Byte Ptr)
  94. Function mysql_fetch_row:Byte Ptr(stmt:Byte Ptr)
  95. Function mysql_free_result(result:Byte Ptr)
  96. Function mysql_stmt_init:Byte Ptr(handle:Byte Ptr)
  97. Function mysql_stmt_prepare:Int(stmt:Byte Ptr, query:Byte Ptr, size:Int)
  98. Function mysql_stmt_param_count:Int(stmt:Byte Ptr)
  99. Function mysql_stmt_execute:Int(stmt:Byte Ptr)
  100. Function mysql_stmt_error:Byte Ptr(stmt:Byte Ptr)
  101. Function mysql_stmt_result_metadata:Byte Ptr(stmt:Byte Ptr)
  102. Function mysql_num_fields:Int(meta:Byte Ptr)
  103. Function mysql_fetch_lengths:Byte Ptr(result:Byte Ptr)
  104. Function mysql_fetch_field:Byte Ptr(meta:Byte Ptr)
  105. Function mysql_stmt_store_result:Int(stmt:Byte Ptr)
  106. Function mysql_list_tables:Byte Ptr(handle:Byte Ptr, name:Byte Ptr)
  107. End Extern
  108. Extern
  109. Function bmx_mysql_field_name:String(f:Byte Ptr)
  110. Function bmx_mysql_field_org_name:Byte Ptr(f:Byte Ptr)
  111. Function bmx_mysql_field_table:Byte Ptr(f:Byte Ptr)
  112. Function bmx_mysql_field_org_table:Byte Ptr(f:Byte Ptr)
  113. Function bmx_mysql_field_db:Byte Ptr(f:Byte Ptr)
  114. Function bmx_mysql_field_catalog:Byte Ptr(f:Byte Ptr)
  115. Function bmx_mysql_field_def:Byte Ptr(f:Byte Ptr)
  116. Function bmx_mysql_field_length:Int(f:Byte Ptr)
  117. Function bmx_mysql_field_max_length:Int(f:Byte Ptr)
  118. Function bmx_mysql_field_flags:Int(f:Byte Ptr)
  119. Function bmx_mysql_field_type:Int(f:Byte Ptr)
  120. Function bmx_mysql_field_decimals:Int(f:Byte Ptr)
  121. Function bmx_mysql_makeBindings:Byte Ptr(size:Int)
  122. Function bmx_mysql_deleteBindings(bindings:Byte Ptr)
  123. 'Function bmx_mysql_makeBools:Byte Ptr(size:Int)
  124. Function bmx_mysql_setBool(bools:Byte Ptr, index:Int, isNull:Int)
  125. Function bmx_mysql_deleteBools(bools:Byte Ptr)
  126. Function bmx_mysql_bind_int(params:Byte Ptr, index:Int, value:Int Ptr)
  127. Function bmx_mysql_bind_float(params:Byte Ptr, index:Int, value:Float Ptr)
  128. Function bmx_mysql_bind_double(params:Byte Ptr, index:Int, value:Double Ptr)
  129. Function bmx_mysql_bind_long(params:Byte Ptr, index:Int, value:Long Ptr)
  130. Function bmx_mysql_bind_string(params:Byte Ptr, index:Int, value:Byte Ptr, size:Int)
  131. Function bmx_mysql_bind_date(params:Byte Ptr, index:Int, value:Byte Ptr, _year:Int, _month:Int, _day:Int)
  132. Function bmx_mysql_bind_time(params:Byte Ptr, index:Int, value:Byte Ptr, _hour:Int, _min:Int, _sec:Int)
  133. Function bmx_mysql_bind_datetime(params:Byte Ptr, index:Int, value:Byte Ptr, _year:Int, _month:Int, _day:Int, _hour:Int, _min:Int, _sec:Int)
  134. Function bmx_mysql_bind_blob(params:Byte Ptr, index:Int, value:Byte Ptr, size:Int)
  135. Function bmx_mysql_makeVals:Byte Ptr(size:Int)
  136. Function bmx_mysql_deleteVals(vals:Byte Ptr)
  137. Function examine_bindings(params:Byte Ptr, size:Int, stmt:Byte Ptr)
  138. Function bmx_mysql_getLength:Int(lengths:Byte Ptr, index:Int)
  139. Function bmx_mysql_rowField_isNull:Int(row:Byte Ptr, index:Int)
  140. Function bmx_mysql_rowField_chars:Byte Ptr(row:Byte Ptr, index:Int)
  141. Function bmx_mysql_inbind(params:Byte Ptr, index:Int, _field:Byte Ptr, dataValue:Byte Ptr, dataLength:Int Ptr, isNull:Int Ptr, ty:Int)
  142. Function bmx_mysql_stmt_bind_result:Int(stmt:Byte Ptr, bindings:Byte Ptr)
  143. Function bmx_mysql_stmt_fetch:Int(stmt:Byte Ptr)
  144. Function bmx_mysql_stmt_bind_param:Int(stmt:Byte Ptr, bindings:Byte Ptr)
  145. Function bmx_mysql_getBindings:Byte Ptr(stmt:Byte Ptr)
  146. Function bmx_mysql_getParams:Byte Ptr(stmt:Byte Ptr)
  147. Function bmx_mysql_stmt_insert_id(stmt:Byte Ptr, id:Long Ptr)
  148. Function bmx_mysql_insert_id(handle:Byte Ptr, id:Long Ptr)
  149. Function bmx_mysql_makeTime:Byte Ptr()
  150. Function bmx_mysql_deleteTime(handle:Byte Ptr)
  151. Function bmx_mysql_stmt_close:Int(stmt:Byte Ptr)
  152. Function bmx_mysql_affected_rows(handle:Byte Ptr, rows:Long Ptr)
  153. Function bmx_mysql_stmt_reset:Int(stmt:Byte Ptr)
  154. Function bmx_mysql_stmt_affected_rows(stmt:Byte Ptr, rows:Long Ptr)
  155. Function bmx_mysql_char_to_int:Int(data:Byte Ptr)
  156. Function bmx_mysql_char_to_long:Long(data:Byte Ptr)
  157. Function bmx_mysql_char_to_float:Float(data:Byte Ptr)
  158. Function bmx_mysql_char_to_double:Double(data:Byte Ptr)
  159. End Extern
  160. Const CLIENT_FOUND_ROWS:Int = 2
  161. Const CLIENT_NO_SCHEMA:Int = 16
  162. Const CLIENT_COMPRESS:Int = 32
  163. Const CLIENT_LOCAL_FILES:Int = 128
  164. Const CLIENT_IGNORE_SPACE:Int = 256
  165. Const CLIENT_INTERACTIVE:Int = 1024
  166. Const CLIENT_SSL:Int = 2048
  167. Const CLIENT_IGNORE_SIGPIPE:Int = 4096
  168. Const CLIENT_MULTI_STATEMENTS:Int = 1 Shl 16
  169. Const CLIENT_MULTI_RESULTS:Int = 1 Shl 17
  170. Const CLIENT_REMEMBER_OPTIONS:Int = 1 Shl 31