More style fixes
This commit is contained in:
parent
83988a5906
commit
d563367b0f
10
lib/db.php
10
lib/db.php
|
@ -140,7 +140,7 @@ class OC_DB {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$connectionParams['wrapperClass'] = 'OC\DB\Connection';
|
$connectionParams['wrapperClass'] = 'OC\DB\Connection';
|
||||||
$connectionParams['table_prefix'] = OC_Config::getValue( "dbtableprefix", "oc_" );
|
$connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_' );
|
||||||
try {
|
try {
|
||||||
self::$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
self::$connection = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
|
||||||
if ($type === 'sqlite' || $type === 'sqlite3') {
|
if ($type === 'sqlite' || $type === 'sqlite3') {
|
||||||
|
@ -218,19 +218,19 @@ class OC_DB {
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static public function isManipulation( $sql ) {
|
static public function isManipulation( $sql ) {
|
||||||
$selectOccurrence = stripos ($sql, "SELECT");
|
$selectOccurrence = stripos($sql, 'SELECT');
|
||||||
if ($selectOccurrence !== false && $selectOccurrence < 10) {
|
if ($selectOccurrence !== false && $selectOccurrence < 10) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$insertOccurrence = stripos ($sql, "INSERT");
|
$insertOccurrence = stripos($sql, 'INSERT');
|
||||||
if ($insertOccurrence !== false && $insertOccurrence < 10) {
|
if ($insertOccurrence !== false && $insertOccurrence < 10) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$updateOccurrence = stripos ($sql, "UPDATE");
|
$updateOccurrence = stripos($sql, 'UPDATE');
|
||||||
if ($updateOccurrence !== false && $updateOccurrence < 10) {
|
if ($updateOccurrence !== false && $updateOccurrence < 10) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$deleteOccurrence = stripos ($sql, "DELETE");
|
$deleteOccurrence = stripos($sql, 'DELETE');
|
||||||
if ($deleteOccurrence !== false && $deleteOccurrence < 10) {
|
if ($deleteOccurrence !== false && $deleteOccurrence < 10) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ use Doctrine\Common\EventManager;
|
||||||
|
|
||||||
class Connection extends \Doctrine\DBAL\Connection {
|
class Connection extends \Doctrine\DBAL\Connection {
|
||||||
/**
|
/**
|
||||||
* @var string $table_prefix
|
* @var string $tablePrefix
|
||||||
*/
|
*/
|
||||||
protected $table_prefix;
|
protected $tablePrefix;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC\DB\Adapter $adapter
|
* @var \OC\DB\Adapter $adapter
|
||||||
|
@ -45,12 +45,12 @@ class Connection extends \Doctrine\DBAL\Connection {
|
||||||
if (!isset($params['adapter'])) {
|
if (!isset($params['adapter'])) {
|
||||||
throw new \Exception('adapter not set');
|
throw new \Exception('adapter not set');
|
||||||
}
|
}
|
||||||
if (!isset($params['table_prefix'])) {
|
if (!isset($params['tablePrefix'])) {
|
||||||
throw new \Exception('table_prefix not set');
|
throw new \Exception('tablePrefix not set');
|
||||||
}
|
}
|
||||||
parent::__construct($params, $driver, $config, $eventManager);
|
parent::__construct($params, $driver, $config, $eventManager);
|
||||||
$this->adapter = new $params['adapter']($this);
|
$this->adapter = new $params['adapter']($this);
|
||||||
$this->table_prefix = $params['table_prefix'];
|
$this->tablePrefix = $params['tablePrefix'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,7 +183,7 @@ class Connection extends \Doctrine\DBAL\Connection {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function replaceTablePrefix($statement) {
|
protected function replaceTablePrefix($statement) {
|
||||||
return str_replace( '*PREFIX*', $this->table_prefix, $statement );
|
return str_replace( '*PREFIX*', $this->tablePrefix, $statement );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enableQueryStatementCaching() {
|
public function enableQueryStatementCaching() {
|
||||||
|
|
Loading…
Reference in New Issue