maxmello

    maxmello

    1 year ago
    Something like
    OrderItems.deleteWhere { OrderItems.id inSubQuery ( OrderItems.innerJoin(Orders).innerJoin(Items).slice(Orders.id).select { Orders.status eq 0 and (Items.alias eq "String") } ) }
    (untested) would probably work as a workaround. It seems that deleteWhere is only available from a
    Table
    , not a
    Join
    or their superclass
    ColumnSet
    . The delete implementation does not seem to support DELETE <TableName> FROM …:
    package org.jetbrains.exposed.sql.vendors // Default.kt
    open fun delete(
            ignore: Boolean,
            table: Table,
            where: String?,
            limit: Int?,
            transaction: Transaction
        ): String {
            // ...
            return buildString {
                append("DELETE FROM ")
                append(transaction.identity(table))
                if (where != null) {
                    append(" WHERE ")
                    append(where)
                }
                // ...
            }
        }
    p

    Pavel Naumov

    1 year ago
    thanks alot, i'll test it soon.