Files
kiri-core/Database/Condition/RLikeCondition.php
T

29 lines
453 B
PHP
Raw Normal View History

2020-08-31 12:38:32 +08:00
<?php
2020-10-29 18:17:25 +08:00
declare(strict_types=1);
2020-08-31 12:38:32 +08:00
namespace Database\Condition;
use Snowflake\Core\Str;
/**
* Class RLikeCondition
* @package Database\Condition
*/
class RLikeCondition extends Condition
{
2020-10-29 18:17:25 +08:00
public string $pos = '';
2020-08-31 12:38:32 +08:00
/**
* @return string
*/
2020-12-17 14:09:14 +08:00
public function builder(): string
2020-08-31 12:38:32 +08:00
{
if (!is_string($this->value)) {
$this->value = array_shift($this->value);
}
2021-02-24 18:34:57 +08:00
return sprintf('%s LIKE \'%s\'', $this->column, addslashes($this->value));
2020-08-31 12:38:32 +08:00
}
}