@@ -32,9 +32,12 @@ |
||
| 32 | 32 | { |
| 33 | 33 | parent::__construct( $config ); |
| 34 | 34 | |
| 35 | - try { |
|
| 35 | + try |
|
| 36 | + { |
|
| 36 | 37 | $this->conn = new \Aimeos\Base\DB\Connection\PDO( $config['db'] ?? [] ); |
| 37 | - } catch( \Aimeos\Base\DB\Exception $e ) { |
|
| 38 | + } |
|
| 39 | + catch( \Aimeos\Base\DB\Exception $e ) |
|
| 40 | + { |
|
| 38 | 41 | throw new \Aimeos\Base\MQueue\Exception( $e->getMessage(), -1, $e ); |
| 39 | 42 | } |
| 40 | 43 | } |
@@ -89,9 +89,12 @@ |
||
| 89 | 89 | */ |
| 90 | 90 | public function clear() : bool |
| 91 | 91 | { |
| 92 | - try { |
|
| 92 | + try |
|
| 93 | + { |
|
| 93 | 94 | $this->conn->create( $this->sql( 'clear' ) )->execute()->finish(); |
| 94 | - } catch( \Exception $e ) { |
|
| 95 | + } |
|
| 96 | + catch( \Exception $e ) |
|
| 97 | + { |
|
| 95 | 98 | return false; |
| 96 | 99 | } |
| 97 | 100 | |
@@ -60,9 +60,12 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public function affectedRows() : int |
| 62 | 62 | { |
| 63 | - try { |
|
| 63 | + try |
|
| 64 | + { |
|
| 64 | 65 | return $this->result->rowCount(); |
| 65 | - } catch( \PDOException $e ) { |
|
| 66 | + } |
|
| 67 | + catch( \PDOException $e ) |
|
| 68 | + { |
|
| 66 | 69 | throw new \Aimeos\Base\DB\Exception( $e->getMessage(), $e->getCode() ); |
| 67 | 70 | } |
| 68 | 71 | } |
@@ -71,9 +71,12 @@ |
||
| 71 | 71 | */ |
| 72 | 72 | public function execute() : \Aimeos\Base\DB\Result\Iface |
| 73 | 73 | { |
| 74 | - try { |
|
| 74 | + try |
|
| 75 | + { |
|
| 75 | 76 | $result = $this->exec(); |
| 76 | - } catch( \PDOException $e ) { |
|
| 77 | + } |
|
| 78 | + catch( \PDOException $e ) |
|
| 79 | + { |
|
| 77 | 80 | throw new \Aimeos\Base\DB\Exception( $e->getMessage() . ': ' . $this->sql . json_encode( array_column( $this->binds, 0 ) ), $e->getCode() ); |
| 78 | 81 | } |
| 79 | 82 | |
@@ -69,9 +69,12 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public function execute() : \Aimeos\Base\DB\Result\Iface |
| 71 | 71 | { |
| 72 | - try { |
|
| 72 | + try |
|
| 73 | + { |
|
| 73 | 74 | $result = $this->getConnection()->getRawObject()->getNativeConnection()->query( $this->sql ); |
| 74 | - } catch( \PDOException $e ) { |
|
| 75 | + } |
|
| 76 | + catch( \PDOException $e ) |
|
| 77 | + { |
|
| 75 | 78 | throw new \Aimeos\Base\DB\Exception( $e->getMessage() . ': ' . $this->sql, $e->getCode() ); |
| 76 | 79 | } |
| 77 | 80 | |