JetBrains / Exposed

Kotlin SQL Framework
http://jetbrains.github.io/Exposed/
Apache License 2.0
8.05k stars 676 forks source link

fix: EXPOSED-301 Update with join throws if additionalConstraint provided #2007

Closed bog-walk closed 4 months ago

bog-walk commented 4 months ago

Attempting to use any join function in its full overload form, with an additionalConstraint argument, results in an exception if an update() is called after instead of a select(), for example:

org.jetbrains.exposed.exceptions.ExposedSQLException: No value specified for parameter 2.

This occurs because the additionalConstraint conditions are being correctly appended to generated SQL, but their arguments are not being first registered with the prepared update statement.

The arguments in the update statement now correctly register any additionalConstraint and take into account their order if an update with a WHERE clause is called.

No unit tests existed for the full overload form with update(), so they have been added to existing tests.