Skip to content

Commit 9530e3f

Browse files
committed
doc: regenerate docs
1 parent 5c50041 commit 9530e3f

File tree

1 file changed

+144
-13
lines changed

1 file changed

+144
-13
lines changed

docs/reference.md

Lines changed: 144 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,10 @@ dbClient.transaction { db =>
236236
LocalDate.parse("2000-01-01")
237237
)
238238
)
239-
assert(generatedKeys == Seq(4, 5))
239+
if (!this.isInstanceOf[MsSqlSuite])
240+
assert(generatedKeys == Seq(4, 5))
241+
else
242+
assert(generatedKeys == Seq(5))
240243

241244
db.run(Buyer.select) ==> List(
242245
Buyer[Sc](1, "James Bond", LocalDate.parse("2001-02-03")),
@@ -1997,7 +2000,6 @@ Buyer.select
19972000
.leftJoin(ShippingInfo)(_.id `=` _.buyerId)
19982001
.map { case (b, si) => (b.name, si.map(_.shippingDate)) }
19992002
.sortBy(_._2)
2000-
.nullsFirst
20012003
```
20022004
20032005
@@ -2006,7 +2008,7 @@ Buyer.select
20062008
SELECT buyer0.name AS res_0, shipping_info1.shipping_date AS res_1
20072009
FROM buyer buyer0
20082010
LEFT JOIN shipping_info shipping_info1 ON (buyer0.id = shipping_info1.buyer_id)
2009-
ORDER BY res_1 NULLS FIRST
2011+
ORDER BY res_1
20102012
```
20112013
20122014
@@ -3395,7 +3397,7 @@ Purchase.delete(_ => true)
33953397
33963398
*
33973399
```sql
3398-
DELETE FROM purchase WHERE ?
3400+
DELETE FROM purchase
33993401
```
34003402
34013403
@@ -4003,7 +4005,7 @@ Product.select
40034005
40044006
40054007
## UpdateJoin
4006-
`UPDATE` queries that use `JOIN`s
4008+
Basic `UPDATE` queries
40074009
### UpdateJoin.join
40084010
40094011
ScalaSql supports performing `UPDATE`s with `FROM`/`JOIN` clauses using the
@@ -6951,7 +6953,7 @@ Select.delete(_ => true)
69516953
69526954
*
69536955
```sql
6954-
DELETE FROM "select" WHERE ?
6956+
DELETE FROM "select"
69556957
```
69566958
69576959
@@ -9774,7 +9776,7 @@ Expr(Bytes("Hello")).contains(Bytes("ll"))
97749776

97759777

97769778
## ExprMathOps
9777-
Math operations; supported by H2/Postgres/MySql, not supported by Sqlite
9779+
Math operations; supported by H2/Postgres/MySql/MsSql, not supported by Sqlite
97789780
### ExprMathOps.power
97799781

97809782

@@ -10111,7 +10113,7 @@ val value = DataTypes[Sc](
1011110113
myInt = 12345678,
1011210114
myBigInt = 12345678901L,
1011310115
myDouble = 3.14,
10114-
myBoolean = true,
10116+
myBoolean = false,
1011510117
myLocalDate = LocalDate.parse("2023-12-20"),
1011610118
myLocalTime = LocalTime.parse("10:15:30"),
1011710119
myLocalDateTime = LocalDateTime.parse("2011-12-03T10:15:30"),
@@ -10122,6 +10124,23 @@ val value = DataTypes[Sc](
1012210124
myEnum = MyEnum.bar
1012310125
)
1012410126
10127+
val value2 = DataTypes[Sc](
10128+
67.toByte,
10129+
mySmallInt = 32767.toShort,
10130+
myInt = 12345678,
10131+
myBigInt = 9876543210L,
10132+
myDouble = 2.71,
10133+
myBoolean = true,
10134+
myLocalDate = LocalDate.parse("2020-02-22"),
10135+
myLocalTime = LocalTime.parse("03:05:01"),
10136+
myLocalDateTime = LocalDateTime.parse("2021-06-07T02:01:03"),
10137+
myUtilDate = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2021-06-07T02:01:03.000"),
10138+
myInstant = Instant.parse("2021-06-07T02:01:03Z"),
10139+
myVarBinary = new geny.Bytes(Array[Byte](9, 8, 7, 6, 5, 4, 3, 2)),
10140+
myUUID = new java.util.UUID(9876543210L, 1234567890L),
10141+
myEnum = MyEnum.baz
10142+
)
10143+
1012510144
db.run(
1012610145
DataTypes.insert.columns(
1012710146
_.myTinyInt := value.myTinyInt,
@@ -10140,8 +10159,26 @@ db.run(
1014010159
_.myEnum := value.myEnum
1014110160
)
1014210161
) ==> 1
10162+
db.run(
10163+
DataTypes.insert.columns(
10164+
_.myTinyInt := value2.myTinyInt,
10165+
_.mySmallInt := value2.mySmallInt,
10166+
_.myInt := value2.myInt,
10167+
_.myBigInt := value2.myBigInt,
10168+
_.myDouble := value2.myDouble,
10169+
_.myBoolean := value2.myBoolean,
10170+
_.myLocalDate := value2.myLocalDate,
10171+
_.myLocalTime := value2.myLocalTime,
10172+
_.myLocalDateTime := value2.myLocalDateTime,
10173+
_.myUtilDate := value2.myUtilDate,
10174+
_.myInstant := value2.myInstant,
10175+
_.myVarBinary := value2.myVarBinary,
10176+
_.myUUID := value2.myUUID,
10177+
_.myEnum := value2.myEnum
10178+
)
10179+
) ==> 1
1014310180
10144-
db.run(DataTypes.select) ==> Seq(value)
10181+
db.run(DataTypes.select) ==> Seq(value, value2)
1014510182
```
1014610183

1014710184

@@ -11181,6 +11218,24 @@ val rowSome = OptDataTypes[Sc](
1118111218
myUUID = Some(new java.util.UUID(1234567890L, 9876543210L)),
1118211219
myEnum = Some(MyEnum.bar)
1118311220
)
11221+
val rowSome2 = OptDataTypes[Sc](
11222+
myTinyInt = Some(67.toByte),
11223+
mySmallInt = Some(32767.toShort),
11224+
myInt = Some(23456789),
11225+
myBigInt = Some(9876543210L),
11226+
myDouble = Some(2.71),
11227+
myBoolean = Some(false),
11228+
myLocalDate = Some(LocalDate.parse("2020-02-22")),
11229+
myLocalTime = Some(LocalTime.parse("03:05:01")),
11230+
myLocalDateTime = Some(LocalDateTime.parse("2021-06-07T02:01:03")),
11231+
myUtilDate = Some(
11232+
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("2021-06-07T02:01:03.000")
11233+
),
11234+
myInstant = Some(Instant.parse("2021-06-07T02:01:03Z")),
11235+
myVarBinary = Some(new geny.Bytes(Array[Byte](9, 8, 7, 6, 5, 4, 3, 2))),
11236+
myUUID = Some(new java.util.UUID(9876543210L, 1234567890L)),
11237+
myEnum = Some(MyEnum.baz)
11238+
)
1118411239
1118511240
val rowNone = OptDataTypes[Sc](
1118611241
myTinyInt = None,
@@ -11198,12 +11253,11 @@ val rowNone = OptDataTypes[Sc](
1119811253
myUUID = None,
1119911254
myEnum = None
1120011255
)
11201-
1120211256
db.run(
11203-
OptDataTypes.insert.values(rowSome, rowNone)
11204-
) ==> 2
11257+
OptDataTypes.insert.values(rowSome, rowSome2, rowNone)
11258+
) ==> 3
1120511259
11206-
db.run(OptDataTypes.select) ==> Seq(rowSome, rowNone)
11260+
db.run(OptDataTypes.select) ==> Seq(rowSome, rowSome2, rowNone)
1120711261
```
1120811262

1120911263

@@ -12376,3 +12430,80 @@ db.concatWs(" ", "i", "am", "cow", 1337)
1237612430
```
1237712431
1237812432
12433+
12434+
## MsSqlDialect
12435+
Operations specific to working with Microsoft SQL Databases
12436+
### MsSqlDialect.top
12437+
12438+
For ScalaSql's Microsoft SQL dialect provides, the `.take(n)` operator translates
12439+
into a SQL `TOP(n)` clause
12440+
12441+
```scala
12442+
Buyer.select.take(0)
12443+
```
12444+
12445+
12446+
*
12447+
```sql
12448+
SELECT TOP(?) buyer0.id AS id, buyer0.name AS name, buyer0.date_of_birth AS date_of_birth
12449+
FROM buyer buyer0
12450+
```
12451+
12452+
12453+
12454+
*
12455+
```scala
12456+
Seq[Buyer[Sc]]()
12457+
```
12458+
12459+
12460+
12461+
### MsSqlDialect.bool vs bit
12462+
12463+
Insert rows with BIT values
12464+
12465+
```scala
12466+
db.run(
12467+
BoolTypes.insert.columns(
12468+
_.nullable := value.nullable,
12469+
_.nonNullable := value.nonNullable,
12470+
_.a := value.a,
12471+
_.b := value.b,
12472+
_.comment := value.comment
12473+
)
12474+
) ==> 1
12475+
db.run(
12476+
BoolTypes.insert.columns(
12477+
_.nullable := value2.nullable,
12478+
_.nonNullable := value2.nonNullable,
12479+
_.a := value2.a,
12480+
_.b := value2.b,
12481+
_.comment := value2.comment
12482+
)
12483+
) ==> 1
12484+
```
12485+
12486+
12487+
12488+
12489+
12490+
12491+
### MsSqlDialect.uodate BIT
12492+
12493+
12494+
12495+
```scala
12496+
BoolTypes
12497+
.update(_.a `=` 1)
12498+
.set(_.nonNullable := true)
12499+
```
12500+
12501+
12502+
*
12503+
```sql
12504+
UPDATE bool_types SET non_nullable = ? WHERE (bool_types.a = ?)
12505+
```
12506+
12507+
12508+
12509+

0 commit comments

Comments
 (0)