Skip to content

Commit

Permalink
Merge pull request #31966 from nextcloud/unencrypted-size
Browse files Browse the repository at this point in the history
store unencrypted size in the unencrypted_size column
  • Loading branch information
PVince81 authored Jun 13, 2022
2 parents c26ddf1 + 8238582 commit 8809de1
Show file tree
Hide file tree
Showing 20 changed files with 321 additions and 173 deletions.
96 changes: 48 additions & 48 deletions lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ public function orX(...$x): ICompositeExpression {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function comparison($x, string $operator, $y, $type = null): string {
public function comparison($x, string $operator, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->comparison($x, $operator, $y);
return new QueryFunction($this->expressionBuilder->comparison($x, $operator, $y));
}

/**
Expand All @@ -137,12 +137,12 @@ public function comparison($x, string $operator, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function eq($x, $y, $type = null): string {
public function eq($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->eq($x, $y);
return new QueryFunction($this->expressionBuilder->eq($x, $y));
}

/**
Expand All @@ -159,12 +159,12 @@ public function eq($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function neq($x, $y, $type = null): string {
public function neq($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->neq($x, $y);
return new QueryFunction($this->expressionBuilder->neq($x, $y));
}

/**
Expand All @@ -181,12 +181,12 @@ public function neq($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function lt($x, $y, $type = null): string {
public function lt($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->lt($x, $y);
return new QueryFunction($this->expressionBuilder->lt($x, $y));
}

/**
Expand All @@ -203,12 +203,12 @@ public function lt($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function lte($x, $y, $type = null): string {
public function lte($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->lte($x, $y);
return new QueryFunction($this->expressionBuilder->lte($x, $y));
}

/**
Expand All @@ -225,12 +225,12 @@ public function lte($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function gt($x, $y, $type = null): string {
public function gt($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->gt($x, $y);
return new QueryFunction($this->expressionBuilder->gt($x, $y));
}

/**
Expand All @@ -247,36 +247,36 @@ public function gt($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function gte($x, $y, $type = null): string {
public function gte($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->gte($x, $y);
return new QueryFunction($this->expressionBuilder->gte($x, $y));
}

/**
* Creates an IS NULL expression with the given arguments.
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NULL.
*
* @return string
* @return IQueryFunction
*/
public function isNull($x): string {
public function isNull($x): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
return $this->expressionBuilder->isNull($x);
return new QueryFunction($this->expressionBuilder->isNull($x));
}

/**
* Creates an IS NOT NULL expression with the given arguments.
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NOT NULL.
*
* @return string
* @return IQueryFunction
*/
public function isNotNull($x): string {
public function isNotNull($x): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
return $this->expressionBuilder->isNotNull($x);
return new QueryFunction($this->expressionBuilder->isNotNull($x));
}

/**
Expand All @@ -287,12 +287,12 @@ public function isNotNull($x): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function like($x, $y, $type = null): string {
public function like($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->like($x, $y);
return new QueryFunction($this->expressionBuilder->like($x, $y));
}

/**
Expand All @@ -303,11 +303,11 @@ public function like($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
* @since 9.0.0
*/
public function iLike($x, $y, $type = null): string {
return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y));
public function iLike($x, $y, $type = null): IQueryFunction {
return new QueryFunction($this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)));
}

/**
Expand All @@ -318,12 +318,12 @@ public function iLike($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function notLike($x, $y, $type = null): string {
public function notLike($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->notLike($x, $y);
return new QueryFunction($this->expressionBuilder->notLike($x, $y));
}

/**
Expand All @@ -334,12 +334,12 @@ public function notLike($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function in($x, $y, $type = null): string {
public function in($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnNames($y);
return $this->expressionBuilder->in($x, $y);
return new QueryFunction($this->expressionBuilder->in($x, $y));
}

/**
Expand All @@ -350,34 +350,34 @@ public function in($x, $y, $type = null): string {
* @param mixed|null $type one of the IQueryBuilder::PARAM_* constants
* required when comparing text fields for oci compatibility
*
* @return string
* @return IQueryFunction
*/
public function notIn($x, $y, $type = null): string {
public function notIn($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnNames($y);
return $this->expressionBuilder->notIn($x, $y);
return new QueryFunction($this->expressionBuilder->notIn($x, $y));
}

/**
* Creates a $x = '' statement, because Oracle needs a different check
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
* @return string
* @return IQueryFunction
* @since 13.0.0
*/
public function emptyString($x): string {
return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR));
public function emptyString($x): IQueryFunction {
return new QueryFunction($this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)));
}

/**
* Creates a `$x <> ''` statement, because Oracle needs a different check
*
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison.
* @return string
* @return IQueryFunction
* @since 13.0.0
*/
public function nonEmptyString($x): string {
return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR));
public function nonEmptyString($x): IQueryFunction {
return new QueryFunction($this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public function __construct(ConnectionAdapter $connection, IQueryBuilder $queryB
/**
* @inheritdoc
*/
public function iLike($x, $y, $type = null): string {
public function iLike($x, $y, $type = null): IQueryFunction {
$x = $this->helper->quoteColumnName($x);
$y = $this->helper->quoteColumnName($y);
return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->collation . ' LIKE', $y);
return new QueryFunction($this->expressionBuilder->comparison($x, ' COLLATE ' . $this->collation . ' LIKE', $y));
}

/**
Expand Down
Loading

0 comments on commit 8809de1

Please sign in to comment.