Initial SQLite development #1
|
@ -91,8 +91,8 @@ class Custom
|
|||
{
|
||||
try {
|
||||
$stmt = self::runQuery($query, $parameters, is_null($pdo) ? $actualPDO = Configuration::dbConn() : $pdo);
|
||||
$stmt = null;
|
||||
} finally {
|
||||
$stmt = null;
|
||||
if (isset($actualPDO)) $actualPDO = null;
|
||||
}
|
||||
}
|
||||
|
@ -110,11 +110,12 @@ class Custom
|
|||
*/
|
||||
public static function scalar(string $query, array $parameters, Mapper $mapper, ?PDO $pdo = null): mixed
|
||||
{
|
||||
$stmt = self::runQuery($query, $parameters, $pdo ?? Configuration::dbConn());
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$first = $stmt->fetch(PDO::FETCH_NUM);
|
||||
return $first ? $mapper->map($first) : false;
|
||||
}
|
||||
return false;
|
||||
try {
|
||||
$stmt = self::runQuery($query, $parameters, is_null($pdo) ? $actualPDO = Configuration::dbConn() : $pdo);
|
||||
return ($first = $stmt->fetch(PDO::FETCH_NUM)) ? $mapper->map($first) : false;
|
||||
} finally {
|
||||
$stmt = null;
|
||||
if (isset($actualPDO)) $actualPDO = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user