Skip to content

Commit 5d056ad

Browse files
committed
Improve debug mode
1 parent 56960ce commit 5d056ad

File tree

5 files changed

+28
-14
lines changed

5 files changed

+28
-14
lines changed

api.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,15 +1774,16 @@ private function getOptions(): array
17741774
$options = array(
17751775
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
17761776
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
1777-
\PDO::ATTR_PERSISTENT => true,
17781777
);
17791778
switch ($this->driver) {
17801779
case 'mysql':return $options + [
17811780
\PDO::ATTR_EMULATE_PREPARES => false,
17821781
\PDO::MYSQL_ATTR_FOUND_ROWS => true,
1782+
\PDO::ATTR_PERSISTENT => true,
17831783
];
17841784
case 'pgsql':return $options + [
17851785
\PDO::ATTR_EMULATE_PREPARES => false,
1786+
\PDO::ATTR_PERSISTENT => true,
17861787
];
17871788
case 'sqlsrv':return $options + [
17881789
\PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true,
@@ -2803,7 +2804,7 @@ public function __construct(Router $router, Responder $responder, array $propert
28032804
$this->reflection = $reflection;
28042805
}
28052806

2806-
private function handleColumns(String $method, String $path, String $databaseName, String $tableName/*: void*/
2807+
private function handleColumns(String $method, String $path, String $databaseName, String $tableName) /*: void*/
28072808
{
28082809
$columnHandler = $this->getProperty('columnHandler', '');
28092810
if ($columnHandler) {
@@ -2817,7 +2818,7 @@ private function handleColumns(String $method, String $path, String $databaseNam
28172818
}
28182819
}
28192820

2820-
private function handleTable(String $method, String $path, String $databaseName, String $tableName/*: void*/
2821+
private function handleTable(String $method, String $path, String $databaseName, String $tableName) /*: void*/
28212822
{
28222823
if (!$this->reflection->hasTable($tableName)) {
28232824
return;
@@ -2833,7 +2834,7 @@ private function handleTable(String $method, String $path, String $databaseName,
28332834
}
28342835
}
28352836

2836-
private function handleJoinTables(String $method, String $path, String $databaseName, array $joinParameters/*: void*/
2837+
private function handleJoinTables(String $method, String $path, String $databaseName, array $joinParameters) /*: void*/
28372838
{
28382839
$uniqueTableNames = array();
28392840
foreach ($joinParameters as $joinParameter) {
@@ -2847,7 +2848,7 @@ private function handleJoinTables(String $method, String $path, String $database
28472848
}
28482849
}
28492850

2850-
private function handleAllTables(String $method, String $path, String $databaseName/*: void*/
2851+
private function handleAllTables(String $method, String $path, String $databaseName) /*: void*/
28512852
{
28522853
$tableNames = $this->reflection->getTableNames();
28532854
foreach ($tableNames as $tableName) {
@@ -3231,7 +3232,7 @@ private function set(String $path, String $value) /*: void*/
32313232
$current = $value;
32323233
}
32333234

3234-
public function setPaths(DatabaseDefinition $database/*: void*/
3235+
public function setPaths(DatabaseDefinition $database) /*: void*/
32353236
{
32363237
$result = [];
32373238
foreach ($database->getTables() as $database) {
@@ -3847,7 +3848,7 @@ class PathTree implements \JsonSerializable
38473848

38483849
private $tree;
38493850

3850-
public function __construct(object &$tree = null)
3851+
public function __construct( /* object */&$tree = null)
38513852
{
38523853
if (!$tree) {
38533854
$tree = $this->newTree();

docker/debian9/run.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,12 @@ echo "skipped"
4444

4545
echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
4646
# install software
47-
git clone --quiet https://github.com/mevdschee/php-crud-api.git
48-
echo "done"
47+
if [ -d /php-crud-api ]; then
48+
echo "skipped"
49+
else
50+
git clone --quiet https://github.com/mevdschee/php-crud-api.git
51+
echo "done"
52+
fi
4953

5054
echo "------------------------------------------------"
5155

docker/debug.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ select f in "${options[@]}"; do
1616
exit
1717
fi
1818
done
19+
dir=$(pwd)/..
1920
docker rm "php-crud-api_$f" > /dev/null 2>&1
20-
docker run -ti --name "php-crud-api_$f" "php-crud-api:$f" /bin/bash -c '/usr/sbin/docker-run && cd php-crud-api && /bin/bash'
21+
docker run -ti -v $dir:/php-crud-api --name "php-crud-api_$f" "php-crud-api:$f" /bin/bash -c '/usr/sbin/docker-run && cd php-crud-api && /bin/bash'

docker/ubuntu16/run.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ echo "done"
5959

6060
echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
6161
# install software
62-
git clone --quiet https://github.com/mevdschee/php-crud-api.git
63-
echo "done"
62+
if [ -d /php-crud-api ]; then
63+
echo "skipped"
64+
else
65+
git clone --quiet https://github.com/mevdschee/php-crud-api.git
66+
echo "done"
67+
fi
6468

6569
echo "------------------------------------------------"
6670

docker/ubuntu18/run.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ echo "skipped"
4646

4747
echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
4848
# install software
49-
git clone --quiet https://github.com/mevdschee/php-crud-api.git
50-
echo "done"
49+
if [ -d /php-crud-api ]; then
50+
echo "skipped"
51+
else
52+
git clone --quiet https://github.com/mevdschee/php-crud-api.git
53+
echo "done"
54+
fi
5155

5256
echo "------------------------------------------------"
5357

0 commit comments

Comments
 (0)