Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » PHP
  • » [PHP-DEV] PDO:PGSQL problem with double prepared statements. (solution included) [RSS Feed]

#1 Dec. 7, 2005 13:18:33

Thies C.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[PHP-DEV] PDO:PGSQL problem with double prepared statements. (solution included)


hi,

i had a slight problem withFatal error: Uncaught exception 'PDOException' with message 'SQLSTATE: Duplicate prepared statement: 7 ERROR: prepared statement"pdo_pgsql_stmt_086eebf4" already exists' in /home/thies/public_html/portal-HEAD/include/pw.db/table.php:670some investigation showed that my prepared statement failed executingbut not "preparing" (some expected unique constraint problem) - so mycode would assign a diffferent value to the bound variables and tryagain (this time i would get the noted message).the code as it is now in pgsql_statement.c says (line 129 -)

if (!stmt->executed) {
/* we deferred the prepare until now, because we didn't
* know anything about the parameter types; now we do */
S->result = PQprepare(H->server, S->stmt_name, S->query,stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0,S->param_types);but stmt->executed only seems to get set to when the execution wassuccessful.my workaround is to add a new var to pdo_pgsql_stmt calledis_prepared and use that as my protection against multiple prepares.re, thies--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit:http://www.php.net/unsub.php

Offline

  • Root
  • » PHP
  • » [PHP-DEV] PDO:PGSQL problem with double prepared statements. (solution included) [RSS Feed]

Board footer

Moderator control

Enjoy the 23rd of January
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support