I have an issue with SQLDelight in my KMM app. I h...
# squarelibraries
m
I have an issue with SQLDelight in my KMM app. I have created my .sq file containing:
Copy code
CREATE TABLE Person (
    id INTEGER PRIMARY KEY NOT NULL,
    name TEXT NOT NULL
);

insertNewPerson:
INSERT INTO Person(id, name)
VALUES(?, ?);
The generated source code does not compile. I generates a query with a negative identifier If I remove the minus sign on the identifier the code compiles. Has anyone else encountered this problem and know the solution?
Generated query:
Copy code
public class AppDatabaseQueries(
  driver: SqlDriver,
) : TransacterImpl(driver) {
  public fun insertNewPerson(id: Long?, name: String) {
    driver.execute(−1_357_689_605, """
        |INSERT INTO Person(id, name)
        |VALUES(?, ?)
        """.trimMargin(), 2) {
          bindLong(0, id)
          bindString(1, name)
        }
    notifyQueries(−1_357_689_605) { emit ->
      emit("Person")
    }
  }
}
h
What exactly is the compiler error?
m
Skärmavbild 2023-08-09 kl. 12.07.12.png
I’m using version 2.0.0 of sqldelight
h
This is very strange 🤔 I will take a look at the issue.
m
Thanks. I created an issue in the repo as well. It seems like the issue is that it uses the wrong minus sign for me. Very strange
Please tell me if I can help in any way :)
For anyone interested this turned out to be a locale issue in kotlinpoet fixed in this PR: https://github.com/square/kotlinpoet/pull/1658