| @@ 254-265 (lines=12) @@ | ||
| 251 | * |
|
| 252 | * @return bool |
|
| 253 | */ |
|
| 254 | protected function __multi(string $sql, array $values){ |
|
| 255 | $stmt = $this->db->prepare($sql, $this->pdo_stmt_options); |
|
| 256 | ||
| 257 | foreach($values as $row){ |
|
| 258 | $this->bindParams($stmt, $row); |
|
| 259 | $stmt->execute(); |
|
| 260 | } |
|
| 261 | ||
| 262 | $stmt = null; |
|
| 263 | ||
| 264 | return true; |
|
| 265 | } |
|
| 266 | ||
| 267 | /** |
|
| 268 | * @param string $sql |
|
| @@ 274-285 (lines=12) @@ | ||
| 271 | * |
|
| 272 | * @return bool |
|
| 273 | */ |
|
| 274 | protected function __multi_callback(string $sql, array $data, $callback){ |
|
| 275 | $stmt = $this->db->prepare($sql, $this->pdo_stmt_options); |
|
| 276 | ||
| 277 | foreach($data as $row){ |
|
| 278 | $this->bindParams($stmt, call_user_func_array($callback, [$row])); |
|
| 279 | $stmt->execute(); |
|
| 280 | } |
|
| 281 | ||
| 282 | $stmt = null; |
|
| 283 | ||
| 284 | return true; |
|
| 285 | } |
|
| 286 | } |
|
| 287 | ||