Unsafe returnColumn in 'SELECT' queries #1

Closed
opened 2025-02-24 11:07:06 +00:00 by xomrk · 1 comment
Owner

public fun <RT, DT : DatabaseType<RT>> returnColumn(name: String, column: IntermediateColumn<RT, DT, qUE>): Column<RT, DT, qUE>

This function not applicable to UNION because it has it's own return:

public fun <RT, DT : DatabaseType<RT>> uniteColumns(first: Column<RT, DT, fqUE>, last: Column<RT, DT, lqUE>): IntermediateColumn<RT, DT, qUE>

Also there is potential errors in returns from queries with reducers.

https://git.landgrafhomyak.ru/SERDHA/serdha-0-api.kt/src/commit/be1ac99550d7c26fe4385ccae817e65cab054fc1/src/commonMain/kotlin/ru/landgrafhomyak/db/serdha0/api/queries/SelectQuery.kt#L78 This function not applicable to `UNION` because it has it's own return: https://git.landgrafhomyak.ru/SERDHA/serdha-0-api.kt/src/commit/be1ac99550d7c26fe4385ccae817e65cab054fc1/src/commonMain/kotlin/ru/landgrafhomyak/db/serdha0/api/queries/SelectQuery.kt#L256 Also there is potential errors in returns from queries with reducers.
xomrk added the
Compile-time safety
label 2025-02-24 11:11:38 +00:00
xomrk added this to the (deleted) project 2025-02-24 11:15:20 +00:00
xomrk added the
Not a error
label 2025-02-24 11:22:29 +00:00
xomrk closed this issue 2025-02-24 11:22:44 +00:00
Author
Owner

public fun <RT, DT : DatabaseType<RT>> uniteColumns(first: Column<RT, DT, fqUE>, last: Column<RT, DT, lqUE>): IntermediateColumn<RT, DT, qUE>

This function returns IntermediateColumn that can be use for next computations inside this query, not returns. Since it's single producer of IntermediateColumn this API is safe.

https://git.landgrafhomyak.ru/SERDHA/serdha-0-api.kt/src/commit/be1ac99550d7c26fe4385ccae817e65cab054fc1/src/commonMain/kotlin/ru/landgrafhomyak/db/serdha0/api/queries/SelectQuery.kt#L256 This function returns `IntermediateColumn` that can be use for next computations inside this query, not returns. Since it's single producer of `IntermediateColumn` this API is safe.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: SERDHA/serdha-0-api.kt#1
No description provided.