| @@ 190-203 (lines=14) @@ | ||
| 187 | return $statement->rowCount(); |
|
| 188 | } |
|
| 189 | ||
| 190 | public function getAll( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 191 | return $this->getResult( |
|
| 192 | $statement, |
|
| 193 | $params, |
|
| 194 | $expires, |
|
| 195 | $key, |
|
| 196 | function( \PDOStatement $statement ) { |
|
| 197 | $result = $statement->fetchAll(); |
|
| 198 | if( $result === false ) |
|
| 199 | $result = []; |
|
| 200 | return $result; |
|
| 201 | } |
|
| 202 | ); |
|
| 203 | } |
|
| 204 | ||
| 205 | public function getAssoc( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 206 | return $this->getResult( |
|
| @@ 243-256 (lines=14) @@ | ||
| 240 | ); |
|
| 241 | } |
|
| 242 | ||
| 243 | public function getRow( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 244 | return $this->getResult( |
|
| 245 | $statement, |
|
| 246 | $params, |
|
| 247 | $expires, |
|
| 248 | $key, |
|
| 249 | function( \PDOStatement $statement ) { |
|
| 250 | $result = $statement->fetch(); |
|
| 251 | if( $result === false ) |
|
| 252 | $result = []; |
|
| 253 | return $result; |
|
| 254 | } |
|
| 255 | ); |
|
| 256 | } |
|
| 257 | ||
| 258 | public function getCol( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 259 | return $this->getResult( |
|
| @@ 258-272 (lines=15) @@ | ||
| 255 | ); |
|
| 256 | } |
|
| 257 | ||
| 258 | public function getCol( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 259 | return $this->getResult( |
|
| 260 | $statement, |
|
| 261 | $params, |
|
| 262 | $expires, |
|
| 263 | $key, |
|
| 264 | function( \PDOStatement $statement ) { |
|
| 265 | $result = []; |
|
| 266 | while( $row = $statement->fetch() ) { |
|
| 267 | $result[] = array_shift($row); |
|
| 268 | } |
|
| 269 | return $result; |
|
| 270 | } |
|
| 271 | ); |
|
| 272 | } |
|
| 273 | ||
| 274 | public function getOne( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 275 | return $this->getResult( |
|
| @@ 274-287 (lines=14) @@ | ||
| 271 | ); |
|
| 272 | } |
|
| 273 | ||
| 274 | public function getOne( $statement, $params = [], $expires = 0, $key = '' ) { |
|
| 275 | return $this->getResult( |
|
| 276 | $statement, |
|
| 277 | $params, |
|
| 278 | $expires, |
|
| 279 | $key, |
|
| 280 | function( \PDOStatement $statement ) { |
|
| 281 | $result = $statement->fetchColumn(); |
|
| 282 | if( $result === false ) |
|
| 283 | $result = null; |
|
| 284 | return $result; |
|
| 285 | } |
|
| 286 | ); |
|
| 287 | } |
|
| 288 | ||
| 289 | public function begin() { |
|
| 290 | ||