-
Notifications
You must be signed in to change notification settings - Fork 809
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
feat(sqlite) add support sqlc functions #2274
Conversation
fdd53b6
to
05a9379
Compare
05a9379
to
44c3ec7
Compare
internal/engine/sqlite/convert.go
Outdated
@@ -325,6 +354,10 @@ func (c *cc) convertMultiSelect_stmtContext(n *parser.Select_stmtContext) ast.No | |||
} | |||
} | |||
|
|||
func (c *cc) convertExprListContext(n *parser.Expr_listContext) ast.Node { | |||
return c.convertExprLists(n.AllExpr()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are returning a nested "ast.List" here, but an un-nested "ast.List" would be correct.
return c.convertExprLists(n.AllExpr()) | |
return c.convertExprLists(n.AllExpr()).Items[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@orisano Thank you for pointing out. I checked SQLite SQL syntax and confirmed parser.Expr_listContext
should return ast.List
. I thought I can reuse c.convertExprLists()
but it's specialized for values for selectStatement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in 2adb18f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hakobera thanks!
10/10, no notes |
This pull request add support sqlc functions below to SQLite.
sqlc.arg()
&@<variable>
notationsqlc.narg()
sqlc.embed()
sqlc.slice()
I know we already have similar PR #2157 by @aloisbarreras and #2259 by @orisano .
Both are introducing new syntax like
sqlc_arg()
as alternative ofsqlc.arg()
because of current SQLite parser's limitation.It works but I prefer to use same syntax for all supported engines to keep consistency, so I modified SQLite parser to accept
sqlc.
schema notation.Fixes #1881 #1962.