method getOrder documentation in bbn\Db\Languages\Sqlite
Get a string starting with ORDER BY with corresponding parameters to $order.
function(array $cfg)
{
$res = '';
if (!empty($cfg['order'])) {
foreach ($cfg['order'] as $col => $dir) {
if (\is_array($dir) && isset($dir['field'])) {
$col = $dir['field'];
$dir = $dir['dir'] ?? 'ASC';
}
if (isset($cfg['available_fields'][$col])) {
// If it's an alias we use the simple name
if (isset($cfg['fields'][$col])) {
$f = $this->colSimpleName($col, true);
} elseif ($cfg['available_fields'][$col] === false) {
$f = $this->escape($col);
} else {
$f = $this->colFullName($col, $cfg['available_fields'][$col], true);
}
$res .= $f.' COLLATE NOCASE '.
(strtolower($dir) === 'desc' ? 'DESC' : 'ASC' ).','.PHP_EOL;
}
}
if (!empty($res)) {
return 'ORDER BY '.substr($res,0, Strrpos($res,',')).PHP_EOL;
}
}
return $res;
}
Get a string starting with ORDER BY with corresponding parameters to $order. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions