common.bmx 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. ' Copyright (c) 2007-2023, 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 name of the author nor the
  12. ' names of its contributors may be used to endorse or promote products
  13. ' derived from this software without specific prior written permission.
  14. '
  15. ' THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''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 THE AUTHOR 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. ?win32
  28. Import "-lpq"
  29. Import "include/*.h"
  30. Import "interfaces/libpq/*.h"
  31. ?
  32. Import "glue.c"
  33. Const PGRES_EMPTY_QUERY:Int = 0 ' empty query String was executed
  34. Const PGRES_COMMAND_OK:Int = 1 ' a query command that doesn't return
  35. ' anything was executed properly by the
  36. ' backend
  37. Const PGRES_TUPLES_OK:Int = 2 ' a query command that returns tuples was
  38. ' executed properly by the backend, PGresult
  39. ' contains the result tuples
  40. Const PGRES_COPY_OUT:Int = 3 ' Copy Out data transfer in progress
  41. Const PGRES_COPY_IN:Int = 4 ' Copy In data transfer in progress
  42. Const PGRES_BAD_RESPONSE:Int = 5 ' an unexpected response was recv'd from the
  43. ' backend
  44. Const PGRES_NONFATAL_ERROR:Int = 6 ' notice Or warning message
  45. Const PGRES_FATAL_ERROR:Int = 7 ' query failed
  46. Const BOOLOID:Int = 16 ' boolean
  47. Const INT2OID:Int = 21 ' -32 thousand to 32 thousand
  48. Const INT4OID:Int = 23 ' -2 billion to 2 billion integer
  49. Const VOIDOID:Int = 2278 ' void oid
  50. Const REGPROCOID:Int = 24 ' registered procedure
  51. Const XIDOID:Int = 28 ' transaction id
  52. Const CIDOID:Int = 29 ' command identifier type
  53. Const INT8OID:Int = 20 ' ~18 digit integer
  54. Const FLOAT4OID:Int = 700 ' single-precision floating point number
  55. Const FLOAT8OID:Int = 701 ' double-precision floating point number
  56. Const NUMERICOID:Int = 1700 ' numeric(precision, decimal)
  57. Const ABSTIMEOID:Int = 702 '
  58. Const RELTIMEOID:Int = 703 '
  59. Const DATEOID:Int = 1082 '
  60. Const TIMEOID:Int = 1083 '
  61. Const TIMETZOID:Int = 1266 '
  62. Const TIMESTAMPOID:Int = 1114 '
  63. Const TIMESTAMPTZOID:Int = 1184 '
  64. Const BYTEAOID:Int = 17 ' byte array
  65. Extern
  66. Function bmx_pgsql_PQfinish(handle:Byte Ptr)
  67. Function bmx_pgsql_PQconnectdb:Byte Ptr(info:Byte Ptr)
  68. Function bmx_pgsql_PQstatus:Int(handle:Byte Ptr)
  69. Function bmx_pgsql_PQerrorMessage:Byte Ptr(handle:Byte Ptr)
  70. Function bmx_pgsql_PQexec:Byte Ptr(handle:Byte Ptr, query:Byte Ptr)
  71. Function bmx_pgsql_PQresultStatus:Int(result:Byte Ptr)
  72. Function bmx_pgsql_PQclear(result:Byte Ptr)
  73. Function bmx_pgsql_PQntuples:Int(result:Byte Ptr)
  74. Function bmx_pgsql_PQnfields:Int(result:Byte Ptr)
  75. Function bmx_pgsql_PQcmdTuples:Byte Ptr(result:Byte Ptr)
  76. Function bmx_pgsql_PQfname:Byte Ptr(result:Byte Ptr, index:Int)
  77. Function bmx_pgsql_PQftype:Int(result:Byte Ptr, index:Int)
  78. Function bmx_pgsql_PQfsize:Int(result:Byte Ptr, index:Int)
  79. Function bmx_pgsql_PQfmod:Int(result:Byte Ptr, index:Int)
  80. Function bmx_pgsql_PQgetisnull:Int(result:Byte Ptr, row:Int, index:Int)
  81. Function bmx_pgsql_PQgetlength:Int(result:Byte Ptr, row:Int, index:Int)
  82. Function bmx_pgsql_PQgetvalue:Byte Ptr(result:Byte Ptr, row:Int, index:Int)
  83. Function bmx_pgsql_PQprepare:Byte Ptr(handle:Byte Ptr, stmtName:Byte Ptr, query:Byte Ptr)
  84. Function bmx_pgsql_PQdescribePrepared:Byte Ptr(result:Byte Ptr, name:Byte Ptr)
  85. Function bmx_pgsql_PQnparams:Int(result:Byte Ptr)
  86. Function bmx_pgsql_createParamValues:Byte Ptr(size:Int)
  87. Function bmx_pgsql_createParamInts:Int Ptr(size:Int)
  88. Function bmx_pgsql_deleteParamValues(params:Byte Ptr)
  89. Function bmx_pgsql_deleteParamInts(params:Int Ptr)
  90. Function bmx_pgsql_setNullParam(params:Byte Ptr, index:Int)
  91. Function bmx_pgsql_setParam(params:Byte Ptr, lengths:Int Ptr, formats:Int Ptr, index:Int, Text:Byte Ptr, length:Int)
  92. Function bmx_pgsql_setParamBinary(params:Byte Ptr, lengths:Int Ptr, formats:Int Ptr, index:Int, data:Byte Ptr, length:Int)
  93. Function bmx_pgsql_PQexecPrepared:Byte Ptr(handle:Byte Ptr, stmtName:Byte Ptr, size:Int, params:Byte Ptr, lengths:Int Ptr, formats:Int Ptr)
  94. Function bmx_pgsql_PQunescapeBytea:Byte Ptr(data:Byte Ptr, length:Int Ptr)
  95. Function bmx_pgsql_PQfreemem(data:Byte Ptr)
  96. Function bmx_pgsql_PQoidValue:UInt(result:Byte Ptr)
  97. End Extern