You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing these lines could solve the problem, but these lines are common for all drivers, so I'm wondering if we can just escape it or we should abstract it.
The text was updated successfully, but these errors were encountered:
yshrsmz
changed the title
generated code is not usable if a query includes backquotes
generated code is not usable if a query contains backquotes
Sep 26, 2024
Changing these lines could solve the problem, but these lines are common for all drivers, so I'm wondering if we can just escape it or we should abstract it.
Backquotes in a query break the code anyway, so I think it's safe to include the fix in app.ts.
problem
Say I have MySQL database and
users
table belowAnd this query.
I wrap columns with backquotes as some are reserved words in MySQL (
comment
in this case).And when I run sqlc, it generates the code below.
Apparently, it is broken as
findAllUsersQuery
contains unescaped backquotes, breaking its template literal.solution
Escape the backquotes?
sqlc-gen-typescript/src/app.ts
Lines 142 to 148 in 54496e9
Changing these lines could solve the problem, but these lines are common for all drivers, so I'm wondering if we can just escape it or we should abstract it.
The text was updated successfully, but these errors were encountered: