|
|
@@ -1,38 +1,12 @@
|
|
|
<?php
|
|
|
|
|
|
-class Core_Pdo {
|
|
|
+class Core_Pdo extends PDO {
|
|
|
|
|
|
- private $pdo;
|
|
|
-
|
|
|
- public function __construct(PDO $pdo) {
|
|
|
- $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
- $pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
|
|
- $this->pdo = $pdo;
|
|
|
- }
|
|
|
-
|
|
|
- public function getPDO() {
|
|
|
- return $this->pdo;
|
|
|
- }
|
|
|
-
|
|
|
- //public PDOStatement PDO::prepare ( string $statement [, array $driver_options = array() ] )
|
|
|
- public function prepare($statement, $driver_options = array()) {
|
|
|
- return $this->pdo->prepare($statement, $driver_options);
|
|
|
- }
|
|
|
- // public PDOStatement query ( string $statement )
|
|
|
- public function query($statement) {
|
|
|
- return $this->pdo->query($statement);
|
|
|
- }
|
|
|
- // public string lastInsertId ([ string $name = NULL ] )
|
|
|
- public function lastInsertId() {
|
|
|
- return $this->pdo->lastInsertId();
|
|
|
- }
|
|
|
- // public int exec ( string $statement )
|
|
|
- public function exec($statement) {
|
|
|
- return $this->pdo->exec($statement);
|
|
|
- }
|
|
|
- // public string quote ( string $string [, int $parameter_type = PDO::PARAM_STR ] )
|
|
|
- public function quote($string, $parameter_type = PDO::PARAM_STR) {
|
|
|
- return $this->pdo->quote($string, $parameter_type);
|
|
|
+ // public PDO::__construct ( string $dsn [, string $username [, string $password [, array $options ]]] )
|
|
|
+ public function __construct($dsn, $username, $password, $options = array()) {
|
|
|
+ parent::__construct($dsn, $username, $password, $options);
|
|
|
+ $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
|
|
+ $this->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
|
|
|
}
|
|
|
|
|
|
}
|