Database: start reworking the DBA to work with PDO
This commit is contained in:
@@ -17,8 +17,8 @@ class ErrorLog
|
||||
INSERT INTO log_errors
|
||||
(id_user, message, debug_info, file, line, request_uri, time, ip_address)
|
||||
VALUES
|
||||
({int:id_user}, {string:message}, {string:debug_info}, {string:file}, {int:line},
|
||||
{string:request_uri}, CURRENT_TIMESTAMP, {string:ip_address})',
|
||||
(:id_user, :message, :debug_info, :file, :line,
|
||||
:request_uri, CURRENT_TIMESTAMP, :ip_address)',
|
||||
$data);
|
||||
}
|
||||
|
||||
@@ -37,14 +37,14 @@ class ErrorLog
|
||||
public static function getOffset($offset, $limit, $order, $direction)
|
||||
{
|
||||
assert(in_array($order, ['id_entry', 'file', 'line', 'time', 'ipaddress', 'id_user']));
|
||||
$order = $order . ($direction === 'up' ? ' ASC' : ' DESC');
|
||||
|
||||
return Registry::get('db')->queryAssocs('
|
||||
SELECT *
|
||||
FROM log_errors
|
||||
ORDER BY {raw:order}
|
||||
LIMIT {int:offset}, {int:limit}',
|
||||
ORDER BY ' . $order . '
|
||||
LIMIT :offset, :limit',
|
||||
[
|
||||
'order' => $order . ($direction === 'up' ? ' ASC' : ' DESC'),
|
||||
'offset' => $offset,
|
||||
'limit' => $limit,
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user