openrat-cms

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

commit 5430293bd77bad5ae2e94b2ab3b2f635e564bbf8
parent 2c1bf100ba794084a0d05e613323902e35986834
Author: dankert <devnull@localhost>
Date:   Thu, 15 Oct 2009 01:54:12 +0200

Erweiterungen für Prepared-Statements.

Diffstat:
db/mysqli.class.php | 29+++++++++++++++++++++++++++++
db/pdo.class.php | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 82 insertions(+), 0 deletions(-)

diff --git a/db/mysqli.class.php b/db/mysqli.class.php @@ -189,6 +189,35 @@ class DB_mysqli { $this->params[$param] = $value; } + + + /** + * Startet eine Transaktion. + */ + function start() + { + mysqli_query($this->connection,'BEGIN'); + } + + + /** + * Beendet eine Transaktion. + */ + function commit() + { + mysqli_query($this->connection,'COMMIT'); + } + + + /** + * Bricht eine Transaktion ab. + */ + function rollback() + { + mysqli_query($this->connection,'ROLLBACK'); + } + + } ?> \ No newline at end of file diff --git a/db/pdo.class.php b/db/pdo.class.php @@ -120,6 +120,59 @@ class DB_pdo { die('called NumRows in PDO()'); } + + + + function prepare( $query,$param) + { + foreach( $param as $pos) + { + foreach( $pos as $pos ) + { + $query = substr($query,0,$pos-1).'?'.substr($query,$pos+1); + } + } + + $this->stmt = $this->connection->prepare($query); + + } + + + + function bind( $param,$value ) + { + $this->params[$param] = $value; + } + + + + /** + * Startet eine Transaktion. + */ + function start() + { + $this->connection->beginTransaction(); + } + + + + /** + * Beendet eine Transaktion. + */ + function commit() + { + $this->connection->commit(); + } + + + /** + * Bricht eine Transaktion ab. + */ + function rollback() + { + $this->connection->rollBack(); + } + } ?> \ No newline at end of file