xitep commented on code in PR #1979:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1979#discussion_r2237264310


##########
src/dialect/mod.rs:
##########
@@ -841,6 +841,12 @@ pub trait Dialect: Debug + Any {
         false
     }
 
+    /// Returns true if this dialect allow colon placeholders
+    /// e.g. `SELECT :var` (JPA named parameters)
+    fn supports_colon_placeholder(&self) -> bool {
+        false
+    }

Review Comment:
   hello @iffyio, yes the parser can deal with things like `:var` already, but 
i'm not sure this is a feature or rather just a side effect of the code pointed 
out above. here's an example:
   
   ```rust
       let q = 
sqlparser::parser::Parser::new(&sqlparser::dialect::GenericDialect)
           .try_with_sql("select :var")
           .unwrap()
           .parse_query()
           .unwrap();
       let _ = sqlparser::ast::visit_expressions(&q, |expr: &Expr| {
           if let Expr::Value(v) = expr
               && let Value::Placeholder(s) = &v.value
           {
               println!("value: {v:?}");
               println!("placeholder: {s:?})");
           }
           ControlFlow::<()>::Continue(())
       });
   // OUTPUT:
   // value: ValueWithSpan { value: Placeholder(":var"), span: 
Span(Location(1,8)..Location(1,9)) }
   // placeholder: ":var")
   ```
   note:
   1. the span is incorrect, it coveres only the colon
   2. the placeholder represents "<colon><word>" (which in fact is what i'm 
after)
   
   however, you'll get the same output when using `""select :    var"` or even 
`"select : /*foobar*/   var"` as input :-/ this is _not_ what i want.
   
   so the intention is to make `:<word>` a first level token.
   
   does this help?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to