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

Move replacePlaceholders() from AbstractExpressionBuilder to AbstractQueryBuilder #903

Open
Tigrov opened this issue Nov 20, 2024 · 0 comments

Comments

@Tigrov
Copy link
Member

Tigrov commented Nov 20, 2024

Move replacePlaceholders() method from AbstractExpressionBuilder to QueryBuilderInterface and make it public.

Use replacePlaceholders() in

  • Command::getRawSql()
    return preg_replace_callback(
    '#(:\w+)#',
    static fn (array $matches): string => $params[$matches[1]] ?? $matches[1],
    $this->sql
    );
  • AbstractDDLQueryBuilder::createView()
    $subQuery = strtr($rawQuery, $params);
  • AbstractQueryBuilder::prepareValue() to prepare ExpressionInterface value after using buildExpression() method
  • other places where bind parameters are replaced by values ​​in a SQL query

This will help avoid possible errors when generating queries.

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

1 participant