From: | Grzegorz Ornoch <yanegorz(at)gmail(dot)com> |
---|---|
To: | Frank Naude <naudefj(at)gmail(dot)com> |
Cc: | pgsql-php(at)postgresql(dot)org |
Subject: | Re: pg_last_error() doesn't return connection errors |
Date: | 2010-08-27 10:22:40 |
Message-ID: | AANLkTinGNuVN3wWe2u08x5MhWtBOV--=71FCCMvrbksv@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-php |
Hi
Try this function
/**
* @name pg_error
*
* @param pg resource result
* @param pg resource connection
*
* @return string content of the error pg
*
*/
function pg_error($result, $connection)
{
return ($result === false ? pg_last_error($connection) :
pg_result_error($result));
}
--
Regards
Grzegorz Ornoch
On Fri, Aug 27, 2010 at 11:17 AM, Frank Naude <naudefj(at)gmail(dot)com> wrote:
> Hi Andrew,
>
> Thank you very much for the reply!
>
> > Alternatively, does pg_errormessage() have the same flaw...?
>
> Unfortunately pg_errormessage() doesn't work either. It returns:
>
> Warning: pg_errormessage() [function.pg-errormessage]: No PostgreSQL
> link opened yet in...
>
> > That behaviour doesn't seem particularly unnatural to me,...
>
> It is inconsistent with how the other DB modules behave. I can provide
> you with some examples if it would help.
>
> Best regards.
>
> Frank
>
> --
> Sent via pgsql-php mailing list (pgsql-php(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-php
>
From | Date | Subject | |
---|---|---|---|
Next Message | Frank Naude | 2010-08-27 12:26:33 | Re: pg_last_error() doesn't return connection errors |
Previous Message | Frank Naude | 2010-08-27 09:17:18 | Re: pg_last_error() doesn't return connection errors |