예제 #1
0
	/**
	 * @param string $table
	 */
	public function assertTableNotExist($table) {
		if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
			// sqlite removes the tables after closing the DB
			$this->assertTrue(true);
		} else {
			$this->assertFalse($this->connection->tableExists($table), 'Table ' . $table . ' doesnt exists.');
		}
	}
예제 #2
0
 /**
  * Make sure all user roots have permissions 23 (all but share)
  */
 protected function fixUserRootPermissions()
 {
     $qb = $this->connection->getQueryBuilder();
     $qb2 = $this->connection->getQueryBuilder();
     $qb->select('numeric_id')->from('storages')->where($qb->expr()->like('id', $qb2->createParameter('like')));
     if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
         // '' is null on oracle
         $path = $qb2->expr()->isNull('path');
     } else {
         $path = $qb2->expr()->eq('path', $qb2->createNamedParameter(''));
     }
     $qb2->update('filecache')->set('permissions', $qb2->createNamedParameter(23))->where($path)->andWhere($qb2->expr()->in('storage', $qb2->createFunction($qb->getSQL())))->andWhere($qb2->expr()->neq('permissions', $qb2->createNamedParameter(23)))->setParameter('like', 'home::%');
     $qb2->execute();
 }
예제 #3
0
 /**
  * Gets an ExpressionBuilder used for object-oriented construction of query expressions.
  * This producer method is intended for convenient inline usage. Example:
  *
  * <code>
  *     $qb = $conn->getQueryBuilder()
  *         ->select('u')
  *         ->from('users', 'u')
  *         ->where($qb->expr()->eq('u.id', 1));
  * </code>
  *
  * For more complex expression construction, consider storing the expression
  * builder object in a local variable.
  *
  * @return \OCP\DB\QueryBuilder\IExpressionBuilder
  */
 public function expr()
 {
     if ($this->connection instanceof OracleConnection) {
         return new OCIExpressionBuilder($this->connection);
     } else {
         if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
             return new PgSqlExpressionBuilder($this->connection);
         } else {
             return new ExpressionBuilder($this->connection);
         }
     }
 }
예제 #4
0
 /**
  * Truncate's the mapping table
  * @return bool
  */
 public function clear()
 {
     $sql = $this->dbc->getDatabasePlatform()->getTruncateTableSQL('`' . $this->getTableName() . '`');
     return $this->dbc->prepare($sql)->execute();
 }
예제 #5
0
파일: db.php 프로젝트: farukuzun/core-1
 /**
  * Gets the DatabasePlatform instance that provides all the metadata about
  * the platform this driver connects to.
  *
  * @return \Doctrine\DBAL\Platforms\AbstractPlatform The database platform.
  */
 public function getDatabasePlatform()
 {
     return $this->connection->getDatabasePlatform();
 }