php_pdo_firebird_int.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Ard Biesheuvel <abies@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_PDO_FIREBIRD_INT_H
  19. #define PHP_PDO_FIREBIRD_INT_H
  20. #include <ibase.h>
  21. #ifdef SQLDA_VERSION
  22. #define PDO_FB_SQLDA_VERSION SQLDA_VERSION
  23. #else
  24. #define PDO_FB_SQLDA_VERSION 1
  25. #endif
  26. #define PDO_FB_DIALECT 3
  27. #define PDO_FB_DEF_DATE_FMT "%Y-%m-%d"
  28. #define PDO_FB_DEF_TIME_FMT "%H:%M:%S"
  29. #define PDO_FB_DEF_TIMESTAMP_FMT PDO_FB_DEF_DATE_FMT " " PDO_FB_DEF_TIME_FMT
  30. #define SHORT_MAX (1 << (8*sizeof(short)-1))
  31. #if SIZEOF_ZEND_LONG == 8 && !defined(PHP_WIN32)
  32. # define LL_MASK "l"
  33. # define LL_LIT(lit) lit ## L
  34. #else
  35. # ifdef PHP_WIN32
  36. # define LL_MASK "I64"
  37. # define LL_LIT(lit) lit ## I64
  38. # else
  39. # define LL_MASK "ll"
  40. # define LL_LIT(lit) lit ## LL
  41. # endif
  42. #endif
  43. /* Firebird API has a couple of missing const decls in its API */
  44. #define const_cast(s) ((char*)(s))
  45. #ifdef PHP_WIN32
  46. typedef void (__stdcall *info_func_t)(char*);
  47. #else
  48. typedef void (*info_func_t)(char*);
  49. #endif
  50. #ifndef min
  51. #define min(a,b) ((a)<(b)?(a):(b))
  52. #endif
  53. #if defined(_LP64) || defined(__LP64__) || defined(__arch64__) || defined(_WIN64)
  54. # define PDO_FIREBIRD_HANDLE_INITIALIZER 0U
  55. #else
  56. # define PDO_FIREBIRD_HANDLE_INITIALIZER NULL
  57. #endif
  58. typedef struct {
  59. /* the result of the last API call */
  60. ISC_STATUS isc_status[20];
  61. /* the connection handle */
  62. isc_db_handle db;
  63. /* the transaction handle */
  64. isc_tr_handle tr;
  65. /* the last error that didn't come from the API */
  66. char const *last_app_error;
  67. /* date and time format strings, can be set by the set_attribute method */
  68. char *date_format;
  69. char *time_format;
  70. char *timestamp_format;
  71. /* prepend table names on column names in fetch */
  72. unsigned fetch_table_names:1;
  73. unsigned _reserved:31;
  74. } pdo_firebird_db_handle;
  75. typedef struct {
  76. /* the link that owns this statement */
  77. pdo_firebird_db_handle *H;
  78. /* the statement handle */
  79. isc_stmt_handle stmt;
  80. /* the name of the cursor (if it has one) */
  81. char name[32];
  82. /* the type of statement that was issued */
  83. char statement_type:8;
  84. /* whether EOF was reached for this statement */
  85. unsigned exhausted:1;
  86. /* successful isc_dsql_execute opens a cursor */
  87. unsigned cursor_open:1;
  88. unsigned _reserved:22;
  89. /* the named params that were converted to ?'s by the driver */
  90. HashTable *named_params;
  91. /* allocated space to convert fields values to other types */
  92. char **fetch_buf;
  93. /* the input SQLDA */
  94. XSQLDA *in_sqlda;
  95. /* the output SQLDA */
  96. XSQLDA out_sqlda; /* last member */
  97. } pdo_firebird_stmt;
  98. extern const pdo_driver_t pdo_firebird_driver;
  99. extern const struct pdo_stmt_methods firebird_stmt_methods;
  100. void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, zend_long line);
  101. enum {
  102. PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
  103. PDO_FB_ATTR_TIME_FORMAT,
  104. PDO_FB_ATTR_TIMESTAMP_FORMAT,
  105. };
  106. #endif /* PHP_PDO_FIREBIRD_INT_H */
  107. /*
  108. * Local variables:
  109. * tab-width: 4
  110. * c-basic-offset: 4
  111. * End:
  112. * vim600: noet sw=4 ts=4 fdm=marker
  113. * vim<600: noet sw=4 ts=4
  114. */