`VALUES ?` fails to make use of custom adapters
See original GitHub issueSQLDelight Version
2.0.0-alpha02
Operating System
Mac
Gradle Version
7.4.2
Kotlin Version
1.6.21
Dialect
sqlite
AGP Version
7.2.0
Describe the Bug
The following sql fails:
import kotlin.Int;
CREATE TABLE myTable (
id TEXT PRIMARY KEY,
foo INTEGER AS Int
);
upsert:
INSERT OR REPLACE INTO myTable
VALUES ?
;
When generating the code for the upsert
there’s no jamesJourneySessionEntryAdapter
passed. Although it’s referenced:
public class MyTableQueries(
private val driver: SqlDriver,
) : TransacterImpl(driver) {
public fun upsert(myTable: MyTable): Unit {
driver.execute(-1698177346, """
|INSERT OR REPLACE INTO myTable
|VALUES (?, ?)
""".trimMargin(), 2) {
bindString(1, myTable.id)
bindLong(2, myTableAdapter.fooAdapter.encode(myTable.foo))
}
notifyQueries(-1698177346) { emit ->
emit("myTable")
}
}
}
I can workaround it by using:
-VALUES ?
+VALUES (?, ?)
Here’s also a repro: https://github.com/vanniktech/playground/pull/3
Stacktrace
e: /Users/niklas/dev/GitHub/playground-android/app/build/generated/sqldelight/code/QueryWrapper/debug/com/vanniktech/playground/MyTableQueries.kt: (16, 23): Unresolved reference: myTableAdapter
Gradle Build Script
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Custom Adapter ListView Error - java - Stack Overflow
I am trying to list some user detail in a Listview , in each row show 4 String. The String is got from...
Read more >Getting Adapter values during login failure
During a user login failure with HTML Form Adapter, is it possible to get the failed user name and error detail from Ping...
Read more >Custom adapter program - IBM
The custom adapter program is a user-written program that transmits a business event to one or more event consumers. The custom adapter program...
Read more >Known Issues for the WCF Adapters - BizTalk Server
If the adapter fails to read the SOAP envelope and body while creating the BizTalk message, the message is not suspended because the...
Read more >Examples of custom action adapters - BMC Documentation
If you do not specify a value for an optional runtime parameter in a custom action, the property does not exist for the...
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
Another workaround: Use select in your query file
This is the real reason, why the tests don’t fail… Removing select results into a test failure too.
I analyzed it a little bit, but was unable to find the real cause:
The database and constructor uses the function
forAdapter
, which should find the needed binding expressions by callingrequiredAdapters
,argumentType
andSqlExpr.inferredType(): IntermediateType
. The resultingIntermediateType.column
is null, soIntermediateType.parentAdapter(): PropertySpec?
returns null => no adapter found.But I don’t know, why
IntermediateType.column
is null.