php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31021 pg_last_notice() is needed to get all notice messages.
Submitted: 2004-12-08 14:44 UTC Modified: 2015-12-18 04:08 UTC
From: ppo at beeznest dot net Assigned: yohgaki
Status: Closed Package: PostgreSQL related
PHP Version: Irrelevant OS:
Private report: No CVE-ID:
 [2004-12-08 14:44 UTC] ppo at beeznest dot net
Description:
------------
Hi,

having the equivalent of pg_result_error for notice messages would be great.
There is also a problem if a query raises several notice messages. Could it be possible to return an array instead of a string, at least if there are several ones?

Thanks,
Pascal


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-08 14:52 UTC] tony2001@php.net
pg_last_notice() - is that what you need ?
 [2004-12-08 15:00 UTC] ppo at beeznest dot net
No, I mean
  mixed pg_result_notice(resource result)
returning a string if one notice message and an array if several ones.
 [2011-01-01 23:16 UTC] jani@php.net
-Package: Feature/Change Request +Package: PostgreSQL related
 [2013-06-26 21:47 UTC] yohgaki@php.net
-Summary: pg_result_notice +Summary: pg_result_notice() is needed to get all notice messages. -Status: Open +Status: Assigned -Assigned To: +Assigned To: yohgaki
 [2013-06-26 21:47 UTC] yohgaki@php.net
Currently, only the last notice message is stored by pgsql module.

/* {{{ _php_pgsql_notice_handler
 */
static void _php_pgsql_notice_handler(void *resource_id, const char *message)
{
	php_pgsql_notice *notice;
	
	TSRMLS_FETCH();
	if (! PGG(ignore_notices)) {
		notice = (php_pgsql_notice *)emalloc(sizeof(php_pgsql_notice));
		notice->message = _php_pgsql_trim_message(message, (int 
*)&notice->len);
		if (PGG(log_notices)) {
			php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s", notice-
>message);
		}
		zend_hash_index_update(&PGG(notices), (ulong)resource_id, (void 
**)&notice, sizeof(php_pgsql_notice *), NULL);
	}
}
/* }}} */


Nested hash for notices is required.
 [2015-12-16 22:36 UTC] yohgaki@php.net
-Status: Assigned +Status: Closed
 [2015-12-18 04:08 UTC] yohgaki@php.net
-Summary: pg_result_notice() is needed to get all notice messages. +Summary: pg_last_notice() is needed to get all notice messages.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Tue Jul 25 16:01:42 2017 UTC