mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-08 03:54:20 +01:00
.
This commit is contained in:
parent
b3036967a2
commit
cf4b084fa0
11
ykval-db.php
11
ykval-db.php
@ -134,11 +134,11 @@ class Db
|
|||||||
|
|
||||||
private function query($query, $returnresult=false) {
|
private function query($query, $returnresult=false) {
|
||||||
if($this->dbh) {
|
if($this->dbh) {
|
||||||
$this->myLog->log(LOG_DEBUG, 'Query is: ' . $query);
|
$this->myLog->log(LOG_DEBUG, 'DB query is: ' . $query);
|
||||||
|
|
||||||
$this->result = $this->dbh->query($query);
|
$this->result = $this->dbh->query($query);
|
||||||
if (! $this->result){
|
if (! $this->result){
|
||||||
$this->myLog->log(LOG_INFO, 'Database error: ' . print_r($this->dbh->errorInfo(), true));
|
$this->myLog->log(LOG_INFO, 'Database error: ' . print_r($this->dbh->errorInfo(), true));
|
||||||
$this->myLog->log(LOG_INFO, 'Query was: ' . $query);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($returnresult) return $this->result;
|
if ($returnresult) return $this->result;
|
||||||
@ -171,7 +171,7 @@ class Db
|
|||||||
else $query .= ' ' . $key . '=NULL,';
|
else $query .= ' ' . $key . '=NULL,';
|
||||||
}
|
}
|
||||||
if (! $query) {
|
if (! $query) {
|
||||||
log("no values to set in query. Not updating DB");
|
$this->myLog->log(LOG_DEBUG, "no values to set in query. Not updating DB");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +215,7 @@ class Db
|
|||||||
$query = $query . " " . $key . "='" . $value . "',";
|
$query = $query . " " . $key . "='" . $value . "',";
|
||||||
}
|
}
|
||||||
if (! $query) {
|
if (! $query) {
|
||||||
log("no values to set in query. Not updating DB");
|
$this->myLog->log(LOG_DEBUG, "no values to set in query. Not updating DB");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +223,6 @@ class Db
|
|||||||
// Insert UPDATE statement at beginning
|
// Insert UPDATE statement at beginning
|
||||||
$query = "UPDATE " . $table . " SET " . $query;
|
$query = "UPDATE " . $table . " SET " . $query;
|
||||||
|
|
||||||
$this->myLog->log(LOG_INFO, "query is " . $query);
|
|
||||||
return $this->query($query, false);
|
return $this->query($query, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,7 +329,6 @@ or false on failure.
|
|||||||
if ($rev==1) $query.= " ORDER BY id DESC";
|
if ($rev==1) $query.= " ORDER BY id DESC";
|
||||||
if ($nr!=null) $query.= " LIMIT " . $nr;
|
if ($nr!=null) $query.= " LIMIT " . $nr;
|
||||||
|
|
||||||
$this->myLog->log(LOG_NOTICE, 'query is ' . $query);
|
|
||||||
$result = $this->query($query, true);
|
$result = $this->query($query, true);
|
||||||
if (!$result) return false;
|
if (!$result) return false;
|
||||||
|
|
||||||
@ -373,7 +371,6 @@ or false on failure.
|
|||||||
}
|
}
|
||||||
if ($rev==1) $query.= " ORDER BY id DESC";
|
if ($rev==1) $query.= " ORDER BY id DESC";
|
||||||
if ($nr!=null) $query.= " LIMIT " . $nr;
|
if ($nr!=null) $query.= " LIMIT " . $nr;
|
||||||
$this->myLog->log(LOG_INFO, "delete query is " . $query);
|
|
||||||
return $this->query($query, false);
|
return $this->query($query, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user