@@ 53-70 (lines=18) @@ | ||
50 | return true; |
|
51 | } |
|
52 | ||
53 | public function executeTransaction($data) |
|
54 | { |
|
55 | try { |
|
56 | $this->db->autocommit(false); |
|
57 | foreach ($data as $item) { |
|
58 | if (!isset($item[0])) { |
|
59 | throw new \ErrorException('No query specified'); |
|
60 | } |
|
61 | $params = isset($item[1]) ? $item[1] : []; |
|
62 | $this->executeQuery($item[0], $params); |
|
63 | } |
|
64 | $this->db->commit(); |
|
65 | return true; |
|
66 | } catch (\Exception $e) { |
|
67 | $this->db->rollback(); |
|
68 | throw new \ErrorException($e->getMessage()); |
|
69 | } |
|
70 | } |
|
71 | ||
72 | public function numRows() |
|
73 | { |
@@ 57-74 (lines=18) @@ | ||
54 | return true; |
|
55 | } |
|
56 | ||
57 | public function executeTransaction($data) |
|
58 | { |
|
59 | try { |
|
60 | $this->db->beginTransaction(); |
|
61 | foreach ($data as $item) { |
|
62 | if (!isset($item[0])) { |
|
63 | throw new \ErrorException('No query specified'); |
|
64 | } |
|
65 | $params = isset($item[1]) ? $item[1] : []; |
|
66 | $this->executeQuery($item[0], $params); |
|
67 | } |
|
68 | $this->db->commit(); |
|
69 | return true; |
|
70 | } catch (\Exception $e) { |
|
71 | $this->db->rollBack(); |
|
72 | throw new \ErrorException($e->getMessage()); |
|
73 | } |
|
74 | } |
|
75 | ||
76 | public function numRows() |
|
77 | { |