@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | case 'percona': |
| 50 | 50 | /// @todo if mysql version is bigger than 8.0, add `WITH mysql_native_password` |
| 51 | 51 | $statements = [ |
| 52 | - "CREATE DATABASE `$dbName`" . ($collation !== null ? " CHARACTER SET $collation" : '') . ';' |
|
| 52 | + "CREATE DATABASE `$dbName`".($collation !== null ? " CHARACTER SET $collation" : '').';' |
|
| 53 | 53 | ]; |
| 54 | 54 | if ($userName != '') { |
| 55 | 55 | $statements[] = "CREATE USER '$userName'@'%' IDENTIFIED BY '$password';"; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | // Also, by default connections are in autocommit mode... |
| 65 | 65 | // And yet, we need a GO to commit the db creation... |
| 66 | 66 | "SET QUOTED_IDENTIFIER ON;", |
| 67 | - "CREATE DATABASE \"$dbName\"" . ($collation !== null ? " COLLATE $collation" : '') . ';' |
|
| 67 | + "CREATE DATABASE \"$dbName\"".($collation !== null ? " COLLATE $collation" : '').';' |
|
| 68 | 68 | ]; |
| 69 | 69 | if ($userName != '') { |
| 70 | 70 | $statements[] = "CREATE LOGIN \"$userName\" WITH PASSWORD = '$password', DEFAULT_DATABASE = \"$dbName\", CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF;"; |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | $statements = [ |
| 82 | 82 | // q: do we need to add 'TEMPLATE template0' ? |
| 83 | 83 | // see f.e. https://www.vertabelo.com/blog/collations-in-postgresql/ |
| 84 | - "CREATE DATABASE \"$dbName\"" . ($collation !== null ? " ENCODING $collation" : '') . ';', |
|
| 84 | + "CREATE DATABASE \"$dbName\"".($collation !== null ? " ENCODING $collation" : '').';', |
|
| 85 | 85 | ]; |
| 86 | 86 | if ($userName != '') { |
| 87 | 87 | $statements[] = "COMMIT;"; |
| 88 | - $statements[] = "CREATE USER \"$userName\" WITH PASSWORD '$password'" . ';'; |
|
| 88 | + $statements[] = "CREATE USER \"$userName\" WITH PASSWORD '$password'".';'; |
|
| 89 | 89 | $statements[] = "GRANT ALL ON DATABASE \"$dbName\" TO \"$userName\""; // q: should we avoid granting CREATE? |
| 90 | 90 | } |
| 91 | 91 | return new Command($statements); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | case 'sqlite': |
| 94 | 94 | /// @todo this does not support creation of the new db with a different character encoding... |
| 95 | 95 | /// see https://stackoverflow.com/questions/21348459/set-pragma-encoding-utf-16-for-main-database-in-sqlite |
| 96 | - $filename = dirname($this->databaseConfiguration['path']) . '/' . $dbName . '.sqlite'; |
|
| 96 | + $filename = dirname($this->databaseConfiguration['path']).'/'.$dbName.'.sqlite'; |
|
| 97 | 97 | return new Command( |
| 98 | 98 | "ATTACH '$filename' AS \"$dbName\";" |
| 99 | 99 | ); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | return new Command($statements); |
| 161 | 161 | |
| 162 | 162 | case 'sqlite': |
| 163 | - $filename = dirname($this->databaseConfiguration['path']) . '/' . $dbName . '.sqlite'; |
|
| 163 | + $filename = dirname($this->databaseConfiguration['path']).'/'.$dbName.'.sqlite'; |
|
| 164 | 164 | return new Command( |
| 165 | 165 | null, |
| 166 | 166 | function() use($filename, $dbName, $ifExists) { |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | case 'percona': |
| 248 | 248 | return new Command( |
| 249 | 249 | 'SHOW COLLATION;', |
| 250 | - function ($output, $executor) { |
|
| 250 | + function($output, $executor) { |
|
| 251 | 251 | /** @var Executor $executor */ |
| 252 | 252 | $lines = $executor->resultSetToArray($output); |
| 253 | 253 | $out = []; |
| 254 | - foreach($lines as $line) { |
|
| 254 | + foreach ($lines as $line) { |
|
| 255 | 255 | $parts = explode("|", $line, 3); |
| 256 | - $out[] = trim($parts[0]) . ' (' . trim($parts[1]) .')'; |
|
| 256 | + $out[] = trim($parts[0]).' ('.trim($parts[1]).')'; |
|
| 257 | 257 | } |
| 258 | 258 | return $out; |
| 259 | 259 | } |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | case 'postgresql': |
| 265 | 265 | return new Command( |
| 266 | 266 | 'SELECT collname AS Collation FROM pg_collation ORDER BY collname', |
| 267 | - function ($output, $executor) { |
|
| 267 | + function($output, $executor) { |
|
| 268 | 268 | /** @var Executor $executor */ |
| 269 | 269 | return $executor->resultSetToArray($output); |
| 270 | 270 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | return new Command( |
| 275 | 275 | null, |
| 276 | 276 | /// @todo list the supported utf16 variants as soon as allow using them |
| 277 | - function () { |
|
| 277 | + function() { |
|
| 278 | 278 | return []; |
| 279 | 279 | } |
| 280 | 280 | ); |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | case 'mssql': |
| 295 | 295 | return new Command( |
| 296 | 296 | 'SELECT name AS Collation FROM fn_helpcollations();', |
| 297 | - function ($output, $executor) { |
|
| 297 | + function($output, $executor) { |
|
| 298 | 298 | /** @var Executor $executor */ |
| 299 | 299 | return $executor->resultSetToArray($output); |
| 300 | 300 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return new Command( |
| 322 | 322 | /// @todo use 'SHOW DATABASES' for versions < 5 |
| 323 | 323 | "SELECT SCHEMA_NAME AS 'Database' FROM information_schema.SCHEMATA ORDER BY SCHEMA_NAME;", |
| 324 | - function ($output, $executor) { |
|
| 324 | + function($output, $executor) { |
|
| 325 | 325 | /** @var Executor $executor */ |
| 326 | 326 | return $executor->resultSetToArray($output); |
| 327 | 327 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | // the way we create it, the user account is contained in the db |
| 333 | 333 | // @todo add "WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb')" ? |
| 334 | 334 | "SELECT name AS 'Database' FROM sys.databases ORDER BY name;", |
| 335 | - function ($output, $executor) { |
|
| 335 | + function($output, $executor) { |
|
| 336 | 336 | /** @var Executor $executor */ |
| 337 | 337 | return $executor->resultSetToArray($output); |
| 338 | 338 | } |
@@ -343,20 +343,20 @@ discard block |
||
| 343 | 343 | case 'postgresql': |
| 344 | 344 | return new Command( |
| 345 | 345 | 'SELECT datname AS "Database" FROM pg_database ORDER BY datname;', |
| 346 | - function ($output, $executor) { |
|
| 346 | + function($output, $executor) { |
|
| 347 | 347 | /** @var Executor $executor */ |
| 348 | 348 | return $executor->resultSetToArray($output); |
| 349 | 349 | } |
| 350 | 350 | ); |
| 351 | 351 | |
| 352 | 352 | case 'sqlite': |
| 353 | - $fileGlob = dirname($this->databaseConfiguration['path']) . '/*.sqlite'; |
|
| 353 | + $fileGlob = dirname($this->databaseConfiguration['path']).'/*.sqlite'; |
|
| 354 | 354 | return new Command( |
| 355 | 355 | null, |
| 356 | 356 | function() use ($fileGlob) { |
| 357 | 357 | $out = []; |
| 358 | 358 | foreach (glob($fileGlob) as $filename) { |
| 359 | - $out[] = basename($filename); |
|
| 359 | + $out[] = basename($filename); |
|
| 360 | 360 | } |
| 361 | 361 | return $out; |
| 362 | 362 | } |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | case 'percona': |
| 382 | 382 | return new Command( |
| 383 | 383 | 'SELECT DISTINCT User FROM mysql.user ORDER BY User;', |
| 384 | - function ($output, $executor) { |
|
| 384 | + function($output, $executor) { |
|
| 385 | 385 | /** @var Executor $executor */ |
| 386 | 386 | return $executor->resultSetToArray($output); |
| 387 | 387 | } |
@@ -390,7 +390,7 @@ discard block |
||
| 390 | 390 | case 'mssql': |
| 391 | 391 | return new Command( |
| 392 | 392 | "SELECT name AS 'User' FROM sys.sql_logins ORDER BY name", |
| 393 | - function ($output, $executor) { |
|
| 393 | + function($output, $executor) { |
|
| 394 | 394 | /** @var Executor $executor */ |
| 395 | 395 | return $executor->resultSetToArray($output); |
| 396 | 396 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | case 'postgresql': |
| 402 | 402 | return new Command( |
| 403 | 403 | 'SELECT usename AS "User" FROM pg_catalog.pg_user ORDER BY usename;', |
| 404 | - function ($output, $executor) { |
|
| 404 | + function($output, $executor) { |
|
| 405 | 405 | /** @var Executor $executor */ |
| 406 | 406 | return $executor->resultSetToArray($output); |
| 407 | 407 | } |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | case 'sqlite': |
| 411 | 411 | return new Command( |
| 412 | 412 | null, |
| 413 | - function () { |
|
| 413 | + function() { |
|
| 414 | 414 | // since sqlite does not support users, null seems more appropriate than an empty array... |
| 415 | 415 | return null; |
| 416 | 416 | } |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | case 'percona': |
| 435 | 435 | return new Command( |
| 436 | 436 | 'SHOW VARIABLES LIKE "version";', |
| 437 | - function ($output, $executor) { |
|
| 437 | + function($output, $executor) { |
|
| 438 | 438 | /** @var Executor $executor */ |
| 439 | 439 | $line = $executor->resultSetToArray($output)[0]; |
| 440 | 440 | $parts = explode('|', $line); |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | case 'postgresql': |
| 448 | 448 | return new Command( |
| 449 | 449 | 'SHOW server_version;', |
| 450 | - function ($output, $executor) { |
|
| 450 | + function($output, $executor) { |
|
| 451 | 451 | /** @var Executor $executor */ |
| 452 | 452 | return $executor->resultSetToArray($output)[0]; |
| 453 | 453 | } |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | case 'sqlite': |
| 457 | 457 | return new Command( |
| 458 | 458 | "select sqlite_version();", |
| 459 | - function ($output, $executor) { |
|
| 459 | + function($output, $executor) { |
|
| 460 | 460 | /** @var Executor $executor */ |
| 461 | 461 | return $executor->resultSetToArray($output)[0]; |
| 462 | 462 | } |
@@ -465,12 +465,12 @@ discard block |
||
| 465 | 465 | case 'mssql': |
| 466 | 466 | return new Command( |
| 467 | 467 | "SELECT @@version", |
| 468 | - function ($output, $executor) { |
|
| 468 | + function($output, $executor) { |
|
| 469 | 469 | /** @var Executor $executor */ |
| 470 | 470 | $output = $executor->resultSetToArray($output); |
| 471 | 471 | $line = $output[0]; |
| 472 | 472 | preg_match('/Microsoft SQL Server +([^ ]+) +([^ ]+) +/', $line, $matches); |
| 473 | - return $matches[1] . ' ' . $matches[2]; |
|
| 473 | + return $matches[1].' '.$matches[2]; |
|
| 474 | 474 | } |
| 475 | 475 | ); |
| 476 | 476 | |