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.

180 lines
4.6 KiB

27 years ago
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP version 4.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2001 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_object);
  42. PHP_FUNCTION(ibase_free_result);
  43. PHP_FUNCTION(ibase_prepare);
  44. PHP_FUNCTION(ibase_execute);
  45. PHP_FUNCTION(ibase_free_query);
  46. PHP_FUNCTION(ibase_timefmt);
  47. PHP_FUNCTION(ibase_num_fields);
  48. PHP_FUNCTION(ibase_field_info);
  49. PHP_FUNCTION(ibase_trans);
  50. PHP_FUNCTION(ibase_commit);
  51. PHP_FUNCTION(ibase_rollback);
  52. PHP_FUNCTION(ibase_blob_create);
  53. PHP_FUNCTION(ibase_blob_add);
  54. PHP_FUNCTION(ibase_blob_cancel);
  55. PHP_FUNCTION(ibase_blob_open);
  56. PHP_FUNCTION(ibase_blob_get);
  57. PHP_FUNCTION(ibase_blob_close);
  58. PHP_FUNCTION(ibase_blob_echo);
  59. PHP_FUNCTION(ibase_blob_info);
  60. PHP_FUNCTION(ibase_blob_import);
  61. PHP_FUNCTION(ibase_errmsg);
  62. #define IBASE_MSGSIZE 256
  63. #define MAX_ERRMSG (IBASE_MSGSIZE*2)
  64. #define IBASE_TRANS_ON_LINK 10
  65. #define IBASE_BLOB_SEG 4096
  66. ZEND_BEGIN_MODULE_GLOBALS(ibase)
  67. ISC_STATUS status[20];
  68. long default_link;
  69. long num_links, num_persistent;
  70. long max_links, max_persistent;
  71. long allow_persistent;
  72. char *default_user, *default_password;
  73. char *timestampformat;
  74. char *cfg_timestampformat;
  75. char *dateformat;
  76. char *cfg_dateformat;
  77. char *timeformat;
  78. char *cfg_timeformat;
  79. char *errmsg;
  80. ZEND_END_MODULE_GLOBALS(ibase)
  81. typedef struct {
  82. isc_tr_handle trans[IBASE_TRANS_ON_LINK];
  83. isc_db_handle link;
  84. unsigned short dialect;
  85. } ibase_db_link;
  86. typedef struct {
  87. int trans_num;
  88. int link_rsrc;
  89. } ibase_tr_link;
  90. typedef struct {
  91. ISC_ARRAY_DESC ar_desc;
  92. int el_type, /* sqltype kinda SQL_TEXT, ...*/
  93. el_size; /* element size in bytes */
  94. ISC_LONG ISC_FAR ar_size; /* all array size in bytes */
  95. } ibase_array;
  96. typedef struct {
  97. isc_tr_handle trans_handle;
  98. isc_db_handle link;
  99. ISC_QUAD bl_qd;
  100. isc_blob_handle bl_handle;
  101. } ibase_blob_handle;
  102. typedef struct {
  103. isc_db_handle link; /* db link for this result */
  104. isc_tr_handle trans;
  105. isc_stmt_handle stmt;
  106. int drop_stmt;
  107. XSQLDA *in_sqlda, *out_sqlda;
  108. ibase_array *in_array, *out_array;
  109. int in_array_cnt, out_array_cnt;
  110. unsigned short dialect;
  111. int cursor_open;
  112. } ibase_query;
  113. typedef struct {
  114. isc_db_handle link; /* db link for this result */
  115. isc_tr_handle trans;
  116. isc_stmt_handle stmt;
  117. int drop_stmt;
  118. XSQLDA *out_sqlda;
  119. ibase_array *out_array;
  120. } ibase_result;
  121. typedef struct _php_ibase_varchar {
  122. short var_len;
  123. char var_str[1];
  124. } IBASE_VCHAR;
  125. /* extern ibase_module php_ibase_module; */
  126. enum php_interbase_option {
  127. PHP_IBASE_DEFAULT = 0,
  128. PHP_IBASE_TEXT = 1,
  129. PHP_IBASE_UNIXTIME = 2,
  130. PHP_IBASE_READ = 4,
  131. PHP_IBASE_COMMITTED = 8,
  132. PHP_IBASE_CONSISTENCY = 16,
  133. PHP_IBASE_NOWAIT = 32,
  134. PHP_IBASE_TIMESTAMP = 64,
  135. PHP_IBASE_DATE = 128,
  136. PHP_IBASE_TIME = 256
  137. };
  138. #ifdef ZTS
  139. #define IBG(v) TSRMG(ibase_globals_id, zend_ibase_globals *, v)
  140. #else
  141. #define IBG(v) (ibase_globals.v)
  142. #endif
  143. #else
  144. #define phpext_interbase_ptr NULL
  145. #endif /* HAVE_IBASE */
  146. #endif /* PHP_INTERBASE_H */
  147. /*
  148. * Local variables:
  149. * tab-width: 4
  150. * c-basic-offset: 4
  151. * End:
  152. */