Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store unencrypted size in the unencrypted_size column #31966

Merged
merged 3 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a public API change?

would need to be mentionned in #32117

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icewind1991 can you clarify ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In guess so strictly speaking, but the result here only really gets used by other query builder parts so no app should care about the actual type

Copy link
Contributor

@summersab summersab May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I applied this PR to my (somewhat customized) Docker image that I am developing. It worked just fine a few days ago, but when I ran it just now, it threw the following error upon trying to access the root page:

{
  "reqId": "EIZn0TU6px16gqETseAb",
  "level": 3,
  "time": "2022-05-30T00:09:52+00:00",
  "remoteAddr": "192.168.0.202",
  "user": "--",
  "app": "PHP",
  "method": "GET",
  "url": "/",
  "message": "Declaration of OC\\DB\\QueryBuilder\\ExpressionBuilder\\ExpressionBuilder::comparison($x, string $operator, $y, $type = null): OCP\\DB\\QueryBuilder\\IQueryFunction must be compatible with OCP\\DB\\QueryBuilder\\IExpressionBuilder::comparison($x, string $operator, $y, $type = null): string at /var/www/html/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php#119",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36",
  "version": "24.0.1.1"
}

I'm fairly adept at debugging Nextcloud and know my way around the code, but this particular PR is quite involved, so I'm not sure where to start to provide more information. Feel free to ask, though - I'm happy to help!

}

/**
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