Repository navigation
Add ordered bind placeholder dialect metadata - #2457
LucaCappelletti94 wants to merge 2 commits into
Conversation
0c0d081 to
1f82e56
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2457 +/- ##
==========================================
+ Coverage 81.23% 81.33% +0.09%
==========================================
Files 42 42
Lines 33891 34015 +124
Branches 33891 34015 +124
==========================================
+ Hits 27533 27666 +133
+ Misses 2793 2785 -8
+ Partials 3565 3564 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
83fd8c3 to
68428c3
Compare
68428c3 to
e7952a1
Compare
sabir-akhadov-localstack
left a comment
There was a problem hiding this comment.
Two non-blocking comments inline.
| /// Returns true if this dialect allows SQLite-style named dollar placeholders, | ||
| /// for example `SELECT $name`. | ||
| /// | ||
| /// This does not describe PostgreSQL-style ordered binds such as `SELECT $1`. |
There was a problem hiding this comment.
This hook does not gate $name placeholders: $name and $1 tokenize as Placeholder in every dialect (see the $1 tests in sqlparser_postgres.rs and $123 in sqlparser_mssql.rs, both with the flag off). What it actually toggles is whether $$…$$ / $tag$…$tag$ is dollar-quoting (false) or a placeholder with $ allowed inside (true, SQLite); the doc should say that.
| } | ||
|
|
||
| fn ordered_bind_placeholder_style(&self) -> Option<BindPlaceholderStyle> { | ||
| Some(BindPlaceholderStyle::DollarNumbered) |
There was a problem hiding this comment.
Redshift uses the same $1 positional syntax (https://docs.aws.amazon.com/redshift/latest/dg/r_PREPARE.html, "refer to the parameters by position using the notation $1, $2"), so RedshiftSqlDialect should return DollarNumbered too rather than falling through to None.
There was a problem hiding this comment.
Ok, added Redshift also now.
This PR adds
Dialect::ordered_bind_placeholder_style()to provide the information of whether a Dialect's ordered bind placeholders should be written as?or$1.