-
Notifications
You must be signed in to change notification settings - Fork 696
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix detekt issues and reference code by line numbers instead of whole…
… functions
- Loading branch information
Showing
17 changed files
with
163 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 8 additions & 2 deletions
10
...terside/snippets/exposed-dsl/src/main/kotlin/org/example/examples/InsertSelectExamples.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,29 @@ | ||
package org.example.examples | ||
|
||
import org.example.tables.UsersTable | ||
import org.example.tables.CitiesTable | ||
import org.example.tables.UsersTable | ||
import org.jetbrains.exposed.sql.* | ||
|
||
private const val MAX_VARCHAR_LENGTH = 10 | ||
|
||
class InsertSelectExamples { | ||
fun insertSelect() { | ||
val substring = UsersTable.name.substring(1, 2) | ||
val insertedRows = CitiesTable.insert(UsersTable.select(substring).orderBy(UsersTable.id).limit(2)) | ||
println(insertedRows) | ||
} | ||
|
||
fun insertSelectWithCol() { | ||
val userCount = UsersTable.selectAll().count() | ||
println(userCount) | ||
|
||
val insertedUsers = UsersTable.insert( | ||
UsersTable.select( | ||
stringParam("Foo"), | ||
Random().castTo<String>(VarCharColumnType()).substring(1, 10) | ||
Random().castTo<String>(VarCharColumnType()).substring(1, MAX_VARCHAR_LENGTH) | ||
), | ||
columns = listOf(UsersTable.name, UsersTable.id) | ||
) | ||
println(insertedUsers) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.