Re: PDO and PostgreSQL - RAISE NOTICE

Re: PDO and PostgreSQL - RAISE NOTICE

am 05.10.2009 07:30:28 von Samuel ROZE

Hi,
Thanks for your reply.

In fact, my request returns a result which i get with the fetch method.
But, it must returns other informations, which are not in the result...
This informations are neturned before the result in console...

So, i don't know how I can get that.

Samuel.

Le lundi 05 octobre 2009 à 09:55 +1100, Kesavan Rengarajan a écrit :
> Hi,
> Query returns an iterable object (thanks to the comments in the php
> site) and that's why when you do a dump you just see the String,
> If you just want to get one row from the resultset you can get it like
> this:
> $stat = $sql->query('SELECT * FROM public.test_info()')->fetch();
>
> More information on the PDO::query method can be found here: http://au.php.net/manual/en/pdo.query.php
>
> Cheers
> Sent from my iPhone
>
> On 05/10/2009, at 2:06 AM, Samuel ROZE wrote:
>
> > Hi !
> >
> > I'm new on this mailling list, so i don't realy know if you know the
> > response and if it is realy here that I have to ask my question :-)
> >
> > I'm working with PostgreSQL (8.3 form sources) and PDO (PHP 5.2.10
> > from
> > sources). In a Postgres function, I have a "RAISE NOTICE" command. My
> > function works like that in console:
> >
> > => SELECT * FROM public.test_info();
> > NOTICE: An information...
> >
> > test_info
> > ------------
> > ok
> > (1 line)
> >
> > There's a NOTICE, like I want ! :-) But, when i'm using PDO, I don't
> > know how I can get this NOTICE, which will provide me some
> > informations
> > about the usage of the function.
> >
> > Code:
> > ----------------------------------------------
> > > > $sql = new PDO('...');
> >
> > $stat = $sql->query('SELECT * FROM public.test_info()');
> > var_dump($stat);
> > ?>
> > ----------------------------------------------
> >
> > Output:
> > ----------------------------------------------
> > object(PDOStatement)#4 (1) {
> > ["queryString"]=>
> > string(34) "SELECT * FROM public.test_info()"
> > }
> > ----------------------------------------------
> >
> > Is there someone who know how I can get that ? I read some thinks
> > about
> > that and pg_last_notice may returns the NOTICE, but with PDO ?
> >
> > Thanks !
> > Samuel (French).
> >
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >


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

Re: PDO and PostgreSQL - RAISE NOTICE

am 05.10.2009 09:36:50 von Lester Caine

Samuel ROZE wrote:
> Hi,
> Thanks for your reply.
>
> In fact, my request returns a result which i get with the fetch method.
> But, it must returns other informations, which are not in the result...
> This informations are neturned before the result in console...
>
> So, i don't know how I can get that.

PDO does not support many of the 'additional' features that databases
provide. It's designed to provide a 'lowest common denominator' solution
JUST for the data. If you are NOT planning to use any other database
then you may well find that the native postgres driver will provide
these additional facilities.

I use Firebird myself so can't comment on the 'fine detail' on postgres,
but some of the Firebird options can't easily be supported in PDO ;)

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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