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.

153 lines
4.4 KiB

  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: Zeev Suraski <zeev@zend.com> |
  16. | Jouni Ahto <jouni.ahto@exdec.fi> |
  17. +----------------------------------------------------------------------+
  18. */
  19. /* $Id$ */
  20. #ifndef PHP_PGSQL_H
  21. #define PHP_PGSQL_H
  22. #if HAVE_PGSQL
  23. extern zend_module_entry pgsql_module_entry;
  24. #define pgsql_module_ptr &pgsql_module_entry
  25. #ifdef PHP_PGSQL_PRIVATE
  26. #undef SOCKET_SIZE_TYPE
  27. #include <libpq-fe.h>
  28. #ifdef PHP_WIN32
  29. #define INV_WRITE 0x00020000
  30. #define INV_READ 0x00040000
  31. #else
  32. #include <libpq/libpq-fs.h>
  33. #endif
  34. #ifdef PHP_WIN32
  35. #define PHP_PGSQL_API __declspec(dllexport)
  36. #else
  37. #define PHP_PGSQL_API
  38. #endif
  39. PHP_MINIT_FUNCTION(pgsql);
  40. PHP_MSHUTDOWN_FUNCTION(pgsql);
  41. PHP_RINIT_FUNCTION(pgsql);
  42. PHP_RSHUTDOWN_FUNCTION(pgsql);
  43. PHP_MINFO_FUNCTION(pgsql);
  44. PHP_FUNCTION(pg_connect);
  45. PHP_FUNCTION(pg_pconnect);
  46. PHP_FUNCTION(pg_close);
  47. PHP_FUNCTION(pg_dbname);
  48. PHP_FUNCTION(pg_errormessage);
  49. PHP_FUNCTION(pg_trace);
  50. PHP_FUNCTION(pg_untrace);
  51. PHP_FUNCTION(pg_options);
  52. PHP_FUNCTION(pg_port);
  53. PHP_FUNCTION(pg_tty);
  54. PHP_FUNCTION(pg_host);
  55. PHP_FUNCTION(pg_exec);
  56. PHP_FUNCTION(pg_numrows);
  57. PHP_FUNCTION(pg_numfields);
  58. PHP_FUNCTION(pg_cmdtuples);
  59. PHP_FUNCTION(pg_last_notice);
  60. PHP_FUNCTION(pg_fieldname);
  61. PHP_FUNCTION(pg_fieldsize);
  62. PHP_FUNCTION(pg_fieldtype);
  63. PHP_FUNCTION(pg_fieldnum);
  64. PHP_FUNCTION(pg_result);
  65. PHP_FUNCTION(pg_fetch_row);
  66. PHP_FUNCTION(pg_fetch_array);
  67. PHP_FUNCTION(pg_fetch_object);
  68. PHP_FUNCTION(pg_fieldprtlen);
  69. PHP_FUNCTION(pg_fieldisnull);
  70. PHP_FUNCTION(pg_freeresult);
  71. PHP_FUNCTION(pg_getlastoid);
  72. PHP_FUNCTION(pg_locreate);
  73. PHP_FUNCTION(pg_lounlink);
  74. PHP_FUNCTION(pg_loopen);
  75. PHP_FUNCTION(pg_loclose);
  76. PHP_FUNCTION(pg_loread);
  77. PHP_FUNCTION(pg_lowrite);
  78. PHP_FUNCTION(pg_loreadall);
  79. PHP_FUNCTION(pg_loimport);
  80. PHP_FUNCTION(pg_loexport);
  81. PHP_FUNCTION(pg_lolseek);
  82. PHP_FUNCTION(pg_lotell);
  83. PHP_FUNCTION(pg_put_line);
  84. PHP_FUNCTION(pg_end_copy);
  85. #if HAVE_PQCLIENTENCODING
  86. PHP_FUNCTION(pg_client_encoding);
  87. PHP_FUNCTION(pg_set_client_encoding);
  88. #endif
  89. PHP_FUNCTION(pg_reset);
  90. PHP_FUNCTION(pg_status);
  91. PHP_FUNCTION(pg_send_query);
  92. PHP_FUNCTION(pg_request_cancel);
  93. PHP_FUNCTION(pg_get_result);
  94. PHP_FUNCTION(pg_is_busy);
  95. void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
  96. int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
  97. void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  98. void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  99. char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list);
  100. void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  101. void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  102. void php_pgsql_do_async(INTERNAL_FUNCTION_PARAMETERS,int entry_type);
  103. typedef struct pgLofp {
  104. PGconn *conn;
  105. int lofd;
  106. } pgLofp;
  107. typedef struct _php_pgsql_result_handle {
  108. PGconn *conn;
  109. PGresult *result;
  110. int row;
  111. } pgsql_result_handle;
  112. typedef struct {
  113. long default_link;
  114. long num_links,num_persistent;
  115. long max_links,max_persistent;
  116. long allow_persistent;
  117. int le_lofp,le_string;
  118. int ignore_notices;
  119. char *last_notice;
  120. uint last_notice_len;
  121. } php_pgsql_globals;
  122. #ifdef ZTS
  123. # define PGG(v) TSRMG(pgsql_globals_id, php_pgsql_globals *, v)
  124. #else
  125. # define PGG(v) (pgsql_globals.v)
  126. extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
  127. #endif
  128. #endif
  129. #else
  130. #define pgsql_module_ptr NULL
  131. #endif
  132. #define phpext_pgsql_ptr pgsql_module_ptr
  133. #endif /* PHP_PGSQL_H */