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.

147 lines
4.2 KiB

  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.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 <jah@mork.net> |
  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 <postgres.h>
  28. #include <libpq-fe.h>
  29. #ifdef PHP_WIN32
  30. #define INV_WRITE 0x00020000
  31. #define INV_READ 0x00040000
  32. #else
  33. #include <libpq/libpq-fs.h>
  34. #endif
  35. #ifdef PHP_WIN32
  36. #define PHP_PGSQL_API __declspec(dllexport)
  37. #else
  38. #define PHP_PGSQL_API
  39. #endif
  40. PHP_MINIT_FUNCTION(pgsql);
  41. PHP_MSHUTDOWN_FUNCTION(pgsql);
  42. PHP_RINIT_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_fieldname);
  60. PHP_FUNCTION(pg_fieldsize);
  61. PHP_FUNCTION(pg_fieldtype);
  62. PHP_FUNCTION(pg_fieldnum);
  63. PHP_FUNCTION(pg_result);
  64. PHP_FUNCTION(pg_fetch_row);
  65. PHP_FUNCTION(pg_fetch_array);
  66. PHP_FUNCTION(pg_fetch_object);
  67. PHP_FUNCTION(pg_fieldprtlen);
  68. PHP_FUNCTION(pg_fieldisnull);
  69. PHP_FUNCTION(pg_freeresult);
  70. PHP_FUNCTION(pg_getlastoid);
  71. PHP_FUNCTION(pg_locreate);
  72. PHP_FUNCTION(pg_lounlink);
  73. PHP_FUNCTION(pg_loopen);
  74. PHP_FUNCTION(pg_loclose);
  75. PHP_FUNCTION(pg_loread);
  76. PHP_FUNCTION(pg_lowrite);
  77. PHP_FUNCTION(pg_loreadall);
  78. PHP_FUNCTION(pg_loimport);
  79. PHP_FUNCTION(pg_loexport);
  80. #if HAVE_PQCLIENTENCODING
  81. PHP_FUNCTION(pg_clientencoding);
  82. PHP_FUNCTION(pg_setclientencoding);
  83. #endif
  84. void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
  85. int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
  86. void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  87. void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  88. char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list);
  89. void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  90. void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  91. typedef struct pgLofp {
  92. PGconn *conn;
  93. int lofd;
  94. } pgLofp;
  95. typedef struct _php_pgsql_result_handle {
  96. PGconn *conn;
  97. PGresult *result;
  98. } pgsql_result_handle;
  99. typedef struct {
  100. long default_link;
  101. long num_links,num_persistent;
  102. long max_links,max_persistent;
  103. long allow_persistent;
  104. int le_lofp,le_string;
  105. } php_pgsql_globals;
  106. #ifdef ZTS
  107. # define PGLS_D php_pgsql_globals *pgsql_globals
  108. # define PGLS_DC , PGLS_D
  109. # define PGLS_C pgsql_globals
  110. # define PGLS_CC , PGLS_C
  111. # define PGG(v) (pgsql_globals->v)
  112. # define PGLS_FETCH() php_pgsql_globals *pgsql_globals = ts_resource(pgsql_globals_id)
  113. #else
  114. # define PGLS_D
  115. # define PGLS_DC
  116. # define PGLS_C
  117. # define PGLS_CC
  118. # define PGG(v) (pgsql_globals.v)
  119. # define PGLS_FETCH()
  120. extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
  121. #endif
  122. #endif
  123. #else
  124. #define pgsql_module_ptr NULL
  125. #endif
  126. #define phpext_pgsql_ptr pgsql_module_ptr
  127. #endif /* PHP_PGSQL_H */