There are still some issues with PDO binding the same parameter twice.
"select :var, :var" with the bound parameters as array('var'=>'value') ...
will result in some spooky action. Im not sure if this is fixed in PDO head,
but it affects zends implementation downstream.
I think this bug is applicable. http://bugs.php.net/bug.php?id=33886 but I
wasn't getting this clean an error message with the PGSQL driver. It was
actually causing a core dump.
Maybe we should see if a param is requested twice in the sql string, and if
it is, do some rejiggering of the sql/bound params such that this bug(aka
intended behaviour) is avoided before passing it along to pdo.
Kevin
----- Original Message -----
From: "Mark Wright" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 17, 2006 7:42 PM
Subject: [fw-general] pdo_pgsql problem with Zend_Db_Table
When using Zend_Db_Table and PDO_PGSQL I get an error in the
describeTable method of pdo_pgsql. The error comes up when a column is
a varchar because it looks for $val['length'] which does not exist.
The sql statement in that method does not select a length column. I
solved this problem by adding "a.atttypmod AS length" to the sql
statement. The complete sql is below:
$sql = "SELECT a.attnum, a.attname AS field, t.typname AS type, "
. "a.attnotnull AS isnotnull, "
. "( SELECT 't' "
. "FROM pg_index "
. "WHERE c.oid = pg_index.indrelid "
. "AND pg_index.indkey[0] = a.attnum "
. "AND pg_index.indisprimary = 't') AS pri, "
. "(SELECT pg_attrdef.adsrc "
. "FROM pg_attrdef "
. "WHERE c.oid = pg_attrdef.adrelid "
. "AND pg_attrdef.adnum=a.attnum) AS default, "
. "a.atttypmod AS length "
. "FROM pg_attribute a, pg_class c, pg_type t "
. "WHERE c.relname = '{$table}' "
. "AND a.attnum > 0 "
. "AND a.attrelid = c.oid "
. "AND a.atttypid = t.oid "
. "ORDER BY a.attnum ";
Has anybody found other issues using PDO_PGSQL?
Mark
--
Have fun or die trying - but try not to actually die.