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.

149 lines
4.7 KiB

  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP HTML Embedded Scripting Language Version 3.0 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997,1998 PHP Development Team (See Credits file) |
  6. +----------------------------------------------------------------------+
  7. | This program is free software; you can redistribute it and/or modify |
  8. | it under the terms of one of the following licenses: |
  9. | |
  10. | A) the GNU General Public License as published by the Free Software |
  11. | Foundation; either version 2 of the License, or (at your option) |
  12. | any later version. |
  13. | |
  14. | B) the PHP License as published by the PHP Development Team and |
  15. | included in the distribution in the file: LICENSE |
  16. | |
  17. | This program is distributed in the hope that it will be useful, |
  18. | but WITHOUT ANY WARRANTY; without even the implied warranty of |
  19. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
  20. | GNU General Public License for more details. |
  21. | |
  22. | You should have received a copy of both licenses referred to here. |
  23. | If you did not, or have any questions about PHP licensing, please |
  24. | contact core@php.net. |
  25. +----------------------------------------------------------------------+
  26. | Authors: Jouni Ahto |
  27. +----------------------------------------------------------------------+
  28. */
  29. /* $Id$ */
  30. #ifndef _PHP_PGSQL_H
  31. #define _PHP_PGSQL_H
  32. #if COMPILE_DL
  33. #undef HAVE_PGSQL
  34. #define HAVE_PGSQL 1
  35. #endif
  36. #if HAVE_PGSQL
  37. extern zend_module_entry pgsql_module_entry;
  38. #define pgsql_module_ptr &pgsql_module_entry
  39. #include <libpq-fe.h>
  40. #if (WIN32||WINNT)
  41. #define INV_WRITE 0x00020000
  42. #define INV_READ 0x00040000
  43. #else
  44. #include <libpq/libpq-fs.h>
  45. #endif
  46. #if WIN32||WINNT
  47. #define PHP_PGSQL_API __declspec(dllexport)
  48. #else
  49. #define PHP_PGSQL_API
  50. #endif
  51. PHP_MINIT_FUNCTION(pgsql);
  52. PHP_RINIT_FUNCTION(pgsql);
  53. PHP_FUNCTION(pg_connect);
  54. PHP_FUNCTION(pg_pconnect);
  55. PHP_FUNCTION(pg_close);
  56. PHP_FUNCTION(pg_dbname);
  57. PHP_FUNCTION(pg_errormessage);
  58. PHP_FUNCTION(pg_options);
  59. PHP_FUNCTION(pg_port);
  60. PHP_FUNCTION(pg_tty);
  61. PHP_FUNCTION(pg_host);
  62. PHP_FUNCTION(pg_exec);
  63. PHP_FUNCTION(pg_numrows);
  64. PHP_FUNCTION(pg_numfields);
  65. PHP_FUNCTION(pg_cmdtuples);
  66. PHP_FUNCTION(pg_fieldname);
  67. PHP_FUNCTION(pg_fieldsize);
  68. PHP_FUNCTION(pg_fieldtype);
  69. PHP_FUNCTION(pg_fieldnum);
  70. PHP_FUNCTION(pg_result);
  71. PHP_FUNCTION(pg_fetch_row);
  72. PHP_FUNCTION(pg_fetch_array);
  73. PHP_FUNCTION(pg_fetch_object);
  74. PHP_FUNCTION(pg_fieldprtlen);
  75. PHP_FUNCTION(pg_fieldisnull);
  76. PHP_FUNCTION(pg_freeresult);
  77. PHP_FUNCTION(pg_getlastoid);
  78. PHP_FUNCTION(pg_locreate);
  79. PHP_FUNCTION(pg_lounlink);
  80. PHP_FUNCTION(pg_loopen);
  81. PHP_FUNCTION(pg_loclose);
  82. PHP_FUNCTION(pg_loread);
  83. PHP_FUNCTION(pg_lowrite);
  84. PHP_FUNCTION(pg_loreadall);
  85. void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
  86. int php_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
  87. void php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  88. void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  89. char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list);
  90. void php_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  91. void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  92. typedef struct pgLofp {
  93. PGconn *conn;
  94. int lofd;
  95. } pgLofp;
  96. typedef struct _php_pgsql_result_handle {
  97. PGconn *conn;
  98. PGresult *result;
  99. } pgsql_result_handle;
  100. typedef struct {
  101. long default_link;
  102. long num_links,num_persistent;
  103. long max_links,max_persistent;
  104. long allow_persistent;
  105. int le_lofp,le_string;
  106. } php_pgsql_globals;
  107. #ifdef ZTS
  108. # define PGLS_D php_pgsql_globals *pgsql_globals
  109. # define PGLS_DC , PGLS_D
  110. # define PGLS_C pgsql_globals
  111. # define PGLS_CC , PGLS_C
  112. # define PGG(v) (pgsql_globals->v)
  113. # define PGLS_FETCH() php_pgsql_globals *pgsql_globals = ts_resource(pgsql_globals_id)
  114. #else
  115. # define PGLS_D
  116. # define PGLS_DC
  117. # define PGLS_C
  118. # define PGLS_CC
  119. # define PGG(v) (pgsql_globals.v)
  120. # define PGLS_FETCH()
  121. extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
  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 */