Completed
Push — resets ( d2f77b )
by Paul
02:06
created

Update::orAbort()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1
Metric Value
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 *
4
 * This file is part of Aura for PHP.
5
 *
6
 * @license http://opensource.org/licenses/bsd-license.php BSD
7
 *
8
 */
9
namespace Aura\SqlQuery\Sqlite;
10
11
use Aura\SqlQuery\Common;
12
13
/**
14
 *
15
 * An object for Sqlite UPDATE queries.
16
 *
17
 * @package Aura.SqlQuery
18
 *
19
 */
20
class Update extends Common\Update implements Common\OrderByInterface, Common\LimitOffsetInterface
21
{
22
    /**
23
     *
24
     * Adds or removes OR ABORT flag.
25
     *
26
     * @param bool $enable Set or unset flag (default true).
27
     *
28
     * @return $this
29
     *
30
     */
31 1
    public function orAbort($enable = true)
32
    {
33 1
        $this->setFlag('OR ABORT', $enable);
34 1
        return $this;
35
    }
36
37
    /**
38
     *
39
     * Adds or removes OR FAIL flag.
40
     *
41
     * @param bool $enable Set or unset flag (default true).
42
     *
43
     * @return $this
44
     *
45
     */
46 1
    public function orFail($enable = true)
47
    {
48 1
        $this->setFlag('OR FAIL', $enable);
49 1
        return $this;
50
    }
51
52
    /**
53
     *
54
     * Adds or removes OR IGNORE flag.
55
     *
56
     * @param bool $enable Set or unset flag (default true).
57
     *
58
     * @return $this
59
     *
60
     */
61 1
    public function orIgnore($enable = true)
62
    {
63 1
        $this->setFlag('OR IGNORE', $enable);
64 1
        return $this;
65
    }
66
67
    /**
68
     *
69
     * Adds or removes OR REPLACE flag.
70
     *
71
     * @param bool $enable Set or unset flag (default true).
72
     *
73
     * @return $this
74
     *
75
     */
76 1
    public function orReplace($enable = true)
77
    {
78 1
        $this->setFlag('OR REPLACE', $enable);
79 1
        return $this;
80
    }
81
82
    /**
83
     *
84
     * Adds or removes OR ROLLBACK flag.
85
     *
86
     * @param bool $enable Set or unset flag (default true).
87
     *
88
     * @return $this
89
     *
90
     */
91 1
    public function orRollback($enable = true)
92
    {
93 1
        $this->setFlag('OR ROLLBACK', $enable);
94 1
        return $this;
95
    }
96
97
    /**
98
     *
99
     * Sets a limit count on the query.
100
     *
101
     * @param int $limit The number of rows to select.
102
     *
103
     * @return $this
104
     *
105
     */
106 7
    public function limit($limit)
107
    {
108 7
        $this->limit = (int) $limit;
109 7
        return $this;
110
    }
111
112
    /**
113
     *
114
     * Returns the LIMIT value.
115
     *
116
     * @return int
117
     *
118
     */
119 1
    public function getLimit()
120
    {
121 1
        return $this->limit;
122
    }
123
124
    /**
125
     *
126
     * Sets a limit offset on the query.
127
     *
128
     * @param int $offset Start returning after this many rows.
129
     *
130
     * @return $this
131
     *
132
     */
133 2
    public function offset($offset)
134
    {
135 2
        $this->offset = (int) $offset;
136 2
        return $this;
137
    }
138
139
    /**
140
     *
141
     * Returns the OFFSET value.
142
     *
143
     * @return int
144
     *
145
     */
146 1
    public function getOffset()
147
    {
148 1
        return $this->offset;
149
    }
150
151
    /**
152
     *
153
     * Adds a column order to the query.
154
     *
155
     * @param array $spec The columns and direction to order by.
156
     *
157
     * @return $this
158
     *
159
     */
160 1
    public function orderBy(array $spec)
161
    {
162 1
        return $this->addOrderBy($spec);
163
    }
164
}
165