Re: PDO and PostgreSQL - RAISE NOTICE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <samuel.roze@xxxxxxxxxxxx> 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux