diff --git a/CHANGELOG.md b/CHANGELOG.md index 325669b..65792a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Fix: the default `lookasideSlotSize` and `lookasideSlotCount` of `DSLDBConfiguration` disabled SQLite's lookaside memory allocator on Kotlin/Native and on Android 9 and higher, as those of `DatabaseConfiguration` did; they are now -1, see sqllin-driver * Fix: on the JVM and Kotlin/Native, a blocking `database { }` scope on another thread could take the TEMP table and triggers that count the changes of observed queries with it, as its transaction can be open while they are created, the connection being locked for each statement rather than for a transaction: its rollback removed them, so the next write failed with "no such table", and once another table was observed, the changes of the table they belonged to were no longer counted. The tracker now creates them again where they are gone, and counts a change of their tables. A failure to tell the observed queries of a change no longer takes the place of the failure of the statement that made it. The guide to observed queries and the documentation of `Database#invoke` and `Database#observe` now say to write through `suspendedScope` while queries are observed, as they run on another thread, and that a blocking scope isn't serialized with them * Fix documentation: the example of the guide to concurrency safety called `database suspendScope { }`, which doesn't exist, in a function that wasn't a `suspend` one; it is `database suspendedScope { }`, in a `suspend` function +* Fix documentation: the query guide called `SelectStatement.getResult()`, which doesn't exist; the method is `getResults()` ### sqllin-driver diff --git a/README.md b/README.md index 781532f..090a21f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ fun sample() { table SELECT WHERE (age LTE 5) GROUP_BY age HAVING (upper(name) EQ "TOM") ORDER_BY (age to DESC) LIMIT 2 OFFSET 1 } } - selectStatement.getResult().forEach { person -> + selectStatement.getResults().forEach { person -> println(person.name) } } diff --git a/README_CN.md b/README_CN.md index f2adc20..6612439 100644 --- a/README_CN.md +++ b/README_CN.md @@ -18,7 +18,7 @@ fun sample() { table SELECT WHERE (age LTE 5) GROUP_BY age HAVING (upper(name) EQ "TOM") ORDER_BY (age to DESC) LIMIT 2 OFFSET 1 } } - selectStatement.getResult().forEach { person -> + selectStatement.getResults().forEach { person -> println(person.name) } } diff --git a/sqllin-dsl/doc/getting-start-cn.md b/sqllin-dsl/doc/getting-start-cn.md index 0cbc7d6..1e59d27 100644 --- a/sqllin-dsl/doc/getting-start-cn.md +++ b/sqllin-dsl/doc/getting-start-cn.md @@ -143,7 +143,7 @@ val database = Database( 除此之外,你还可以使用 `DSLDBConfiguration`,它允许你在 `create` 和 `upgrade` 回调中使用类型安全的 SQL DSL,而不是原始的 SQL 字符串: ```kotlin -import com.ctrip.sqllin.driver.DSLDBConfiguration +import com.ctrip.sqllin.dsl.DSLDBConfiguration import com.ctrip.sqllin.dsl.Database val database = Database( diff --git a/sqllin-dsl/doc/getting-start.md b/sqllin-dsl/doc/getting-start.md index bc561d4..c847544 100644 --- a/sqllin-dsl/doc/getting-start.md +++ b/sqllin-dsl/doc/getting-start.md @@ -153,7 +153,7 @@ only work on Android 9 and higher. And, because [sqlite-jdbc](https://github.com Alternatively, you can use `DSLDBConfiguration` which allows you to use the type-safe SQL DSL in the `create` and `upgrade` callbacks instead of raw SQL strings: ```kotlin -import com.ctrip.sqllin.driver.DSLDBConfiguration +import com.ctrip.sqllin.dsl.DSLDBConfiguration import com.ctrip.sqllin.dsl.Database val database = Database( @@ -399,7 +399,7 @@ Use `@CollateNoCase` to make string comparisons case-insensitive: ```kotlin import com.ctrip.sqllin.dsl.annotation.DBRow import com.ctrip.sqllin.dsl.annotation.PrimaryKey -import com.ctrip.sqllin.dsl.annotation.NoCase +import com.ctrip.sqllin.dsl.annotation.CollateNoCase import com.ctrip.sqllin.dsl.annotation.Unique import kotlinx.serialization.Serializable diff --git a/sqllin-dsl/doc/modify-database-and-transaction-cn.md b/sqllin-dsl/doc/modify-database-and-transaction-cn.md index 0aa20db..cfb9c90 100644 --- a/sqllin-dsl/doc/modify-database-and-transaction-cn.md +++ b/sqllin-dsl/doc/modify-database-and-transaction-cn.md @@ -19,7 +19,7 @@ import kotlinx.serialization.Serializable @Serializable data class Person( @PrimaryKey(autoIncrement = true) - val id: Long = 0, + val id: Long? = null, val name: String, val age: Int, ) diff --git a/sqllin-dsl/doc/modify-database-and-transaction.md b/sqllin-dsl/doc/modify-database-and-transaction.md index 90e6c36..f99982e 100644 --- a/sqllin-dsl/doc/modify-database-and-transaction.md +++ b/sqllin-dsl/doc/modify-database-and-transaction.md @@ -22,7 +22,7 @@ import kotlinx.serialization.Serializable @Serializable data class Person( @PrimaryKey(autoIncrement = true) - val id: Long = 0, + val id: Long? = null, val name: String, val age: Int, ) diff --git a/sqllin-dsl/doc/query-cn.md b/sqllin-dsl/doc/query-cn.md index 2eec4a1..ab890ef 100644 --- a/sqllin-dsl/doc/query-cn.md +++ b/sqllin-dsl/doc/query-cn.md @@ -14,7 +14,7 @@ fun sample() { selectStatement = table SELECT X } } - selectStatement.getResult().forEach { person -> + selectStatement.getResults().forEach { person -> println(person) } } @@ -76,7 +76,7 @@ fun sample() { selectStatement = table SELECT WHERE (age LTE 5) GROUP_BY age HAVING (upper(name) EQ "TOM") ORDER_BY (age to DESC) LIMIT 2 OFFSET 1 } } - selectStatement.getResult().forEach { person -> + selectStatement.getResults().forEach { person -> println(person) } } diff --git a/sqllin-dsl/doc/query.md b/sqllin-dsl/doc/query.md index 1c71bb4..edd5037 100644 --- a/sqllin-dsl/doc/query.md +++ b/sqllin-dsl/doc/query.md @@ -16,7 +16,7 @@ fun sample() { selectStatement = table SELECT X } } - selectStatement.getResult().forEach { person -> + selectStatement.getResults().forEach { person -> println(person) } } @@ -78,7 +78,7 @@ fun sample() { selectStatement = table SELECT WHERE (age LTE 5) GROUP_BY age HAVING (upper(name) EQ "TOM") ORDER_BY (age to DESC) LIMIT 2 OFFSET 1 } } - selectStatement.getResult().forEach { person -> + selectStatement.getResults().forEach { person -> println(person) } }