@@ 134-147 (lines=14) @@ | ||
131 | return (bool)$result; |
|
132 | } |
|
133 | ||
134 | public function increment($table, $field, $index, Array $condition, $operator, $increment) |
|
135 | { |
|
136 | $hs = $this->getWriteSocket(); |
|
137 | ||
138 | list($database, $table) = $this->getTableDatabase($table); |
|
139 | ||
140 | if ($index == HSAL::INDEX_PRIMARY) $index = 'PRIMARY'; |
|
141 | ||
142 | $idx = $hs->openIndex($database, $table, [$field], ['index' => $index]); |
|
143 | ||
144 | $result = $idx->update([$operator => $condition], ['+' => $increment]); |
|
145 | ||
146 | return (bool)$result; |
|
147 | } |
|
148 | ||
149 | public function decrement($table, $field, $index, Array $condition, $operator, $decrement) |
|
150 | { |
|
@@ 149-163 (lines=15) @@ | ||
146 | return (bool)$result; |
|
147 | } |
|
148 | ||
149 | public function decrement($table, $field, $index, Array $condition, $operator, $decrement) |
|
150 | { |
|
151 | ||
152 | $hs = $this->getWriteSocket(); |
|
153 | ||
154 | list($database, $table) = $this->getTableDatabase($table); |
|
155 | ||
156 | if ($index == HSAL::INDEX_PRIMARY) $index = 'PRIMARY'; |
|
157 | ||
158 | $idx = $hs->openIndex($database, $table, [$field], ['index' => $index]); |
|
159 | ||
160 | $result = $idx->update([$operator => $condition], ['-' => $decrement]); |
|
161 | ||
162 | return (bool)$result; |
|
163 | } |
|
164 | ||
165 | } |