@@ -163,7 +163,7 @@ |
||
| 163 | 163 | return $this->queryString; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - $escape = function ($value) { |
|
| 166 | + $escape = function($value) { |
|
| 167 | 167 | if (null === $value) { |
| 168 | 168 | return 'NULL'; |
| 169 | 169 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public static function query(string $query, mysqli $cnx) |
| 34 | 34 | { |
| 35 | - $promise = new Promise(function () { |
|
| 35 | + $promise = new Promise(function() { |
|
| 36 | 36 | self::getInstance()->wait(); |
| 37 | 37 | }); |
| 38 | 38 | $cnx->query($query, MYSQLI_ASYNC); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | } |
| 119 | 119 | foreach ($this->queries as $l => $link) { |
| 120 | 120 | $promise = $this->getPromise($link); |
| 121 | - $cnx = $this->getConnection($link); |
|
| 121 | + $cnx = $this->getConnection($link); |
|
| 122 | 122 | try { |
| 123 | 123 | $result = $cnx->reap_async_query(); |
| 124 | 124 | if ($result instanceof mysqli_result) { |
@@ -156,7 +156,7 @@ |
||
| 156 | 156 | return $this->stmt->queryString; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - $escape = function ($value) { |
|
| 159 | + $escape = function($value) { |
|
| 160 | 160 | if (null === $value) { |
| 161 | 161 | return 'NULL'; |
| 162 | 162 | } |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | namespace BenTools\SimpleDBAL\Model\Adapter\PDO; |
| 4 | 4 | |
| 5 | 5 | use BenTools\SimpleDBAL\Contract\AdapterInterface; |
| 6 | -use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 7 | 6 | use BenTools\SimpleDBAL\Contract\ResultInterface; |
| 7 | +use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 8 | 8 | use BenTools\SimpleDBAL\Model\StatementTrait; |
| 9 | 9 | use PDO; |
| 10 | 10 | use PDOStatement; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | $this->credentials = $credentials; |
| 54 | 54 | if (null !== $options) { |
| 55 | - $this->options = array_replace($this->getDefaultOptions(), $options); |
|
| 55 | + $this->options = array_replace($this->getDefaultOptions(), $options); |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function isConnected(): bool |
| 79 | 79 | { |
| 80 | 80 | try { |
| 81 | - self::wrapWithErrorHandler(function () { |
|
| 81 | + self::wrapWithErrorHandler(function() { |
|
| 82 | 82 | $this->cnx->getAttribute(PDO::ATTR_SERVER_INFO); |
| 83 | 83 | }); |
| 84 | 84 | return true; |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | */ |
| 170 | 170 | public function executeAsync($stmt, array $values = null): PromiseInterface |
| 171 | 171 | { |
| 172 | - $promise = new Promise(function () use (&$promise, $stmt, $values) { |
|
| 172 | + $promise = new Promise(function() use (&$promise, $stmt, $values) { |
|
| 173 | 173 | try { |
| 174 | 174 | $promise->resolve($this->execute($stmt, $values)); |
| 175 | 175 | } catch (DBALException $e) { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $wrappedStmt = $stmt->getWrappedStatement(); |
| 188 | 188 | try { |
| 189 | - self::wrapWithErrorHandler(function () use ($stmt, $wrappedStmt) { |
|
| 189 | + self::wrapWithErrorHandler(function() use ($stmt, $wrappedStmt) { |
|
| 190 | 190 | $stmt->bind(); |
| 191 | 191 | $wrappedStmt->execute(); |
| 192 | 192 | }); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | private static function wrapWithErrorHandler(callable $run) |
| 275 | 275 | { |
| 276 | - $errorHandler = function ($errno, $errstr) { |
|
| 276 | + $errorHandler = function($errno, $errstr) { |
|
| 277 | 277 | throw new PDOException($errstr, $errno); |
| 278 | 278 | }; |
| 279 | 279 | set_error_handler($errorHandler, E_WARNING); |
@@ -5,8 +5,8 @@ |
||
| 5 | 5 | use BenTools\SimpleDBAL\Contract\AdapterInterface; |
| 6 | 6 | use BenTools\SimpleDBAL\Contract\CredentialsInterface; |
| 7 | 7 | use BenTools\SimpleDBAL\Contract\ReconnectableAdapterInterface; |
| 8 | -use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 9 | 8 | use BenTools\SimpleDBAL\Contract\ResultInterface; |
| 9 | +use BenTools\SimpleDBAL\Contract\StatementInterface; |
|
| 10 | 10 | use BenTools\SimpleDBAL\Contract\TransactionAdapterInterface; |
| 11 | 11 | use BenTools\SimpleDBAL\Model\ConfigurableTrait; |
| 12 | 12 | use BenTools\SimpleDBAL\Model\Exception\AccessDeniedException; |
@@ -15,10 +15,10 @@ |
||
| 15 | 15 | use BenTools\SimpleDBAL\Model\Exception\ParamBindingException; |
| 16 | 16 | use GuzzleHttp\Promise\Promise; |
| 17 | 17 | use GuzzleHttp\Promise\PromiseInterface; |
| 18 | +use Throwable; |
|
| 18 | 19 | use mysqli; |
| 19 | 20 | use mysqli_result; |
| 20 | 21 | use mysqli_sql_exception; |
| 21 | -use Throwable; |
|
| 22 | 22 | |
| 23 | 23 | class MysqliAdapter implements AdapterInterface, TransactionAdapterInterface, ReconnectableAdapterInterface |
| 24 | 24 | { |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $this->cnx = $cnx; |
| 57 | 57 | $this->credentials = $credentials; |
| 58 | 58 | if (null !== $options) { |
| 59 | - $this->options = array_replace($this->getDefaultOptions(), $options); |
|
| 59 | + $this->options = array_replace($this->getDefaultOptions(), $options); |
|
| 60 | 60 | if ($this->hasOption('charset')) { |
| 61 | 61 | $this->cnx->set_charset($this->getOption('charset')); |
| 62 | 62 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | try { |
| 146 | - $wrappedStmt = self::wrapWithErrorHandler(function () use ($runnableQueryString) { |
|
| 146 | + $wrappedStmt = self::wrapWithErrorHandler(function() use ($runnableQueryString) { |
|
| 147 | 147 | return $this->cnx->prepare($runnableQueryString); |
| 148 | 148 | }); |
| 149 | 149 | } catch (mysqli_sql_exception $e) { |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | return $this->executeParallel($stmt, $values); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - $promise = new Promise(function () use (&$promise, $stmt, $values) { |
|
| 209 | + $promise = new Promise(function() use (&$promise, $stmt, $values) { |
|
| 210 | 210 | try { |
| 211 | 211 | $promise->resolve($this->execute($stmt, $values)); |
| 212 | 212 | } catch (Throwable $e) { |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | $stmt->bind(); |
| 253 | - $promise = MysqliAsync::query($stmt->getRunnableQuery(), $cnx)->then(function ($result) use ($cnx, $stmt) { |
|
| 253 | + $promise = MysqliAsync::query($stmt->getRunnableQuery(), $cnx)->then(function($result) use ($cnx, $stmt) { |
|
| 254 | 254 | if (!$result instanceof mysqli_result) { |
| 255 | 255 | $result = null; |
| 256 | 256 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | private function runStmt(Statement $stmt) |
| 264 | 264 | { |
| 265 | 265 | try { |
| 266 | - return self::wrapWithErrorHandler(function () use ($stmt) { |
|
| 266 | + return self::wrapWithErrorHandler(function() use ($stmt) { |
|
| 267 | 267 | return $stmt->createResult(); |
| 268 | 268 | }); |
| 269 | 269 | } catch (mysqli_sql_exception $e) { |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | private static function wrapWithErrorHandler(callable $run) |
| 360 | 360 | { |
| 361 | - $errorHandler = function ($errno, $errstr) { |
|
| 361 | + $errorHandler = function($errno, $errstr) { |
|
| 362 | 362 | throw new mysqli_sql_exception($errstr, $errno); |
| 363 | 363 | }; |
| 364 | 364 | set_error_handler($errorHandler, E_WARNING); |
@@ -130,7 +130,7 @@ |
||
| 130 | 130 | $this->resetResultset(); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $generator = function (\mysqli_result $result) { |
|
| 133 | + $generator = function(\mysqli_result $result) { |
|
| 134 | 134 | while ($row = $result->fetch_array(MYSQLI_NUM)) { |
| 135 | 135 | yield $row[0]; |
| 136 | 136 | } |
@@ -127,7 +127,7 @@ |
||
| 127 | 127 | $this->resetResultset(); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - $generator = function (\PDOStatement $stmt) { |
|
| 130 | + $generator = function(\PDOStatement $stmt) { |
|
| 131 | 131 | while ($value = $stmt->fetchColumn(0)) { |
| 132 | 132 | yield $value; |
| 133 | 133 | } |