diff --git a/src/Database.php b/src/Database.php index 279c29dd..4aaa9d61 100644 --- a/src/Database.php +++ b/src/Database.php @@ -17,6 +17,7 @@ class Database /** * The global database connection object * + * @todo Move this to the Service class * @var Database */ private static $Database; @@ -122,7 +123,7 @@ public static function getInstance() */ public function closeConnection() { - @mysqli_close($this->dbc); + $this->dbc = null; } /** @@ -145,7 +146,7 @@ public function getInsertId() } /** - * Prepares and executes a MySQL prepared INSERT/DELETE/UPDATE statement. Second two parameter is optional when using this function to execute a query with no placeholders. + * Prepares and executes a MySQL prepared INSERT/DELETE/UPDATE statement. The second parameter is optional when using this function to execute a query with no placeholders. * * @param string $queryText The prepared SQL statement that will be executed * @param mixed|array $params (Optional) The array of values that will be binded to the prepared statement @@ -168,7 +169,7 @@ public function execute($queryText, $params = false) } /** - * Prepares and executes a MySQL prepared SELECT statement. Second two parameter is optional when using this function to execute a query with no placeholders. + * Prepares and executes a MySQL prepared SELECT statement. The second parameter is optional when using this function to execute a query with no placeholders. * * @param string $queryText The prepared SQL statement that will be executed * @param mixed|array $params (Optional) The array of values that will be binded to the prepared statement @@ -209,6 +210,8 @@ private function doQuery($queryText, $params = null) $type = PDO::PARAM_BOOL; } elseif (is_int($param)) { $type = PDO::PARAM_INT; + } elseif (is_null($param)) { + $type = PDO::PARAM_NULL; } else { $type = PDO::PARAM_STR; } @@ -284,8 +287,6 @@ public function error($error, $id = null, $previous = null) $context['id'] = $id; } - $id = 5; - $this->logger->addError($error, $context); throw new Exception($error, $id, $previous); }