This commit is contained in:
Shoghi Cervantes 2013-06-10 17:10:40 +02:00
parent 33733cd608
commit 4284211bd1

View File

@ -143,7 +143,7 @@ class PocketMinecraftServer{
public function query($sql, $fetch = false){ public function query($sql, $fetch = false){
$result = $this->database->query($sql) or console("[ERROR] [SQL Error] ".$this->database->lastErrorMsg().". Query: ".$sql, true, true, 0); $result = $this->database->query($sql) or console("[ERROR] [SQL Error] ".$this->database->lastErrorMsg().". Query: ".$sql, true, true, 0);
if($fetch === true and ($result !== false and $result !== true)){ if($fetch === true and ($result instanceof SQLite3Result)){
$result = $result->fetchArray(SQLITE3_ASSOC); $result = $result->fetchArray(SQLITE3_ASSOC);
} }
return $result; return $result;
@ -228,7 +228,7 @@ class PocketMinecraftServer{
$this->preparedSQL->selectHandlers->bindValue(":name", $event, SQLITE3_TEXT); $this->preparedSQL->selectHandlers->bindValue(":name", $event, SQLITE3_TEXT);
$handlers = $this->preparedSQL->selectHandlers->execute(); $handlers = $this->preparedSQL->selectHandlers->execute();
$result = null; $result = null;
if($handlers !== false and $handlers !== true){ if($handlers instanceof SQLite3Result){
$call = array(); $call = array();
while(($hn = $handlers->fetchArray(SQLITE3_ASSOC)) !== false){ while(($hn = $handlers->fetchArray(SQLITE3_ASSOC)) !== false){
$call[(int) $hn["ID"]] = true; $call[(int) $hn["ID"]] = true;
@ -534,9 +534,7 @@ class PocketMinecraftServer{
$this->preparedSQL->selectActions->bindValue(":time", $time, SQLITE3_FLOAT); $this->preparedSQL->selectActions->bindValue(":time", $time, SQLITE3_FLOAT);
$actions = $this->preparedSQL->selectActions->execute(); $actions = $this->preparedSQL->selectActions->execute();
if($actions === false or $actions === true){ if($actions instanceof SQLite3Result){
return;
}
while(($action = $actions->fetchArray(SQLITE3_ASSOC)) !== false){ while(($action = $actions->fetchArray(SQLITE3_ASSOC)) !== false){
$cid = $action["ID"]; $cid = $action["ID"];
$this->preparedSQL->updateAction->reset(); $this->preparedSQL->updateAction->reset();
@ -558,6 +556,7 @@ class PocketMinecraftServer{
} }
$actions->finalize(); $actions->finalize();
} }
}
public function event($event,callable $func){ public function event($event,callable $func){
if(!is_callable($func)){ if(!is_callable($func)){