diff --git a/src/Pixxel/DBAL.php b/src/Pixxel/DBAL.php index 055367b..09d7e51 100755 --- a/src/Pixxel/DBAL.php +++ b/src/Pixxel/DBAL.php @@ -39,6 +39,15 @@ public function __construct($username, $password, $database, $host = 'localhost' } } + /** + * Get the raw pdo object + * @return object + */ + public function getPdo() + { + return $this->pdo; + } + /** * Perform a query and return true or false, depending on successful or not * @param string $query @@ -88,6 +97,19 @@ public function read($query, $parameters = []) return $return; } + /** + * Perform a select query and transform result into a php-object (return the first row only) + * @param string $query + * @param array $parameters + * @return object|bool + */ + public function readSingle($query, $parameters = []): object|bool + { + $result = $this->read($query, $parameters); + + return !empty($result) ? $result[0] : false; + } + /** * Get the last inserted id or false if nothing is returned * @return int|bool