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.

150 lines
4.9 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 php3_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. extern PHP_MINIT_FUNCTION(pgsql);;
  52. extern int php3_rinit_pgsql(INIT_FUNC_ARGS);
  53. PHP_FUNCTION(pgsql_connect);
  54. PHP_FUNCTION(pgsql_pconnect);
  55. PHP_FUNCTION(pgsql_close);
  56. PHP_FUNCTION(pgsql_dbname);
  57. PHP_FUNCTION(pgsql_error_message);
  58. PHP_FUNCTION(pgsql_options);
  59. PHP_FUNCTION(pgsql_port);
  60. PHP_FUNCTION(pgsql_tty);
  61. PHP_FUNCTION(pgsql_host);
  62. PHP_FUNCTION(pgsql_exec);
  63. PHP_FUNCTION(pgsql_num_rows);
  64. PHP_FUNCTION(pgsql_num_fields);
  65. PHP_FUNCTION(pgsql_cmdtuples);
  66. PHP_FUNCTION(pgsql_field_name);
  67. PHP_FUNCTION(pgsql_field_size);
  68. PHP_FUNCTION(pgsql_field_type);
  69. PHP_FUNCTION(pgsql_field_number);
  70. PHP_FUNCTION(pgsql_result);
  71. PHP_FUNCTION(pgsql_fetch_row);
  72. PHP_FUNCTION(pgsql_fetch_array);
  73. PHP_FUNCTION(pgsql_fetch_object);
  74. PHP_FUNCTION(pgsql_data_length);
  75. PHP_FUNCTION(pgsql_data_isnull);
  76. PHP_FUNCTION(pgsql_free_result);
  77. PHP_FUNCTION(pgsql_last_oid);
  78. PHP_FUNCTION(pgsql_lo_create);
  79. PHP_FUNCTION(pgsql_lo_unlink);
  80. PHP_FUNCTION(pgsql_lo_open);
  81. PHP_FUNCTION(pgsql_lo_close);
  82. PHP_FUNCTION(pgsql_lo_read);
  83. PHP_FUNCTION(pgsql_lo_write);
  84. PHP_FUNCTION(pgsql_lo_readall);
  85. void php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);
  86. int php3_pgsql_get_default_link(INTERNAL_FUNCTION_PARAMETERS);
  87. void php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  88. void php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  89. char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list);
  90. void php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  91. void php3_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type);
  92. typedef struct pgLofp {
  93. PGconn *conn;
  94. int lofd;
  95. } pgLofp;
  96. typedef struct _php3_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. /* extern pgsql_module php3_pgsql_module; */
  108. #ifdef ZTS
  109. # define PGLS_D php_pgsql_globals *pgsql_globals
  110. # define PGLS_DC , PGLS_D
  111. # define PGLS_C pgsql_globals
  112. # define PGLS_CC , PGLS_C
  113. # define PGG(v) (pgsql_globals->v)
  114. # define PGLS_FETCH() php_pgsql_globals *pgsql_globals = ts_resource(pgsql_globals_id)
  115. #else
  116. # define PGLS_D
  117. # define PGLS_DC
  118. # define PGLS_C
  119. # define PGLS_CC
  120. # define PGG(v) (pgsql_globals.v)
  121. # define PGLS_FETCH()
  122. extern PHP_PGSQL_API php_pgsql_globals pgsql_globals;
  123. #endif
  124. #else
  125. #define pgsql_module_ptr NULL
  126. #endif
  127. #define phpext_pgsql_ptr pgsql_module_ptr
  128. #endif /* _PHP_PGSQL_H */