Ejemplo n.º 1
0
 /**
  * Throw a PDO Exception based on the last PDO error.
  */
 protected function throwPDOException()
 {
     $error_info = $this->dbh->getPDO()->errorInfo();
     // We rebuild a message formatted in the same way as PDO.
     $exception = new PDOException("SQLSTATE[" . $error_info[0] . "]: General error " . $error_info[1] . ": " . $error_info[2]);
     $exception->errorInfo = $error_info;
     throw $exception;
 }
Ejemplo n.º 2
0
 /**
  * NEVER CALL THIS FUNCTION: YOU MIGHT DEADLOCK YOUR PHP PROCESS.
  *
  * This is a wrapper around the parent PDO::prepare method. However, as
  * the PDO SQLite driver only closes SELECT statements when the PDOStatement
  * destructor is called and SQLite does not allow data change (INSERT,
  * UPDATE etc) on a table which has open SELECT statements, you should never
  * call this function and keep a PDOStatement object alive as that can lead
  * to a deadlock. This really, really should be private, but as
  * kxDBStatement_sqlite needs to call it, we have no other choice but to
  * expose this function to the world.
  */
 public function PDOPrepare($query, array $options = array())
 {
     return parent::getPDO()->prepare($query, $options);
 }