mathiasbn
06/30/2016, 7:17 PMoverride fun prepareSQL(transaction: Transaction): String {
val builder = QueryBuilder(true)
return transaction.db.dialect.insert(isIgnore, table, values.map { it.key},
"VALUES (${values.map { builder.registerArgument(it.value, it.key.columnType) }.joinToString()})", transaction)
}
ie the values are used just as if they were the type of the column, while for update:
override fun prepareSQL(transaction: Transaction): String = buildString {
val builder = QueryBuilder(true)
append("UPDATE ${targetsSet.describe(transaction)}")
append(" SET ")
append(firstDataSet.map {
val (col, value) = it
"${transaction.identity(col)}=" + when (value) {
is Expression<*> -> value.toSQL(builder)
else -> builder.registerArgument(value, col.columnType)
}
}.joinToString())
where?.let { append(" WHERE " + it.toSQL(builder)) }
limit?.let { append(" LIMIT $it")}
}
ie the value is handled differently depending on whether it is an expression or not.
Maybe i’m missing something