109 \Doctrine\DBAL\Driver $driver,
110 \Doctrine\DBAL\Configuration
$config = null,
111 \Doctrine\Common\EventManager $eventManager = null
113 if (!defined(
'XOOPS_DB_PROXY') || (
$_SERVER[
'REQUEST_METHOD'] !=
'GET')) {
116 self::setSafe(
false);
118 self::setForce(
false);
119 self::$transactionActive =
false;
121 parent::__construct($params, $driver,
$config, $eventManager);
122 }
catch (\Exception $e) {
126 trigger_error(
"Cannot get database connection", E_USER_ERROR);
139 public static function prefix($tablename =
'')
144 if ($tablename !=
'') {
145 return $prefix .
'_' . $tablename;
162 public function insertPrefix($tableName, array $data, array $types = array())
164 $tableName = $this->
prefix($tableName);
165 return $this->insert($tableName, $data, $types);
183 public function updatePrefix($tableName, array $data, array $identifier, array $types = array())
185 $tableName = $this->
prefix($tableName);
186 return $this->update($tableName, $data, $identifier, $types);
203 $tableName = $this->
prefix($tableName);
204 return $this->
delete($tableName, $identifier);
224 array $params = array(),
226 \Doctrine\DBAL\
Cache\QueryCacheProfile $qcp = null
228 return parent::executeQuery(
$query, $params, $types, $qcp);
254 if (self::getSafe() || self::getForce()) {
255 if (!self::$transactionActive) {
256 self::setForce(
false);
258 $xoopsPreload->triggerEvent(
'core.database.query.start');
261 }
catch (\Exception $e) {
262 $xoopsPreload->triggerEvent(
'core.exception', $e);
265 $xoopsPreload->triggerEvent(
'core.database.query.end');
286 self::$transactionActive =
true;
287 parent::beginTransaction();
297 self::$transactionActive =
false;
298 self::setForce(
false);
309 self::$transactionActive =
false;
310 self::setForce(
false);
329 if (!self::getSafe() && !self::getForce()) {
330 $sql = ltrim(func_get_arg(0));
331 if (!self::getSafe() && strtolower(substr(
$sql, 0, 6))!=
'select') {
336 self::setForce(
false);
337 $xoopsPreload->triggerEvent(
'core.database.query.start');
339 $result = call_user_func_array(array(
'parent',
'query'), func_get_args());
340 }
catch (\Exception $e) {
341 $xoopsPreload->triggerEvent(
'core.exception', $e);
344 $xoopsPreload->triggerEvent(
'core.database.query.end');
364 if (
false !== ($fp = fopen(
$file,
'r'))) {
365 $sql_queries = trim(fread($fp, filesize(
$file)));
367 foreach ($pieces as
$query) {
369 if ($prefixed_query !=
false) {
370 $this->
query($prefixed_query[0]);
388 return $this->quote($input);
__construct(array $params,\Doctrine\DBAL\Driver $driver,\Doctrine\DBAL\Configuration $config=null,\Doctrine\Common\EventManager $eventManager=null)
executeQuery($query, array $params=array(), $types=array(),\Doctrine\DBAL\Cache\QueryCacheProfile $qcp=null)
static prefixQuery($query, $prefix)
static setForce($force=false)
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
static $transactionActive
deletePrefix($tableName, array $identifier)
static splitMySqlFile(&$ret, $sql)
executeUpdate($query, array $params=array(), array $types=array())
updatePrefix($tableName, array $data, array $identifier, array $types=array())
static setSafe($safe=true)
insertPrefix($tableName, array $data, array $types=array())
static prefix($tablename= '')
createXoopsQueryBuilder()