Skip to content
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

Bind parameter DEFAULT is replaced with ? #3374

Closed
hfhbd opened this issue Jul 15, 2022 · 0 comments · Fixed by #3375
Closed

Bind parameter DEFAULT is replaced with ? #3374

hfhbd opened this issue Jul 15, 2022 · 0 comments · Fixed by #3375
Labels

Comments

@hfhbd
Copy link
Collaborator

hfhbd commented Jul 15, 2022

SQLDelight Version

master #af1e04406489a324d3e53efcf68700cc88e9844d

Operating System

nA

Gradle Version

nA

Kotlin Version

1.7.10

Dialect

HSql (and PostgreSQL after merge)

AGP Version

No response

Describe the Bug

Given sql:

CREATE TABLE dog (
  name VARCHAR(8) NOT NULL,
  breed VARCHAR(40) NOT NULL,
  is_good BOOLEAN DEFAULT TRUE NOT NULL
);

insertDog:
INSERT INTO dog
VALUES (?, ?, DEFAULT);
public fun insertDog(
    name: String,
    breed: String,
    is_good: Boolean,
  ): Unit {
    driver.execute(2111717998, """
        |INSERT INTO dog (name, breed, is_good)
        |VALUES (?, ?, ?)
        """.trimMargin(), 3) {
          check(this is JdbcPreparedStatement)
          bindString(0, name)
          bindString(1, breed)
          bindLong(2, if (is_good) 1L else 0L)
        }
    notifyQueries(2111717998) { emit ->
      emit("dog")
    }
  }

Expected:

public fun insertDog(
  name: String,
  breed: String
): Unit {
  driver.execute(2111717998, """
      |INSERT INTO dog (name, breed, is_good)
      |VALUES (?, ?, DEFAULT)
      """.trimMargin(), 2) {
        check(this is JdbcPreparedStatement)
        bindString(0, name)
        bindString(1, breed)
      }
  notifyQueries(2111717998) { emit ->
    emit("dog")
  }
}

Stacktrace

No response

Gradle Build Script

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant