Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expression in columns array not working #369

Open
SukPavel opened this issue Jun 19, 2020 · 2 comments
Open

expression in columns array not working #369

SukPavel opened this issue Jun 19, 2020 · 2 comments

Comments

@SukPavel
Copy link

SukPavel commented Jun 19, 2020

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

@dg
Copy link
Owner

dg commented Jun 19, 2020

I don't understand what you mean.

@SukPavel
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants