Bugfix: PDO shell plugin
* Fix broken .set command * Prevent crash if database not available
This commit is contained in:
		@@ -218,7 +218,7 @@ class PdoShell {
 | 
				
			|||||||
                $this->output->writeln("<error>No such option {$varname}</>");
 | 
					                $this->output->writeln("<error>No such option {$varname}</>");
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            $this->options[$varname] = $args;
 | 
					            $this->options[$varname] = $value;
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
            $this->output->writeln(var_export($this->options[$varname]??null,true));
 | 
					            $this->output->writeln(var_export($this->options[$varname]??null,true));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -291,9 +291,9 @@ class PdoShell {
 | 
				
			|||||||
            $this->output->writeln("<error>No database resource selected</>");
 | 
					            $this->output->writeln("<error>No database resource selected</>");
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        $pdo = $this->db->getPDO();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
					            $pdo = $this->db->getPDO();
 | 
				
			||||||
            $stmt = $pdo->prepare($query);
 | 
					            $stmt = $pdo->prepare($query);
 | 
				
			||||||
            $stmt->execute($params);
 | 
					            $stmt->execute($params);
 | 
				
			||||||
            $res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
 | 
					            $res = $stmt->fetchAll(\PDO::FETCH_ASSOC);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user