@@ -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 ( |
@@ -110,9 +110,12 @@ |
||
| 110 | 110 | throw new Exception( 'Unable to fork new process: ' . pcntl_strerror( pcntl_get_last_error() ) ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if( $pid === 0 ) // child process |
|
| 113 | + if( $pid === 0 ) { |
|
| 114 | + // child process |
|
| 114 | 115 | { |
| 115 | - $this->list = []; // use own child process list |
|
| 116 | + $this->list = []; |
|
| 117 | + } |
|
| 118 | + // use own child process list |
|
| 116 | 119 | exit( $this->exec( $fcn, $data ) ); |
| 117 | 120 | } |
| 118 | 121 | |
@@ -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->exec(); |
| 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 | |
@@ -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 | $stmt = $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(), $e->errorInfo ); |
| 78 | 81 | } |
| 79 | 82 | |
@@ -50,9 +50,12 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function affectedRows() : int |
| 52 | 52 | { |
| 53 | - try { |
|
| 53 | + try |
|
| 54 | + { |
|
| 54 | 55 | return $this->statement->rowCount(); |
| 55 | - } catch( \PDOException $e ) { |
|
| 56 | + } |
|
| 57 | + catch( \PDOException $e ) |
|
| 58 | + { |
|
| 56 | 59 | throw new \Aimeos\Base\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 57 | 60 | } |
| 58 | 61 | } |
@@ -67,9 +70,12 @@ discard block |
||
| 67 | 70 | */ |
| 68 | 71 | public function fetch( int $style = \Aimeos\Base\DB\Result\Base::FETCH_ASSOC ) : ?array |
| 69 | 72 | { |
| 70 | - try { |
|
| 73 | + try |
|
| 74 | + { |
|
| 71 | 75 | return $this->statement->fetch( $style ? \PDO::FETCH_ASSOC : \PDO::FETCH_NUM ) ?: null; |
| 72 | - } catch( \PDOException $e ) { |
|
| 76 | + } |
|
| 77 | + catch( \PDOException $e ) |
|
| 78 | + { |
|
| 73 | 79 | throw new \Aimeos\Base\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 74 | 80 | } |
| 75 | 81 | } |
@@ -83,9 +89,12 @@ discard block |
||
| 83 | 89 | */ |
| 84 | 90 | public function finish() : Iface |
| 85 | 91 | { |
| 86 | - try { |
|
| 92 | + try |
|
| 93 | + { |
|
| 87 | 94 | $this->statement->closeCursor(); |
| 88 | - } catch( \PDOException $e ) { |
|
| 95 | + } |
|
| 96 | + catch( \PDOException $e ) |
|
| 97 | + { |
|
| 89 | 98 | throw new \Aimeos\Base\DB\Exception( $e->getMessage(), $e->getCode(), $e->errorInfo ); |
| 90 | 99 | } |
| 91 | 100 | |
@@ -100,9 +109,12 @@ discard block |
||
| 100 | 109 | */ |
| 101 | 110 | public function nextResult() : bool |
| 102 | 111 | { |
| 103 | - try { |
|
| 112 | + try |
|
| 113 | + { |
|
| 104 | 114 | return $this->statement->nextRowset(); |
| 105 | - } catch( \PDOException $e ) { |
|
| 115 | + } |
|
| 116 | + catch( \PDOException $e ) |
|
| 117 | + { |
|
| 106 | 118 | return false; |
| 107 | 119 | } |
| 108 | 120 | } |
@@ -102,8 +102,7 @@ |
||
| 102 | 102 | { |
| 103 | 103 | $this->cache[$name] = $value; |
| 104 | 104 | unset( $this->negCache[$name] ); |
| 105 | - } |
|
| 106 | - else |
|
| 105 | + } else |
|
| 107 | 106 | { |
| 108 | 107 | $this->negCache[$name] = true; |
| 109 | 108 | } |
@@ -241,9 +241,12 @@ |
||
| 241 | 241 | { |
| 242 | 242 | if( self::$node === null ) |
| 243 | 243 | { |
| 244 | - try { |
|
| 244 | + try |
|
| 245 | + { |
|
| 245 | 246 | self::$node = random_bytes( 6 ); |
| 246 | - } catch( \Throwable $t ) { |
|
| 247 | + } |
|
| 248 | + catch( \Throwable $t ) |
|
| 249 | + { |
|
| 247 | 250 | if( function_exists( 'openssl_random_pseudo_bytes' ) ) { |
| 248 | 251 | self::$node = openssl_random_pseudo_bytes( 6 ); |
| 249 | 252 | } else { |
@@ -139,8 +139,7 @@ |
||
| 139 | 139 | $list[] = $this->escape( '==', $this->getParamType( $item ), $item ); |
| 140 | 140 | } |
| 141 | 141 | $params[$i] = join( ',', $list ); |
| 142 | - } |
|
| 143 | - else |
|
| 142 | + } else |
|
| 144 | 143 | { |
| 145 | 144 | $params[$i] = $this->escape( '==', $this->getParamType( $params[$i] ), $params[$i] ); |
| 146 | 145 | } |
@@ -252,8 +252,7 @@ discard block |
||
| 252 | 252 | |
| 253 | 253 | if( in_array( $op, $operators['combine'], true ) ) { |
| 254 | 254 | return $this->createCombineExpression( $op, (array) $value ); |
| 255 | - } |
|
| 256 | - else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 255 | + } else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 257 | 256 | return $this->createCompareExpression( $op, (array) $value ); |
| 258 | 257 | } |
| 259 | 258 | |
@@ -307,11 +306,9 @@ discard block |
||
| 307 | 306 | |
| 308 | 307 | if( in_array( $op, $operators['combine'], true ) ) { |
| 309 | 308 | $results[] = $this->createCombineExpression( $op, (array) $entry[$op] ); |
| 310 | - } |
|
| 311 | - else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 309 | + } else if( in_array( $op, $operators['compare'], true ) ) { |
|
| 312 | 310 | $results[] = $this->createCompareExpression( $op, (array) $entry[$op] ); |
| 313 | - } |
|
| 314 | - else { |
|
| 311 | + } else { |
|
| 315 | 312 | throw new \Aimeos\Base\Exception( sprintf( 'Invalid operator "%1$s"', $op ) ); |
| 316 | 313 | } |
| 317 | 314 | } |