openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit f259769f04fec48e5c9d10aa67ddb692b328710a
parent f3d58b37da34e49a968bc171c3faab19292dee5c
Author: dankert <devnull@localhost>
Date:   Thu, 15 Oct 2009 01:10:48 +0200

Reihenfolge der Prepared-Statement-Variablen beibehalten, so dass es unwichtig ist, in welcher Reihenfolge die Variablen im Code gesetzt werden.

Diffstat:
db/postgresql.class.php | 15++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/db/postgresql.class.php b/db/postgresql.class.php @@ -36,7 +36,7 @@ class DB_postgresql var $prepared; var $params = array(); - + /** * Verbinden zum POSTGRES-Server. @@ -208,14 +208,19 @@ class DB_postgresql { $query = substr($query,0,$pos+$offset).'$'.($nr).substr($query,$pos+$offset); $offset += strlen((string)$nr)+1; - $nr++; } + $nr++; } - $this->stmtid = md5($query).rand(); - pg_prepare($this->connection,$this->stmtid,$query); + $this->stmtid = md5($query); $this->prepared = true; - //Html::debug($query); + + // Feststellen, ob Statement bereits vorhanden ist + $result = pg_query_params($this->connection, 'SELECT name FROM pg_prepared_statements WHERE name = $1', array($this->stmtid)); + if (pg_num_rows($result) > 0) + return; + + pg_prepare($this->connection,$this->stmtid,$query); }