[PHP-CVS] cvs: php-src /ext/pgsql config.m4 pgsql.c /ext/pgsql/tests 27large_object_oid.phpt 28large_object_import_oid.phpt
hholzgraWed Jul 23 09:27:01 2008 UTC Modified files: /php-src/ext/pgsql config.m4 pgsql.c /php-src/ext/pgsql/tests27large_object_oid.phpt 28large_object_import_oid.phpt Log: MFB + Unicode: added support for object ids in pg_lo_create() and pg_lo_import() where available (based on code provided by Tatsuo Ishii) http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.m4?r1=1.52r2=1.53diff_format=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.52 php-src/ext/pgsql/config.m4:1.53 --- php-src/ext/pgsql/config.m4:1.52Wed Jul 11 21:51:10 2007 +++ php-src/ext/pgsql/config.m4 Wed Jul 23 09:27:01 2008 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.52 2007/07/11 21:51:10 jani Exp $ +dnl $Id: config.m4,v 1.53 2008/07/23 09:27:01 hholzgra Exp $ dnl PHP_ARG_WITH(pgsql,for PostgreSQL support, @@ -92,6 +92,8 @@ AC_CHECK_LIB(pq, PQescapeStringConn, AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 or later])) AC_CHECK_LIB(pq, PQescapeByteaConn, AC_DEFINE(HAVE_PQESCAPE_BYTEA_CONN,1,[PostgreSQL 8.1.4 or later])) AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte])) + AC_CHECK_LIB(pq, lo_create, AC_DEFINE(HAVE_PG_LO_CREATE,1,[PostgreSQL 8.1 or later])) + AC_CHECK_LIB(pq, lo_import_with_oid, AC_DEFINE(HAVE_PG_LO_IMPORT_WITH_OID,1,[PostgreSQL 8.4 or later])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.381r2=1.382diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.381 php-src/ext/pgsql/pgsql.c:1.382 --- php-src/ext/pgsql/pgsql.c:1.381 Wed Jul 2 00:13:26 2008 +++ php-src/ext/pgsql/pgsql.c Wed Jul 23 09:27:01 2008 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.381 2008/07/02 00:13:26 felipe Exp $ */ +/* $Id: pgsql.c,v 1.382 2008/07/23 09:27:01 hholzgra Exp $ */ #include stdlib.h @@ -350,6 +350,7 @@ static ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_lo_create, 0, 0, 0) ZEND_ARG_INFO(0, connection) + ZEND_ARG_INFO(0, large_object_id) ZEND_END_ARG_INFO() static @@ -392,6 +393,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_lo_import, 0, 0, 0) ZEND_ARG_INFO(0, connection) ZEND_ARG_INFO(0, filename) + ZEND_ARG_INFO(0, large_object_oid) ZEND_END_ARG_INFO() static @@ -2978,42 +2980,86 @@ } /* }}} */ -/* {{{ proto int pg_lo_create([resource connection]) +/* {{{ proto mixed pg_lo_create([resource connection],[mixed large_object_oid]) Create a large object */ PHP_FUNCTION(pg_lo_create) { - zval *pgsql_link = NULL; - PGconn *pgsql; - Oid pgsql_oid; - int id = -1, argc = ZEND_NUM_ARGS(); + zval *pgsql_link = NULL, *oid = NULL; + PGconn *pgsql; + Oid pgsql_oid, wanted_oid = InvalidOid; + int id = -1, argc = ZEND_NUM_ARGS(); - if (zend_parse_parameters(argc TSRMLS_CC, |r, pgsql_link) == FAILURE) { + if (zend_parse_parameters(argc TSRMLS_CC, |zz, pgsql_link, oid) == FAILURE) { return; } + + if ((argc == 1) (Z_TYPE_P(pgsql_link) != IS_RESOURCE)) { + oid = pgsql_link; + pgsql_link = NULL; + } - if (argc == 0) { + if (pgsql_link == NULL) { id = PGG(default_link); CHECK_DEFAULT_LINK(id); + if (id == -1) { + RETURN_FALSE; + } } - if (pgsql_link == NULL id == -1) { - RETURN_FALSE; - } - ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, le_link, le_plink); - /* NOTE: Archive modes not supported until I get some more data. Don't think anybody's - using it anyway. I believe it's also somehow related to the 'time travel' feature of - PostgreSQL, that's on the list of features to be removed... Create modes not supported. - What's the use of an object that can be only written to, but not read from, and vice - versa? Beats me... And the access type (r/w) must be specified again when opening - the object, probably (?) overrides this. (Jouni) - */ + if (oid) { +#ifndef HAVE_PG_LO_CREATE + php_error_docref(NULL TSRMLS_CC, E_NOTICE, OID value passing not supported); +#else + switch (Z_TYPE_P(oid)) { + case IS_STRING: + { + char *end_ptr; + wanted_oid = (Oid)strtoul(Z_STRVAL_P(oid), end_ptr, 10); + if ((Z_STRVAL_P(oid)+Z_STRLEN_P(oid)) != end_ptr) { + /* wrong integer format */ + php_error_docref(NULL
[PHP-CVS] cvs: php-src /ext/pgsql config.m4
hholzgraWed Jul 23 21:41:27 2008 UTC Modified files: /php-src/ext/pgsql config.m4 Log: corrected library search path order in tests http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.m4?r1=1.53r2=1.54diff_format=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.53 php-src/ext/pgsql/config.m4:1.54 --- php-src/ext/pgsql/config.m4:1.53Wed Jul 23 09:27:01 2008 +++ php-src/ext/pgsql/config.m4 Wed Jul 23 21:41:27 2008 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.53 2008/07/23 09:27:01 hholzgra Exp $ +dnl $Id: config.m4,v 1.54 2008/07/23 21:41:27 hholzgra Exp $ dnl PHP_ARG_WITH(pgsql,for PostgreSQL support, @@ -66,7 +66,7 @@ AC_DEFINE(HAVE_PGSQL,1,[Whether to build PostgreSQL support or not]) old_LIBS=$LIBS old_LDFLAGS=$LDFLAGS - LDFLAGS=$LDFLAGS -L$PGSQL_LIBDIR + LDFLAGS=-L$PGSQL_LIBDIR $LDFLAGS AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 or later])) AC_CHECK_LIB(pq, PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.3.0 or later])) AC_CHECK_LIB(pq, PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later])) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4 config.w32
tony2001Mon Feb 19 19:46:36 2007 UTC Modified files: /php-src/ext/pgsql config.m4 config.w32 Log: MFB: PQfreemem() checks http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.m4?r1=1.50r2=1.51diff_format=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.50 php-src/ext/pgsql/config.m4:1.51 --- php-src/ext/pgsql/config.m4:1.50Fri Oct 6 21:45:35 2006 +++ php-src/ext/pgsql/config.m4 Mon Feb 19 19:46:36 2007 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.50 2006/10/06 21:45:35 iliaa Exp $ +dnl $Id: config.m4,v 1.51 2007/02/19 19:46:36 tony2001 Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -87,6 +87,7 @@ AC_CHECK_LIB(pq, PQsendPrepare,AC_DEFINE(HAVE_PQSENDPREPARE,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQsendQueryPrepared,AC_DEFINE(HAVE_PQSENDQUERYPREPARED,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQputCopyData,AC_DEFINE(HAVE_PQPUTCOPYDATA,1,[PostgreSQL 7.4 or later])) + AC_CHECK_LIB(pq, PQfreemem,AC_DEFINE(HAVE_PQFREEMEM,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQputCopyEnd,AC_DEFINE(HAVE_PQPUTCOPYEND,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQgetCopyData,AC_DEFINE(HAVE_PQGETCOPYDATA,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQsetErrorVerbosity,AC_DEFINE(HAVE_PQSETERRORVERBOSITY,1,[PostgreSQL 7.4 or later])) http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.w32?r1=1.11r2=1.12diff_format=u Index: php-src/ext/pgsql/config.w32 diff -u php-src/ext/pgsql/config.w32:1.11 php-src/ext/pgsql/config.w32:1.12 --- php-src/ext/pgsql/config.w32:1.11 Mon Feb 19 17:28:26 2007 +++ php-src/ext/pgsql/config.w32Mon Feb 19 19:46:36 2007 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.11 2007/02/19 17:28:26 edink Exp $ +// $Id: config.w32,v 1.12 2007/02/19 19:46:36 tony2001 Exp $ // vim:ft=javascript ARG_WITH(pgsql, PostgreSQL support, no); @@ -8,7 +8,7 @@ CHECK_HEADER_ADD_INCLUDE(libpq-fe.h, CFLAGS_PGSQL, PHP_PGSQL + \\include; + 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_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE /D HAVE_PQESCAPE_CONN /D HAVE_PQESCAPE_BYTEA_CONN /D HAVE_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT); + ADD_FLAG(CFLAGS_PGSQL, /D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE /D HAVE_PQESCAPE_CONN /D HAVE_PQESCAPE_BYTEA_CONN /D HAVE_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT /D HAVE_PQFREEMEM); } else { WARNING(pgsql not enabled; libraries and headers not found); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4 pgsql.c
iliaa Wed Oct 4 23:27:17 2006 UTC Modified files: /php-src/ext/pgsql pgsql.c config.m4 Log: MFB: Added support for character sets in pg_escape_string() for PostgreSQL 8.1.4 and higher. http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.355r2=1.356diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.355 php-src/ext/pgsql/pgsql.c:1.356 --- php-src/ext/pgsql/pgsql.c:1.355 Tue Oct 3 15:22:54 2006 +++ php-src/ext/pgsql/pgsql.c Wed Oct 4 23:27:17 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.355 2006/10/03 15:22:54 bjori Exp $ */ +/* $Id: pgsql.c,v 1.356 2006/10/04 23:27:17 iliaa Exp $ */ #include stdlib.h @@ -3534,20 +3534,36 @@ /* }}} */ #ifdef HAVE_PQESCAPE -/* {{{ proto string pg_escape_string(string data) +/* {{{ proto string pg_escape_string([resource connection,] string data) Escape string for text/char type */ PHP_FUNCTION(pg_escape_string) { char *from = NULL, *to = NULL; + zval *pgsql_link; + PGconn *pgsql; int to_len; int from_len; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, - from, from_len) == FAILURE) { - return; + int id; + + if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, rs, pgsql_link, from, from_len) == SUCCESS) { + id = -1; + } else if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s, from, from_len) == SUCCESS) { + pgsql_link = NULL; + id = PGG(default_link); + } else { + WRONG_PARAM_COUNT; } - to = (char *)safe_emalloc(from_len, 2, 1); - to_len = (int)PQescapeString(to, from, from_len); + to = (char *) safe_emalloc(from_len, 2, 1); + +#ifdef HAVE_PQESCAPE_CONN + if (pgsql_link != NULL || id != -1) { + ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, le_link, le_plink); + to_len = (int) PQescapeStringConn(pgsql, to, from, (size_t)from_len, NULL); + } else +#endif + to_len = (int) PQescapeString(to, from, (size_t)from_len); + RETURN_STRINGL(to, to_len, 0); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.m4?r1=1.48r2=1.49diff_format=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.48 php-src/ext/pgsql/config.m4:1.49 --- php-src/ext/pgsql/config.m4:1.48Fri Sep 15 19:48:55 2006 +++ php-src/ext/pgsql/config.m4 Wed Oct 4 23:27:17 2006 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.48 2006/09/15 19:48:55 iliaa Exp $ +dnl $Id: config.m4,v 1.49 2006/10/04 23:27:17 iliaa Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -91,6 +91,7 @@ AC_CHECK_LIB(pq, PQgetCopyData,AC_DEFINE(HAVE_PQGETCOPYDATA,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQsetErrorVerbosity,AC_DEFINE(HAVE_PQSETERRORVERBOSITY,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQftable,AC_DEFINE(HAVE_PQFTABLE,1,[PostgreSQL 7.4 or later])) + AC_CHECK_LIB(pq, PQescapeStringConn, AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1 or later])) AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4 config.w32 pgsql.c
iliaa Fri Sep 15 19:48:55 2006 UTC Modified files: /php-src/ext/pgsql config.w32 config.m4 pgsql.c Log: MFB: Added a check for PQftable() function http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.w32?r1=1.7r2=1.8diff_format=u Index: php-src/ext/pgsql/config.w32 diff -u php-src/ext/pgsql/config.w32:1.7 php-src/ext/pgsql/config.w32:1.8 --- php-src/ext/pgsql/config.w32:1.7Sun Jun 5 19:25:01 2005 +++ php-src/ext/pgsql/config.w32Fri Sep 15 19:48:55 2006 @@ -1,4 +1,4 @@ -// $Id: config.w32,v 1.7 2005/06/05 19:25:01 wez Exp $ +// $Id: config.w32,v 1.8 2006/09/15 19:48:55 iliaa Exp $ // vim:ft=javascript ARG_WITH(pgsql, PostgreSQL support, no); @@ -8,7 +8,7 @@ CHECK_HEADER_ADD_INCLUDE(libpq-fe.h, CFLAGS_PGSQL, PHP_PGSQL + \\include; + 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_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA); + ADD_FLAG(CFLAGS_PGSQL, /D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE); } else { WARNING(pgsql not enabled; libraries and headers not found); } http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/config.m4?r1=1.47r2=1.48diff_format=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.47 php-src/ext/pgsql/config.m4:1.48 --- php-src/ext/pgsql/config.m4:1.47Thu Jan 5 21:53:07 2006 +++ php-src/ext/pgsql/config.m4 Fri Sep 15 19:48:55 2006 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.47 2006/01/05 21:53:07 sniper Exp $ +dnl $Id: config.m4,v 1.48 2006/09/15 19:48:55 iliaa Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -90,6 +90,7 @@ AC_CHECK_LIB(pq, PQputCopyEnd,AC_DEFINE(HAVE_PQPUTCOPYEND,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQgetCopyData,AC_DEFINE(HAVE_PQGETCOPYDATA,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQsetErrorVerbosity,AC_DEFINE(HAVE_PQSETERRORVERBOSITY,1,[PostgreSQL 7.4 or later])) + AC_CHECK_LIB(pq, PQftable,AC_DEFINE(HAVE_PQFTABLE,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS http://cvs.php.net/viewvc.cgi/php-src/ext/pgsql/pgsql.c?r1=1.353r2=1.354diff_format=u Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.353 php-src/ext/pgsql/pgsql.c:1.354 --- php-src/ext/pgsql/pgsql.c:1.353 Wed Sep 6 12:40:47 2006 +++ php-src/ext/pgsql/pgsql.c Fri Sep 15 19:48:55 2006 @@ -20,7 +20,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.353 2006/09/06 12:40:47 tony2001 Exp $ */ +/* $Id: pgsql.c,v 1.354 2006/09/15 19:48:55 iliaa Exp $ */ #include stdlib.h @@ -154,7 +154,9 @@ PHP_FE(pg_field_type_oid, NULL) PHP_FE(pg_field_prtlen, NULL) PHP_FE(pg_field_is_null,NULL) +#ifdef HAVE_PQFTABLE PHP_FE(pg_field_table, NULL) +#endif /* async message function */ PHP_FE(pg_get_notify, NULL) PHP_FE(pg_get_pid, NULL) @@ -1698,6 +1700,7 @@ } /* }}} */ +#ifdef HAVE_PQFTABLE /* {{{ proto mixed pg_field_table(resource result, int field_number[, bool oid_only]) Returns the name of the table field belongs to, or table's oid if oid_only is true */ PHP_FUNCTION(pg_field_table) @@ -1785,7 +1788,8 @@ } } -/* }}} */ +/* }}} */ +#endif #define PHP_PG_FIELD_NAME 1 #define PHP_PG_FIELD_SIZE 2 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4
sniper Thu Jan 5 21:53:07 2006 UTC Modified files: /php-src/ext/pgsql config.m4 Log: - Fixed bug #35911 (HAVE_PG_CONFIG_H set incorrectly) http://cvs.php.net/viewcvs.cgi/php-src/ext/pgsql/config.m4?r1=1.46r2=1.47diff_format=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.46 php-src/ext/pgsql/config.m4:1.47 --- php-src/ext/pgsql/config.m4:1.46Fri Jul 22 22:00:55 2005 +++ php-src/ext/pgsql/config.m4 Thu Jan 5 21:53:07 2006 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.46 2005/07/22 22:00:55 sniper Exp $ +dnl $Id: config.m4,v 1.47 2006/01/05 21:53:07 sniper Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -24,7 +24,9 @@ AC_MSG_RESULT([$PG_CONFIG]) PGSQL_INCLUDE=`$PG_CONFIG --includedir` PGSQL_LIBDIR=`$PG_CONFIG --libdir` -AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) +if test -r $PGSQL_INCLUDE/pg_config.h; then + AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) +fi else AC_MSG_RESULT(not found) if test $PHP_PGSQL = yes; then -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/pgsql config.m4
Thank you, I made a mistake. I should have commit this to PHP_4_4 only probably. I'll revert head and check what needs to be done for PHP_4_4 branch. Antony Dovgal wrote: As far as I understand, you break 64bit build this way. On Fri, 22 Jul 2005 18:48:14 - Yasuo Ohgaki [EMAIL PROTECTED] wrote: yohgaki Fri Jul 22 14:48:14 2005 EDT Modified files: /php-src/ext/pgsqlconfig.m4 Log: fix build with older postgresql http://cvs.php.net/diff.php/php-src/ext/pgsql/config.m4?r1=1.44r2=1.45ty=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.44 php-src/ext/pgsql/config.m4:1.45 --- php-src/ext/pgsql/config.m4:1.44 Sun May 29 19:16:43 2005 +++ php-src/ext/pgsql/config.m4 Fri Jul 22 14:48:14 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.44 2005/05/29 23:16:43 sniper Exp $ +dnl $Id: config.m4,v 1.45 2005/07/22 18:48:14 yohgaki Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -44,7 +44,7 @@ fi done - for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ; do + for j in lib lib/pgsql lib/postgres lib/postgresql ; do if test -f $i/$j/libpq.so || test -f $i/$j/libpq.a; then PGSQL_LIBDIR=$i/$j fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Yasuo Ohgaki -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4
yohgaki Fri Jul 22 14:48:14 2005 EDT Modified files: /php-src/ext/pgsql config.m4 Log: fix build with older postgresql http://cvs.php.net/diff.php/php-src/ext/pgsql/config.m4?r1=1.44r2=1.45ty=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.44 php-src/ext/pgsql/config.m4:1.45 --- php-src/ext/pgsql/config.m4:1.44Sun May 29 19:16:43 2005 +++ php-src/ext/pgsql/config.m4 Fri Jul 22 14:48:14 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.44 2005/05/29 23:16:43 sniper Exp $ +dnl $Id: config.m4,v 1.45 2005/07/22 18:48:14 yohgaki Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -44,7 +44,7 @@ fi done - for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ; do + for j in lib lib/pgsql lib/postgres lib/postgresql ; do if test -f $i/$j/libpq.so || test -f $i/$j/libpq.a; then PGSQL_LIBDIR=$i/$j fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/pgsql config.m4
As far as I understand, you break 64bit build this way. On Fri, 22 Jul 2005 18:48:14 - Yasuo Ohgaki [EMAIL PROTECTED] wrote: yohgaki Fri Jul 22 14:48:14 2005 EDT Modified files: /php-src/ext/pgsqlconfig.m4 Log: fix build with older postgresql http://cvs.php.net/diff.php/php-src/ext/pgsql/config.m4?r1=1.44r2=1.45ty=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.44 php-src/ext/pgsql/config.m4:1.45 --- php-src/ext/pgsql/config.m4:1.44 Sun May 29 19:16:43 2005 +++ php-src/ext/pgsql/config.m4 Fri Jul 22 14:48:14 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.44 2005/05/29 23:16:43 sniper Exp $ +dnl $Id: config.m4,v 1.45 2005/07/22 18:48:14 yohgaki Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -44,7 +44,7 @@ fi done - for j in $PHP_LIBDIR $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ; do + for j in lib lib/pgsql lib/postgres lib/postgresql ; do if test -f $i/$j/libpq.so || test -f $i/$j/libpq.a; then PGSQL_LIBDIR=$i/$j fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4
sniper Fri Jul 22 18:01:04 2005 EDT Modified files: /php-src/ext/pgsql config.m4 Log: revert fix that did not fix anything http://cvs.php.net/diff.php/php-src/ext/pgsql/config.m4?r1=1.45r2=1.46ty=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.45 php-src/ext/pgsql/config.m4:1.46 --- php-src/ext/pgsql/config.m4:1.45Fri Jul 22 14:48:14 2005 +++ php-src/ext/pgsql/config.m4 Fri Jul 22 18:00:55 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.45 2005/07/22 18:48:14 yohgaki Exp $ +dnl $Id: config.m4,v 1.46 2005/07/22 22:00:55 sniper Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -44,7 +44,7 @@ fi done - for j in lib lib/pgsql lib/postgres lib/postgresql ; do + for j in lib $PHP_LIBDIR/pgsql $PHP_LIBDIR/postgres $PHP_LIBDIR/postgresql ; do if test -f $i/$j/libpq.so || test -f $i/$j/libpq.a; then PGSQL_LIBDIR=$i/$j fi -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4
tony2001Sun Apr 3 09:06:08 2005 EDT Modified files: /php-src/ext/pgsql config.m4 Log: fix typo http://cvs.php.net/diff.php/php-src/ext/pgsql/config.m4?r1=1.42r2=1.43ty=u Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.42 php-src/ext/pgsql/config.m4:1.43 --- php-src/ext/pgsql/config.m4:1.42Fri Mar 25 01:26:30 2005 +++ php-src/ext/pgsql/config.m4 Sun Apr 3 09:06:08 2005 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.42 2005/03/25 06:26:30 chriskl Exp $ +dnl $Id: config.m4,v 1.43 2005/04/03 13:06:08 tony2001 Exp $ dnl AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[ @@ -88,7 +88,7 @@ AC_CHECK_LIB(pq, PQputCopyEnd,AC_DEFINE(HAVE_PQPUTCOPYEND,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQgetCopyData,AC_DEFINE(HAVE_PQGETCOPYDATA,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, PQsetErrorVerbosity,AC_DEFINE(HAVE_PQSETERRORVERBOSITY,1,[PostgreSQL 7.4 or later])) - AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibye])) + AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibyte])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4
helly Fri Jan 9 13:44:34 2004 EDT Modified files: /php-src/ext/pgsql config.m4 Log: Use pg_config if it can be found. Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.36 php-src/ext/pgsql/config.m4:1.37 --- php-src/ext/pgsql/config.m4:1.36Sun Jul 27 12:46:40 2003 +++ php-src/ext/pgsql/config.m4 Fri Jan 9 13:44:33 2004 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.36 2003/07/27 16:46:40 helly Exp $ +dnl $Id: config.m4,v 1.37 2004/01/09 18:44:33 helly Exp $ dnl AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[ @@ -7,34 +7,50 @@ PHP_ARG_WITH(pgsql,for PostgreSQL support, [ --with-pgsql[=DIR] Include PostgreSQL support. DIR is the PostgreSQL - base install directory, defaults to /usr/local/pgsql.]) + base install directory or the path to pg_config.]) if test $PHP_PGSQL != no; then PHP_EXPAND_PATH($PGSQL_INCLUDE, PGSQL_INCLUDE) - if test $PHP_PGSQL = yes; then -PGSQL_SEARCH_PATHS=/usr /usr/local /usr/local/pgsql + AC_MSG_CHECKING(for pg_config) + for i in $PHP_PGSQL $PHP_PGSQL/bin /usr/local/pgsql/bin /usr/local/bin /usr/bin ; do + if test -x $i/pg_config; then + PG_CONFIG=$i/pg_config + break; +fi + done + + if test -n $PG_CONFIG; then +AC_MSG_RESULT([$PG_CONFIG]) +PGSQL_INCLUDE=`$PG_CONFIG --includedir` +PGSQL_LIBDIR=`$PG_CONFIG --libdir` +AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) else -PGSQL_SEARCH_PATHS=$PHP_PGSQL - fi +AC_MSG_RESULT(not found) +if test $PHP_PGSQL = yes; then + PGSQL_SEARCH_PATHS=/usr /usr/local /usr/local/pgsql +else + PGSQL_SEARCH_PATHS=$PHP_PGSQL +fi - for i in $PGSQL_SEARCH_PATHS; do -for j in include include/pgsql include/postgres include/postgresql ; do - if test -r $i/$j/libpq-fe.h; then -PGSQL_INC_BASE=$i -PGSQL_INCLUDE=$i/$j -if test -r $i/$j/pg_config.h; then - AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) +for i in $PGSQL_SEARCH_PATHS; do + for j in include include/pgsql include/postgres include/postgresql ; do +if test -r $i/$j/libpq-fe.h; then + PGSQL_INC_BASE=$i + PGSQL_INCLUDE=$i/$j + if test -r $i/$j/pg_config.h; then +AC_DEFINE(HAVE_PG_CONFIG_H,1,[Whether to have pg_config.h]) + fi fi - fi -done + done -for j in lib lib/pgsql lib/postgres lib/postgresql ; do - if test -f $i/$j/libpq.so || test -f $i/$j/libpq.a; then -PGSQL_LIBDIR=$i/$j - fi + for j in lib lib/pgsql lib/postgres lib/postgresql ; do +if test -f $i/$j/libpq.so || test -f $i/$j/libpq.a; then + PGSQL_LIBDIR=$i/$j +fi + done done - done + fi if test -z $PGSQL_INCLUDE; then AC_MSG_ERROR(Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/pgsql config.m4 pgsql.c php_pgsql.h
@ does not work. (and editing NEWS is much nicer anyway) --Jani On Tue, 22 Jul 2003, Marcus Boerger wrote: helly Tue Jul 22 19:05:17 2003 EDT Modified files: /php-src/ext/pgsql config.m4 php_pgsql.h pgsql.c Log: Added pg_version() which returns an associative array of client/protocol/server version. @Added pg_version() function. (Marcus) Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.34 php-src/ext/pgsql/config.m4:1.35 --- php-src/ext/pgsql/config.m4:1.34 Wed Jun 26 09:07:40 2002 +++ php-src/ext/pgsql/config.m4Tue Jul 22 19:05:17 2003 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.34 2002/06/26 13:07:40 derick Exp $ +dnl $Id: config.m4,v 1.35 2003/07/22 23:05:17 helly Exp $ dnl AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[ @@ -57,6 +57,8 @@ AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under windows])) AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL])) AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later])) + AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later])) + AC_CHECK_LIB(pq, PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibye])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS Index: php-src/ext/pgsql/php_pgsql.h diff -u php-src/ext/pgsql/php_pgsql.h:1.62 php-src/ext/pgsql/php_pgsql.h:1.63 --- php-src/ext/pgsql/php_pgsql.h:1.62 Tue Jun 10 16:03:35 2003 +++ php-src/ext/pgsql/php_pgsql.h Tue Jul 22 19:05:17 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_pgsql.h,v 1.62 2003/06/10 20:03:35 imajes Exp $ */ +/* $Id: php_pgsql.h,v 1.63 2003/07/22 23:05:17 helly Exp $ */ #ifndef PHP_PGSQL_H #define PHP_PGSQL_H @@ -71,6 +71,7 @@ PHP_FUNCTION(pg_port); PHP_FUNCTION(pg_tty); PHP_FUNCTION(pg_options); +PHP_FUNCTION(pg_version); PHP_FUNCTION(pg_ping); /* query functions */ PHP_FUNCTION(pg_query); Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.283 php-src/ext/pgsql/pgsql.c:1.284 --- php-src/ext/pgsql/pgsql.c:1.283Tue Jul 22 18:05:46 2003 +++ php-src/ext/pgsql/pgsql.c Tue Jul 22 19:05:17 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.283 2003/07/22 22:05:46 helly Exp $ */ +/* $Id: pgsql.c,v 1.284 2003/07/22 23:05:17 helly Exp $ */ #include stdlib.h @@ -88,6 +88,7 @@ PHP_FE(pg_port, NULL) PHP_FE(pg_tty, NULL) PHP_FE(pg_options, NULL) + PHP_FE(pg_version, NULL) PHP_FE(pg_ping, NULL) /* query functions */ PHP_FE(pg_query,NULL) @@ -782,6 +783,7 @@ #define PHP_PG_PORT 4 #define PHP_PG_TTY 5 #define PHP_PG_HOST 6 +#define PHP_PG_VERSION 7 /* {{{ php_pgsql_get_link_info */ @@ -831,6 +833,18 @@ case PHP_PG_HOST: Z_STRVAL_P(return_value) = PQhost(pgsql); break; + case PHP_PG_VERSION: + array_init(return_value); + add_assoc_string(return_value, client, PG_VERSION, 1); +#if HAVE_PQPROTOCOLVERSION + add_assoc_long(return_value, protocol, PQprotocolVersion(pgsql)); +#if HAVE_PQPARAMETERSTATUS + if (PQprotocolVersion(pgsql) = 3) { + add_assoc_string(return_value, server, PQparameterStatus(pgsql, server_version), 1); + } +#endif +#endif + return; default: RETURN_FALSE; } @@ -890,6 +904,14 @@ PHP_FUNCTION(pg_host) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_HOST); +} +/* }}} */ + +/* {{{ proto array pg_version([resource connection]) + Returns an array with client, protocol and server version (when available) */ +PHP_FUNCTION(pg_version) +{ + php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_VERSION); } /* }}} */ -- https://www.paypal.com/xclick/[EMAIL PROTECTED]no_note=1tax=0currency_code=EUR -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/pgsql config.m4 pgsql.c php_pgsql.h
helly Tue Jul 22 19:05:17 2003 EDT Modified files: /php-src/ext/pgsql config.m4 php_pgsql.h pgsql.c Log: Added pg_version() which returns an associative array of client/protocol/server version. @Added pg_version() function. (Marcus) Index: php-src/ext/pgsql/config.m4 diff -u php-src/ext/pgsql/config.m4:1.34 php-src/ext/pgsql/config.m4:1.35 --- php-src/ext/pgsql/config.m4:1.34Wed Jun 26 09:07:40 2002 +++ php-src/ext/pgsql/config.m4 Tue Jul 22 19:05:17 2003 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.34 2002/06/26 13:07:40 derick Exp $ +dnl $Id: config.m4,v 1.35 2003/07/22 23:05:17 helly Exp $ dnl AC_DEFUN(PHP_PGSQL_CHECK_FUNCTIONS,[ @@ -57,6 +57,8 @@ AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq under windows])) AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL])) AC_CHECK_LIB(pq, PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later])) + AC_CHECK_LIB(pq, PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later])) + AC_CHECK_LIB(pq, PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later])) AC_CHECK_LIB(pq, pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether libpq is compiled with --enable-multibye])) LIBS=$old_LIBS LDFLAGS=$old_LDFLAGS Index: php-src/ext/pgsql/php_pgsql.h diff -u php-src/ext/pgsql/php_pgsql.h:1.62 php-src/ext/pgsql/php_pgsql.h:1.63 --- php-src/ext/pgsql/php_pgsql.h:1.62 Tue Jun 10 16:03:35 2003 +++ php-src/ext/pgsql/php_pgsql.h Tue Jul 22 19:05:17 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: php_pgsql.h,v 1.62 2003/06/10 20:03:35 imajes Exp $ */ +/* $Id: php_pgsql.h,v 1.63 2003/07/22 23:05:17 helly Exp $ */ #ifndef PHP_PGSQL_H #define PHP_PGSQL_H @@ -71,6 +71,7 @@ PHP_FUNCTION(pg_port); PHP_FUNCTION(pg_tty); PHP_FUNCTION(pg_options); +PHP_FUNCTION(pg_version); PHP_FUNCTION(pg_ping); /* query functions */ PHP_FUNCTION(pg_query); Index: php-src/ext/pgsql/pgsql.c diff -u php-src/ext/pgsql/pgsql.c:1.283 php-src/ext/pgsql/pgsql.c:1.284 --- php-src/ext/pgsql/pgsql.c:1.283 Tue Jul 22 18:05:46 2003 +++ php-src/ext/pgsql/pgsql.c Tue Jul 22 19:05:17 2003 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: pgsql.c,v 1.283 2003/07/22 22:05:46 helly Exp $ */ +/* $Id: pgsql.c,v 1.284 2003/07/22 23:05:17 helly Exp $ */ #include stdlib.h @@ -88,6 +88,7 @@ PHP_FE(pg_port, NULL) PHP_FE(pg_tty, NULL) PHP_FE(pg_options, NULL) + PHP_FE(pg_version, NULL) PHP_FE(pg_ping, NULL) /* query functions */ PHP_FE(pg_query,NULL) @@ -782,6 +783,7 @@ #define PHP_PG_PORT 4 #define PHP_PG_TTY 5 #define PHP_PG_HOST 6 +#define PHP_PG_VERSION 7 /* {{{ php_pgsql_get_link_info */ @@ -831,6 +833,18 @@ case PHP_PG_HOST: Z_STRVAL_P(return_value) = PQhost(pgsql); break; + case PHP_PG_VERSION: + array_init(return_value); + add_assoc_string(return_value, client, PG_VERSION, 1); +#if HAVE_PQPROTOCOLVERSION + add_assoc_long(return_value, protocol, PQprotocolVersion(pgsql)); +#if HAVE_PQPARAMETERSTATUS + if (PQprotocolVersion(pgsql) = 3) { + add_assoc_string(return_value, server, PQparameterStatus(pgsql, server_version), 1); + } +#endif +#endif + return; default: RETURN_FALSE; } @@ -890,6 +904,14 @@ PHP_FUNCTION(pg_host) { php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_HOST); +} +/* }}} */ + +/* {{{ proto array pg_version([resource connection]) + Returns an array with client, protocol and server version (when available) */ +PHP_FUNCTION(pg_version) +{ + php_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP_PG_VERSION); } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php