Skip to content

Commit

Permalink
do not include the join in not found error message
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Sep 1, 2023
1 parent e8a0198 commit 9caecc3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion jdbc/src/JdbcExtensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ typealias Where = Collection<ColValue>
typealias Values = Map<out Column, *>

fun <R, ID> DataSource.select(@Language("SQL", prefix = selectFrom) table: String, id: ID, column: String = "id", suffix: String = "", mapper: Mapper<R>): R =
select(table, listOf(column to id), suffix, ArrayList(1), mapper).firstOrNull() ?: throw NoSuchElementException("$table:$id not found")
select(table, listOf(column to id), suffix, ArrayList(1), mapper).firstOrNull() ?: throw NoSuchElementException("${table.substringBefore(" ")}:$id not found")

fun <R, C: MutableCollection<R>> DataSource.select(@Language("SQL", prefix = selectFrom) table: String, where: Where = emptyList(), @Language("SQL", prefix = selectFromTable) suffix: String = "", into: C, mapper: Mapper<R>): C =
query(selectFrom + q(table), where, suffix, into, mapper)
Expand Down

0 comments on commit 9caecc3

Please sign in to comment.