| @@ 176-181 (lines=6) @@ | ||
| 173 | protected function appendStoredEvents($streamId, $storedEvents, $expectedVersion) |
|
| 174 | { |
|
| 175 | $this->connection->transactional(function() use ($streamId, $storedEvents, $expectedVersion) { |
|
| 176 | if (!$this->streamExists($streamId)) { |
|
| 177 | $stmt = $this->connection |
|
| 178 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
| 179 | $stmt->bindValue(':streamId', $streamId); |
|
| 180 | $stmt->execute(); |
|
| 181 | } |
|
| 182 | foreach ($storedEvents as $storedEvent) { |
|
| 183 | $stmt = $this->connection->prepare( |
|
| 184 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
|
| @@ 146-151 (lines=6) @@ | ||
| 143 | { |
|
| 144 | $this->connection->beginTransaction(); |
|
| 145 | try { |
|
| 146 | if (!$this->streamExists($streamId)) { |
|
| 147 | $stmt = $this->connection |
|
| 148 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
| 149 | $stmt->bindValue(':streamId', $streamId); |
|
| 150 | $stmt->execute(); |
|
| 151 | } |
|
| 152 | foreach ($storedEvents as $storedEvent) { |
|
| 153 | $stmt = $this->connection->prepare( |
|
| 154 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
|