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.

146 lines
4.1 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. void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
  90. int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
  91. void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  92. void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  93. char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list);
  94. void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  95. void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  96. typedef struct pgLofp {
  97. PGconn *conn;
  98. int lofd;
  99. } pgLofp;
  100. typedef struct _php_pgsql_result_handle {
  101. PGconn *conn;
  102. PGresult *result;
  103. int row;
  104. } pgsql_result_handle;
  105. typedef struct {
  106. long default_link;
  107. long num_links,num_persistent;
  108. long max_links,max_persistent;
  109. long allow_persistent;
  110. int le_lofp,le_string;
  111. int ignore_notices;
  112. char *last_notice;
  113. } php_pgsql_globals;
  114. #ifdef ZTS
  115. # define PGG(v) TSRMG(pgsql_globals_id, php_pgsql_globals *, v)
  116. #else
  117. # define PGG(v) (pgsql_globals.v)
  118. extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
  119. #endif
  120. #endif
  121. #else
  122. #define pgsql_module_ptr NULL
  123. #endif
  124. #define phpext_pgsql_ptr pgsql_module_ptr
  125. #endif /* PHP_PGSQL_H */