Skip to content

Commit

Permalink
Merge pull request #59 from skipperbent/v3-development
Browse files Browse the repository at this point in the history
Removed PDOException error-code as it's not an integer which is what exceptions espect.
  • Loading branch information
skipperbent authored Jan 16, 2018
2 parents bf3d210 + ce5cb9a commit 52edfb6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Pecee/Pixie/ConnectionAdapters/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ protected function doConnect(array $config)
}

} catch (\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
throw new Exception($e->getMessage(), 0, $e->getPrevious());
}

return $connection;
Expand Down
2 changes: 1 addition & 1 deletion src/Pecee/Pixie/ConnectionAdapters/Pgsql.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected function doConnect(array $config)
}

} catch (\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
throw new Exception($e->getMessage(), 0, $e->getPrevious());
}

return $connection;
Expand Down
2 changes: 1 addition & 1 deletion src/Pecee/Pixie/ConnectionAdapters/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function doConnect(array $config)
try {
return new PDO($connectionString, null, null, $config['options']);
} catch (\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious());
throw new Exception($e->getMessage(), 0, $e->getPrevious());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Pecee/Pixie/QueryBuilder/QueryBuilderHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ public function statement($sql, array $bindings = [])
try {
$pdoStatement->execute();
} catch (\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $this->connection->getLastQuery());
throw new Exception($e->getMessage(), 0, $this->connection->getLastQuery());
}

return [$pdoStatement, microtime(true) - $start];
Expand Down Expand Up @@ -1200,7 +1200,7 @@ public function transaction(\Closure $callback)
$this->pdo->rollBack();
}

throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->connection->getLastQuery());
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
}

return $queryTransaction;
Expand Down
6 changes: 3 additions & 3 deletions src/Pecee/Pixie/QueryBuilder/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function commit()
try {
$this->pdo->commit();
} catch (\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->getConnection()->getLastQuery());
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
}

throw new TransactionHaltException('Commit triggered transaction-halt.');
Expand All @@ -52,7 +52,7 @@ public function rollBack()
try {
$this->pdo->rollBack();
} catch (\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->getConnection()->getLastQuery());
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
}

throw new TransactionHaltException('Rollback triggered transaction-halt.');
Expand All @@ -79,7 +79,7 @@ public function statement($sql, array $bindings = [])

$this->transactionStatement->execute($bindings);
} catch(\PDOException $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e->getPrevious(), $this->getConnection()->getLastQuery());
throw new Exception($e->getMessage(), 0, $e->getPrevious(), $this->connection->getLastQuery());
}

return [$this->transactionStatement, microtime(true) - $start];
Expand Down

0 comments on commit 52edfb6

Please sign in to comment.