You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

184 lines
4.7 KiB

27 years ago
27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP version 4.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997, 1998, 1999, 2000 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 2.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available at through the world-wide-web at |
  10. | http://www.php.net/license/2_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. | Authors: Jouni Ahto <jah@mork.net> |
  16. | Andrew Avdeev <andy@simgts.mv.ru> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef _PHP_IBASE_H
  21. #define _PHP_IBASE_H
  22. #if COMPILE_DL
  23. #undef HAVE_IBASE
  24. #define HAVE_IBASE 1
  25. #endif
  26. #if HAVE_IBASE
  27. #include <ibase.h>
  28. extern zend_module_entry ibase_module_entry;
  29. #define phpext_interbase_ptr &ibase_module_entry
  30. #ifdef PHP_WIN32
  31. #define PHP_IBASE_API __declspec(dllexport)
  32. #else
  33. #define PHP_IBASE_API
  34. #endif
  35. extern PHP_MINIT_FUNCTION(ibase);
  36. extern PHP_RINIT_FUNCTION(ibase);
  37. extern PHP_MSHUTDOWN_FUNCTION(ibase);
  38. extern PHP_RSHUTDOWN_FUNCTION(ibase);
  39. PHP_MINFO_FUNCTION(ibase);
  40. PHP_FUNCTION(ibase_connect);
  41. PHP_FUNCTION(ibase_pconnect);
  42. PHP_FUNCTION(ibase_close);
  43. PHP_FUNCTION(ibase_query);
  44. PHP_FUNCTION(ibase_fetch_row);
  45. PHP_FUNCTION(ibase_fetch_object);
  46. PHP_FUNCTION(ibase_free_result);
  47. PHP_FUNCTION(ibase_prepare);
  48. PHP_FUNCTION(ibase_execute);
  49. PHP_FUNCTION(ibase_free_query);
  50. PHP_FUNCTION(ibase_timefmt);
  51. PHP_FUNCTION(ibase_num_fields);
  52. PHP_FUNCTION(ibase_field_info);
  53. PHP_FUNCTION(ibase_trans);
  54. PHP_FUNCTION(ibase_commit);
  55. PHP_FUNCTION(ibase_rollback);
  56. PHP_FUNCTION(ibase_blob_create);
  57. PHP_FUNCTION(ibase_blob_add);
  58. PHP_FUNCTION(ibase_blob_cancel);
  59. PHP_FUNCTION(ibase_blob_open);
  60. PHP_FUNCTION(ibase_blob_get);
  61. PHP_FUNCTION(ibase_blob_close);
  62. PHP_FUNCTION(ibase_blob_echo);
  63. PHP_FUNCTION(ibase_blob_info);
  64. PHP_FUNCTION(ibase_blob_import);
  65. PHP_FUNCTION(ibase_errmsg);
  66. #define IBASE_MSGSIZE 256
  67. #define MAX_ERRMSG (IBASE_MSGSIZE*2)
  68. #define IBASE_TRANS_ON_LINK 10
  69. #define IBASE_BLOB_SEG 4096
  70. typedef struct {
  71. ISC_STATUS status[20];
  72. long default_link;
  73. long num_links, num_persistent;
  74. long max_links, max_persistent;
  75. long allow_persistent;
  76. int le_blob, le_link, le_plink, le_result, le_query;
  77. char *default_user, *default_password;
  78. char *timestampformat;
  79. char *cfg_timestampformat;
  80. char *dateformat;
  81. char *cfg_dateformat;
  82. char *timeformat;
  83. char *cfg_timeformat;
  84. char *errmsg;
  85. } php_ibase_globals;
  86. typedef struct {
  87. isc_tr_handle trans[IBASE_TRANS_ON_LINK];
  88. isc_db_handle link;
  89. int dialect;
  90. } ibase_db_link;
  91. typedef struct {
  92. ISC_ARRAY_DESC ar_desc;
  93. int el_type, /* sqltype kinda SQL_TEXT, ...*/
  94. el_size; /* element size in bytes */
  95. ISC_LONG ISC_FAR ar_size; /* all array size in bytes */
  96. } ibase_array;
  97. typedef struct {
  98. isc_tr_handle trans_handle;
  99. isc_db_handle link;
  100. ISC_QUAD bl_qd;
  101. isc_blob_handle bl_handle;
  102. } ibase_blob_handle;
  103. typedef struct {
  104. isc_db_handle link; /* db link for this result */
  105. isc_tr_handle trans;
  106. isc_stmt_handle stmt;
  107. XSQLDA *in_sqlda, *out_sqlda;
  108. ibase_array *in_array, *out_array;
  109. int in_array_cnt, out_array_cnt;
  110. int dialect;
  111. } ibase_query;
  112. typedef struct {
  113. isc_db_handle link; /* db link for this result */
  114. isc_tr_handle trans;
  115. isc_stmt_handle stmt;
  116. int drop_stmt;
  117. XSQLDA *out_sqlda;
  118. ibase_array *out_array;
  119. } ibase_result;
  120. typedef struct _php_ibase_varchar {
  121. short var_len;
  122. char var_str[1];
  123. } IBASE_VCHAR;
  124. /* extern ibase_module php_ibase_module; */
  125. enum php_interbase_option {
  126. PHP_IBASE_DEFAULT = 0,
  127. PHP_IBASE_TEXT = 1,
  128. PHP_IBASE_UNIXTIME = 2,
  129. PHP_IBASE_READ = 4,
  130. PHP_IBASE_COMMITTED = 8,
  131. PHP_IBASE_CONSISTENCY = 16,
  132. PHP_IBASE_NOWAIT = 32,
  133. PHP_IBASE_TIMESTAMP = 64,
  134. PHP_IBASE_DATE = 128,
  135. PHP_IBASE_TIME = 256
  136. };
  137. #ifdef ZTS
  138. #define IBLS_D php_ibase_globals *ibase_globals
  139. #define IBG(v) (ibase_globals->v)
  140. #define IBLS_FETCH() php_ibase_globals *ibase_globals = ts_resource(ibase_globals_id)
  141. #else
  142. #define IBLS_D
  143. #define IBG(v) (ibase_globals.v)
  144. #define IBLS_FETCH()
  145. extern PHP_IBASE_API php_ibase_globals ibase_globals;
  146. #endif
  147. #else
  148. #define phpext_interbase_ptr NULL
  149. #endif /* HAVE_IBASE */
  150. #endif /* _PHP_IBASE_H */
  151. /*
  152. * Local variables:
  153. * tab-width: 4
  154. * c-basic-offset: 4
  155. * End:
  156. */