Re: Query Problems with PDO, PDO_PGSQL
| From: | Edin Kadribasic | Date: | Fri, 25 Feb 2005 22:42:16 +0000 |
| Subject: | Re: Query Problems with PDO, PDO_PGSQL | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-2064@lists.php.net to get a copy of this message | ||
Could you please try the latest php-5.1 snap (which now includes pdo so none
of the pear install problems). I belive that this bug was already solved.
(http://pecl.php.net/bugs/bug.php?id=3478)
Edin
----- Original Message -----
From: "Gavin Roy" <gmr.pear@gmail.com>
To: <pecl-dev@lists.php.net>
Sent: Thursday, February 24, 2005 10:42 PM
Subject: [PECL-DEV] Query Problems with PDO, PDO_PGSQL
> I believe there's a bug with using database side functions in a SELECT
> with PDO_PGSQL. When I issue the following query in psql I get the
> results as such:
>
> framewerk_www=> SELECT a.category, count(b.cmskey) AS cnt FROM
> cms_categories AS a LEFT JOIN cms_keys AS b ON b.category = a.category
> GROUP BY a.category ORDER BY a.category;
> category | cnt
> -------------------+-----
> Documentation | 7
> Public | 13
> Site Instructions | 5
> (3 rows)
>
> However the following code produces the results with nothing in the
> "cnt" column:
>
> $query = $this->PDO->prepare("SELECT a.category,
> count(b.cmskey) AS cnt FROM cms_categories AS a LEFT JOIN cms_keys AS
> b ON b.category = a.category GROUP BY a.category ORDER BY
> a.category;");
> $query->Execute();
> $rows = $query->fetchAll(PDO_FETCH_OBJ);
> print_r($rows);
>
> Array
> (
> [0] => stdClass Object
> (
> [category] => Documentation
> [cnt] =>
> )
>
> [1] => stdClass Object
> (
> [category] => Public
> [cnt] =>
> )
>
> [2] => stdClass Object
> (
> [category] => Site Instructions
> [cnt] =>
> )
>
> )
>
> Likewise if I change fetchAll to include no parameters:
>
> Array
> (
> [0] => Array
> (
> [category] => Documentation
> [0] => Documentation
> [cnt] =>
> [1] =>
> )
>
> [1] => Array
> (
> [category] => Public
> [0] => Public
> [cnt] =>
> [1] =>
> )
>
> [2] => Array
> (
> [category] => Site Instructions
> [0] => Site Instructions
> [cnt] =>
> [1] =>
> )
>
> )
>
> Also please be aware I believe there is still a pear installation
> issue with PDO having to do with case sensitivity. when you do a pear
> install pdo_pgsql-beta it looks to see if "pdo" is installed. But
> pear only sees "PDO" installed, and says it's not.
>
> Gavin
>
> --
> PECL development discussion Mailing List (http://pecl.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>