mirror of
https://github.com/jlengrand/exposed-wiki.git
synced 2026-03-10 08:11:18 +00:00
Fix example codes and descriptions in DSL
This commit is contained in:
5
DSL.md
5
DSL.md
@@ -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)`.
|
||||||
|
|||||||
Reference in New Issue
Block a user