-
Notifications
You must be signed in to change notification settings - Fork 0
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
How to get actual SQL query text? #8
Comments
Btw, I've written a quick-and-dirty codegen for |
That's pretty neat! You can use exec function which takes a connection and creates a function that is passed a query which returns the desired types.
|
I don't have explicit sqlite support yet but here's an example package that is for postgres: https://github.com/ClickerMonkey/typed-query-builder/tree/master/packages/sql-pgsql Essentially each DB only supports certain features, functions are named different things, etc. So these sql- packages is to support the types and functions as best as possible. |
To get the string and type data you use a Dialect (using the base dialect may be good enough for you if you don't want to implement a Sqlite one). There are a few helper types that can be seen here. These exec functions will return different things based on the options you pass:
|
Thank you for the fast response. Another question... As I'm planning to use it with Bun's sqlite driver, and it favors prepared statements a lot. Is there a way to have a query builder produce a query that has named placeholder values within the query text? Such query is cached by the sqlite engine and can be invoked with parameters in a separate call... |
Yep, that's by default iirc. The base dialect should support named parameters just fine. |
So, the |
I don't think the documentation ever mentions how to transform
into
to supply to my database driver...
Can you elaborate on this?
And how to get back the type of the resulting data, so I can inform the rest of the application about what's going on...
The text was updated successfully, but these errors were encountered: