openrat-cms

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

commit c5db9ea5c8068beadd4104e4ec25f341795c8abe
parent dce653c0b76993e406c1f367414eda94ddf3771c
Author: dankert <devnull@localhost>
Date:   Wed, 14 Oct 2009 01:12:53 +0200

Korrektur in 'prepare()' beim Setzen der Variablennamen

Diffstat:
db/postgresql.class.php | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/db/postgresql.class.php b/db/postgresql.class.php @@ -123,13 +123,11 @@ class DB_postgresql function query($query) { - //Html::debug($query,'query()'); if ( $this->prepared ) { $ar = array(); foreach($this->params as $name => $data) { - //Html::debug($data,'data!!!'); switch( $data['type'] ) { case 'string': @@ -140,7 +138,7 @@ class DB_postgresql $ar[] = (int) $data['value']; break; default: - die('was ist mit type '.$data['type'].'?'); + die('unknown type "'.$data['type'].'"'); } } //Html::debug($this->params,'Parameter'); @@ -201,11 +199,14 @@ class DB_postgresql function prepare( $query,$param ) { $nr = 1; - foreach( $param as $pos) + $offset = 0; + foreach( $param as $p) { - foreach( $pos as $pos ) + foreach( $p as $pos ) { - $query = substr($query,0,$pos).'$'.($nr++).substr($query,$pos); + $query = substr($query,0,$pos+$offset).'$'.($nr).substr($query,$pos+$offset); + $offset += strlen((string)$nr)+1; + $nr++; } }