dibi
dibi copied to clipboard
expression in columns array not working
Version: 4.1.3
dibi::expression in conjunction with %n modifier and alias not working
$cols = [
'name' => firstname,
'surname' => 'lastname',
dibi::expression("DATE_FORMAT(date_created, '%Y/%m/%d %k:%i')") => 'date_created'
];
used as:
dibi::fetchAll('SELECT %n FROM users', $cols);
will result in SELECT name AS firstname, surname AS lastname FROM users
I don't understand what you mean.
OK.
Is it possible to define selected columns by array (using %n modifier) where column names are not only names but expressions like DATE_FORMAT, IF(), atc?
According to docs this should be possible, but final query does not contain columns that are defined as expressions.