Get rid of PHPAPI usage.

Enable shared build in the new php5 build system
Check for the correct header.
This commit is contained in:
Edin Kadribasic 2003-12-05 01:03:35 +00:00
parent 6abf2179c1
commit 32eb4f78c2
3 changed files with 24 additions and 27 deletions

View File

@ -4,16 +4,12 @@
ARG_WITH("pgsql", "PostgreSQL support", "no");
if (PHP_PGSQL != "no") {
if (!PHP_PGSQL_SHARED) {
ERROR("Cannot build pgsql as a static extension until someone fixes its bogus PHPAPI usage\r\nuse --with-pgsql=shared instead.");
if (CHECK_LIB("libpq.lib", "pgsql", PHP_PGSQL) &&
CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PGSQL", PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PGSQL)) {
EXTENSION("pgsql", "pgsql.c");
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
ADD_FLAG("CFLAGS_PGSQL", "/D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS");
} else {
if (CHECK_LIB("libpq.lib", "pgsql", PHP_PGSQL) &&
CHECK_HEADER_ADD_INCLUDE("postgres.h", "CFLAGS_PGSQL", PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\postgresql\\src\\include;" + PHP_PGSQL)) {
EXTENSION("pgsql", "pgsql.c");
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
ADD_FLAG("CFLAGS_PGSQL", "/D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PG_CONFIG_H");
} else {
WARNING("pgsql not enabled; libraries and headers not found");
}
WARNING("pgsql not enabled; libraries and headers not found");
}
}

View File

@ -3315,7 +3315,7 @@ PHP_FUNCTION(pg_get_pid)
/* {{{ php_pgsql_meta_data
* TODO: Add meta_data cache for better performance
*/
PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC)
{
PGresult *pg_result;
char *tmp_name;
@ -3574,7 +3574,7 @@ static int php_pgsql_add_quotes(zval *src, zend_bool should_free TSRMLS_DC)
/* {{{ php_pgsql_convert
* check and convert array values (fieldname=>vlaue pair) for sql
*/
PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC)
{
HashPosition pos;
char *field = NULL;
@ -4212,7 +4212,7 @@ static int do_exec(smart_str *querystr, int expect, PGconn *pg_link, ulong opt T
/* {{{ php_pgsql_insert
*/
PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC)
{
zval **val, *converted = NULL;
char buf[256];
@ -4391,7 +4391,7 @@ static inline int build_assignment_string(smart_str *querystr, HashTable *ht, co
/* {{{ php_pgsql_update
*/
PHPAPI int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, ulong opt, char **sql TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *var_array, zval *ids_array, ulong opt, char **sql TSRMLS_DC)
{
zval *var_converted = NULL, *ids_converted = NULL;
smart_str querystr = {0};
@ -4497,7 +4497,7 @@ PHP_FUNCTION(pg_update)
/* {{{ php_pgsql_delete
*/
PHPAPI int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, ulong opt, char **sql TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids_array, ulong opt, char **sql TSRMLS_DC)
{
zval *ids_converted = NULL;
smart_str querystr = {0};
@ -4586,7 +4586,7 @@ PHP_FUNCTION(pg_delete)
/* {{{ php_pgsql_result2array
*/
PHPAPI int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC)
{
zval *row;
char *field_name, *element, *data;
@ -4628,7 +4628,7 @@ PHPAPI int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC
/* {{{ php_pgsql_select
*/
PHPAPI int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, ulong opt, char **sql TSRMLS_DC)
PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids_array, zval *ret_array, ulong opt, char **sql TSRMLS_DC)
{
zval *ids_converted = NULL;
smart_str querystr = {0};

View File

@ -36,14 +36,15 @@ extern zend_module_entry pgsql_module_entry;
#ifdef PHP_WIN32
#define INV_WRITE 0x00020000
#define INV_READ 0x00040000
#undef PHPAPI
#undef PHP_PGSQL_API
#ifdef PGSQL_EXPORTS
#define PHPAPI __declspec(dllexport)
#define PHP_PGSQL_API __declspec(dllexport)
#else
#define PHPAPI __declspec(dllimport)
#define PHP_PGSQL_API __declspec(dllimport)
#endif
#else
#include <libpq/libpq-fs.h>
#define PHP_PGSQL_API /* nothing special */
#endif
#ifdef HAVE_PG_CONFIG_H
@ -161,13 +162,13 @@ PHP_FUNCTION(pg_select);
#define PGSQL_DML_STRING (1<<11) /* Return query string */
/* exported functions */
PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC);
PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC);
PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, ulong opt, char **sql TSRMLS_DC);
PHPAPI int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, ulong opt , char **sql TSRMLS_DC);
PHPAPI int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, ulong opt, char **sql TSRMLS_DC);
PHPAPI int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, ulong opt, char **sql TSRMLS_DC);
PHPAPI int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *values, ulong opt, char **sql TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_update(PGconn *pg_link, const char *table, zval *values, zval *ids, ulong opt , char **sql TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_delete(PGconn *pg_link, const char *table, zval *ids, ulong opt, char **sql TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_select(PGconn *pg_link, const char *table, zval *ids, zval *ret_array, ulong opt, char **sql TSRMLS_DC);
PHP_PGSQL_API int php_pgsql_result2array(PGresult *pg_result, zval *ret_array TSRMLS_DC);
/* internal functions */
static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent);