Commit 5da7198b authored by javer's avatar javer

Fixed compatibility with PHP PDO

parent 7aa02d0a
...@@ -45,9 +45,9 @@ class PDOConnection extends PDO implements Connection ...@@ -45,9 +45,9 @@ class PDOConnection extends PDO implements Connection
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function prepare($prepareString) public function prepare($prepareString, $driverOptions = array())
{ {
return parent::prepare($prepareString); return parent::prepare($prepareString, $driverOptions);
} }
/** /**
...@@ -56,15 +56,27 @@ class PDOConnection extends PDO implements Connection ...@@ -56,15 +56,27 @@ class PDOConnection extends PDO implements Connection
public function query() public function query()
{ {
$args = func_get_args(); $args = func_get_args();
$sql = $args[0]; $argsCount = count($args);
return parent::query($sql); if ($argsCount == 4) {
return parent::query($args[0], $args[1], $args[2], $args[3]);
}
if ($argsCount == 3) {
return parent::query($args[0], $args[1], $args[2]);
}
if ($argsCount == 2) {
return parent::query($args[0], $args[1]);
}
return parent::query($args[0]);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function quote($input, $type=\PDO::PARAM_STR) public function quote($input, $type = \PDO::PARAM_STR)
{ {
return parent::quote($input, $type); return parent::quote($input, $type);
} }
......
...@@ -57,7 +57,7 @@ class PDOStatement extends \PDOStatement implements Statement ...@@ -57,7 +57,7 @@ class PDOStatement extends \PDOStatement implements Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindValue($param, $value, $type = null) public function bindValue($param, $value, $type = \PDO::PARAM_STR)
{ {
return parent::bindValue($param, $value, $type); return parent::bindValue($param, $value, $type);
} }
...@@ -65,9 +65,9 @@ class PDOStatement extends \PDOStatement implements Statement ...@@ -65,9 +65,9 @@ class PDOStatement extends \PDOStatement implements Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function bindParam($column, &$variable, $type = null, $length = null) public function bindParam($column, &$variable, $type = \PDO::PARAM_STR, $length = null, $driverOptions = array())
{ {
return parent::bindParam($column, $variable, $type, $length); return parent::bindParam($column, $variable, $type, $length, $driverOptions);
} }
/** /**
...@@ -81,17 +81,41 @@ class PDOStatement extends \PDOStatement implements Statement ...@@ -81,17 +81,41 @@ class PDOStatement extends \PDOStatement implements Statement
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function fetch($fetchMode = null) public function fetch($fetchMode = null, $cursorOrientation = null, $cursorOffset = null)
{ {
return parent::fetch($fetchMode); if ($fetchMode == null && $cursorOrientation == null && $cursorOffset === null) {
return parent::fetch();
}
if ($cursorOrientation == null && $cursorOffset === null) {
return parent::fetch($fetchMode);
}
if ($cursorOffset === null) {
return parent::fetch($fetchMode, $cursorOrientation);
}
return parent::fetch($fetchMode, $cursorOrientation, $cursorOffset);
} }
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function fetchAll($fetchMode = null) public function fetchAll($fetchMode = null, $fetchArgument = null, $ctorArgs = null)
{ {
return parent::fetchAll($fetchMode); if ($fetchMode == null && $fetchArgument == null && $ctorArgs == null) {
return parent::fetchAll();
}
if ($fetchArgument == null && $ctorArgs == null) {
return parent::fetchAll($fetchMode);
}
if ($ctorArgs == null) {
return parent::fetchAll($fetchMode, $fetchArgument);
}
return parent::fetchAll($fetchMode, $fetchArgument, $ctorArgs);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment