dibi icon indicating copy to clipboard operation
dibi copied to clipboard

expression in columns array not working

Open SukPavel opened this issue 5 years ago • 2 comments

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

SukPavel avatar Jun 19 '20 11:06 SukPavel

I don't understand what you mean.

dg avatar Jun 19 '20 14:06 dg

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.

SukPavel avatar Jun 22 '20 10:06 SukPavel