Sfoglia il codice sorgente

Improve debug mode

Maurits van der Schee 5 anni fa
parent
commit
5d056adfeb
5 ha cambiato i file con 28 aggiunte e 14 eliminazioni
  1. 8
    7
      api.php
  2. 6
    2
      docker/debian9/run.sh
  3. 2
    1
      docker/debug.sh
  4. 6
    2
      docker/ubuntu16/run.sh
  5. 6
    2
      docker/ubuntu18/run.sh

+ 8
- 7
api.php Vedi File

1774
         $options = array(
1774
         $options = array(
1775
             \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
1775
             \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
1776
             \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
1776
             \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
1777
-            \PDO::ATTR_PERSISTENT => true,
1778
         );
1777
         );
1779
         switch ($this->driver) {
1778
         switch ($this->driver) {
1780
             case 'mysql':return $options + [
1779
             case 'mysql':return $options + [
1781
                     \PDO::ATTR_EMULATE_PREPARES => false,
1780
                     \PDO::ATTR_EMULATE_PREPARES => false,
1782
                     \PDO::MYSQL_ATTR_FOUND_ROWS => true,
1781
                     \PDO::MYSQL_ATTR_FOUND_ROWS => true,
1782
+                    \PDO::ATTR_PERSISTENT => true,
1783
                 ];
1783
                 ];
1784
             case 'pgsql':return $options + [
1784
             case 'pgsql':return $options + [
1785
                     \PDO::ATTR_EMULATE_PREPARES => false,
1785
                     \PDO::ATTR_EMULATE_PREPARES => false,
1786
+                    \PDO::ATTR_PERSISTENT => true,
1786
                 ];
1787
                 ];
1787
             case 'sqlsrv':return $options + [
1788
             case 'sqlsrv':return $options + [
1788
                     \PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true,
1789
                     \PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true,
2803
         $this->reflection = $reflection;
2804
         $this->reflection = $reflection;
2804
     }
2805
     }
2805
 
2806
 
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*/
2807
     {
2808
     {
2808
         $columnHandler = $this->getProperty('columnHandler', '');
2809
         $columnHandler = $this->getProperty('columnHandler', '');
2809
         if ($columnHandler) {
2810
         if ($columnHandler) {
2817
         }
2818
         }
2818
     }
2819
     }
2819
 
2820
 
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*/
2821
     {
2822
     {
2822
         if (!$this->reflection->hasTable($tableName)) {
2823
         if (!$this->reflection->hasTable($tableName)) {
2823
             return;
2824
             return;
2833
         }
2834
         }
2834
     }
2835
     }
2835
 
2836
 
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*/
2837
     {
2838
     {
2838
         $uniqueTableNames = array();
2839
         $uniqueTableNames = array();
2839
         foreach ($joinParameters as $joinParameter) {
2840
         foreach ($joinParameters as $joinParameter) {
2847
         }
2848
         }
2848
     }
2849
     }
2849
 
2850
 
2850
-    private function handleAllTables(String $method, String $path, String $databaseName/*: void*/
2851
+    private function handleAllTables(String $method, String $path, String $databaseName) /*: void*/
2851
     {
2852
     {
2852
         $tableNames = $this->reflection->getTableNames();
2853
         $tableNames = $this->reflection->getTableNames();
2853
         foreach ($tableNames as $tableName) {
2854
         foreach ($tableNames as $tableName) {
3231
         $current = $value;
3232
         $current = $value;
3232
     }
3233
     }
3233
 
3234
 
3234
-    public function setPaths(DatabaseDefinition $database/*: void*/
3235
+    public function setPaths(DatabaseDefinition $database) /*: void*/
3235
     {
3236
     {
3236
         $result = [];
3237
         $result = [];
3237
         foreach ($database->getTables() as $database) {
3238
         foreach ($database->getTables() as $database) {
3847
 
3848
 
3848
     private $tree;
3849
     private $tree;
3849
 
3850
 
3850
-    public function __construct(object &$tree = null)
3851
+    public function __construct( /* object */&$tree = null)
3851
     {
3852
     {
3852
         if (!$tree) {
3853
         if (!$tree) {
3853
             $tree = $this->newTree();
3854
             $tree = $this->newTree();

+ 6
- 2
docker/debian9/run.sh Vedi File

44
 
44
 
45
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
45
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
46
 # install software
46
 # 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
49
 
53
 
50
 echo "------------------------------------------------"
54
 echo "------------------------------------------------"
51
 
55
 

+ 2
- 1
docker/debug.sh Vedi File

16
 	exit
16
 	exit
17
     fi
17
     fi
18
 done
18
 done
19
+dir=$(pwd)/..
19
 docker rm "php-crud-api_$f" > /dev/null 2>&1
20
 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'

+ 6
- 2
docker/ubuntu16/run.sh Vedi File

59
 
59
 
60
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
60
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
61
 # install software
61
 # 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
64
 
68
 
65
 echo "------------------------------------------------"
69
 echo "------------------------------------------------"
66
 
70
 

+ 6
- 2
docker/ubuntu18/run.sh Vedi File

46
 
46
 
47
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
47
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
48
 # install software
48
 # 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
51
 
55
 
52
 echo "------------------------------------------------"
56
 echo "------------------------------------------------"
53
 
57
 

Loading…
Annulla
Salva