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

Build User Varaiable Expression in FunctionBuilder #340

Merged
merged 1 commit into from Feb 1, 2022

Conversation

Aramics
Copy link
Contributor

@Aramics Aramics commented Jun 3, 2021

Implement UserVariableBuilder in FunctionBuilder to build for custom variable.

This changes solve issues of subtree with user_variable expr_type when building parsed query.

Solve this error while building query.
Message: unknown [expr_type] = user_variable in "function subtree

To reproduce:

$sql = 'select  demoid as id, parent_id as pid, name from    (select demoid, parent_id, d.name as name from tbldemos as d order by d.parent_id, d.demoid) demos_sorted, (select @pv := "0") initialisation where find_in_set(parent_id, @pv) and     length(@pv := concat(@pv, ",", demoid))';

$parser = new PHPSQLParser($sql);
$parsed  = $parser->parsed;

//building sql will fail without this commit.
$creator = new PHPSQLCreator($parsed);
$newSql = $creator->created;

Implement UserVariableBuilder in FunctionBuilder to build for custom variable.

This changes solve issues of subtree with user_variable expr_type

Solve this error while building parsed query.
Message: unknown [expr_type] = user_variable in "function subtree
@greenlion greenlion merged commit 6737695 into greenlion:master Feb 1, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants