@@ -69,9 +69,12 @@ |
||
| 69 | 69 | */ |
| 70 | 70 | public function execute() : \Aimeos\MW\DB\Result\Iface |
| 71 | 71 | { |
| 72 | - try { |
|
| 72 | + try |
|
| 73 | + { |
|
| 73 | 74 | $result = $this->exec(); |
| 74 | - } catch( \PDOException $e ) { |
|
| 75 | + } |
|
| 76 | + catch( \PDOException $e ) |
|
| 77 | + { |
|
| 75 | 78 | throw new \Aimeos\MW\DB\Exception( $e->getMessage() . ': ' . $this->sql, $e->getCode() ); |
| 76 | 79 | } |
| 77 | 80 | |
@@ -51,9 +51,12 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function affectedRows() : int |
| 53 | 53 | { |
| 54 | - try { |
|
| 54 | + try |
|
| 55 | + { |
|
| 55 | 56 | return $this->statement->rowCount(); |
| 56 | - } catch( \PDOException $e ) { |
|
| 57 | + } |
|
| 58 | + catch( \PDOException $e ) |
|
| 59 | + { |
|
| 57 | 60 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 58 | 61 | } |
| 59 | 62 | } |
@@ -68,9 +71,12 @@ discard block |
||
| 68 | 71 | */ |
| 69 | 72 | public function fetch( int $style = \Aimeos\MW\DB\Result\Base::FETCH_ASSOC ) : ?array |
| 70 | 73 | { |
| 71 | - try { |
|
| 74 | + try |
|
| 75 | + { |
|
| 72 | 76 | return $this->statement->fetch( $style ? \PDO::FETCH_ASSOC : \PDO::FETCH_NUM ) ?: null; |
| 73 | - } catch( \PDOException $e ) { |
|
| 77 | + } |
|
| 78 | + catch( \PDOException $e ) |
|
| 79 | + { |
|
| 74 | 80 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 75 | 81 | } |
| 76 | 82 | } |
@@ -84,9 +90,12 @@ discard block |
||
| 84 | 90 | */ |
| 85 | 91 | public function finish() : Iface |
| 86 | 92 | { |
| 87 | - try { |
|
| 93 | + try |
|
| 94 | + { |
|
| 88 | 95 | $this->statement->closeCursor(); |
| 89 | - } catch( \PDOException $e ) { |
|
| 96 | + } |
|
| 97 | + catch( \PDOException $e ) |
|
| 98 | + { |
|
| 90 | 99 | throw new \Aimeos\MW\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 91 | 100 | } |
| 92 | 101 | |
@@ -101,9 +110,12 @@ discard block |
||
| 101 | 110 | */ |
| 102 | 111 | public function nextResult() : bool |
| 103 | 112 | { |
| 104 | - try { |
|
| 113 | + try |
|
| 114 | + { |
|
| 105 | 115 | return $this->statement->nextRowset(); |
| 106 | - } catch( \PDOException $e ) { |
|
| 116 | + } |
|
| 117 | + catch( \PDOException $e ) |
|
| 118 | + { |
|
| 107 | 119 | return false; |
| 108 | 120 | } |
| 109 | 121 | } |
@@ -69,8 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if( in_array( $op, $operators['combine'], true ) ) { |
| 71 | 71 | return $this->createCombineExpression( $op, (array) $value ); |
| 72 | - } |
|
| 73 | - else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 72 | + } else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 74 | 73 | return $this->createCompareExpression( $op, (array) $value ); |
| 75 | 74 | } |
| 76 | 75 | |
@@ -147,11 +146,9 @@ discard block |
||
| 147 | 146 | |
| 148 | 147 | if( in_array( $op, $operators['combine'], true ) ) { |
| 149 | 148 | $results[] = $this->createCombineExpression( $op, (array) $entry[$op] ); |
| 150 | - } |
|
| 151 | - else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 149 | + } else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 152 | 150 | $results[] = $this->createCompareExpression( $op, (array) $entry[$op] ); |
| 153 | - } |
|
| 154 | - else { |
|
| 151 | + } else { |
|
| 155 | 152 | throw new \Aimeos\MW\Common\Exception( sprintf( 'Invalid operator "%1$s"', $op ) ); |
| 156 | 153 | } |
| 157 | 154 | } |
@@ -74,8 +74,7 @@ |
||
| 74 | 74 | SELECT * FROM mw_mqueue_test WHERE queue = ? AND cname = ? AND rtime = ? |
| 75 | 75 | ORDER BY id LIMIT 1 |
| 76 | 76 | '; |
| 77 | - } |
|
| 78 | - else |
|
| 77 | + } else |
|
| 79 | 78 | { |
| 80 | 79 | $config['sql']['reserve'] = ' |
| 81 | 80 | UPDATE mw_mqueue_test SET cname = ?, rtime = ? WHERE id IN ( |
@@ -32,9 +32,12 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | parent::__construct( $config ); |
| 34 | 34 | |
| 35 | - try { |
|
| 35 | + try |
|
| 36 | + { |
|
| 36 | 37 | $this->conn = $this->createConnection(); |
| 37 | - } catch( \Aimeos\MW\DB\Exception $e ) { |
|
| 38 | + } |
|
| 39 | + catch( \Aimeos\MW\DB\Exception $e ) |
|
| 40 | + { |
|
| 38 | 41 | throw new \Aimeos\MW\MQueue\Exception( $e->getMessage() ); |
| 39 | 42 | } |
| 40 | 43 | } |
@@ -111,14 +114,12 @@ discard block |
||
| 111 | 114 | { |
| 112 | 115 | $dsn .= 'Database=' . $dbase; |
| 113 | 116 | $dsn .= isset( $host ) ? ';Server=' . $host . ( isset( $port ) ? ',' . $port : '' ) : ''; |
| 114 | - } |
|
| 115 | - elseif( $sock == null ) |
|
| 117 | + } elseif( $sock == null ) |
|
| 116 | 118 | { |
| 117 | 119 | $dsn .= 'dbname=' . $dbase; |
| 118 | 120 | $dsn .= isset( $host ) ? ';host=' . $host : ''; |
| 119 | 121 | $dsn .= isset( $port ) ? ';port=' . $port : ''; |
| 120 | - } |
|
| 121 | - else |
|
| 122 | + } else |
|
| 122 | 123 | { |
| 123 | 124 | $dsn .= 'dbname=' . $dbase . ';unix_socket=' . $sock; |
| 124 | 125 | } |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | $sort = 'mindte_ft.RANK'; |
| 61 | 61 | |
| 62 | 62 | $func = $this->getFunctionRelevance(); |
| 63 | - } |
|
| 64 | - else |
|
| 63 | + } else |
|
| 65 | 64 | { |
| 66 | 65 | $search = ':site AND mindte."langid" = $1 AND CHARINDEX( $2, content )'; |
| 67 | 66 | $sort = '-CHARINDEX( $2, content )'; |
@@ -306,8 +306,7 @@ |
||
| 306 | 306 | if( empty( $search->getSortations() ) && ( $attribute = reset( $attributes ) ) !== false ) |
| 307 | 307 | { |
| 308 | 308 | $search = ( clone $search )->setSortations( [$search->sort( '+', $attribute->getCode() )] ); |
| 309 | - } |
|
| 310 | - elseif( !empty( $search->getSortations() ) ) |
|
| 309 | + } elseif( !empty( $search->getSortations() ) ) |
|
| 311 | 310 | { |
| 312 | 311 | $names = $search->translate( $search->getSortations(), [], $funcs ); |
| 313 | 312 | $cols = $search->translate( $search->getSortations(), $translations, $funcs ); |
@@ -117,8 +117,7 @@ |
||
| 117 | 117 | return false; |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | - } |
|
| 121 | - elseif( ( $addresses = $basket->getAddress( Address\Base::TYPE_PAYMENT ) ) !== [] ) |
|
| 120 | + } elseif( ( $addresses = $basket->getAddress( Address\Base::TYPE_PAYMENT ) ) !== [] ) |
|
| 122 | 121 | { |
| 123 | 122 | // use billing address if no delivery address is available |
| 124 | 123 | foreach( $addresses as $address ) |
@@ -305,8 +305,7 @@ discard block |
||
| 305 | 305 | foreach( $columns as $name ) { |
| 306 | 306 | $names .= '"' . $name . '", '; $values .= '?, '; |
| 307 | 307 | } |
| 308 | - } |
|
| 309 | - else |
|
| 308 | + } else |
|
| 310 | 309 | { |
| 311 | 310 | foreach( $columns as $name ) { |
| 312 | 311 | $names .= '"' . $name . '" = ?, '; |
@@ -691,11 +690,9 @@ discard block |
||
| 691 | 690 | |
| 692 | 691 | if( isset( $attributes[$prefix] ) && $attributes[$prefix] instanceof $iface ) { |
| 693 | 692 | return $attributes[$prefix]->getInternalDeps(); |
| 694 | - } |
|
| 695 | - elseif( isset( $attributes[$name] ) && $attributes[$name] instanceof $iface ) { |
|
| 693 | + } elseif( isset( $attributes[$name] ) && $attributes[$name] instanceof $iface ) { |
|
| 696 | 694 | return $attributes[$name]->getInternalDeps(); |
| 697 | - } |
|
| 698 | - else if( isset( $attributes['id'] ) && $attributes['id'] instanceof $iface ) { |
|
| 695 | + } else if( isset( $attributes['id'] ) && $attributes['id'] instanceof $iface ) { |
|
| 699 | 696 | return $attributes['id']->getInternalDeps(); |
| 700 | 697 | } |
| 701 | 698 | |