[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-06-22 Thread Ilia Alshanetsky
iliaa   Sun Jun 22 12:46:24 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed bug #24284 (Fixed memory leak inside pg_ping())
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.276 php4/ext/pgsql/pgsql.c:1.277
--- php4/ext/pgsql/pgsql.c:1.276Tue Jun 10 16:03:34 2003
+++ php4/ext/pgsql/pgsql.c  Sun Jun 22 12:46:24 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.276 2003/06/10 20:03:34 imajes Exp $ */
+/* $Id: pgsql.c,v 1.277 2003/06/22 16:46:24 iliaa Exp $ */
 
 #include stdlib.h
 
@@ -865,6 +865,7 @@
zval *pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
+   PGresult *res;
 
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
TSRMLS_CC, r,
 pgsql_link) == 
FAILURE) {
@@ -874,7 +875,8 @@
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
/* ping connection */
-   PQexec(pgsql, SELECT 1;);
+   res = PQexec(pgsql, SELECT 1;);
+   PQclear(res);
 
/* check status. */
if (PQstatus(pgsql) == CONNECTION_OK)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c /ext/pgsql/tests 09notice.phpt

2003-05-31 Thread Marcus Boerger
helly   Fri May 30 11:42:46 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
/php4/ext/pgsql/tests   09notice.phpt 
  Log:
  Fix notice handling
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.272 php4/ext/pgsql/pgsql.c:1.273
--- php4/ext/pgsql/pgsql.c:1.272Fri May 30 11:07:01 2003
+++ php4/ext/pgsql/pgsql.c  Fri May 30 11:42:46 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.272 2003/05/30 15:07:01 helly Exp $ */
+/* $Id: pgsql.c,v 1.273 2003/05/30 15:42:46 helly Exp $ */
 
 #include stdlib.h
 
@@ -264,15 +264,21 @@
 static void _php_pgsql_notice_handler(void *resource_id, const char *message)
 {
php_pgsql_notice *notice;
+   int i;

TSRMLS_FETCH();
if (! PGG(ignore_notices)) {
+   notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
+   i = strlen(message)-1;
+   while (i  (message[i] == '\r' || message[i] == '\n')) {
+   i--;
+   }
+   i++;
+   notice-message = estrndup(message, i);
+   notice-len = i;
if (PGG(log_notices)) {
-   php_log_err((char *) message TSRMLS_CC);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, %s, 
notice-message);
}
-   notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
-   notice-len = strlen(message);
-   notice-message = estrndup(message, notice-len);
zend_hash_index_update(PGG(notices), *(int *)resource_id, (void 
**)notice, sizeof(php_pgsql_notice *), NULL);
}
 }
Index: php4/ext/pgsql/tests/09notice.phpt
diff -u php4/ext/pgsql/tests/09notice.phpt:1.4 php4/ext/pgsql/tests/09notice.phpt:1.5
--- php4/ext/pgsql/tests/09notice.phpt:1.4  Fri May 30 11:07:02 2003
+++ php4/ext/pgsql/tests/09notice.phpt  Fri May 30 11:42:46 2003
@@ -18,12 +18,11 @@
echo Cannot find notice message in hash\n;
var_dump($msg);
 }
-echo $msg;
+echo $msg.\n;
 echo pg_last_notice() is Ok\n;
 
 ?
---EXPECT--
-NOTICE:  BEGIN: already a transaction in progress
-
+--EXPECTF--
+Notice: pg_query(): NOTICE:  BEGIN: already a transaction in progress in %s on line %d
 NOTICE:  BEGIN: already a transaction in progress
 pg_last_notice() is Ok



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c /ext/pgsql/tests 05large_object.phpt

2003-05-31 Thread Marcus Boerger
helly   Fri May 30 12:51:00 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
/php4/ext/pgsql/tests   05large_object.phpt 
  Log:
  Fix handling of default links
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.273 php4/ext/pgsql/pgsql.c:1.274
--- php4/ext/pgsql/pgsql.c:1.273Fri May 30 11:42:46 2003
+++ php4/ext/pgsql/pgsql.c  Fri May 30 12:51:00 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.273 2003/05/30 15:42:46 helly Exp $ */
+/* $Id: pgsql.c,v 1.274 2003/05/30 16:51:00 helly Exp $ */
 
 #include stdlib.h
 
@@ -1774,10 +1774,6 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Requires 1 or 2 
arguments.);
RETURN_FALSE;
}
-
-   if (pgsql_link == NULL) {
-   RETURN_FALSE;
-   }

ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
@@ -1848,10 +1844,6 @@
RETURN_FALSE;
}
 
-   if (pgsql_link == NULL) {
-   RETURN_FALSE;
-   }
-   
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);

/* r/w/+ is little bit more PHP-like than INV_READ/INV_WRITE and a lot of
@@ -2080,10 +2072,6 @@
WRONG_PARAM_COUNT;
}
 
-   if (pgsql_link == NULL) {
-   RETURN_FALSE;
-   }
-   
if (PG(safe_mode) (!php_checkuid(file_in, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
@@ -2178,10 +2166,6 @@
RETURN_FALSE;
}
 
-   if (pgsql_link == NULL) {
-   RETURN_FALSE;
-   }
-   
if (PG(safe_mode) (!php_checkuid(file_out, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
RETURN_FALSE;
}
Index: php4/ext/pgsql/tests/05large_object.phpt
diff -u php4/ext/pgsql/tests/05large_object.phpt:1.2 
php4/ext/pgsql/tests/05large_object.phpt:1.3
--- php4/ext/pgsql/tests/05large_object.phpt:1.2Mon May 19 20:14:46 2003
+++ php4/ext/pgsql/tests/05large_object.phptFri May 30 12:51:00 2003
@@ -9,7 +9,7 @@
 
 $db = pg_connect($conn_str);
 
-// create/write/close LO
+echo create/write/close LO\n;
 pg_exec ($db, begin);
 $oid = pg_lo_create ($db);
 if (!$oid) echo (pg_lo_create() error\n);
@@ -19,7 +19,7 @@
 pg_lo_close ($handle);
 pg_exec ($db, commit);
 
-// open/read/tell/seek/close LO
+echo open/read/tell/seek/close LO\n;
 pg_exec ($db, begin);
 $handle = pg_lo_open ($db, $oid, w);
 pg_lo_read($handle, 100);
@@ -28,7 +28,7 @@
 pg_lo_close($handle);
 pg_exec ($db, commit);
 
-// open/read_all/close LO
+echo open/read_all/close LO\n;
 pg_exec ($db, begin);
 $handle = pg_lo_open ($db, $oid, w);
 pg_lo_read_all($handle);
@@ -36,25 +36,25 @@
 pg_lo_close($handle);
 pg_exec ($db, commit);
 
-// unlink LO
+echo unlink LO\n;
 pg_exec ($db, begin);
-pg_lo_unlink($db, $oid) or print(pg_lo_unlink() error\n);
+pg_lo_unlink($db, $oid) or print(pg_lo_unlink() error 1\n);
 pg_exec ($db, commit);
 
 // more pg_lo_unlink() tests
-// Test without connection 
+echo Test without connection\n;
 pg_exec ($db, begin);
 $oid = pg_lo_create ($db) or print(pg_lo_create() error\n);
-pg_lo_unlink($oid) or print(pg_lo_unlink() error\n);
+pg_lo_unlink($oid) or print(pg_lo_unlink() error 2\n);
 pg_exec ($db, commit);
 
-// Test with string oid value
+echo Test with string oid value\n;
 pg_exec ($db, begin);
 $oid = pg_lo_create ($db) or print(pg_lo_create() error\n);
-pg_lo_unlink($db, (string)$oid) or print(pg_lo_unlink() error\n);
+pg_lo_unlink($db, (string)$oid) or print(pg_lo_unlink() error 3\n);
 pg_exec ($db, commit);
 
-// import/export LO
+echo import/export LO\n;
 pg_query($db, 'begin');
 $oid = pg_lo_import($db, 'php.gif');
 pg_query($db, 'commit');
@@ -70,5 +70,12 @@
 echo OK;
 ?
 --EXPECT--
+create/write/close LO
+open/read/tell/seek/close LO
+open/read_all/close LO
 large object data
+unlink LO
+Test without connection
+Test with string oid value
+import/export LO
 OK



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-05-31 Thread Marcus Boerger
helly   Fri May 30 15:12:26 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Better fix for default connection handling.
  # Problems noticed by Jay with the help of Sascha's nice little script.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.274 php4/ext/pgsql/pgsql.c:1.275
--- php4/ext/pgsql/pgsql.c:1.274Fri May 30 12:51:00 2003
+++ php4/ext/pgsql/pgsql.c  Fri May 30 15:12:26 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.274 2003/05/30 16:51:00 helly Exp $ */
+/* $Id: pgsql.c,v 1.275 2003/05/30 19:12:26 helly Exp $ */
 
 #include stdlib.h
 
@@ -726,7 +726,10 @@
WRONG_PARAM_COUNT;
break;
}
-   
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
+
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
if (id==-1) { /* explicit resource number */
@@ -773,7 +776,10 @@
WRONG_PARAM_COUNT;
break;
}
-   
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
+
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
switch(entry_type) {
@@ -912,7 +918,10 @@
WRONG_PARAM_COUNT;
break;
}
-   
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
+
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
convert_to_string_ex(query);
@@ -1593,7 +1602,7 @@
Enable tracing a PostgreSQL connection */
 PHP_FUNCTION(pg_trace)
 {
-   zval **z_filename, **z_mode, **z_pgsql_link = NULL;
+   zval **z_filename, **z_mode, **pgsql_link = NULL;
int id = -1;
PGconn *pgsql;
char *mode = w;
@@ -1617,7 +1626,7 @@
mode = Z_STRVAL_PP(z_mode);
break;
case 3:
-   if (zend_get_parameters_ex(3, z_filename, z_mode, 
z_pgsql_link)==FAILURE) {
+   if (zend_get_parameters_ex(3, z_filename, z_mode, 
pgsql_link)==FAILURE) {
RETURN_FALSE;
}
convert_to_string_ex(z_mode);
@@ -1627,8 +1636,11 @@
ZEND_WRONG_PARAM_COUNT();
break;
}
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
 
-   ZEND_FETCH_RESOURCE2(pgsql, PGconn *, z_pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
+   ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
convert_to_string_ex(z_filename);
 
stream = php_stream_open_wrapper(Z_STRVAL_PP(z_filename), mode, 
ENFORCE_SAFE_MODE|REPORT_ERRORS, NULL);
@@ -1669,6 +1681,9 @@
ZEND_WRONG_PARAM_COUNT();
break;
}
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
 
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
PQuntrace(pgsql);
@@ -1699,7 +1714,10 @@
WRONG_PARAM_COUNT;
break;
}
-   
+   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
@@ -1774,7 +1792,10 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Requires 1 or 2 
arguments.);
RETURN_FALSE;
}
-   
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
+
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
if (lo_unlink(pgsql, oid) == -1) {
@@ -1843,6 +1864,9 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, Requires 1 or 2 
arguments.);
RETURN_FALSE;
}
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
 
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);

@@ -2080,6 +2104,10 @@
RETURN_FALSE;
}
 
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+   }   
+
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
le_link, le_plink);
 
oid = lo_import(pgsql, file_in);
@@ -2174,6 +2202,10 @@
RETURN_FALSE;
}
 
+   if (pgsql_link == NULL  id == -1) {
+   RETURN_FALSE;
+  

[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-04-01 Thread Jay Smith
jay Tue Apr  1 18:26:11 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed bug #23009 (pg_select with timestamp) 
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.266 php4/ext/pgsql/pgsql.c:1.267
--- php4/ext/pgsql/pgsql.c:1.266Mon Mar 10 15:30:32 2003
+++ php4/ext/pgsql/pgsql.c  Tue Apr  1 18:26:10 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.266 2003/03/10 20:30:32 ddhill Exp $ */
+/* $Id: pgsql.c,v 1.267 2003/04/01 23:26:10 jay Exp $ */
 
 #include stdlib.h
 
@@ -3205,7 +3205,7 @@
return PG_TIME;
if (!strcmp(type_name, timestamp) || !strcmp(type_name, time with time 
zone))
return PG_TIME_WITH_TIMEZONE;
-   if (!strcmp(type_name, timestamp with time zone))
+   if (!strcmp(type_name, timestamp with time zone) || !strcmp(type_name, 
timestamptz))
return PG_TIMESTAMP_WITH_TIMEZONE;
if (!strcmp(type_name, interval))
return PG_INTERVAL;
@@ -3665,7 +3665,7 @@
}
else {
/* FIXME: better regex must be 
used */
-   if 
(php_pgsql_convert_match(Z_STRVAL_PP(val), ^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ 
\\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$, 1 TSRMLS_CC) == FAILURE) {
+   if 
(php_pgsql_convert_match(Z_STRVAL_PP(val), ^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ 
\\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ 
\\t]*([+-][0-9]{1,2}(:[0-9]{1,2}){0,1}|[a-zA-Z]{1,5})){0,1})){0,1}$, 1 TSRMLS_CC) == 
FAILURE) {
err = 1;
}
else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-04-01 Thread Marcus Boerger
helly   Tue Apr  1 18:34:12 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fix 'time with timezone', too
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.267 php4/ext/pgsql/pgsql.c:1.268
--- php4/ext/pgsql/pgsql.c:1.267Tue Apr  1 18:26:10 2003
+++ php4/ext/pgsql/pgsql.c  Tue Apr  1 18:34:11 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.267 2003/04/01 23:26:10 jay Exp $ */
+/* $Id: pgsql.c,v 1.268 2003/04/01 23:34:11 helly Exp $ */
 
 #include stdlib.h
 
@@ -3203,7 +3203,7 @@
return PG_DATE;
if (!strcmp(type_name, time))
return PG_TIME;
-   if (!strcmp(type_name, timestamp) || !strcmp(type_name, time with time 
zone))
+   if (!strcmp(type_name, time with time zone) || !strcmp(type_name, timetz))
return PG_TIME_WITH_TIMEZONE;
if (!strcmp(type_name, timestamp with time zone) || !strcmp(type_name, 
timestamptz))
return PG_TIMESTAMP_WITH_TIMEZONE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2003-04-01 Thread Jay Smith
jay Tue Apr  1 18:56:16 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Fix 'timestamp without timezone', too.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.268 php4/ext/pgsql/pgsql.c:1.269
--- php4/ext/pgsql/pgsql.c:1.268Tue Apr  1 18:34:11 2003
+++ php4/ext/pgsql/pgsql.c  Tue Apr  1 18:56:16 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.268 2003/04/01 23:34:11 helly Exp $ */
+/* $Id: pgsql.c,v 1.269 2003/04/01 23:56:16 jay Exp $ */
 
 #include stdlib.h
 
@@ -3205,6 +3205,8 @@
return PG_TIME;
if (!strcmp(type_name, time with time zone) || !strcmp(type_name, timetz))
return PG_TIME_WITH_TIMEZONE;
+   if (!strcmp(type_name, timestamp without time zone) || !strcmp(type_name, 
timestamp))
+   return PG_TIMESTAMP;
if (!strcmp(type_name, timestamp with time zone) || !strcmp(type_name, 
timestamptz))
return PG_TIMESTAMP_WITH_TIMEZONE;
if (!strcmp(type_name, interval))
@@ -3657,6 +3659,7 @@
break;

case PG_TIME_WITH_TIMEZONE:
+   case PG_TIMESTAMP:
case PG_TIMESTAMP_WITH_TIMEZONE:
switch(Z_TYPE_PP(val)) {
case IS_STRING:
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.59 php4/ext/pgsql/php_pgsql.h:1.60
--- php4/ext/pgsql/php_pgsql.h:1.59 Mon Jan  6 05:28:34 2003
+++ php4/ext/pgsql/php_pgsql.h  Tue Apr  1 18:56:16 2003
@@ -17,7 +17,7 @@
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.59 2003/01/06 10:28:34 hyanantha Exp $ */
+/* $Id: php_pgsql.h,v 1.60 2003/04/01 23:56:16 jay Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
@@ -196,6 +196,7 @@
PG_DATE,
PG_TIME,
PG_TIME_WITH_TIMEZONE,
+   PG_TIMESTAMP,
PG_TIMESTAMP_WITH_TIMEZONE,
PG_INTERVAL,
/* binary */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c /ext/standard url_scanner.c url_scanner_ex.c

2003-03-10 Thread David Hill
ddhill  Mon Mar 10 15:30:33 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
/php4/ext/standard  url_scanner.c url_scanner_ex.c 
  Log:
  Correcting int/long mismatched - 64bit issues.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.265 php4/ext/pgsql/pgsql.c:1.266
--- php4/ext/pgsql/pgsql.c:1.265Fri Mar  7 00:15:20 2003
+++ php4/ext/pgsql/pgsql.c  Mon Mar 10 15:30:32 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.265 2003/03/07 05:15:20 sniper Exp $ */
+/* $Id: pgsql.c,v 1.266 2003/03/10 20:30:32 ddhill Exp $ */
 
 #include stdlib.h
 
@@ -1727,7 +1727,7 @@
zval *pgsql_link = NULL;
long oid_long;
char *oid_string, *end_ptr;
-   size_t oid_strlen;
+   int oid_strlen;
PGconn *pgsql;
Oid oid;
int id = -1;
@@ -1794,7 +1794,7 @@
zval *pgsql_link = NULL;
long oid_long;
char *oid_string, *end_ptr, *mode_string;
-   size_t oid_strlen, mode_strlen;
+   int oid_strlen, mode_strlen;
PGconn *pgsql;
Oid oid;
int id = -1, pgsql_mode=0, pgsql_lofd;
@@ -2099,7 +2099,7 @@
 {
zval *pgsql_link = NULL;
char *file_out, *oid_string, *end_ptr;
-   size_t oid_strlen;
+   int oid_strlen;
int id = -1, name_len;
long oid_long;
Oid oid;
@@ -2599,8 +2599,8 @@
 PHP_FUNCTION(pg_escape_string)
 {
char *from = NULL, *to = NULL;
-   size_t to_len;
-   long from_len;
+   int to_len;
+   int from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s,
  from, from_len) == 
FAILURE) {
return;
@@ -2618,7 +2618,7 @@
 {
char *from = NULL, *to = NULL;
size_t to_len;
-   long from_len;
+   int from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s,
  from, from_len) == 
FAILURE) {
return;
@@ -2740,7 +2740,7 @@
 {
char *from = NULL, *to = NULL;
size_t to_len;
-   long from_len;
+   int from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s,
  from, from_len) == 
FAILURE) {
return;
@@ -3077,7 +3077,7 @@
PGresult *pg_result;
char *tmp_name;
smart_str querystr = {0};
-   size_t new_len;
+   int new_len;
int i, num_rows;
zval *elem;

@@ -3969,7 +3969,8 @@
char buf[256];
char *fld;
smart_str querystr = {0};
-   int key_type, fld_len, ret = FAILURE;
+   int key_type, ret = FAILURE;
+   uint fld_len;
ulong num_idx;
HashPosition pos;
 
@@ -4099,7 +4100,7 @@
 static inline int build_assignment_string(smart_str *querystr, HashTable *ht, const 
char *pad, int pad_len TSRMLS_DC)
 {
HashPosition pos;
-   size_t fld_len;
+   uint fld_len;
int key_type;
ulong num_idx;
char *fld;
Index: php4/ext/standard/url_scanner.c
diff -u php4/ext/standard/url_scanner.c:1.40 php4/ext/standard/url_scanner.c:1.41
--- php4/ext/standard/url_scanner.c:1.40Tue Dec 31 11:07:56 2002
+++ php4/ext/standard/url_scanner.c Mon Mar 10 15:30:33 2003
@@ -15,7 +15,7 @@
| Author: Hartmut Holzgraefe [EMAIL PROTECTED]|
+--+
  */
-/* $Id: url_scanner.c,v 1.40 2002/12/31 16:07:56 sebastian Exp $ */
+/* $Id: url_scanner.c,v 1.41 2003/03/10 20:30:33 ddhill Exp $ */
 
 #include php.h
 
@@ -88,7 +88,7 @@
 
 /* {{{ url_adapt_ext
  */
-char *url_adapt_ext(const char *src, size_t srclen, const char *name, const char 
*val, size_t *newlen)
+char *url_adapt_ext(const char *src, uint srclen, const char *name, const char *val, 
size_t *newlen)
 {
char buf[1024];
 
Index: php4/ext/standard/url_scanner_ex.c
diff -u php4/ext/standard/url_scanner_ex.c:1.74 php4/ext/standard/url_scanner_ex.c:1.75
--- php4/ext/standard/url_scanner_ex.c:1.74 Wed Feb 12 09:56:13 2003
+++ php4/ext/standard/url_scanner_ex.c  Mon Mar 10 15:30:33 2003
@@ -860,7 +860,7 @@
 }
 
 
-static char *url_adapt_ext(const char *src, size_t srclen, size_t *newlen, zend_bool 
do_flush TSRMLS_DC)
+static char *url_adapt_ext(const char *src, uint srclen, uint *newlen, zend_bool 
do_flush TSRMLS_DC)
 {
url_adapt_state_ex_t *ctx;
char *retval;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-02-20 Thread Justin Erenkrantz
jerenkrantz Thu Feb 20 16:48:59 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Remove C++-style comment.  (Breaks Sun Forte compiler.)
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.262 php4/ext/pgsql/pgsql.c:1.263
--- php4/ext/pgsql/pgsql.c:1.262Thu Feb 20 02:10:07 2003
+++ php4/ext/pgsql/pgsql.c  Thu Feb 20 16:48:58 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.262 2003/02/20 07:10:07 sniper Exp $ */
+/* $Id: pgsql.c,v 1.263 2003/02/20 21:48:58 jerenkrantz Exp $ */
 
 #include stdlib.h
 
@@ -606,7 +606,7 @@
pgsql = (PGconn *) le-ptr;
}
ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
-   } else { // Non persistent connection
+   } else { /* Non persistent connection */
list_entry *index_ptr,new_index_ptr;

/* first we check the hash for the hashed_details key.  if it exists,



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-02-19 Thread Jani Taskinen
sniper  Thu Feb 20 02:10:07 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed bug: #22306 (pg_lo_seek($h, 0, PGSQL_SEEK_SET) succeeds but returns false)
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.261 php4/ext/pgsql/pgsql.c:1.262
--- php4/ext/pgsql/pgsql.c:1.261Mon Feb 10 10:46:47 2003
+++ php4/ext/pgsql/pgsql.c  Thu Feb 20 02:10:07 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.261 2003/02/10 15:46:47 jon Exp $ */
+/* $Id: pgsql.c,v 1.262 2003/02/20 07:10:07 sniper Exp $ */
 
 #include stdlib.h
 
@@ -2204,7 +2204,7 @@
 
ZEND_FETCH_RESOURCE(pgsql, pgLofp *, pgsql_id, -1, PostgreSQL large object, 
le_lofp);
 
-   if (lo_lseek((PGconn *)pgsql-conn, pgsql-lofd, offset, whence )) {
+   if (lo_lseek((PGconn *)pgsql-conn, pgsql-lofd, offset, whence )  -1) {
RETURN_TRUE;
} else {
RETURN_FALSE;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-02-10 Thread Jon Parise
jon Mon Feb 10 10:46:47 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Correct the spelling of 'supported'.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.260 php4/ext/pgsql/pgsql.c:1.261
--- php4/ext/pgsql/pgsql.c:1.260Sun Feb  9 02:50:16 2003
+++ php4/ext/pgsql/pgsql.c  Mon Feb 10 10:46:47 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.260 2003/02/09 07:50:16 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.261 2003/02/10 15:46:47 jon Exp $ */
 
 #include stdlib.h
 
@@ -997,7 +997,7 @@
 #if HAVE_PQCMDTUPLES
Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result));
 #else
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Not supportted 
under this build.);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Not supported 
+under this build.);
Z_LVAL_P(return_value) = 0;
 #endif
break;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-02-08 Thread Yasuo Ohgaki
yohgaki Sun Feb  9 02:24:18 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed improper result offset handling.
  Prevent error when connection is broken. (optional)
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.258 php4/ext/pgsql/pgsql.c:1.259
--- php4/ext/pgsql/pgsql.c:1.258Tue Feb  4 13:34:00 2003
+++ php4/ext/pgsql/pgsql.c  Sun Feb  9 02:24:18 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.258 2003/02/04 18:34:00 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.259 2003/02/09 07:24:18 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -579,7 +579,7 @@
RETURN_FALSE;
}
/* ensure that the link did not die */
-   if (PGG(auto_reset_persistent)) {
+   if (PGG(auto_reset_persistent)  1) {
/* need to send  get something from backend to
   make sure we catch CONNECTION_BAD everytime */
PGresult *pg_result;
@@ -930,7 +930,12 @@
php_error_docref(NULL TSRMLS_CC, E_NOTICE, Found results on this 
connection. Use pg_get_result() to get these results first.);
}
pgsql_result = PQexec(pgsql, Z_STRVAL_PP(query));
-   
+   if ((PGG(auto_reset_persistent)  2)  PQstatus(pgsql) != CONNECTION_OK) {
+   PQclear(pgsql_result);
+   PQreset(pgsql);
+   pgsql_result = PQexec(pgsql, Z_STRVAL_PP(query));
+   }
+
if (pgsql_result) {
status = PQresultStatus(pgsql_result);
} else {
@@ -951,7 +956,7 @@
pg_result = (pgsql_result_handle *) 
emalloc(sizeof(pgsql_result_handle));
pg_result-conn = pgsql;
pg_result-result = pgsql_result;
-   pg_result-row = -1;
+   pg_result-row = 0;
ZEND_REGISTER_RESOURCE(return_value, pg_result, 
le_result);
} else {
RETURN_FALSE;
@@ -1301,11 +1306,11 @@
pgsql_result = pg_result-result;
 
if (ZEND_NUM_ARGS() == 1) {
-   pg_result-row++;
pgsql_row = pg_result-row;
if (pgsql_row  0 || pgsql_row = PQntuples(pgsql_result)) {
RETURN_FALSE;
}
+   pg_result-row++;
} else {
if (Z_TYPE_PP(row) != IS_NULL) { 
convert_to_long_ex(row);
@@ -1317,11 +1322,11 @@
}
} else {
/* If 2nd param is NULL, use internal row counter to access 
next row */
-   pg_result-row++;
pgsql_row = pg_result-row;
if (pgsql_row  0 || pgsql_row = PQntuples(pgsql_result)) {
RETURN_FALSE;
}
+   pg_result-row++;
}
}
array_init(return_value);
@@ -1448,7 +1453,7 @@
}

/* seek to offset */
-   pg_result-row = row - 1;
+   pg_result-row = row;
RETURN_TRUE;
 }
 /* }}} */
@@ -2930,7 +2935,12 @@
php_error_docref(NULL TSRMLS_CC, E_NOTICE, There are results on this 
connection. Call pg_get_result() until it returns FALSE.);
}
if (!PQsendQuery(pgsql, query)) {
-   RETURN_FALSE;
+   if ((PGG(auto_reset_persistent)  2)  PQstatus(pgsql) != 
+CONNECTION_OK) {
+   PQreset(pgsql);
+   }
+   if (!PQsendQuery(pgsql, query)) {
+   RETURN_FALSE;
+   }
}
if (PQ_SETNONBLOCKING(pgsql, 0)) {
php_error_docref(NULL TSRMLS_CC, E_NOTICE, Cannot set connection to 
blocking mode.);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-02-08 Thread Yasuo Ohgaki
yohgaki Sun Feb  9 02:50:16 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed one more improper row offset handling.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.259 php4/ext/pgsql/pgsql.c:1.260
--- php4/ext/pgsql/pgsql.c:1.259Sun Feb  9 02:24:18 2003
+++ php4/ext/pgsql/pgsql.c  Sun Feb  9 02:50:16 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.259 2003/02/09 07:24:18 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.260 2003/02/09 07:50:16 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -2975,7 +2975,7 @@
pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle));
pg_result-conn = pgsql;
pg_result-result = pgsql_result;
-   pg_result-row = -1;
+   pg_result-row = 0;
ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result);
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-02-04 Thread Ilia Alshanetsky
iliaa   Tue Feb  4 13:34:01 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Made the row parameter in pg_result_seek() non-optional, the current 
  implementation would result in random behavior if the 2nd argument is not
  passed.
  Fixed bug #22042 (pg_result_seek() would never seek to the 1st row in the 
  result due to always seeking to row next to the one requested).
  Removed dead code from pg_result_seek().
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.257 php4/ext/pgsql/pgsql.c:1.258
--- php4/ext/pgsql/pgsql.c:1.257Sat Jan 18 14:28:08 2003
+++ php4/ext/pgsql/pgsql.c  Tue Feb  4 13:34:00 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.257 2003/01/18 19:28:08 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.258 2003/02/04 18:34:00 iliaa Exp $ */
 
 #include stdlib.h
 
@@ -1437,23 +1437,18 @@
int row;
pgsql_result_handle *pg_result;
 
-   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|l,
- result, row) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, rl, result, row) == 
+FAILURE) {
return;
}
 
ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, PostgreSQL 
result, le_result);
 
-   /* Let see if we are better to have another function for this */
-   /* if offset is omitted, return current position */
-/* if (ZEND_NUM_ARGS() == 1) */
-/* RETURN_LONG(pg_result-row); */
-
-   if (row  0 || row = PQntuples(pg_result-result))
+   if (row  0 || row = PQntuples(pg_result-result)) {
RETURN_FALSE;
+   }

/* seek to offset */
-   pg_result-row = row;
+   pg_result-row = row - 1;
RETURN_TRUE;
 }
 /* }}} */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2003-01-15 Thread Yasuo Ohgaki
yohgaki Wed Jan 15 05:21:15 2003 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed proto
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.255 php4/ext/pgsql/pgsql.c:1.256
--- php4/ext/pgsql/pgsql.c:1.255Sat Jan  4 07:33:46 2003
+++ php4/ext/pgsql/pgsql.c  Wed Jan 15 05:21:15 2003
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.255 2003/01/04 12:33:46 derick Exp $ */
+/* $Id: pgsql.c,v 1.256 2003/01/15 10:21:15 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -2947,7 +2947,7 @@
 /* }}} */
 
 
-/* {{{ proto resource pg_get_result([resource connection])
+/* {{{ proto resource pg_get_result(resource connection)
Get asynchronous query result */
 PHP_FUNCTION(pg_get_result)
 {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-12-21 Thread Derick Rethans
derick  Sat Dec 21 12:48:37 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  MFB: Fix typo
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.252 php4/ext/pgsql/pgsql.c:1.253
--- php4/ext/pgsql/pgsql.c:1.252Mon Dec 16 02:46:36 2002
+++ php4/ext/pgsql/pgsql.c  Sat Dec 21 12:48:37 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.252 2002/12/16 07:46:36 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.253 2002/12/21 17:48:37 derick Exp $ */
 
 #include stdlib.h
 
@@ -466,9 +466,9 @@
 #if HAVE_PG_CONFIG_H
php_info_print_table_row(2, PostgreSQL(libpq) Version, PG_VERSION);
 #ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
-   php_info_print_table_row(2, Multibyte charater support, enabled);
+   php_info_print_table_row(2, Multibyte character support, enabled);
 #else
-   php_info_print_table_row(2, Multibyte charater support, disabled);
+   php_info_print_table_row(2, Multibyte character support, disabled);
 #endif
 #ifdef USE_SSL
php_info_print_table_row(2, SSL support, enabled);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-12-15 Thread Ilia Alshanetsky
iliaa   Mon Dec 16 02:46:36 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  A better memory leak patch.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.251 php4/ext/pgsql/pgsql.c:1.252
--- php4/ext/pgsql/pgsql.c:1.251Sun Dec 15 01:44:30 2002
+++ php4/ext/pgsql/pgsql.c  Mon Dec 16 02:46:36 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.251 2002/12/15 06:44:30 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.252 2002/12/16 07:46:36 iliaa Exp $ */
 
 #include stdlib.h
 
@@ -427,7 +427,8 @@
 PHP_MSHUTDOWN_FUNCTION(pgsql)
 {
UNREGISTER_INI_ENTRIES();
-   
+   zend_hash_destroy(PGG(notices));
+
return SUCCESS;
 }
 /* }}} */
@@ -447,7 +448,7 @@
 PHP_RSHUTDOWN_FUNCTION(pgsql)
 {
/* clean up notice messages */
-   zend_hash_destroy(PGG(notices));
+   zend_hash_clean(PGG(notices));
/* clean up persistent connection */
zend_hash_apply(EG(persistent_list), (apply_func_t) _rollback_transactions 
TSRMLS_CC);
return SUCCESS;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-12-14 Thread Ilia Alshanetsky
iliaa   Sun Dec 15 01:44:31 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed a memory leak.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.250 php4/ext/pgsql/pgsql.c:1.251
--- php4/ext/pgsql/pgsql.c:1.250Fri Nov 29 12:18:01 2002
+++ php4/ext/pgsql/pgsql.c  Sun Dec 15 01:44:30 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.250 2002/11/29 17:18:01 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.251 2002/12/15 06:44:30 iliaa Exp $ */
 
 #include stdlib.h
 
@@ -447,7 +447,7 @@
 PHP_RSHUTDOWN_FUNCTION(pgsql)
 {
/* clean up notice messages */
-   zend_hash_clean(PGG(notices));
+   zend_hash_destroy(PGG(notices));
/* clean up persistent connection */
zend_hash_apply(EG(persistent_list), (apply_func_t) _rollback_transactions 
TSRMLS_CC);
return SUCCESS;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-29 Thread Yasuo Ohgaki
yohgaki Fri Nov 29 12:18:01 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed problem with PostgreSQL 7.3
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.249 php4/ext/pgsql/pgsql.c:1.250
--- php4/ext/pgsql/pgsql.c:1.249Mon Nov 25 21:13:35 2002
+++ php4/ext/pgsql/pgsql.c  Fri Nov 29 12:18:01 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.249 2002/11/26 02:13:35 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.250 2002/11/29 17:18:01 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -464,7 +464,7 @@
php_info_print_table_header(2, PostgreSQL Support, enabled);
 #if HAVE_PG_CONFIG_H
php_info_print_table_row(2, PostgreSQL(libpq) Version, PG_VERSION);
-#ifdef MULTIBYTE
+#ifdef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT
php_info_print_table_row(2, Multibyte charater support, enabled);
 #else
php_info_print_table_row(2, Multibyte charater support, disabled);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-25 Thread Yasuo Ohgaki
yohgaki Mon Nov 25 21:13:35 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Remove a warning
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.248 php4/ext/pgsql/pgsql.c:1.249
--- php4/ext/pgsql/pgsql.c:1.248Sun Nov 24 20:38:29 2002
+++ php4/ext/pgsql/pgsql.c  Mon Nov 25 21:13:35 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.248 2002/11/25 01:38:29 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.249 2002/11/26 02:13:35 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -2714,7 +2714,7 @@
memcpy(buf, sp-2, 3);
buf[3] = '\0';
start = buf;
-   *bp = (unsigned char)strtoul(start, end, 8);
+   *bp = (unsigned char)strtoul(start, (char 
+**)end, 8);
buflen -= 3;
state = 0;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-24 Thread Marcus Börger
At 08:45 24.11.2002, Yasuo Ohgaki wrote:

yohgaki Sun Nov 24 02:45:27 2002 EDT

  Modified files:
/php4/ext/pgsql pgsql.c
  Log:
  Added missing '\0'


Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.244 php4/ext/pgsql/pgsql.c:1.245
--- php4/ext/pgsql/pgsql.c:1.244Tue Nov 12 04:07:36 2002
+++ php4/ext/pgsql/pgsql.c  Sun Nov 24 02:45:26 2002
@@ -19,7 +19,7 @@
+--+
  */

-/* $Id: pgsql.c,v 1.244 2002/11/12 09:07:36 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.245 2002/11/24 07:45:26 yohgaki Exp $ */

 #include stdlib.h

@@ -2730,7 +2730,8 @@
break;
}
}
-   buffer = erealloc(buffer, buflen);
+   buffer[buflen] = '\0';
+   buffer = erealloc(buffer, buflen+1);
if (buffer == NULL)
return NULL;



Erm shoudln't this better read:
+   buffer = erealloc(buffer, buflen+1);
+   buffer[buflen] = '\0';

as i understand the could it is possible that buflen will not be
decremented and then you would write zero behind the allocated
buffer.

marcus


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-24 Thread Sterling Hughes
sterlingSun Nov 24 10:11:43 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  null after the erealloc()
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.245 php4/ext/pgsql/pgsql.c:1.246
--- php4/ext/pgsql/pgsql.c:1.245Sun Nov 24 02:45:26 2002
+++ php4/ext/pgsql/pgsql.c  Sun Nov 24 10:11:43 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.245 2002/11/24 07:45:26 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.246 2002/11/24 15:11:43 sterling Exp $ */
 
 #include stdlib.h
 
@@ -2730,8 +2730,8 @@
break;
}
}
-   buffer[buflen] = '\0';
buffer = erealloc(buffer, buflen+1);
+   buffer[buflen] = 0;
if (buffer == NULL)
return NULL;
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-24 Thread Sterling Hughes
 sas   Sun Nov 24 11:23:38 2002 EDT
 
   Modified files:  
 /php4/ext/pgsql   pgsql.c 
   Log:
   Use proper form of NUL

I was under the assumption that 0 and '\0' were semantically equivalent.

-Sterling


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-24 Thread Yasuo Ohgaki
yohgaki Sun Nov 24 20:38:30 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Cleanup state=4 and avoid using sscanf()
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.247 php4/ext/pgsql/pgsql.c:1.248
--- php4/ext/pgsql/pgsql.c:1.247Sun Nov 24 11:23:37 2002
+++ php4/ext/pgsql/pgsql.c  Sun Nov 24 20:38:29 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.247 2002/11/24 16:23:37 sas Exp $ */
+/* $Id: pgsql.c,v 1.248 2002/11/25 01:38:29 yohgaki Exp $ */
 
 #include stdlib.h
 
@@ -2708,15 +2708,13 @@
case 3:
if (isdigit(*sp))   /* state=4 */
{
-   unsigned int  v,i;
-   unsigned char buf[4]; /* 000 + '\0' */
-
+   unsigned char *start, *end, buf[4]; /* 000 + 
+'\0' */
+   
bp -= 3;
-   for (i = 0; i  3; i++)
-   buf[i] = *((sp-2)+i);
-   buf[i] = '\0';
-   sscanf(buf, %03o, v);
-   *bp = v;
+   memcpy(buf, sp-2, 3);
+   buf[3] = '\0';
+   start = buf;
+   *bp = (unsigned char)strtoul(start, end, 8);
buflen -= 3;
state = 0;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-12 Thread Yasuo Ohgaki
yohgaki Tue Nov 12 04:07:36 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Speed up pg_escape_bytea, from O(n^2) = O(n). My test script speed up
  from 50 sec to 5 sec. (sscanf is too slow at least under my linux, I 
  might write better function that unescape values later)
  Use emalloc/erealloc for bundled PQescapeBytea(php_pgsql_escape_bytea)
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.243 php4/ext/pgsql/pgsql.c:1.244
--- php4/ext/pgsql/pgsql.c:1.243Tue Nov  5 09:28:32 2002
+++ php4/ext/pgsql/pgsql.c  Tue Nov 12 04:07:36 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.243 2002/11/05 14:28:32 iliaa Exp $ */
+/* $Id: pgsql.c,v 1.244 2002/11/12 09:07:36 yohgaki Exp $ */
 
 #include stdlib.h
 
 -2664,7 +2664,7 
return NULL;
buflen = strlen(strtext);   /* will shrink, also we discover if
 * strtext */
-   buffer = (unsigned char *) malloc(buflen);  /* isn't NULL terminated */
+   buffer = (unsigned char *) emalloc(buflen); /* isn't NULL terminated */
if (buffer == NULL)
return NULL;
for (bp = buffer, sp = strtext; *sp != '\0'; bp++, sp++)
 -2710,10 +2710,14 
case 3:
if (isdigit(*sp))   /* state=4 */
{
-   int v;
+   unsigned int  v,i;
+   unsigned char buf[4]; /* 000 + '\0' */
 
bp -= 3;
-   sscanf(sp - 2, %03o, v);
+   for (i = 0; i  3; i++)
+   buf[i] = *((sp-2)+i);
+   buf[i] = '\0';
+   sscanf(buf, %03o, v);
*bp = v;
buflen -= 3;
state = 0;
 -2726,7 +2730,7 
break;
}
}
-   buffer = realloc(buffer, buflen);
+   buffer = erealloc(buffer, buflen);
if (buffer == NULL)
return NULL;
 
 -2749,8 +2753,7 
if (!to) {
RETURN_FALSE;
}
-   RETVAL_STRINGL(to, to_len, 1);
-   free(to);
+   RETVAL_STRINGL(to, to_len, 0);
 }
 /* }}} */
 #endif



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-11-05 Thread Ilia Alshanetsky
iliaa   Tue Nov  5 09:28:32 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fix compile warning.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.242 php4/ext/pgsql/pgsql.c:1.243
--- php4/ext/pgsql/pgsql.c:1.242Thu Oct 24 15:05:29 2002
+++ php4/ext/pgsql/pgsql.c  Tue Nov  5 09:28:32 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.242 2002/10/24 19:05:29 helly Exp $ */
+/* $Id: pgsql.c,v 1.243 2002/11/05 14:28:32 iliaa Exp $ */
 
 #include stdlib.h
 
 -1564,8 +1564,10 
zval **result;
PGresult *pgsql_result;
pgsql_result_handle *pg_result;
+#ifdef HAVE_PQOIDVALUE
Oid oid;
-   
+#endif
+
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, result)==FAILURE) {
WRONG_PARAM_COUNT;
}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-10-19 Thread Yasuo Ohgaki
yohgaki Sat Oct 19 00:46:19 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Skip field when there is obvious error.
  Fixed freeing of wrong zval.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.238 php4/ext/pgsql/pgsql.c:1.239
--- php4/ext/pgsql/pgsql.c:1.238Sat Oct 19 00:01:27 2002
+++ php4/ext/pgsql/pgsql.c  Sat Oct 19 00:46:19 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.238 2002/10/19 04:01:27 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.239 2002/10/19 04:46:19 yohgaki Exp $ */
 
 #include stdlib.h
 
 -3356,6 +3356,8 
 zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)val, 
pos) == SUCCESS;
 zend_hash_move_forward_ex(Z_ARRVAL_P(values), pos)) {
skip_field = 0;
+   MAKE_STD_ZVAL(new_val);
+   
if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), 
field, field_len, num_idx, 0, pos)) == HASH_KEY_NON_EXISTANT) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Failed to get 
array key type);
err = 1;
 -3391,10 +3393,10 
err = 1;
}
if (err) {
+   skip_field = 1; /* prevent adding invalid feild */
break;
}

-   MAKE_STD_ZVAL(new_val);
switch(php_pgsql_get_data_type(Z_STRVAL_PP(type), Z_STRLEN_PP(type)))
{
case PG_BOOL:



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-10-19 Thread Yasuo Ohgaki
yohgaki Sat Oct 19 00:01:27 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Fixed typo.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.237 php4/ext/pgsql/pgsql.c:1.238
--- php4/ext/pgsql/pgsql.c:1.237Thu Oct 17 19:41:34 2002
+++ php4/ext/pgsql/pgsql.c  Sat Oct 19 00:01:27 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.237 2002/10/17 23:41:34 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.238 2002/10/19 04:01:27 yohgaki Exp $ */
 
 #include stdlib.h
 
 -3919,7 +3919,7 
return;
}
if (option  ~PGSQL_CONV_OPTS) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
spedified);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
+specified);
RETURN_FALSE;
}
if (!table_name_len) {
 -4078,7 +4078,7 
return;
}
if (option  
~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
spedified);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
+specified);
RETURN_FALSE;
}

 -4227,7 +4227,7 
return;
}
if (option  
~(PGSQL_CONV_OPTS|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
spedified);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
+specified);
RETURN_FALSE;
}

 -4315,7 +4315,7 
return;
}
if (option  
~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_STRING)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
spedified);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
+specified);
RETURN_FALSE;
}

 -4452,7 +4452,7 
return;
}
if (option  
~(PGSQL_CONV_FORCE_NULL|PGSQL_DML_NO_CONV|PGSQL_DML_EXEC|PGSQL_DML_ASYNC|PGSQL_DML_STRING))
 {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
spedified);
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid option is 
+specified);
RETURN_FALSE;
}




-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-10-19 Thread Derick Rethans
derick  Sat Oct 19 08:58:41 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  - Style polizei =)
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.240 php4/ext/pgsql/pgsql.c:1.241
--- php4/ext/pgsql/pgsql.c:1.240Sat Oct 19 02:05:16 2002
+++ php4/ext/pgsql/pgsql.c  Sat Oct 19 08:58:41 2002
@@ -19,7 +19,7 @@
+--+
  */
  
-/* $Id: pgsql.c,v 1.240 2002/10/19 06:05:16 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.241 2002/10/19 12:58:41 derick Exp $ */
 
 #include stdlib.h
 
@@ -71,7 +71,7 @@
 #define PQ_SETNONBLOCKING(pg_link, flag) 0
 #endif
 
-#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, 
E_WARNING, No PostgreSQL link opened yet); }
+#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, 
+E_WARNING, No PostgreSQL link opened yet.); }
 
 /* {{{ pgsql_functions[]
  */
@@ -308,7 +308,7 @@
link = (PGconn *) rsrc-ptr;
 
if (PQ_SETNONBLOCKING(link, 0)) {
-   php_error_docref(ref.pgsql TSRMLS_CC, E_NOTICE, Cannot set 
connection to blocking mode);
+   php_error_docref(ref.pgsql TSRMLS_CC, E_NOTICE, Cannot set 
+connection to blocking mode.);
return -1;
}

@@ -541,12 +541,12 @@

if (PGG(max_links)!=-1  PGG(num_links)=PGG(max_links)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
-Cannot create new 
link. Too many open links (%d), PGG(num_links));
+Cannot create new 
+link. Too many open links (%d)., PGG(num_links));
goto err;
}
if (PGG(max_persistent)!=-1  
PGG(num_persistent)=PGG(max_persistent)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
-Cannot create new 
link. Too many open persistent links (%d), PGG(num_persistent));
+Cannot create new 
+link. Too many open persistent links (%d)., PGG(num_persistent));
goto err;
}
 
@@ -558,7 +558,7 @@
}
if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
php_error_docref(NULL TSRMLS_CC, E_WARNING,
-Unable to connect to 
PostgreSQL server: %s, PQerrorMessage(pgsql));
+Unable to connect to 
+PostgreSQL server: %s., PQerrorMessage(pgsql));
if (pgsql) {
PQfinish(pgsql);
}
@@ -597,7 +597,7 @@
PQreset(le-ptr);
}
if (le-ptr==NULL || 
PQstatus(le-ptr)==CONNECTION_BAD) {
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING,PostgreSQL link lost, unable to reconnect);
+   php_error_docref(NULL TSRMLS_CC, 
+E_WARNING,PostgreSQL link lost, unable to reconnect.);

zend_hash_del(EG(persistent_list),str.c,str.len+1);
goto err;
}
@@ -634,7 +634,7 @@
}
}
if (PGG(max_links)!=-1  PGG(num_links)=PGG(max_links)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot create new 
link. Too many open links (%d), PGG(num_links));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Cannot create new 
+link. Too many open links (%d)., PGG(num_links));
goto err;
}
if (connstring) {
@@ -643,7 +643,7 @@
pgsql = PQsetdb(host,port,options,tty,dbname);
}
if (pgsql==NULL || PQstatus(pgsql)==CONNECTION_BAD) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to connect 
to PostgreSQL server: %s, PQerrorMessage(pgsql));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to connect 
+to PostgreSQL server: %s., PQerrorMessage(pgsql));
goto err;
}
 
@@ -918,7 +918,7 @@
 
convert_to_string_ex(query);
if (PQ_SETNONBLOCKING(pgsql, 0)) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE,Cannot set connection to 
blocking mode);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE,Cannot set connection to 
+blocking mode.);
RETURN_FALSE;
  

[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2002-10-17 Thread Yasuo Ohgaki

yohgaki Thu Oct 17 03:58:47 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Added async message function - pg_get_notify()
  
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.235 php4/ext/pgsql/pgsql.c:1.236
--- php4/ext/pgsql/pgsql.c:1.235Sun Oct 13 05:48:18 2002
+++ php4/ext/pgsql/pgsql.c  Thu Oct 17 03:58:46 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.235 2002/10/13 09:48:18 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.236 2002/10/17 07:58:46 yohgaki Exp $ */
 
 #include stdlib.h
 
 -114,6 +114,8 
PHP_FE(pg_field_type,   NULL)
PHP_FE(pg_field_prtlen, NULL)
PHP_FE(pg_field_is_null,NULL)
+   /* async message function */
+   PHP_FE(pg_get_notify,   NULL)
/* error message functions */
PHP_FE(pg_result_error, NULL)
PHP_FE(pg_last_error,   NULL)
 -3004,6 +3006,44 
}
 }
 /* }}} */
+
+
+/* {{{ proto resource pg_get_notify([resource connection[, result_type]])
+   Get asynchronous notification */
+PHP_FUNCTION(pg_get_notify)
+{
+   zval *pgsql_link;
+   int id = -1, result_type = PGSQL_ASSOC;
+   PGconn *pgsql;
+   PGresult *pgsql_result;
+   PGnotify *pgsql_notify;
+   pgsql_result_handle *pg_result;
+
+   if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
+TSRMLS_CC, r|l,
+pgsql_link) == 
+FAILURE) {
+   RETURN_FALSE;
+   }
+
+   ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, PostgreSQL link, 
+le_link, le_plink);
+
+   PQconsumeInput(pgsql);
+   pgsql_notify = PQnotifies(pgsql);
+   if (!pgsql_notify) {
+   /* no notify message */
+   RETURN_FALSE;
+   }
+   array_init(return_value);
+   if (result_type  (PGSQL_NUM|PGSQL_BOTH)) {
+   add_index_string(return_value, 0, pgsql_notify-relname, 1);
+   add_index_long(return_value, 1, pgsql_notify-be_pid);
+   }
+   if (result_type  (PGSQL_ASSOC|PGSQL_BOTH)) {
+   add_assoc_string(return_value, message, pgsql_notify-relname, 1);
+   add_assoc_long(return_value, pid, pgsql_notify-be_pid);
+   }
+}
+/* }}} */
+
 
 /* {{{ php_pgsql_meta_data
  * TODO: Add meta_data cache for better performance
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.54 php4/ext/pgsql/php_pgsql.h:1.55
--- php4/ext/pgsql/php_pgsql.h:1.54 Sun Oct 13 05:37:27 2002
+++ php4/ext/pgsql/php_pgsql.h  Thu Oct 17 03:58:46 2002
 -17,7 +17,7 
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.54 2002/10/13 09:37:27 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.55 2002/10/17 07:58:46 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
 -97,6 +97,8 
 PHP_FUNCTION(pg_field_type);
 PHP_FUNCTION(pg_field_prtlen);
 PHP_FUNCTION(pg_field_is_null);
+/* async message functions */
+PHP_FUNCTION(pg_get_notify);
 /* error message functions */
 PHP_FUNCTION(pg_result_error);
 PHP_FUNCTION(pg_last_error);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sat Oct 12 23:00:49 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Enable pg_escape_bytea().
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.231 php4/ext/pgsql/pgsql.c:1.232
--- php4/ext/pgsql/pgsql.c:1.231Wed Oct  2 22:32:09 2002
+++ php4/ext/pgsql/pgsql.c  Sat Oct 12 23:00:47 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.231 2002/10/03 02:32:09 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.232 2002/10/13 03:00:47 yohgaki Exp $ */
 
 #include stdlib.h
 
 -142,6 +142,7 
 #if HAVE_PQESCAPE
PHP_FE(pg_escape_string,NULL)
PHP_FE(pg_escape_bytea, NULL)
+   PHP_FE(pg_unescape_bytea, NULL)
 #endif
 #if HAVE_PQCLIENTENCODING
PHP_FE(pg_client_encoding,  NULL)
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.52 php4/ext/pgsql/php_pgsql.h:1.53
--- php4/ext/pgsql/php_pgsql.h:1.52 Wed Oct  2 22:32:09 2002
+++ php4/ext/pgsql/php_pgsql.h  Sat Oct 12 23:00:48 2002
 -17,7 +17,7 
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.52 2002/10/03 02:32:09 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.53 2002/10/13 03:00:48 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
 -129,6 +129,7 
 #if HAVE_PQESCAPE
 PHP_FUNCTION(pg_escape_string);
 PHP_FUNCTION(pg_escape_bytea);
+PHP_FUNCTION(pg_unescape_bytea);
 #endif
 
 /* misc functions */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sun Oct 13 05:37:27 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Introduce connect_type option to pg_connect().
  pg_connect(conn_str, conn_type) is allowed. 
  Added PGSQL_CONNECT_FORCE_NEW option to pg_connect() (Yasuo)
  # If you have better idea about constant name(s), let me know.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.232 php4/ext/pgsql/pgsql.c:1.233
--- php4/ext/pgsql/pgsql.c:1.232Sat Oct 12 23:00:47 2002
+++ php4/ext/pgsql/pgsql.c  Sun Oct 13 05:37:27 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.232 2002/10/13 03:00:47 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.233 2002/10/13 09:37:27 yohgaki Exp $ */
 
 #include stdlib.h
 
 -381,6 +381,8 
le_result = zend_register_list_destructors_ex(_free_result, NULL, pgsql 
result, module_number);
le_lofp = zend_register_list_destructors_ex(_free_ptr, NULL, pgsql large 
object, module_number);
le_string = zend_register_list_destructors_ex(_free_ptr, NULL, pgsql string, 
module_number);
+   /* For connection option */
+   REGISTER_LONG_CONSTANT(PGSQL_CONNECT_FORCE_NEW, PGSQL_CONNECT_FORCE_NEW, 
+CONST_CS | CONST_PERSISTENT);
/* For pg_fetch_array() */
REGISTER_LONG_CONSTANT(PGSQL_ASSOC, PGSQL_ASSOC, CONST_CS | 
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT(PGSQL_NUM, PGSQL_NUM, CONST_CS | CONST_PERSISTENT);
 -489,9 +491,9 
PGconn *pgsql;
smart_str str = {0};
zval **args[5];
-   int i;
+   int i, connect_type = 0;
 
-   if (ZEND_NUM_ARGS()  1 || ZEND_NUM_ARGS() == 2 || ZEND_NUM_ARGS()  5
+   if (ZEND_NUM_ARGS()  1 || ZEND_NUM_ARGS()  5
|| zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args) == 
FAILURE) {
WRONG_PARAM_COUNT;
}
 -508,6 +510,9 
 
if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */
connstring = Z_STRVAL_PP(args[0]);
+   } else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 
+args was illegal */
+   convert_to_long_ex(args[1]);
+   connect_type = Z_LVAL_PP(args[1]);
} else {
host = Z_STRVAL_PP(args[0]);
port = Z_STRVAL_PP(args[1]);
 -596,7 +601,7 
pgsql = (PGconn *) le-ptr;
}
ZEND_REGISTER_RESOURCE(return_value, pgsql, le_plink);
-   } else {
+   } else { // Non persistent connection
list_entry *index_ptr,new_index_ptr;

/* first we check the hash for the hashed_details key.  if it exists,
 -604,7 +609,8 
 * if it doesn't, open a new pgsql link, add it to the resource list,
 * and add a pointer to it with hashed_details as the key.
 */
-   if (zend_hash_find(EG(regular_list),str.c,str.len+1,(void **) 
index_ptr)==SUCCESS) {
+   if (!(connect_type  PGSQL_CONNECT_FORCE_NEW)
+zend_hash_find(EG(regular_list),str.c,str.len+1,(void **) 
+index_ptr)==SUCCESS) {
int type,link;
void *ptr;
 
 -678,7 +684,7 
 /* }}} */
 #endif
 
-/* {{{ proto resource pg_connect([string connection_string] | [string host, string 
port [, string options [, string tty,]] string database)
+/* {{{ proto resource pg_connect(string connection_string[, int connect_type] | 
+[string host, string port [, string options [, string tty,]]] string database)
Open a PostgreSQL connection */
 PHP_FUNCTION(pg_connect)
 {
 -686,7 +692,7 
 }
 /* }}} */
 
-/* {{{ proto resource pg_pconnect([string connection_string] | [string host, string 
port [, string options [, string tty,]] string database)
+/* {{{ proto resource pg_pconnect(string connection_string | [string host, string 
+port [, string options [, string tty,]]] string database)
Open a persistent PostgreSQL connection */
 PHP_FUNCTION(pg_pconnect)
 {
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.53 php4/ext/pgsql/php_pgsql.h:1.54
--- php4/ext/pgsql/php_pgsql.h:1.53 Sat Oct 12 23:00:48 2002
+++ php4/ext/pgsql/php_pgsql.h  Sun Oct 13 05:37:27 2002
 -17,7 +17,7 
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.53 2002/10/13 03:00:48 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.54 2002/10/13 09:37:27 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
 -140,6 +140,8 
 PHP_FUNCTION(pg_delete);
 PHP_FUNCTION(pg_select);
 
+/* connection options - ToDo: Add async connection option */
+#define PGSQL_CONNECT_FORCE_NEW (11)
 /* php_pgsql_convert options */
 #define PGSQL_CONV_IGNORE_DEFAULT   (11) /* Do not use DEAFULT value by 
removing field from returned array */
 #define PGSQL_CONV_FORCE_NULL   (12) /* Convert to NULL if string is 

[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-10-13 Thread Yasuo Ohgaki

yohgaki Sun Oct 13 05:41:36 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Need to init connstring when there are 2 args.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.233 php4/ext/pgsql/pgsql.c:1.234
--- php4/ext/pgsql/pgsql.c:1.233Sun Oct 13 05:37:27 2002
+++ php4/ext/pgsql/pgsql.c  Sun Oct 13 05:41:35 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.233 2002/10/13 09:37:27 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.234 2002/10/13 09:41:35 yohgaki Exp $ */
 
 #include stdlib.h
 
 -511,6 +511,7 
if (ZEND_NUM_ARGS() == 1) { /* new style, using connection string */
connstring = Z_STRVAL_PP(args[0]);
} else if (ZEND_NUM_ARGS() == 2 ) { /* Safe to add conntype_option, since 2 
args was illegal */
+   connstring = Z_STRVAL_PP(args[0]);
convert_to_long_ex(args[1]);
connect_type = Z_LVAL_PP(args[1]);
} else {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-09-30 Thread Yasuo Ohgaki

yohgaki Mon Sep 30 03:24:42 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Use of PGSQL_CONV_INGORE_NOT_NULL as it is supposed. Change comment a little.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.221 php4/ext/pgsql/pgsql.c:1.222
--- php4/ext/pgsql/pgsql.c:1.221Mon Sep 30 00:15:39 2002
+++ php4/ext/pgsql/pgsql.c  Mon Sep 30 03:24:41 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.221 2002/09/30 04:15:39 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.222 2002/09/30 07:24:41 yohgaki Exp $ */
 
 #include stdlib.h
 
 -3040,14 +3040,14 
 
 #define PGSQL_CONV_CHECK_IGNORE() \
if (!err  Z_TYPE_P(new_val) == IS_STRING  
!strcmp(Z_STRVAL_P(new_val), NULL)) { \
-   /* if value is NULL and has default, remove 
entry to use default value*/ \
+   /* if new_value is string NULL and field has 
+default value, remove element to use default value */ \
if (!(opt  PGSQL_CONV_IGNORE_DEFAULT)  
Z_BVAL_PP(has_default)) { \
zval_dtor(new_val); \
FREE_ZVAL(new_val); \
skip_field = 1; \
} \
-   /* raise error if it's not null */ \
-   else if (Z_BVAL_PP(not_null)) { \
+   /* raise error if it's not null and cannot be 
+ignored */ \
+   else if (!(opt  PGSQL_CONV_IGNORE_NOT_NULL) 
+ Z_BVAL_PP(not_null)) { \
php_error_docref(NULL TSRMLS_CC, 
E_NOTICE, Detected NULL for 'NOT NULL' field '%s', field ); \
err = 1; \
} \



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-09-30 Thread Yasuo Ohgaki

yohgaki Mon Sep 30 03:35:41 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Use PGSQL_CONV_FORCE_NULL as it is supposed.
  PGSQL_CONV_FORCE_NULL inserts NULL to field instead of 
  NULL string for string type tuples.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.222 php4/ext/pgsql/pgsql.c:1.223
--- php4/ext/pgsql/pgsql.c:1.222Mon Sep 30 03:24:41 2002
+++ php4/ext/pgsql/pgsql.c  Mon Sep 30 03:35:41 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.222 2002/09/30 07:24:41 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.223 2002/09/30 07:35:41 yohgaki Exp $ */
 
 #include stdlib.h
 
 -3269,7 +3269,12 
switch (Z_TYPE_PP(val)) {
case IS_STRING:
if (Z_STRLEN_PP(val) == 0) {
-   ZVAL_STRING(new_val, 
empty_string, 1);
+   if (opt  
+PGSQL_CONV_FORCE_NULL) {
+   ZVAL_STRING(new_val, 
+NULL, 1);
+   }
+   else {
+   ZVAL_STRING(new_val, 
+empty_string, 1);
+   }
}
else {
Z_TYPE_P(new_val) = IS_STRING;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c php_pgsql.h

2002-09-30 Thread Yasuo Ohgaki

yohgaki Mon Sep 30 05:07:58 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c php_pgsql.h 
  Log:
  Added pg_fetch_assoc(). Fixed proto. Added/fixed comments.
  # It seems last attempt was failed. Try committing again.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.223 php4/ext/pgsql/pgsql.c:1.224
--- php4/ext/pgsql/pgsql.c:1.223Mon Sep 30 03:35:41 2002
+++ php4/ext/pgsql/pgsql.c  Mon Sep 30 05:07:57 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.223 2002/09/30 07:35:41 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.224 2002/09/30 09:07:57 yohgaki Exp $ */
 
 #include stdlib.h
 
 -95,6 +95,7 
/* result functions */
PHP_FE(pg_fetch_result, NULL)
PHP_FE(pg_fetch_row,NULL)
+   PHP_FE(pg_fetch_assoc,  NULL)
PHP_FE(pg_fetch_array,  NULL)
PHP_FE(pg_fetch_object, NULL)
PHP_FE(pg_fetch_all,NULL)
 -1326,6 +1327,18 
 }
 /* }}} */
 
+/* {{{ proto array pg_fetch_assoc(resource result [, int row])
+   Fetch a row as an assoc array */
+PHP_FUNCTION(pg_fetch_assoc)
+{
+   /* pg_fetch_assoc() is added from PHP 4.3.0. It should raise error, when
+  there is 3rd parameter */
+   if (ZEND_NUM_ARGS()  2)
+   WRONG_PARAM_COUNT;
+   php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC);
+}
+/* }}} */
+
 /* {{{ proto array pg_fetch_array(resource result [, int row [, int result_type]])
Fetch a row as an array */
 PHP_FUNCTION(pg_fetch_array)
 -1334,10 +1347,12 
 }
 /* }}} */
 
-/* {{{ proto object pg_fetch_object(resource result [, int row[, int result_type]])
+/* {{{ proto object pg_fetch_object(resource result [, int row])
Fetch a row as an object */
 PHP_FUNCTION(pg_fetch_object)
 {
+   /* pg_fetch_object() allowed result_type used to be. 3rd parameter
+  must be allowed for compatibility */
php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, PGSQL_ASSOC);
if (Z_TYPE_P(return_value)==IS_ARRAY) {
object_and_properties_init(return_value, ZEND_STANDARD_CLASS_DEF_PTR, 
Z_ARRVAL_P(return_value));
 -3794,7 +3809,7 
 }
 /* }}} */
 
-/* {{{ proto bool pg_insert(resource db, string table, array values[, int options])
+/* {{{ proto mixed pg_insert(resource db, string table, array values[, int options])
Insert values (filed=value) to table */
 PHP_FUNCTION(pg_insert)
 {
 -3943,7 +3958,7 
 }
 /* }}} */
 
-/* {{{ proto bool pg_update(resource db, string table, array fields, array ids[, int 
options])
+/* {{{ proto mixed pg_update(resource db, string table, array fields, array ids[, int 
+options])
Update table using values (field=value) and ids (id=value) */
 PHP_FUNCTION(pg_update)
 {
 -4032,7 +4047,7 
 }
 /* }}} */
 
-/* {{{ proto bool pg_delete(resource db, string table, array ids[, int options])
+/* {{{ proto mixed pg_delete(resource db, string table, array ids[, int options])
Delete records has ids (id=value) */
 PHP_FUNCTION(pg_delete)
 {
 -4169,7 +4184,7 
 }
 /* }}} */
 
-/* {{{ proto array pg_select(resource db, string table, array ids[, int options])
+/* {{{ proto mixed pg_select(resource db, string table, array ids[, int options])
Select records that has ids (id=value) */
 PHP_FUNCTION(pg_select)
 {
Index: php4/ext/pgsql/php_pgsql.h
diff -u php4/ext/pgsql/php_pgsql.h:1.47 php4/ext/pgsql/php_pgsql.h:1.48
--- php4/ext/pgsql/php_pgsql.h:1.47 Sun Jul 21 03:25:10 2002
+++ php4/ext/pgsql/php_pgsql.h  Mon Sep 30 05:07:57 2002
 -17,7 +17,7 
+--+
  */
  
-/* $Id: php_pgsql.h,v 1.47 2002/07/21 07:25:10 yohgaki Exp $ */
+/* $Id: php_pgsql.h,v 1.48 2002/09/30 09:07:57 yohgaki Exp $ */
 
 #ifndef PHP_PGSQL_H
 #define PHP_PGSQL_H
 -76,6 +76,7 
 PHP_FUNCTION(pg_send_query);
 PHP_FUNCTION(pg_cancel_query);
 /* result functions */
+PHP_FUNCTION(pg_fetch_assoc);
 PHP_FUNCTION(pg_fetch_array);
 PHP_FUNCTION(pg_fetch_object);
 PHP_FUNCTION(pg_fetch_result);
 -142,7 +143,7 
 #define PGSQL_CONV_IGNORE_NOT_NULL  (13) /* Ignore NOT NULL constraints */
 #define PGSQL_CONV_OPTS 
(PGSQL_CONV_IGNORE_DEFAULT|PGSQL_CONV_FORCE_NULL|PGSQL_CONV_IGNORE_NOT_NULL)
 /* php_pgsql_insert/update/select/delete options */
-#define PGSQL_DML_NO_CONV   (18) /* Call php_pgsql_convert() */
+#define PGSQL_DML_NO_CONV   (18) /* Do not call php_pgsql_convert() */
 #define PGSQL_DML_EXEC  (19) /* Execute query */
 #define PGSQL_DML_ASYNC (110)/* Do async query */
 #define PGSQL_DML_STRING(111)/* Return query string */



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-CVS] cvs: php4 /ext/pgsql pgsql.c

2002-09-29 Thread Yasuo Ohgaki

yohgaki Sun Sep 29 23:51:54 2002 EDT

  Modified files:  
/php4/ext/pgsql pgsql.c 
  Log:
  Improve error message. Fix proto.
  
  
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.218 php4/ext/pgsql/pgsql.c:1.219
--- php4/ext/pgsql/pgsql.c:1.218Wed Sep  4 18:25:13 2002
+++ php4/ext/pgsql/pgsql.c  Sun Sep 29 23:51:54 2002
 -19,7 +19,7 
+--+
  */
  
-/* $Id: pgsql.c,v 1.218 2002/09/04 22:25:13 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.219 2002/09/30 03:51:54 yohgaki Exp $ */
 
 #include stdlib.h
 
 -2296,7 +2296,7 
 }
 /* }}} */
 
-/* {{{ proto array pg_copy_to(int connection, string table_name [, string delimiter 
[, string null_as]])
+/* {{{ proto array pg_copy_to(resource connection, string table_name [, string 
+delimiter [, string null_as]])
Copy table to array */
 PHP_FUNCTION(pg_copy_to)
 {
 -2357,7 +2357,7 
while (!copydone)
{
if ((ret = PQgetline(pgsql, copybuf, 
COPYBUFSIZ))) {
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Query failed: %s, PQerrorMessage(pgsql));
+   php_error_docref(NULL TSRMLS_CC, 
+E_WARNING, getline failed: %s, PQerrorMessage(pgsql));
RETURN_FALSE;
}

 -2391,7 +2391,7 
}
}
if (PQendcopy(pgsql)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Query failed: %s, PQerrorMessage(pgsql));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+endcopy failed: %s, PQerrorMessage(pgsql));
RETURN_FALSE;
}
while ((pgsql_result = PQgetResult(pgsql))) {
 -2404,14 +2404,14 
break;
default:
PQclear(pgsql_result);
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, Query failed: 
%s, PQerrorMessage(pgsql));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, COPY command 
+failed: %s, PQerrorMessage(pgsql));
RETURN_FALSE;
break;
}
 }
 /* }}} */
 
-/* {{{ proto bool pg_copy_from(int connection, string table_name , array rows [, 
string delimiter [, string null_as]])
+/* {{{ proto bool pg_copy_from(resource connection, string table_name , array rows [, 
+string delimiter [, string null_as]])
Copy table from array */
 PHP_FUNCTION(pg_copy_from)
 {
 -2468,21 +2468,22 
convert_to_string_ex(tmp);
query = (char *)emalloc(Z_STRLEN_PP(tmp) +2);
strcpy(query, Z_STRVAL_PP(tmp));
-   if(*(query+Z_STRLEN_PP(tmp)-1) != '\n') 
strcat(query, \n);
+   if(*(query+Z_STRLEN_PP(tmp)-1) != '\n')
+   strcat(query, \n);
if (PQputline(pgsql, query)) {
efree(query);
-   php_error_docref(NULL TSRMLS_CC, 
E_WARNING, Query failed: %s, PQerrorMessage(pgsql));
+   php_error_docref(NULL TSRMLS_CC, 
+E_WARNING, copy failed: %s, PQerrorMessage(pgsql));
RETURN_FALSE;
}
efree(query);
zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), 
pos);
}
-   if (PQputline(pgsql, \\.\n)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Query failed: %s, PQerrorMessage(pgsql));
+   if (PQputline(pgsql, \\.\n) == EOF) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+putline failed: %s, PQerrorMessage(pgsql));
RETURN_FALSE;
}
if (PQendcopy(pgsql)) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
Query failed: %s, PQerrorMessage(pgsql));
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, 
+endcopy failed: %s, PQerrorMessage(pgsql));
RETURN_FALSE;
}
while ((pgsql_result = PQgetResult(pgsql)))