Lines 99.53% 214 / 215
Methods 97.77% 44 / 45
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 select 100.00% 13 / 13 100.00% 1 / 1 5
 buildSelectSQL 100.00% 8 / 8 100.00% 1 / 1 4
 resetSelect 100.00% 2 / 2 100.00% 1 / 1 1
 from 100.00% 7 / 7 100.00% 1 / 1 2
 buildFromSQL 100.00% 8 / 8 100.00% 1 / 1 4
 resetFrom 100.00% 2 / 2 100.00% 1 / 1 1
 join 100.00% 1 / 1 100.00% 1 / 1 1
 leftJoin 100.00% 1 / 1 100.00% 1 / 1 1
 rightJoin 100.00% 1 / 1 100.00% 1 / 1 1
 applyJoin 100.00% 9 / 9 100.00% 1 / 1 3
 buildJoinSQL 100.00% 13 / 13 100.00% 1 / 1 5
 resetJoins 100.00% 2 / 2 100.00% 1 / 1 1
 groupBy 100.00% 5 / 5 100.00% 1 / 1 3
 buildGroupBySQL 100.00% 6 / 6 100.00% 1 / 1 3
 resetGroupBy 100.00% 2 / 2 100.00% 1 / 1 1
 orderBy 100.00% 13 / 13 100.00% 1 / 1 5
 buildOrderBySQL 100.00% 8 / 8 100.00% 1 / 1 4
 resetOrderBy 100.00% 2 / 2 100.00% 1 / 1 1
 sql 100.00% 15 / 15 100.00% 1 / 1 3
 params 100.00% 1 / 1 100.00% 1 / 1 1
 reset 100.00% 10 / 10 100.00% 1 / 1 1
 allTablesReferenced 100.00% 9 / 9 100.00% 1 / 1 6
 [BO\Zmsbackend\Query\Builder\Where] where 100.00% 6 / 6 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Where] orWhere 100.00% 6 / 6 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Where] whereIn 66.66% 2 / 3 0.00% 0 / 1 2.15
 [BO\Zmsbackend\Query\Builder\Where] buildWhereSQL 100.00% 3 / 3 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Where] getWhereParams 100.00% 1 / 1 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Where] resetWhere 100.00% 3 / 3 100.00% 1 / 1 1
 [BO\Zmsbackend\Query\Builder\Having] having 100.00% 6 / 6 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Having] orHaving 100.00% 6 / 6 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Having] buildHavingSQL 100.00% 3 / 3 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Having] getHavingParams 100.00% 1 / 1 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Having] resetHaving 100.00% 3 / 3 100.00% 1 / 1 1
 [BO\Zmsbackend\Query\Builder\Paginate] limit 100.00% 4 / 4 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Paginate] offset 100.00% 4 / 4 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Paginate] buildPaginateSQL 100.00% 3 / 3 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Paginate] resetLimit 100.00% 2 / 2 100.00% 1 / 1 1
 [BO\Zmsbackend\Query\Builder\Paginate] resetOffset 100.00% 2 / 2 100.00% 1 / 1 1
 [BO\Zmsbackend\Query\Builder\Query] __construct 100.00% 1 / 1 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Query] queryBaseStatement 100.00% 4 / 4 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Query] dialect 100.00% 4 / 4 100.00% 1 / 1 2
 [BO\Zmsbackend\Query\Builder\Query] flag 100.00% 4 / 4 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Query] flags 100.00% 5 / 5 100.00% 1 / 1 3
 [BO\Zmsbackend\Query\Builder\Query] deleteFlag 100.00% 2 / 2 100.00% 1 / 1 1
 [BO\Zmsbackend\Query\Builder\Query] __toString 100.00% 1 / 1 100.00% 1 / 1 1
14class Select extends Query
15{
16    use Where;
17    use Having;
18    use Paginate;
19
20    /**
21     * @var     string      The base part of the query
22     */
23    protected $queryBase = 'SELECT';
24
25    /**
26     * @var     array
27     */
28    protected $selectColumns = [];
29
30    /**
31     * @var     array
32     */
33    protected $fromTables = [];
34
35    /**
36     * @var     array
37     */
38    protected $joins = [];
39
40    /**
41     * @var     array
42     */
43    protected $groupBy = [];
44
45    /**
46     * @var     array
47     */
48    protected $orderBy = [];
49
50    /*
51     * ------------------ SELECT ---------------------
52     */
53
54    /**
55     * Set/Get the Select columns.
56     *
57     * To get, pass no arguments.
58     *
59     * To set:
60     *  - pass either a pair of string for column, alias
61     *  - pass an array of columns
62     *  - pass an array of [alias => column] pairs
63     *
64     * Columns can be ExpressionInterface instances.
65     *
66     * @param   string|array|null   $columns
67     * @param   string|null         $alias      Null to get or no alias. Alias is ignored if $columns is an array.
68     * @return  $this|array
69     */
70    public function select($columns = null, $alias = null)
71    {
72        if ($columns === null) {
73            return $this->selectColumns;
74        }
75
76        if (!is_array($columns)) {
77            $this->selectColumns[] = [
78                'column' => $columns,
79                'alias' => $alias,
80            ];
81        } else {
82            foreach ($columns as $k => $v) {
83                $this->selectColumns[] = [
84                    'column'    => $v,
85                    'alias'     => is_numeric($k) ? null : $k,
86                ];
87            }
88        }
89
90        return $this;
91    }
92
93    /**
94     * Builds the SQL for the SELECT component of the query
95     *
96     * @return  string
97     */
98    public function buildSelectSQL()
99    {
100        if (empty($this->selectColumns)) {
101            return '';
102        }
103
104        $parts = [];
105        foreach ($this->selectColumns as $c) {
106            $ret = $this->dialect->quoteField($c['column']);
107            $ret .= ($c['alias'] != null) ? ' AS ' . $this->dialect->quoteField($c['alias']) : '';
108            $parts[] = $ret;
109        }
110        return $this->queryBase . ' ' . implode(', ', $parts);
111    }
112
113    /**
114     * Resets the SELECT portion of this query to empty.
115     *
116     * @return  $this
117     */
118    public function resetSelect()
119    {
120        $this->selectColumns = [];
121        return $this;
122    }
123
124    /*
125     * ----------------- FROM --------------------
126     */
127
128    /**
129     * Get/Set Table to pull from.
130     *
131     * @param   string|null     $table      String to set, NULL to return
132     * @param   string|null     $alias
133     * @return  $this|string|array
134     */
135    public function from($table = null, $alias = null)
136    {
137        if ($table === null) {
138            return $this->fromTables;
139        }
140        $this->fromTables[] = [
141            'table' => $table,
142            'alias' => $alias
143        ];
144        return $this;
145    }
146
147    /**
148     * Builds the SQL for the FROM component of the query
149     *
150     * @return  string
151     */
152    public function buildFromSQL()
153    {
154        if (empty($this->fromTables)) {
155            return '';
156        }
157
158        $parts = [];
159        foreach ($this->fromTables as $f) {
160            $part = $this->dialect->quoteTable($f['table']);
161            $part .= ($f['alias'] !== null) ? ' ' . $this->dialect->quoteTable($f['alias']) : '';
162            $parts[] = $part;
163        }
164        return 'FROM ' . implode(', ', $parts);
165    }
166
167    /**
168     * Resets the FROM portion of this query to empty.
169     *
170     * @return  $this
171     */
172    public function resetFrom()
173    {
174        $this->fromTables = [];
175        return $this;
176    }
177
178    /*
179     * ------------------ JOIN -----------------------
180     */
181
182    /**
183     * Sets/Gets an INNER JOIN.
184     *
185     *  $query->join('comments', 'users.id', '=', 'comment.user_id');
186     *
187     * @param   string|null     $right          Name of the table to join
188     * @param   string|null     $leftField      Left part of the ON
189     * @param   string|null     $operator       Operator for the ON
190     * @param   string|null     $rightField     Right part of the ON
191     * @return  $this|array                     $this on set, array on get
192     * @throws  \InvalidArgumentException       On unknown $type
193     */
194    public function join($right = null, $leftField = null, $operator = null, $rightField = null)
195    {
196        return $this->applyJoin('INNER', $right, $leftField, $operator, $rightField);
197    }
198
199    /**
200     * Sets/Gets a LEFT JOIN.
201     *
202     *  $query->leftJoin('comments', 'users.id', '=', 'comment.user_id');
203     *
204     * @param   string|null     $right          Name of the table we're joining
205     * @param   string|null     $leftField      Left part of the ON
206     * @param   string|null     $operator       Operator for the ON
207     * @param   string|null     $rightField     Right part of the ON
208     * @return  $this|array                     $this on set, array on get
209     * @throws  \InvalidArgumentException       On unknown $type
210     */
211    public function leftJoin($right = null, $leftField = null, $operator = null, $rightField = null)
212    {
213        return $this->applyJoin('LEFT', $right, $leftField, $operator, $rightField);
214    }
215
216    /**
217     * Sets/Gets a LEFT JOIN.
218     *
219     *  $query->leftJoin('comments', 'users.id', '=', 'comment.user_id');
220     *
221     * @param   string|null     $right          Name of the table we're joining
222     * @param   string|null     $leftField      Left part of the ON
223     * @param   string|null     $operator       Operator for the ON
224     * @param   string|null     $rightField     Right part of the ON
225     * @return  $this|array                     $this on set, array on get
226     * @throws  \InvalidArgumentException       On unknown $type
227     */
228    public function rightJoin($right = null, $leftField = null, $operator = null, $rightField = null)
229    {
230        return $this->applyJoin('RIGHT', $right, $leftField, $operator, $rightField);
231    }
232
233    /**
234     * Adds in any kind of join. Used internally, you should use join(), leftJoin() and rightJoin()
235     *
236     * @param   string          $type           The type of join to add
237     * @param   string|null     $right          Name of the right table
238     * @param   string|null     $leftField      Left part of the ON
239     * @param   string|null     $operator       Operator for the ON
240     * @param   string|null     $rightField     Right part of the ON
241     * @return  $this|array                     $this on set, array of joins for given type on get
242     */
243    protected function applyJoin($type, $right = null, $leftField = null, $operator = null, $rightField = null)
244    {
245        // Get:
246        if ($right === null) {
247            return (array_key_exists($type, $this->joins)) ? $this->joins[$type] : [];
248        }
249
250        // Set:
251        $this->joins[$type][] = [
252            'right'         => $right,
253            'leftField'     => $leftField,
254            'operator'      => $operator,
255            'rightField'    => $rightField
256        ];
257
258        return $this;
259    }
260
261    /**
262     * Builds the SQL for a JOIN statement
263     *
264     * @return  string
265     */
266    public function buildJoinSQL()
267    {
268        if (empty($this->joins)) {
269            return '';
270        }
271
272        $joins = [];
273        foreach ($this->joins as $type => $typeJoins) {
274            foreach ($typeJoins as $j) {
275                $join = ($type != 'INNER') ? $type . ' ' : '';
276                $join .= 'JOIN ';
277                $join .= $this->dialect->quoteTable($j['right']) . ' ON ';
278                $join .= $this->dialect->quoteField($j['leftField']);
279                $join .= ' ' . $j['operator'] . ' ';
280                $join .= $this->dialect->quoteField($j['rightField']);
281                $joins[] = $join;
282            }
283        }
284
285        return trim(implode("\n", $joins));
286    }
287
288    /**
289     * Resets the JOIN portion of this query to empty.
290     *
291     * @return  $this
292     */
293    public function resetJoins()
294    {
295        $this->joins = [];
296        return $this;
297    }
298
299    /*
300     * ------------------ GROUP BY -------------------
301     */
302
303    /**
304     * Set/Get the group by clause
305     *
306     * @param   string|array|null     $clause     String or array to set, null to get
307     * @return  $this|string|array
308     */
309    public function groupBy($clause = null)
310    {
311        if ($clause === null) {
312            return $this->groupBy;
313        }
314
315        $clause = (is_array($clause)) ? $clause : [$clause];
316        $this->groupBy = array_merge($this->groupBy, $clause);
317
318        return $this;
319    }
320
321    /**
322     * Builds the SQL for a GROUP BY statement
323     *
324     * @return  string
325     */
326    public function buildGroupBySQL()
327    {
328        if (empty($this->groupBy)) {
329            return '';
330        }
331
332        $parts = [];
333        foreach ($this->groupBy as $p) {
334            $parts[] = $this->dialect->quoteField($p);
335        }
336
337        return 'GROUP BY ' . implode(', ', $parts);
338    }
339
340    /**
341     * Resets the GROUP BY portion of this query to empty.
342     *
343     * @return  $this
344     */
345    public function resetGroupBy()
346    {
347        $this->groupBy = [];
348        return $this;
349    }
350
351    /*
352     * ---------------- ORDER BY ----------------------
353     */
354
355    /**
356     * Set/Get the ORDER BY component of the query.
357     *
358     * @param   string|array|null       $field      Field name or an array of field => direction. Null to get
359     * @param   string|null             $direction  ASC by default
360     * @return  $this|array
361     */
362    public function orderBy($field = null, $direction = 'ASC')
363    {
364        if ($field === null) {
365            return $this->orderBy;
366        }
367
368        if (is_array($field)) {
369            foreach ($field as $f => $d) {
370                $this->orderBy[] = [
371                    'field' => $f,
372                    'direction' => $d,
373                ];
374            }
375        } else {
376            $this->orderBy[] = [
377                'field' => $field,
378                'direction' => ($field instanceof ExpressionInterface) ? null : $direction
379            ];
380        }
381
382        return $this;
383    }
384
385    /**
386     * Builds the SQL for the ORDER BY part of the query
387     *
388     * @return  string
389     */
390    public function buildOrderBySQL()
391    {
392        if (empty($this->orderBy)) {
393            return '';
394        }
395
396        $parts = [];
397        foreach ($this->orderBy as $order) {
398            $part = $this->dialect->quoteField($order['field']);
399            $part .= ($order['direction'] != null) ? ' ' . $order['direction'] : '';
400            $parts[] = $part;
401        }
402
403        return 'ORDER BY ' . implode(', ', $parts);
404    }
405
406    /**
407     * Resets the ORDER BY portion of this query to empty.
408     *
409     * @return  $this
410     */
411    public function resetOrderBy()
412    {
413        $this->orderBy = [];
414        return $this;
415    }
416
417    /*
418     * --------------- Generating SQL --------------------
419     */
420
421    /**
422     * Generates the full SQL statement for this query with all the composite parts.
423     * Note: there is no guarantee that this will be valid SQL! Obviously the parts
424     * you've given will come out good, but if you forget to add a FROM or something,
425     * this class won't automatically guess one for you!
426     *
427     * @return  string
428     */
429    #[\Override]
430    public function sql()
431    {
432        $candidateParts = [
433            $this->buildSelectSQL(),
434            $this->buildFromSQL(),
435            $this->buildJoinSQL(),
436            $this->buildWhereSQL($this->dialect),
437            $this->buildGroupBySQL(),
438            $this->buildHavingSQL($this->dialect),
439            $this->buildOrderBySQL(),
440            $this->buildPaginateSQL()
441        ];
442
443        $realParts = [];
444        foreach ($candidateParts as $p) {
445            if ($p != '') {
446                $realParts[] = $p;
447            }
448        }
449
450        return implode(" ", $realParts);
451    }
452
453    /**
454     * Returns all the parameters, in the correct order, to pass into PDO.
455     *
456     * @return  array
457     */
458    #[\Override]
459    public function params()
460    {
461        return array_merge($this->getWhereParams(), $this->getHavingParams());
462    }
463
464    /**
465     * Resets the entire query by calling each sections resetXXX() function.
466     *
467     * @return  $this
468     */
469    #[\Override]
470    public function reset()
471    {
472        return $this
473            ->resetSelect()
474            ->resetFrom()
475            ->resetJoins()
476            ->resetWhere()
477            ->resetGroupBy()
478            ->resetHaving()
479            ->resetOrderBy()
480            ->resetLimit()
481            ->resetOffset();
482    }
483
484    /*
485     * ------------------- All Tables ------------------------
486     */
487
488    /**
489     * Returns all the tables that this query makes mention of, in FROMs and JOINs
490     *
491     * @return  array
492     */
493    #[\Override]
494    public function allTablesReferenced()
495    {
496        $tables = [];
497
498        // Deal with FROMs:
499        if ($this->fromTables) {
500            foreach ($this->fromTables as $tbl) {
501                $tables[] = $tbl['table'];
502            }
503        }
504
505        // And now JOINs:
506        if ($this->joins) {
507            foreach (array_keys($this->joins) as $type) {
508                foreach ($this->joins[$type] as $join) {
509                    $tables[] = $join['right'];
510                }
511            }
512        }
513
514        return array_unique($tables);
515    }
516}

From BO\Zmsbackend\Query\Builder\Where

30trait Where
31{
32    /**
33     * @var     ConditionBuilder
34     */
35    protected $whereBuilder;
36
37    /**
38     * Get/Set an "AND WHERE" clause on the query. You can either pass a simple
39     * comparison ('name', '=', 'Alex') or a function to append multiple queries
40     * in a group.
41     *
42     * @param   string|\Closure|null    $field      Fieldname|callback for group|to return
43     * @param   string|null             $operator   Operator (=, !=, <>, <= etc)
44     * @param   mixed|null              $value      Value to test against
45     * @return  $this|array                         $this on set, array on get
46     */
47    public function where($field = null, $operator = null, $value = null)
48    {
49        if (!isset($this->whereBuilder)) {
50            $this->whereBuilder = new ConditionBuilder();
51        }
52        if ($field == null) {
53            return $this->whereBuilder->conditions();
54        }
55        $this->whereBuilder->andWith($field, $operator, $value);
56        return $this;
57    }
58
59    /**
60     * Adds a new 'OR ' predicate to the query.
61     *
62     * @param   string|\Closure|null    $field      Fieldname|callback for group|to return
63     * @param   string|null             $operator   Operator (=, !=, <>, <= etc)
64     * @param   mixed|null              $value      Value to test against
65     * @return  $this|array                         $this on set, array on get
66     * @psalm-api
67     */
68    public function orWhere($field = null, $operator = null, $value = null)
69    {
70        if (!isset($this->whereBuilder)) {
71            $this->whereBuilder = new ConditionBuilder();
72        }
73        if ($field == null) {
74            return $this->whereBuilder->conditions();
75        }
76        $this->whereBuilder->orWith($field, $operator, $value);
77        return $this;
78    }
79
80    /**
81     * @psalm-api
82     */
83    public function whereIn(string $field, array $values): static|array
84    {
85        if (empty($values)) {
86            throw new \InvalidArgumentException('whereIn() requires a non-empty $values array.');
87        }
88        return $this->where($field, 'IN', array_values($values));
89    }
90
91    /**
92     * Returns the SQL string for the WHERE portion of the query
93     *
94     * @param   DialectInterface    $dialect
95     * @return  string
96     */
97    public function buildWhereSQL(DialectInterface $dialect)
98    {
99        if (!isset($this->whereBuilder) || !$this->whereBuilder->hasConditions()) {
100            return '';
101        }
102
103        return 'WHERE ' . $this->whereBuilder->buildConditionSQL($dialect);
104    }
105
106    /**
107     * Returns an array of all the parameter that have been passed to where()
108     * ready to be thrown at PDO.
109     *
110     * @return  array
111     */
112    public function getWhereParams()
113    {
114        return (isset($this->whereBuilder)) ? $this->whereBuilder->getConditionParameters() : [];
115    }
116
117    /**
118     * Resets the WHERE portion of this query to empty.
119     *
120     * @return  $this
121     */
122    public function resetWhere()
123    {
124        unset($this->whereBuilder);
125        $this->whereBuilder = new ConditionBuilder();
126        return $this;
127    }
128}

From BO\Zmsbackend\Query\Builder\Having

33trait Having
34{
35    /**
36     * @var     ConditionBuilder
37     */
38    protected $havingBuilder;
39
40    /**
41     * Get/Set an "AND HAVING" clause on the query. You can either pass a simple
42     * comparison ('name', '=', 'Alex') or a function to append multiple queries
43     * in a group.
44     *
45     * @param   string|\Closure|null    $field      Fieldname|callback for group|to return
46     * @param   string|null             $operator   Operator (=, !=, <>, <= etc)
47     * @param   mixed|null              $value      Value to test against
48     * @return  $this|array                         $this on set, array on get
49     */
50    public function having($field = null, $operator = null, $value = null)
51    {
52        if (!isset($this->havingBuilder)) {
53            $this->havingBuilder = new ConditionBuilder();
54        }
55        if ($field == null) {
56            return $this->havingBuilder->conditions();
57        }
58        $this->havingBuilder->andWith($field, $operator, $value);
59        return $this;
60    }
61
62    /**
63     * Adds a new 'OR' predicate to the query.
64     *
65     * @param   string|\Closure|null    $field      Fieldname|callback for group|to return
66     * @param   string|null             $operator   Operator (=, !=, <>, <= etc)
67     * @param   mixed|null              $value      Value to test against
68     * @return  $this|array                         $this on set, array on get
69     * @psalm-api
70     */
71    public function orHaving($field = null, $operator = null, $value = null)
72    {
73        if (!isset($this->havingBuilder)) {
74            $this->havingBuilder = new ConditionBuilder();
75        }
76        if ($field == null) {
77            return $this->havingBuilder->conditions();
78        }
79        $this->havingBuilder->orWith($field, $operator, $value);
80        return $this;
81    }
82
83    /**
84     * Returns the SQL string for the WHERE portion of the query
85     *
86     * @param   DialectInterface    $dialect
87     * @return  string
88     */
89    public function buildHavingSQL(DialectInterface $dialect)
90    {
91        if (!isset($this->havingBuilder) || !$this->havingBuilder->hasConditions()) {
92            return '';
93        }
94
95        return 'HAVING ' . $this->havingBuilder->buildConditionSQL($dialect);
96    }
97
98    /**
99     * Returns an array of all the parameter that have been passed to having()
100     * ready to be thrown at PDO.
101     *
102     * @return  array
103     */
104    public function getHavingParams()
105    {
106        return (isset($this->havingBuilder)) ? $this->havingBuilder->getConditionParameters() : [];
107    }
108
109    /**
110     * Resets the HAVING portion of this query to empty.
111     *
112     * @return  $this
113     */
114    public function resetHaving()
115    {
116        unset($this->havingBuilder);
117        $this->havingBuilder = new ConditionBuilder();
118        return $this;
119    }
120}

From BO\Zmsbackend\Query\Builder\Paginate

15trait Paginate
16{
17    /**
18     * @var     int     Limit or results per page
19     */
20    protected $limit = null;
21
22    /**
23     * @var     int     Offset
24     */
25    protected $offset = 0;
26
27    /**
28     * Set/Get the limit of the query
29     *
30     * @param   int|null    $limit  Int to set, null to get
31     * @return  $this|int
32     */
33    public function limit($limit = null)
34    {
35        if ($limit === null) {
36            return $this->limit;
37        }
38
39        $this->limit = (int)$limit;
40        return $this;
41    }
42
43    /**
44     * Set/Get the offset of the query
45     *
46     * @param   int|null    $offset     Int to set, null to get
47     * @return  $this|int
48     */
49    public function offset($offset = null)
50    {
51        if ($offset === null) {
52            return $this->offset;
53        }
54
55        $this->offset = (int)$offset;
56        return $this;
57    }
58
59    /**
60     * Builds the SQL for the pagination, based on the DB engine
61     *
62     * @return  string
63     */
64    public function buildPaginateSQL()
65    {
66        if ($this->limit === null) {
67            return '';
68        }
69
70        return 'LIMIT ' . (($this->offset != 0) ? $this->offset . ', ' . $this->limit : $this->limit);
71    }
72
73    /**
74     * Resets the LIMIT portion of this query to none.
75     *
76     * @return  $this
77     */
78    public function resetLimit()
79    {
80        $this->limit = null;
81        return $this;
82    }
83
84    /**
85     * Resets the OFFSET portion of this query to 0.
86     *
87     * @return  $this
88     */
89    public function resetOffset()
90    {
91        $this->offset = 0;
92        return $this;
93    }
94}

Inherited from BO\Zmsbackend\Query\Builder\Query

42    public function __construct(?DialectInterface $dialect = null)
43    {
44        $this->dialect = ($dialect === null) ? new ANSI() : $dialect;
45    }
54    public function queryBaseStatement($base = null)
55    {
56        if ($base === null) {
57            return $this->queryBase;
58        }
59        $this->queryBase = $base;
60        return $this;
61    }
70    public function dialect(?DialectInterface $dialect = null)
71    {
72        if ($dialect === null) {
73            return $this->dialect;
74        }
75        $this->dialect = $dialect;
76        return $this;
77    }
92    public function flag($flag, $value = null)
93    {
94        if ($value === null) {
95            return (array_key_exists($flag, $this->flags)) ? $this->flags[$flag] : null;
96        }
97        $this->flags[$flag] = $value;
98        return $this;
99    }
110    public function flags(?array $flags = null)
111    {
112        if (!is_array($flags)) {
113            return $this->flags;
114        }
115        foreach ($flags as $f => $v) {
116            $this->flags[$f] = $v;
117        }
118        return $this;
119    }
128    public function deleteFlag($flag)
129    {
130        unset($this->flags[$flag]);
131        return $this;
132    }
146    public function __toString()
147    {
148        return $this->sql();
149    }