php_pdo_firebird_int.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 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_LONG == 8
  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. typedef struct {
  54. /* the result of the last API call */
  55. ISC_STATUS isc_status[20];
  56. /* the connection handle */
  57. isc_db_handle db;
  58. /* the transaction handle */
  59. isc_tr_handle tr;
  60. /* the last error that didn't come from the API */
  61. char const *last_app_error;
  62. /* date and time format strings, can be set by the set_attribute method */
  63. char *date_format;
  64. char *time_format;
  65. char *timestamp_format;
  66. /* prepend table names on column names in fetch */
  67. unsigned fetch_table_names:1;
  68. unsigned _reserved:31;
  69. } pdo_firebird_db_handle;
  70. typedef struct {
  71. /* the link that owns this statement */
  72. pdo_firebird_db_handle *H;
  73. /* the statement handle */
  74. isc_stmt_handle stmt;
  75. /* the name of the cursor (if it has one) */
  76. char name[32];
  77. /* the type of statement that was issued */
  78. char statement_type:8;
  79. /* whether EOF was reached for this statement */
  80. unsigned exhausted:1;
  81. /* successful isc_dsql_execute opens a cursor */
  82. unsigned cursor_open:1;
  83. unsigned _reserved:22;
  84. /* the named params that were converted to ?'s by the driver */
  85. HashTable *named_params;
  86. /* allocated space to convert fields values to other types */
  87. char **fetch_buf;
  88. /* the input SQLDA */
  89. XSQLDA *in_sqlda;
  90. /* the output SQLDA */
  91. XSQLDA out_sqlda; /* last member */
  92. } pdo_firebird_stmt;
  93. extern pdo_driver_t pdo_firebird_driver;
  94. extern struct pdo_stmt_methods firebird_stmt_methods;
  95. void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC);
  96. enum {
  97. PDO_FB_ATTR_DATE_FORMAT = PDO_ATTR_DRIVER_SPECIFIC,
  98. PDO_FB_ATTR_TIME_FORMAT,
  99. PDO_FB_ATTR_TIMESTAMP_FORMAT,
  100. };
  101. #endif /* PHP_PDO_FIREBIRD_INT_H */
  102. /*
  103. * Local variables:
  104. * tab-width: 4
  105. * c-basic-offset: 4
  106. * End:
  107. * vim600: noet sw=4 ts=4 fdm=marker
  108. * vim<600: noet sw=4 ts=4
  109. */