Faster way of coding equals to null in the sql builder
This commit is contained in:
+12
-4
@@ -39,12 +39,20 @@ class SqlSelectionBuilder(
|
||||
private fun buildCondition(cond: Condition): String =
|
||||
when (cond) {
|
||||
is Condition.Equals -> {
|
||||
selectionArgs.add(cond.value.toString())
|
||||
"${cond.column} = ?"
|
||||
if (cond.value == null) {
|
||||
"${cond.column} IS NULL"
|
||||
} else {
|
||||
selectionArgs.add(cond.value.toString())
|
||||
"${cond.column} = ?"
|
||||
}
|
||||
}
|
||||
is Condition.NotEquals -> {
|
||||
selectionArgs.add(cond.value.toString())
|
||||
"${cond.column} != ?"
|
||||
if (cond.value == null) {
|
||||
"${cond.column} IS NULL"
|
||||
} else {
|
||||
selectionArgs.add(cond.value.toString())
|
||||
"${cond.column} != ?"
|
||||
}
|
||||
}
|
||||
is Condition.GreaterThan -> {
|
||||
selectionArgs.add(cond.value.toString())
|
||||
|
||||
Reference in New Issue
Block a user