summaryrefslogtreecommitdiff
path: root/ext/pgsql
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
commit0a36161e13484a99ccf69bb38f206462d27cc6d6 (patch)
treed5107db4b7369603ac7c753829e8972ee74949f7 /ext/pgsql
parentce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (diff)
downloadphp-0a36161e13484a99ccf69bb38f206462d27cc6d6.tar.gz
Imported Upstream version 5.1.2upstream/5.1.2
Diffstat (limited to 'ext/pgsql')
-rw-r--r--ext/pgsql/config.m46
-rw-r--r--ext/pgsql/pgsql.c32
-rw-r--r--ext/pgsql/php_pgsql.h8
-rw-r--r--ext/pgsql/tests/09notice.phpt1
-rwxr-xr-xext/pgsql/tests/80_bug27597.phpt2
-rwxr-xr-xext/pgsql/tests/80_bug32223.phpt1
-rwxr-xr-xext/pgsql/tests/80_bug32223b.phpt8
7 files changed, 34 insertions, 24 deletions
diff --git a/ext/pgsql/config.m4 b/ext/pgsql/config.m4
index d2bfe8829..e15344d91 100644
--- a/ext/pgsql/config.m4
+++ b/ext/pgsql/config.m4
@@ -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.46.2.1 2006/01/05 21:53:19 sniper Exp $
dnl
AC_DEFUN([PHP_PGSQL_CHECK_FUNCTIONS],[
@@ -24,7 +24,9 @@ if test "$PHP_PGSQL" != "no"; 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])
+ 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
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index d1e3d6d43..92a20ad1c 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -20,7 +20,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.331.2.4 2005/11/07 12:57:49 helly Exp $ */
+/* $Id: pgsql.c,v 1.331.2.8 2006/01/01 12:50:12 sniper Exp $ */
#include <stdlib.h>
@@ -36,6 +36,12 @@
#include "php_ini.h"
#include "ext/standard/php_standard.h"
#include "ext/standard/php_smart_str.h"
+
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
#include "php_pgsql.h"
#include "php_globals.h"
#include "zend_exceptions.h"
@@ -77,7 +83,7 @@
/* {{{ pgsql_functions[]
*/
-function_entry pgsql_functions[] = {
+zend_function_entry pgsql_functions[] = {
/* connection functions */
PHP_FE(pg_connect, NULL)
PHP_FE(pg_pconnect, NULL)
@@ -646,11 +652,11 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
if (persistent && PGG(allow_persistent)) {
- list_entry *le;
+ zend_rsrc_list_entry *le;
/* try to find if we already have this link in our persistent list */
if (zend_hash_find(&EG(persistent_list), str.c, str.len+1, (void **) &le)==FAILURE) { /* we don't */
- list_entry new_le;
+ zend_rsrc_list_entry new_le;
if (PGG(max_links)!=-1 && PGG(num_links)>=PGG(max_links)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
@@ -680,7 +686,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* hash it up */
Z_TYPE(new_le) = le_plink;
new_le.ptr = pgsql;
- if (zend_hash_update(&EG(persistent_list), str.c, str.len+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
+ if (zend_hash_update(&EG(persistent_list), str.c, str.len+1, (void *) &new_le, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) {
goto err;
}
PGG(num_links)++;
@@ -726,7 +732,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
} else { /* Non persistent connection */
- list_entry *index_ptr,new_index_ptr;
+ zend_rsrc_list_entry *index_ptr,new_index_ptr;
/* first we check the hash for the hashed_details key. if it exists,
* it should point us to the right offset where the actual pgsql link sits.
@@ -776,7 +782,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
/* add it to the hash */
new_index_ptr.ptr = (void *) Z_LVAL_P(return_value);
Z_TYPE(new_index_ptr) = le_index_ptr;
- if (zend_hash_update(&EG(regular_list),str.c,str.len+1,(void *) &new_index_ptr, sizeof(list_entry), NULL)==FAILURE) {
+ if (zend_hash_update(&EG(regular_list),str.c,str.len+1,(void *) &new_index_ptr, sizeof(zend_rsrc_list_entry), NULL)==FAILURE) {
goto err;
}
PGG(num_links)++;
@@ -1633,7 +1639,7 @@ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
{
PGresult *result;
smart_str str = {0};
- list_entry *field_type;
+ zend_rsrc_list_entry *field_type;
char *ret=NULL;
/* try to lookup the type in the resource list */
@@ -1647,7 +1653,7 @@ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
int i,num_rows;
int oid_offset,name_offset;
char *tmp_oid, *end_ptr, *tmp_name;
- list_entry new_oid_entry;
+ zend_rsrc_list_entry new_oid_entry;
if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) {
if (result) {
@@ -1675,7 +1681,7 @@ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
}
Z_TYPE(new_oid_entry) = le_string;
new_oid_entry.ptr = estrdup(tmp_name);
- zend_hash_update(list,str.c,str.len+1,(void *) &new_oid_entry, sizeof(list_entry), NULL);
+ zend_hash_update(list,str.c,str.len+1,(void *) &new_oid_entry, sizeof(zend_rsrc_list_entry), NULL);
if (!ret && strtoul(tmp_oid, &end_ptr, 10)==oid) {
ret = estrdup(tmp_name);
}
diff --git a/ext/pgsql/php_pgsql.h b/ext/pgsql/php_pgsql.h
index e7ca2219c..68f110107 100644
--- a/ext/pgsql/php_pgsql.h
+++ b/ext/pgsql/php_pgsql.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_pgsql.h,v 1.73 2005/08/03 14:07:41 sniper Exp $ */
+/* $Id: php_pgsql.h,v 1.73.2.1 2006/01/01 12:50:12 sniper Exp $ */
#ifndef PHP_PGSQL_H
#define PHP_PGSQL_H
diff --git a/ext/pgsql/tests/09notice.phpt b/ext/pgsql/tests/09notice.phpt
index ccb0c8082..b7611b98c 100644
--- a/ext/pgsql/tests/09notice.phpt
+++ b/ext/pgsql/tests/09notice.phpt
@@ -10,6 +10,7 @@ pgsql.ignore_notices=0
include 'config.inc';
$db = pg_connect($conn_str);
+pg_exec($db, "SET LC_MESSAGES='C';");
pg_query($db, "BEGIN;");
pg_query($db, "BEGIN;");
diff --git a/ext/pgsql/tests/80_bug27597.phpt b/ext/pgsql/tests/80_bug27597.phpt
index aa04a4a22..b27d6e94f 100755
--- a/ext/pgsql/tests/80_bug27597.phpt
+++ b/ext/pgsql/tests/80_bug27597.phpt
@@ -7,7 +7,7 @@ require_once('skipif.inc');
--FILE--
<?php
-require_once('config.inc');
+require_once(dirname(__FILE__) . '/config.inc');
$dbh = @pg_connect($conn_str);
if (!$dbh) {
diff --git a/ext/pgsql/tests/80_bug32223.phpt b/ext/pgsql/tests/80_bug32223.phpt
index a605fcc20..b201d320c 100755
--- a/ext/pgsql/tests/80_bug32223.phpt
+++ b/ext/pgsql/tests/80_bug32223.phpt
@@ -22,6 +22,7 @@ $dbh = @pg_connect($conn_str);
if (!$dbh) {
die ("Could not connect to the server");
}
+pg_exec($dbh, "SET LC_MESSAGES='C';");
//@pg_query($dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = pg_query($dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
diff --git a/ext/pgsql/tests/80_bug32223b.phpt b/ext/pgsql/tests/80_bug32223b.phpt
index 010915e82..98e472388 100755
--- a/ext/pgsql/tests/80_bug32223b.phpt
+++ b/ext/pgsql/tests/80_bug32223b.phpt
@@ -1,5 +1,5 @@
--TEST--
-Bug #32223 (weird behaviour of pg_last_notice using notice)
+Bug #32223 (weird behaviour of pg_last_notice using define)
--SKIPIF--
<?php
require_once('skipif.inc');
@@ -16,13 +16,13 @@ if (!$res) die('skip PLPGSQL not available');
--FILE--
<?php
-require('config.inc');
+require_once('config.inc');
-define ('dbh', pg_connect($conn_str));
-//$dbh = @pg_connect($conn_str);
+define('dbh', pg_connect($conn_str));
if (!dbh) {
die ("Could not connect to the server");
}
+pg_exec(dbh, "SET LC_MESSAGES='C';");
//@pg_query(dbh, "CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL'");
$res = pg_query(dbh, "CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '