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

Alias for a function without parameters forgotten #155

Open
GoogleCodeExporter opened this issue Jun 17, 2015 · 0 comments
Open

Alias for a function without parameters forgotten #155

GoogleCodeExporter opened this issue Jun 17, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create a SQL query containing an aliased function without parameters (for 
example "SELECT NOW() AS today"
2. Parse it
3. Create SQL from parsed query

What is the expected output? What do you see instead?
I expect "SELECT NOW() AS today"
I see "SELECT NOW()"
The alias is forgotten. If my function has parameters (DATEDIFF for example), 
the alias is keeped.

What version of the product are you using? On what operating system?
SVN: $Id: PHPSQLParser.php 757 2013-12-16 09:54:05Z on linux

Please provide any additional information below.
In builders/FunctionBuilder.php, you wrote :
if ($parsed['sub_tree'] === false) {
    return $parsed['base_expr'] . "()";
}

You should have :
if ($parsed['sub_tree'] === false) {
    return $parsed['base_expr'] . "()". $this->buildAlias($parsed) . $this->buildDirection($parsed);;
}

Thanks !

Original issue reported on code.google.com by ludo.zeg...@gmail.com on 12 Dec 2014 at 8:09

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

No branches or pull requests

1 participant