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;
}
$dbtype = \OCP\Config::getSystemValue('dbtype');
if(strpos($dbtype, 'sqlite') !== false || $dbtype === 'oci') {
$query = \OCP\DB::prepare('DELETE FROM '.$table);
} else {
$query = \OCP\DB::prepare('TRUNCATE '.$table);
}
$connection = \OC_DB::getConnection();
$sql = $connection->getDatabasePlatform()->getTruncateTableSQL($table);
$query = \OCP\DB::prepare($sql);
$res = $query->execute();
if(\OCP\DB::isError($res)) {