Get Statement from Query
See original GitHub issueDescription
I would like to get the raw sql statement defined in a .sq
file and validated/generated with the compiler.
Usecase 1: Having a class with more than 256 attributes. Instead defining the raw query in Kotlin code and validate the query at runtime (eg wrong typed names), it would be nice to validate it with SQLDelight. Then you can use SqlDriver.executeQuery
with a custom binders
block.
Usecase 2: Using other APIs, which requires a SQL statement, eg Postgres CopyManager. Same reason, the validation can be done by the compiler.
// sq file
filter:
SELECT * FROM foo WHERE name = ?;
// kt file
val rawStatement = queries.filter().statement // SELECT * FROM foo WHERE name = ?;
driver.executeQuery(null, rawStatement, ...)
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
Get query from java.sql.PreparedStatement [duplicate]
In my code I am using java.sql.PreparedStatement . I then execute the setString() method to populate the wildcards of the prepared statement. Is ......
Read more >SQL example statements for retrieving data from a table - IU KB
An SQL SELECT statement retrieves records from a database table according to clauses (for example, FROM and WHERE ) that specify criteria. The ......
Read more >SQL SELECT Statement - W3Schools
The SELECT statement is used to select data from a database. The data returned is stored in a result table, called the result-set....
Read more >How to query data using a SELECT statement in SQL Server
This article describes how to query data using a SELECT statement in SQL Server effortlessly.
Read more >SQL examples for beginners: SQL SELECT statement usage
The above query template specifies a very basic SQL SELECT statement. As you can see, column names are placed after the SELECT clause...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The new QueryResult async api is nice, without it it was impossible to return
R
inexecuteQuery
, now I can use:once you have an instance of
Query
it isn’t, so that proposed API would work: