| @@ 194-199 (lines=6) @@ | ||
| 191 | protected function appendStoredEvents($streamId, $storedEvents, $expectedVersion) |
|
| 192 | { |
|
| 193 | $this->connection->transactional(function() use ($streamId, $storedEvents, $expectedVersion) { |
|
| 194 | if (!$this->streamExists($streamId)) { |
|
| 195 | $stmt = $this->connection |
|
| 196 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
| 197 | $stmt->bindValue(':streamId', $streamId); |
|
| 198 | $stmt->execute(); |
|
| 199 | } |
|
| 200 | $stmt = $this->connection->prepare( |
|
| 201 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
|
| 202 | VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)' |
|
| @@ 164-169 (lines=6) @@ | ||
| 161 | { |
|
| 162 | $this->connection->beginTransaction(); |
|
| 163 | try { |
|
| 164 | if (!$this->streamExists($streamId)) { |
|
| 165 | $stmt = $this->connection |
|
| 166 | ->prepare('INSERT INTO streams (id) VALUES (:streamId)'); |
|
| 167 | $stmt->bindValue(':streamId', $streamId); |
|
| 168 | $stmt->execute(); |
|
| 169 | } |
|
| 170 | $stmt = $this->connection->prepare( |
|
| 171 | 'INSERT INTO events (stream_id, type, event, metadata, occurred_on, version) |
|
| 172 | VALUES (:streamId, :type, :event, :metadata, :occurredOn, :version)' |
|