Esempio n. 1
0
 public function prepareInput($value)
 {
     if (is_string($value) && function_exists('mb_detect_encoding') && mb_detect_encoding($value) === 'UTF-8') {
         return 'N' . parent::prepareInput($value);
     }
     return parent::prepareInput($value);
 }
Esempio n. 2
0
 /**
  * Rollback current transaction,
  *
  * @throws PDOException if there is no transaction started
  * @return bool|void
  */
 public function rollBack()
 {
     if ($this->_transactionDepth === 0) {
         throw new PDOException('Rollback error : There is no transaction started');
     }
     $this->_transactionDepth--;
     if ($this->_transactionDepth === 0) {
         parent::rollBack();
     } else {
         $this->exec("ROLLBACK TO SAVEPOINT LEVEL{$this->_transactionDepth}");
     }
 }
Esempio n. 3
0
 function setUp()
 {
     $this->pdoSQLite = DABLPDO::factory(array('driver' => 'sqlite', 'dbname' => ':memory:'));
     return parent::setUp();
 }
Esempio n. 4
0
 /**
  * (Re-)connect to the database connection named $key.
  *
  * @access private
  * @since 2010-10-29
  * @param string $key Connection name
  * @return DABLPDO Database connection
  * @throws PDOException If the connection fails
  */
 private static function connect($key)
 {
     if (array_key_exists($key, self::$connections)) {
         return self::$connections[$key];
     }
     if (!array_key_exists($key, self::$parameters)) {
         throw new RuntimeException('Connection "' . $key . '" has not been set');
     }
     $conn = DABLPDO::factory(self::$parameters[$key]);
     return self::$connections[$key] = $conn;
 }