* @author Jerome Bogaerts, * */ use Doctrine\DBAL\Driver\Statement; /** * Persistence base on SQL */ class common_persistence_SqlPersistence extends common_persistence_Persistence { /** * @return common_persistence_sql_SchemaManager */ public function getSchemaManager() { return $this->getDriver()->getSchemaManager(); } /** * @return common_persistence_sql_Platform */ public function getPlatForm() { return $this->getDriver()->getPlatform(); } /** * Execute a statement. * * @param string $statement * @param array $params * @param array $types * @return int number of updated rows */ public function exec($statement, array $params = [], array $types = []) { return $this->getDriver()->exec($statement, $params, $types); } /** * Inserts one row. * * @param string $tableName * @param array $data * @param array $types * @return int number of updated rows */ public function insert($tableName, array $data, array $types = []) { return $this->getDriver()->insert($tableName, $data, $types); } /** * Inserts multiple rows. * * @param $tableName * @param array $data * @param array $types * @return int number of updated rows */ public function insertMultiple($tableName, array $data, array $types = []) { return $this->getDriver()->insertMultiple($tableName, $data, $types); } /** * Update multiple rows. * * @param string $table * @param array $data * @return bool * @throws Exception */ public function updateMultiple($table, array $data) { return $this->getDriver()->updateMultiple($table, $data); } /** * Executes parameterized query. * * @param string $statement * @param array $params * @param array $types * @return Statement */ public function query($statement, $params = [], array $types = []) { return $this->getDriver()->query($statement, $params, $types); } /** * Convenience access to quote. * * @param string $parameter The parameter to quote. * @param int $parameter_type A PDO PARAM_XX constant. * @return string The quoted string. */ public function quote($parameter, $parameter_type = PDO::PARAM_STR) { return $this->getDriver()->quote($parameter, $parameter_type); } /** * Convenience access to lastInsertId. * * @param string $name * @return string The quoted string. */ public function lastInsertId($name = null) { return $this->getDriver()->lastInsertId($name); } /** * Execute a function within a transaction. * * @param Closure $func The function to execute in a transactional way. * * @return mixed The value returned by $func * * @throws Throwable */ public function transactional(Closure $func) { return $this->getDriver()->transactional($func); } }