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.

185 lines
4.7 KiB

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