82 $clause = (!empty($this->prefix) ?
"{$this->prefix}." :
"") . $this->column;
83 if (!empty($this->
function)) {
84 $clause = sprintf($this->
function, $clause);
86 if (in_array(strtoupper($this->
operator), array(
'IS NULL',
'IS NOT NULL'))) {
89 if (
'' === (
$value = trim($this->value))) {
92 if (!in_array(strtoupper($this->
operator), array(
'IN',
'NOT IN'))) {
93 if ((substr(
$value, 0, 1) !=
'`') && (substr(
$value, -1) !=
'`')) {
96 if (!preg_match(
'/^[a-zA-Z0-9_\.\-`]*$/',
$value)) {
101 $clause .=
" {$this->operator} {$value}";
116 if ($this->
operator ==
'>') {
117 $this->
operator =
'>=';
119 if ($this->
operator ==
'<') {
120 $this->
operator =
'<=';
123 if ($this->
operator ==
'!=' || $this->
operator ==
'<>') {
125 $clause =
"(!(" . $this->column .
$operator . $this->value .
"))";
127 if ($this->
operator ==
'IN') {
128 $newvalue = str_replace(array(
'(',
')'),
'', $this->value);
129 $tab = explode(
',', $newvalue);
130 foreach ($tab as
$uid) {
131 $clause .=
"({$this->column}={$uid})";
133 $clause =
'(|' . $clause .
')';
135 $clause =
"(" . $this->column .
' ' . $this->
operator .
' ' . $this->value .
")";
149 return empty($cond) ?
'' :
"WHERE {$cond}";
243 switch (strtolower($whereMode)) {
245 $qb->andWhere($expr);
255 if ($this->limit!=0 || $this->start!=0) {
256 $qb->setFirstResult($this->start)
257 ->setMaxResults($this->limit);
260 if (!empty($this->groupby)) {
261 $qb->groupBy($this->groupby);
264 if (!empty($this->sort)) {
265 $qb->orderBy($this->sort, $this->order);
290 if (!empty($this->
function)) {
294 $value=trim($this->value);
300 if (in_array(
$operator, array(
'is null',
'is not null',
'in',
'not in'))) {
306 $expr = $eb->isNotNull(
$column);
323 $colvalue = $qb->createNamedParameter(
$value);
327 $expr = $eb->eq(
$column, $colvalue);
332 $expr = $eb->neq(
$column, $colvalue);
336 $expr = $eb->lt(
$column, $colvalue);
340 $expr = $eb->lte(
$column, $colvalue);
344 $expr = $eb->gt(
$column, $colvalue);
348 $expr = $eb->gte(
$column, $colvalue);
351 $expr = $eb->like(
$column, $colvalue);
354 $expr = $eb->notLike(
$column, $colvalue);
renderQb(QueryBuilder $qb=null, $whereMode= '')
if(!$xoops->isUser()) $uid
__construct($column, $value= '', $operator= '=', $prefix= '', $function= '')
buildExpressionQb(QueryBuilder $qb)