Use Doctrine Platform to generate SQL query for table truncation.

This commit is contained in:
Andreas Fischer 2014-08-29 20:53:51 +02:00
parent 9b1c4a1e74
commit 7458e21f2c
1 changed files with 3 additions and 8 deletions

View File

@ -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)) {