Use Doctrine Platform to generate SQL query for table truncation.
This commit is contained in:
parent
9b1c4a1e74
commit
7458e21f2c
|
@ -159,14 +159,9 @@ class Helper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dbtype = \OCP\Config::getSystemValue('dbtype');
|
$connection = \OC_DB::getConnection();
|
||||||
if(strpos($dbtype, 'sqlite') !== false || $dbtype === 'oci') {
|
$sql = $connection->getDatabasePlatform()->getTruncateTableSQL($table);
|
||||||
$query = \OCP\DB::prepare('DELETE FROM '.$table);
|
$query = \OCP\DB::prepare($sql);
|
||||||
} else {
|
|
||||||
$query = \OCP\DB::prepare('TRUNCATE '.$table);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
$res = $query->execute();
|
$res = $query->execute();
|
||||||
|
|
||||||
if(\OCP\DB::isError($res)) {
|
if(\OCP\DB::isError($res)) {
|
||||||
|
|
Loading…
Reference in New Issue