fixed jsonresult html entities, connectionpg now logs notice if present
This commit is contained in:
parent
4989aae171
commit
2b0486d9e9
@ -18,21 +18,25 @@ class ConnectionPG extends ConnectionAbstr {
|
||||
|
||||
public function __destruct(){}
|
||||
|
||||
public function prepare($stmtName, $stmt, $values){
|
||||
public function prepare($stmtName, $stmt, $values){
|
||||
$result = pg_query_params($this->connection, 'SELECT name FROM pg_prepared_statements WHERE name = $1', array($stmtName));
|
||||
//var_dump($stmt);
|
||||
//var_dump($values);
|
||||
if (pg_num_rows($result) == 0) {
|
||||
$result = \pg_prepare($this->connection, $stmtName, $stmt);
|
||||
if(($info = \pg_last_notice($this->connection)) != ''){
|
||||
new \SYSTEM\LOG\INFO($info);}
|
||||
}
|
||||
|
||||
if(!$result)
|
||||
throw new \SYSTEM\LOG\ERROR('Prepared Statement prepare fail: '. \pg_last_error($this->connection));
|
||||
|
||||
$result = \pg_execute($this->connection, $stmtName, $values);
|
||||
if(($info = \pg_last_notice($this->connection)) != ''){
|
||||
new \SYSTEM\LOG\INFO($info);}
|
||||
|
||||
if(!$result)
|
||||
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \pg_last_error($this->connection));
|
||||
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \pg_last_error($this->connection));
|
||||
|
||||
return new ResultPostgres($result);
|
||||
}
|
||||
@ -41,7 +45,10 @@ class ConnectionPG extends ConnectionAbstr {
|
||||
return pg_close($this->connection);}
|
||||
|
||||
public function query($query){
|
||||
$result = pg_query($this->connection, $query);
|
||||
$result = \pg_query($this->connection, $query);
|
||||
if(($info = \pg_last_notice($this->connection)) != ''){
|
||||
new \SYSTEM\LOG\INFO($info);}
|
||||
|
||||
if(!$result){
|
||||
throw new \SYSTEM\LOG\ERROR('Could not query Database. Check ur Query Syntax or required Rights: '.pg_last_error($this->connection));}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ class JsonResult extends \SYSTEM\LOG\AbstractResult {
|
||||
$error = array();
|
||||
|
||||
$error['class'] = get_class($e);
|
||||
$error['message'] = htmlentities($e->getMessage());
|
||||
$error['message'] = $e->getMessage();
|
||||
$error['code'] = $e->getCode();
|
||||
$error['file'] = $e->getFile();
|
||||
$error['line'] = $e->getLine();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user