Fix example codes and descriptions in DSL

This commit is contained in:
Seong Yong-ju
2020-05-12 20:58:26 +09:00
parent 4ad987935a
commit 8a7ee54c50

5
DSL.md
View File

@@ -68,7 +68,7 @@ If you want to select only distinct value then use `withDistinct()` function:
```kotlin ```kotlin
val directors = StarWarsFilms. val directors = StarWarsFilms.
slice(StarWarsFilms.director). slice(StarWarsFilms.director).
select { StarWarsFilms.sequelId < 5 }. select { StarWarsFilms.sequelId less 5 }.
withDistinct().map { withDistinct().map {
it[StarWarsFilms.director] it[StarWarsFilms.director]
} }
@@ -229,6 +229,7 @@ Same example using the full syntax:
```kotlin ```kotlin
Players.join(StarWarsFilms, JoinType.INNER, additionalConstraint = {StarWarsFilms.sequelId eq Players.sequelId}) Players.join(StarWarsFilms, JoinType.INNER, additionalConstraint = {StarWarsFilms.sequelId eq Players.sequelId})
.slice(Players.name.count(), StarWarsFilms.name) .slice(Players.name.count(), StarWarsFilms.name)
.selectAll()
.groupBy(StarWarsFilms.name) .groupBy(StarWarsFilms.name)
``` ```
## Alias ## Alias
@@ -324,7 +325,7 @@ val allCitiesID = cities.batchInsert(cityNames) { name ->
this[cities.name] = name this[cities.name] = name
} }
``` ```
*NOTE:* The `batchInsert` function will still create multiple `INSERT` statements when interacting with your database. You most likely want to couple this with the `rewriteBatchedInserts=true` (or `rewriteBatchedStatements=true` option of your relevant JDBC driver, which will convert those into a single bulkInsert. *NOTE:* The `batchInsert` function will still create multiple `INSERT` statements when interacting with your database. You most likely want to couple this with the `rewriteBatchedInserts=true` (or `rewriteBatchedStatements=true`) option of your relevant JDBC driver, which will convert those into a single bulkInsert.
You can find the documentation for this option for MySQL [here](https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html) and PostgreSQL [here](https://jdbc.postgresql.org/documentation/94/connect.html). You can find the documentation for this option for MySQL [here](https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html) and PostgreSQL [here](https://jdbc.postgresql.org/documentation/94/connect.html).
## Insert From Select ## Insert From Select
If you want to use `INSERT INTO ... SELECT ` SQL clause try Exposed analog `Table.insert(Query)`. If you want to use `INSERT INTO ... SELECT ` SQL clause try Exposed analog `Table.insert(Query)`.