Repository navigation
Add ordered bind placeholder dialect metadata - #2457
LucaCappelletti94 wants to merge 2 commits into
Conversation
0c0d081 to
1f82e56
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2457 +/- ##
==========================================
+ Coverage 81.72% 81.74% +0.02%
==========================================
Files 42 42
Lines 34476 34514 +38
Branches 34476 34514 +38
==========================================
+ Hits 28174 28212 +38
Misses 2757 2757
Partials 3545 3545 ☔ 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.
0e22a9d to
1b41777
Compare
1b41777 to
681b993
Compare
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.