Type the experssionbuilderstags/v22.0.0beta1
use OC\DB\QueryBuilder\Literal; | use OC\DB\QueryBuilder\Literal; | ||||
use OC\DB\QueryBuilder\QueryFunction; | use OC\DB\QueryBuilder\QueryFunction; | ||||
use OC\DB\QueryBuilder\QuoteHelper; | use OC\DB\QueryBuilder\QuoteHelper; | ||||
use OCP\DB\QueryBuilder\ICompositeExpression; | |||||
use OCP\DB\QueryBuilder\IExpressionBuilder; | use OCP\DB\QueryBuilder\IExpressionBuilder; | ||||
use OCP\DB\QueryBuilder\ILiteral; | use OCP\DB\QueryBuilder\ILiteral; | ||||
use OCP\DB\QueryBuilder\IParameter; | use OCP\DB\QueryBuilder\IParameter; | ||||
* | * | ||||
* @return \OCP\DB\QueryBuilder\ICompositeExpression | * @return \OCP\DB\QueryBuilder\ICompositeExpression | ||||
*/ | */ | ||||
public function andX(...$x) { | |||||
public function andX(...$x): ICompositeExpression { | |||||
$compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x); | $compositeExpression = call_user_func_array([$this->expressionBuilder, 'andX'], $x); | ||||
return new CompositeExpression($compositeExpression); | return new CompositeExpression($compositeExpression); | ||||
} | } | ||||
* | * | ||||
* @return \OCP\DB\QueryBuilder\ICompositeExpression | * @return \OCP\DB\QueryBuilder\ICompositeExpression | ||||
*/ | */ | ||||
public function orX(...$x) { | |||||
public function orX(...$x): ICompositeExpression { | |||||
$compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x); | $compositeExpression = call_user_func_array([$this->expressionBuilder, 'orX'], $x); | ||||
return new CompositeExpression($compositeExpression); | return new CompositeExpression($compositeExpression); | ||||
} | } | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function comparison($x, $operator, $y, $type = null) { | |||||
public function comparison($x, string $operator, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->comparison($x, $operator, $y); | return $this->expressionBuilder->comparison($x, $operator, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function eq($x, $y, $type = null) { | |||||
public function eq($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->eq($x, $y); | return $this->expressionBuilder->eq($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function neq($x, $y, $type = null) { | |||||
public function neq($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->neq($x, $y); | return $this->expressionBuilder->neq($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function lt($x, $y, $type = null) { | |||||
public function lt($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->lt($x, $y); | return $this->expressionBuilder->lt($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function lte($x, $y, $type = null) { | |||||
public function lte($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->lte($x, $y); | return $this->expressionBuilder->lte($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function gt($x, $y, $type = null) { | |||||
public function gt($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->gt($x, $y); | return $this->expressionBuilder->gt($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function gte($x, $y, $type = null) { | |||||
public function gte($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->gte($x, $y); | return $this->expressionBuilder->gte($x, $y); | ||||
/** | /** | ||||
* Creates an IS NULL expression with the given arguments. | * Creates an IS NULL expression with the given arguments. | ||||
* | * | ||||
* @param string $x The field in string format to be restricted by IS NULL. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NULL. | |||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function isNull($x) { | |||||
public function isNull($x): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
return $this->expressionBuilder->isNull($x); | return $this->expressionBuilder->isNull($x); | ||||
} | } | ||||
/** | /** | ||||
* Creates an IS NOT NULL expression with the given arguments. | * Creates an IS NOT NULL expression with the given arguments. | ||||
* | * | ||||
* @param string $x The field in string format to be restricted by IS NOT NULL. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NOT NULL. | |||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function isNotNull($x) { | |||||
public function isNotNull($x): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
return $this->expressionBuilder->isNotNull($x); | return $this->expressionBuilder->isNotNull($x); | ||||
} | } | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function like($x, $y, $type = null) { | |||||
public function like($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->like($x, $y); | return $this->expressionBuilder->like($x, $y); | ||||
* @return string | * @return string | ||||
* @since 9.0.0 | * @since 9.0.0 | ||||
*/ | */ | ||||
public function iLike($x, $y, $type = null) { | |||||
public function iLike($x, $y, $type = null): string { | |||||
return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); | return $this->expressionBuilder->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); | ||||
} | } | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function notLike($x, $y, $type = null) { | |||||
public function notLike($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->notLike($x, $y); | return $this->expressionBuilder->notLike($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function in($x, $y, $type = null) { | |||||
public function in($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnNames($y); | $y = $this->helper->quoteColumnNames($y); | ||||
return $this->expressionBuilder->in($x, $y); | return $this->expressionBuilder->in($x, $y); | ||||
* | * | ||||
* @return string | * @return string | ||||
*/ | */ | ||||
public function notIn($x, $y, $type = null) { | |||||
public function notIn($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnNames($y); | $y = $this->helper->quoteColumnNames($y); | ||||
return $this->expressionBuilder->notIn($x, $y); | return $this->expressionBuilder->notIn($x, $y); | ||||
/** | /** | ||||
* Creates a $x = '' statement, because Oracle needs a different check | * Creates a $x = '' statement, because Oracle needs a different check | ||||
* | * | ||||
* @param string $x The field in string format to be inspected by the comparison. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. | |||||
* @return string | * @return string | ||||
* @since 13.0.0 | * @since 13.0.0 | ||||
*/ | */ | ||||
public function emptyString($x) { | |||||
public function emptyString($x): string { | |||||
return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)); | return $this->eq($x, $this->literal('', IQueryBuilder::PARAM_STR)); | ||||
} | } | ||||
/** | /** | ||||
* Creates a `$x <> ''` statement, because Oracle needs a different check | * Creates a `$x <> ''` statement, because Oracle needs a different check | ||||
* | * | ||||
* @param string $x The field in string format to be inspected by the comparison. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. | |||||
* @return string | * @return string | ||||
* @since 13.0.0 | * @since 13.0.0 | ||||
*/ | */ | ||||
public function nonEmptyString($x) { | |||||
public function nonEmptyString($x): string { | |||||
return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)); | return $this->neq($x, $this->literal('', IQueryBuilder::PARAM_STR)); | ||||
} | } | ||||
* @return IQueryFunction | * @return IQueryFunction | ||||
* @since 12.0.0 | * @since 12.0.0 | ||||
*/ | */ | ||||
public function bitwiseAnd($x, $y) { | |||||
public function bitwiseAnd($x, int $y): IQueryFunction { | |||||
return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression( | return new QueryFunction($this->connection->getDatabasePlatform()->getBitAndComparisonExpression( | ||||
$this->helper->quoteColumnName($x), | $this->helper->quoteColumnName($x), | ||||
$y | $y | ||||
* @return IQueryFunction | * @return IQueryFunction | ||||
* @since 12.0.0 | * @since 12.0.0 | ||||
*/ | */ | ||||
public function bitwiseOr($x, $y) { | |||||
public function bitwiseOr($x, int $y): IQueryFunction { | |||||
return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression( | return new QueryFunction($this->connection->getDatabasePlatform()->getBitOrComparisonExpression( | ||||
$this->helper->quoteColumnName($x), | $this->helper->quoteColumnName($x), | ||||
$y | $y | ||||
* | * | ||||
* @return ILiteral | * @return ILiteral | ||||
*/ | */ | ||||
public function literal($input, $type = null) { | |||||
public function literal($input, $type = null): ILiteral { | |||||
return new Literal($this->expressionBuilder->literal($input, $type)); | return new Literal($this->expressionBuilder->literal($input, $type)); | ||||
} | } | ||||
* | * | ||||
* @param string $column | * @param string $column | ||||
* @param mixed $type One of IQueryBuilder::PARAM_* | * @param mixed $type One of IQueryBuilder::PARAM_* | ||||
* @return string | |||||
* @return IQueryFunction | |||||
*/ | */ | ||||
public function castColumn($column, $type) { | |||||
public function castColumn(string $column, $type): IQueryFunction { | |||||
return new QueryFunction( | return new QueryFunction( | ||||
$this->helper->quoteColumnName($column) | $this->helper->quoteColumnName($column) | ||||
); | ); |
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function iLike($x, $y, $type = null) { | |||||
public function iLike($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->charset . '_general_ci LIKE', $y); | return $this->expressionBuilder->comparison($x, ' COLLATE ' . $this->charset . '_general_ci LIKE', $y); |
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function comparison($x, $operator, $y, $type = null) { | |||||
public function comparison($x, string $operator, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function eq($x, $y, $type = null) { | |||||
public function eq($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function neq($x, $y, $type = null) { | |||||
public function neq($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function lt($x, $y, $type = null) { | |||||
public function lt($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function lte($x, $y, $type = null) { | |||||
public function lte($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function gt($x, $y, $type = null) { | |||||
public function gt($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function gte($x, $y, $type = null) { | |||||
public function gte($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function in($x, $y, $type = null) { | |||||
public function in($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function notIn($x, $y, $type = null) { | |||||
public function notIn($x, $y, $type = null): string { | |||||
$x = $this->prepareColumn($x, $type); | $x = $this->prepareColumn($x, $type); | ||||
$y = $this->prepareColumn($y, $type); | $y = $this->prepareColumn($y, $type); | ||||
/** | /** | ||||
* Creates a $x = '' statement, because Oracle needs a different check | * Creates a $x = '' statement, because Oracle needs a different check | ||||
* | * | ||||
* @param string $x The field in string format to be inspected by the comparison. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. | |||||
* @return string | * @return string | ||||
* @since 13.0.0 | * @since 13.0.0 | ||||
*/ | */ | ||||
public function emptyString($x) { | |||||
public function emptyString($x): string { | |||||
return $this->isNull($x); | return $this->isNull($x); | ||||
} | } | ||||
/** | /** | ||||
* Creates a `$x <> ''` statement, because Oracle needs a different check | * Creates a `$x <> ''` statement, because Oracle needs a different check | ||||
* | * | ||||
* @param string $x The field in string format to be inspected by the comparison. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. | |||||
* @return string | * @return string | ||||
* @since 13.0.0 | * @since 13.0.0 | ||||
*/ | */ | ||||
public function nonEmptyString($x) { | |||||
public function nonEmptyString($x): string { | |||||
return $this->isNotNull($x); | return $this->isNotNull($x); | ||||
} | } | ||||
* @param mixed $type One of IQueryBuilder::PARAM_* | * @param mixed $type One of IQueryBuilder::PARAM_* | ||||
* @return IQueryFunction | * @return IQueryFunction | ||||
*/ | */ | ||||
public function castColumn($column, $type) { | |||||
public function castColumn(string $column, $type): IQueryFunction { | |||||
if ($type === IQueryBuilder::PARAM_STR) { | if ($type === IQueryBuilder::PARAM_STR) { | ||||
$column = $this->helper->quoteColumnName($column); | $column = $this->helper->quoteColumnName($column); | ||||
return new QueryFunction('to_char(' . $column . ')'); | return new QueryFunction('to_char(' . $column . ')'); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function like($x, $y, $type = null) { | |||||
public function like($x, $y, $type = null): string { | |||||
return parent::like($x, $y, $type) . " ESCAPE '\\'"; | return parent::like($x, $y, $type) . " ESCAPE '\\'"; | ||||
} | } | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function iLike($x, $y, $type = null) { | |||||
public function iLike($x, $y, $type = null): string { | |||||
return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); | return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y)); | ||||
} | } | ||||
} | } |
use OC\DB\QueryBuilder\QueryFunction; | use OC\DB\QueryBuilder\QueryFunction; | ||||
use OCP\DB\QueryBuilder\IQueryBuilder; | use OCP\DB\QueryBuilder\IQueryBuilder; | ||||
use OCP\DB\QueryBuilder\IQueryFunction; | |||||
class PgSqlExpressionBuilder extends ExpressionBuilder { | class PgSqlExpressionBuilder extends ExpressionBuilder { | ||||
* | * | ||||
* @param string $column | * @param string $column | ||||
* @param mixed $type One of IQueryBuilder::PARAM_* | * @param mixed $type One of IQueryBuilder::PARAM_* | ||||
* @return string | |||||
* @return IQueryFunction | |||||
*/ | */ | ||||
public function castColumn($column, $type) { | |||||
public function castColumn($column, $type): IQueryFunction { | |||||
switch ($type) { | switch ($type) { | ||||
case IQueryBuilder::PARAM_INT: | case IQueryBuilder::PARAM_INT: | ||||
return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS INT)'); | return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS INT)'); | ||||
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function iLike($x, $y, $type = null) { | |||||
public function iLike($x, $y, $type = null): string { | |||||
$x = $this->helper->quoteColumnName($x); | $x = $this->helper->quoteColumnName($x); | ||||
$y = $this->helper->quoteColumnName($y); | $y = $this->helper->quoteColumnName($y); | ||||
return $this->expressionBuilder->comparison($x, 'ILIKE', $y); | return $this->expressionBuilder->comparison($x, 'ILIKE', $y); |
/** | /** | ||||
* @inheritdoc | * @inheritdoc | ||||
*/ | */ | ||||
public function like($x, $y, $type = null) { | |||||
public function like($x, $y, $type = null): string { | |||||
return parent::like($x, $y, $type) . " ESCAPE '\\'"; | return parent::like($x, $y, $type) . " ESCAPE '\\'"; | ||||
} | } | ||||
public function iLike($x, $y, $type = null) { | |||||
public function iLike($x, $y, $type = null): string { | |||||
return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); | return $this->like($this->functionBuilder->lower($x), $this->functionBuilder->lower($y), $type); | ||||
} | } | ||||
} | } |
* | * | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
*/ | */ | ||||
public function andX(...$x); | |||||
public function andX(...$x): ICompositeExpression; | |||||
/** | /** | ||||
* Creates a disjunction of the given boolean expressions. | * Creates a disjunction of the given boolean expressions. | ||||
* | * | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
*/ | */ | ||||
public function orX(...$x); | |||||
public function orX(...$x): ICompositeExpression; | |||||
/** | /** | ||||
* Creates a comparison expression. | * Creates a comparison expression. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function comparison($x, $operator, $y, $type = null); | |||||
public function comparison($x, string $operator, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates an equality comparison expression with the given arguments. | * Creates an equality comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function eq($x, $y, $type = null); | |||||
public function eq($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a non equality comparison expression with the given arguments. | * Creates a non equality comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function neq($x, $y, $type = null); | |||||
public function neq($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a lower-than comparison expression with the given arguments. | * Creates a lower-than comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function lt($x, $y, $type = null); | |||||
public function lt($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a lower-than-equal comparison expression with the given arguments. | * Creates a lower-than-equal comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function lte($x, $y, $type = null); | |||||
public function lte($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a greater-than comparison expression with the given arguments. | * Creates a greater-than comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function gt($x, $y, $type = null); | |||||
public function gt($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a greater-than-equal comparison expression with the given arguments. | * Creates a greater-than-equal comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function gte($x, $y, $type = null); | |||||
public function gte($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates an IS NULL expression with the given arguments. | * Creates an IS NULL expression with the given arguments. | ||||
* | * | ||||
* @param string $x The field in string format to be restricted by IS NULL. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NULL. | |||||
* | * | ||||
* @return string | * @return string | ||||
* @since 8.2.0 | * @since 8.2.0 | ||||
* | * | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
*/ | */ | ||||
public function isNull($x); | |||||
public function isNull($x): string; | |||||
/** | /** | ||||
* Creates an IS NOT NULL expression with the given arguments. | * Creates an IS NOT NULL expression with the given arguments. | ||||
* | * | ||||
* @param string $x The field in string format to be restricted by IS NOT NULL. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be restricted by IS NOT NULL. | |||||
* | * | ||||
* @return string | * @return string | ||||
* @since 8.2.0 | * @since 8.2.0 | ||||
* | * | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
*/ | */ | ||||
public function isNotNull($x); | |||||
public function isNotNull($x): string; | |||||
/** | /** | ||||
* Creates a LIKE() comparison expression with the given arguments. | * Creates a LIKE() comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function like($x, $y, $type = null); | |||||
public function like($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a NOT LIKE() comparison expression with the given arguments. | * Creates a NOT LIKE() comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function notLike($x, $y, $type = null); | |||||
public function notLike($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a ILIKE() comparison expression with the given arguments. | * Creates a ILIKE() comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function iLike($x, $y, $type = null); | |||||
public function iLike($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a IN () comparison expression with the given arguments. | * Creates a IN () comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function in($x, $y, $type = null); | |||||
public function in($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a NOT IN () comparison expression with the given arguments. | * Creates a NOT IN () comparison expression with the given arguments. | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function notIn($x, $y, $type = null); | |||||
public function notIn($x, $y, $type = null): string; | |||||
/** | /** | ||||
* Creates a $x = '' statement, because Oracle needs a different check | * Creates a $x = '' statement, because Oracle needs a different check | ||||
* | * | ||||
* @param string $x The field in string format to be inspected by the comparison. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. | |||||
* @return string | * @return string | ||||
* @since 13.0.0 | * @since 13.0.0 | ||||
* | * | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
*/ | */ | ||||
public function emptyString($x); | |||||
public function emptyString($x): string; | |||||
/** | /** | ||||
* Creates a `$x <> ''` statement, because Oracle needs a different check | * Creates a `$x <> ''` statement, because Oracle needs a different check | ||||
* | * | ||||
* @param string $x The field in string format to be inspected by the comparison. | |||||
* @param string|ILiteral|IParameter|IQueryFunction $x The field in string format to be inspected by the comparison. | |||||
* @return string | * @return string | ||||
* @since 13.0.0 | * @since 13.0.0 | ||||
* | * | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
*/ | */ | ||||
public function nonEmptyString($x); | |||||
public function nonEmptyString($x): string; | |||||
/** | /** | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
*/ | */ | ||||
public function bitwiseAnd($x, $y); | |||||
public function bitwiseAnd($x, int $y): IQueryFunction; | |||||
/** | /** | ||||
* Creates a bitwise OR comparison | * Creates a bitwise OR comparison | ||||
* @psalm-taint-sink sql $x | * @psalm-taint-sink sql $x | ||||
* @psalm-taint-sink sql $y | * @psalm-taint-sink sql $y | ||||
*/ | */ | ||||
public function bitwiseOr($x, $y); | |||||
public function bitwiseOr($x, int $y): IQueryFunction; | |||||
/** | /** | ||||
* Quotes a given input parameter. | * Quotes a given input parameter. | ||||
* @param mixed $input The parameter to be quoted. | * @param mixed $input The parameter to be quoted. | ||||
* @param mixed|null $type One of the IQueryBuilder::PARAM_* constants | * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants | ||||
* | * | ||||
* @return string | |||||
* @return ILiteral | |||||
* @since 8.2.0 | * @since 8.2.0 | ||||
* | * | ||||
* @psalm-taint-sink sql $input | * @psalm-taint-sink sql $input | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function literal($input, $type = null); | |||||
public function literal($input, $type = null): ILiteral; | |||||
/** | /** | ||||
* Returns a IQueryFunction that casts the column to the given type | * Returns a IQueryFunction that casts the column to the given type | ||||
* | * | ||||
* @param string $column | * @param string $column | ||||
* @param mixed $type One of IQueryBuilder::PARAM_* | * @param mixed $type One of IQueryBuilder::PARAM_* | ||||
* @return string | |||||
* @return IQueryFunction | |||||
* @since 9.0.0 | * @since 9.0.0 | ||||
* | * | ||||
* @psalm-taint-sink sql $column | * @psalm-taint-sink sql $column | ||||
* @psalm-taint-sink sql $type | * @psalm-taint-sink sql $type | ||||
*/ | */ | ||||
public function castColumn($column, $type); | |||||
public function castColumn(string $column, $type): IQueryFunction; | |||||
} | } |