Skip to content

Commit f369fdc

Browse files
authored
Merge pull request #65 from qiaoyuang/main
Update version to 1.2.3
2 parents 827a78d + 5bd04a5 commit f369fdc

File tree

27 files changed

+602
-417
lines changed

27 files changed

+602
-417
lines changed

.github/workflows/build.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ jobs:
105105
with:
106106
name: Test-Reports
107107
path: sqllin-driver/build/reports
108-
if: always()
108+
if: failure()
109109

110110
- name: Upload sqllin-dsl Reports
111111
uses: actions/upload-artifact@v2
112112
with:
113113
name: Test-Reports
114114
path: sqllin-dsl/build/reports
115-
if: always()
115+
if: failure()
116116

117117
build-on-windows:
118118
runs-on: windows-latest
@@ -165,14 +165,14 @@ jobs:
165165
with:
166166
name: Test-Reports
167167
path: sqllin-driver/build/reports
168-
if: always()
168+
if: failure()
169169

170170
- name: Upload sqllin-dsl Reports
171171
uses: actions/upload-artifact@v2
172172
with:
173173
name: Test-Reports
174174
path: sqllin-dsl/build/reports
175-
if: always()
175+
if: failure()
176176

177177
build-on-linux:
178178
runs-on: ubuntu-latest
@@ -265,11 +265,11 @@ jobs:
265265
with:
266266
name: Test-Reports
267267
path: sqllin-driver/build/reports
268-
if: always()
268+
if: failure()
269269

270270
- name: Upload sqllin-dsl Reports
271271
uses: actions/upload-artifact@v2
272272
with:
273273
name: Test-Reports
274274
path: sqllin-dsl/build/reports
275-
if: always()
275+
if: failure()

.github/workflows/publish.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,14 @@ jobs:
100100
with:
101101
name: Test-Reports
102102
path: sqllin-driver/build/reports
103-
if: always()
103+
if: failure()
104104

105105
- name: Upload sqllin-dsl Reports
106106
uses: actions/upload-artifact@v2
107107
with:
108108
name: Test-Reports
109109
path: sqllin-dsl/build/reports
110-
if: always()
110+
if: failure()
111111

112112
- name: Publish to MavenCentral
113113
run: ./publish_apple_android_jvm.sh
@@ -163,14 +163,14 @@ jobs:
163163
with:
164164
name: Test-Reports
165165
path: sqllin-driver/build/reports
166-
if: always()
166+
if: failure()
167167

168168
- name: Upload sqllin-dsl Reports
169169
uses: actions/upload-artifact@v2
170170
with:
171171
name: Test-Reports
172172
path: sqllin-dsl/build/reports
173-
if: always()
173+
if: failure()
174174

175175
- name: Publish to MavenCentral
176176
run: ./gradlew :sqllin-driver:publishMingwX64PublicationToMavenRepository && ./gradlew :sqllin-dsl:publishMingwX64PublicationToMavenRepository
@@ -266,14 +266,14 @@ jobs:
266266
with:
267267
name: Test-Reports
268268
path: sqllin-driver/build/reports
269-
if: always()
269+
if: failure()
270270

271271
- name: Upload sqllin-dsl Reports
272272
uses: actions/upload-artifact@v2
273273
with:
274274
name: Test-Reports
275275
path: sqllin-dsl/build/reports
276-
if: always()
276+
if: failure()
277277

278278
- name: Publish to MavenCentral
279279
run: ./publish_linux_processor.sh

CHANGELOG.md

+27-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,30 @@
22

33
- Date format: YYYY-MM-dd
44

5+
## v1.2.3 / 2023-11-28
6+
7+
### All
8+
9+
* Update `Kotlin`'s version to `1.9.21`
10+
11+
### sqllin-dsl
12+
13+
* Now, the `ORDER_BY` clause could ignore the `OrderByWay` parameter like SQL.
14+
* Optimize the performance in concurrent scenarios. Some types have changed, but users don't need to change the code.
15+
* Now, `SelectStatement` has been changed to lazy deserialization mode, that's means the first time you invoke the
16+
function `SelectStatement#getResults` will consume more time. But, correspondingly, executing `SELECT` statements will be faster.
17+
* Add the `enableSimpleSQLLog` parameter to `Database`'s constructor, default by `true`, if you set it to
18+
`false`, you can disable the simple SQL logout.
19+
20+
### sqllin-driver
21+
22+
* Deprecated the public API `CommonCursor#forEachRows`, you can replace with `CommonCursor#forEachRow`. This
23+
change just for fixing a typo :). And, the `CommonCursor#forEachRows` will be removed in next version.
24+
25+
### sqllin-processor
26+
27+
* Update `KSP`'s version to `1.9.21-1.0.15`
28+
529
## v1.2.2 / 2023-11-08
630

731
### All
@@ -35,13 +59,13 @@
3559
* Fix the problem: [Native driver does not respect isReadOnly](https://github.com/ctripcorp/SQLlin/issues/50). ***On native platforms***.
3660
Now, if a user set `isReadOnly = true` in `DatabaseConfigurtaion`, the database file must exist. And, if opening in read-write mode
3761
fails due to OS-level permissions, the user will get a read-only database, and if the user try to modify the database, will receive
38-
a runtime exception. Thanks for [@nbransby](https://github.com/nbransby)
62+
a runtime exception. Thanks for [@nbransby](https://github.com/nbransby).
3963

4064
### sqllin-processor
4165

4266
* Update `KSP`'s version to `1.9.10-1.0.13`
4367
* Now, if your data class with `@DBRow` can't be solved or imported successfully(Using `KSNode#validate` to judge), the
44-
`ClauseProcessor` would try to resolve it in second round
68+
`ClauseProcessor` would try to resolve it in second round.
4569

4670
## v1.2.0 / 2023-09-19
4771

@@ -63,7 +87,7 @@ a runtime exception. Thanks for [@nbransby](https://github.com/nbransby)
6387

6488
### sqllin-dsl
6589

66-
* Deprecated the public API `DBEntity`([#36](https://github.com/ctripcorp/SQLlin/pull/36), [#37](https://github.com/ctripcorp/SQLlin/pull/37)), any data classes used in _sqllin-dsl_ don't need to extend `DBEntity` anymore
90+
* Deprecated the public API `DBEntity`([#36](https://github.com/ctripcorp/SQLlin/pull/36), [#37](https://github.com/ctripcorp/SQLlin/pull/37)), any data classes used in _sqllin-dsl_ don't need to extend `DBEntity` anymore.
6791

6892
### sqllin-driver
6993

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
dependencies {
88
val kotlinVersion: String by project
99
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
10-
classpath("com.android.tools.build:gradle:8.1.2")
10+
classpath("com.android.tools.build:gradle:8.1.4")
1111
}
1212
}
1313

gradle.properties

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
VERSION=1.2.2
1+
VERSION=1.2.3
22
GROUP=com.ctrip.kotlin
33

4-
kotlinVersion=1.9.20
5-
kspVersion=1.9.20-1.0.13
4+
kotlinVersion=1.9.21
5+
kspVersion=1.9.21-1.0.15
66
coroutinesVersion=1.7.3
77

88
#Maven Publish Information

sample/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ kotlin {
4242

4343
android {
4444
namespace = "com.ctrip.sqllin.sample"
45-
compileSdk = 33
45+
compileSdk = 34
4646
defaultConfig {
4747
minSdk = 23
4848
}

sqllin-driver/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ gradle.taskGraph.whenReady {
117117

118118
android {
119119
namespace = "com.ctrip.sqllin.driver"
120-
compileSdk = 33
120+
compileSdk = 34
121121
defaultConfig {
122122
minSdk = 23
123123
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

sqllin-driver/src/androidMain/kotlin/com/ctrip/sqllin/driver/AndroidCursor.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@ internal class AndroidCursor(private val cursor: Cursor) : CommonCursor {
4646

4747
override fun getColumnIndex(columnName: String): Int = cursor.getColumnIndexOrThrow(columnName)
4848

49-
override fun forEachRows(block: (Int) -> Unit) {
49+
@Deprecated(
50+
message = "Please use the new API: forEachRow",
51+
replaceWith = ReplaceWith(expression = "forEachRow"),
52+
)
53+
override fun forEachRows(block: (Int) -> Unit) = forEachRow(block)
54+
55+
override fun forEachRow(block: (Int) -> Unit) {
5056
if (!cursor.moveToFirst()) return
5157
var index = 0
5258
do block(index++)

sqllin-driver/src/commonMain/kotlin/com/ctrip/sqllin/driver/CommonCursor.kt

+8-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ package com.ctrip.sqllin.driver
2121
* @author yaqiao
2222
*/
2323

24-
public interface CommonCursor {
24+
@OptIn(ExperimentalStdlibApi::class)
25+
public interface CommonCursor : AutoCloseable {
2526

2627
public fun getInt(columnIndex: Int): Int
2728
public fun getLong(columnIndex: Int): Long
@@ -32,9 +33,14 @@ public interface CommonCursor {
3233

3334
public fun getColumnIndex(columnName: String): Int
3435

36+
@Deprecated(
37+
message = "Please use the new API: forEachRow",
38+
replaceWith = ReplaceWith(expression = "forEachRow"),
39+
)
3540
public fun forEachRows(block: (Int) -> Unit)
41+
public fun forEachRow(block: (Int) -> Unit)
3642

3743
public fun next(): Boolean
3844

39-
public fun close()
45+
public override fun close()
4046
}

sqllin-driver/src/commonTest/kotlin/com/ctrip/sqllin/driver/CommonBasicTest.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class CommonBasicTest(private val path: DatabasePath) {
9292
val readOnlyConfig = getDefaultDBConfig(true)
9393
openDatabase(readOnlyConfig) {
9494
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
95-
cursor.forEachRows { rowIndex ->
95+
cursor.forEachRow { rowIndex ->
9696
val book = bookList[rowIndex]
9797
var columnIndex = 0
9898
assertEquals(book.name, cursor.getString(++columnIndex))
@@ -121,7 +121,7 @@ class CommonBasicTest(private val path: DatabasePath) {
121121
val readOnlyConfig = getDefaultDBConfig(true)
122122
openDatabase(readOnlyConfig) {
123123
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
124-
cursor.forEachRows { rowIndex ->
124+
cursor.forEachRow { rowIndex ->
125125
val (name, price) = when (rowIndex) {
126126
0 -> "The Da Vinci Code" to 18.99
127127
1 -> "The Lost Symbol" to 25.88
@@ -147,7 +147,7 @@ class CommonBasicTest(private val path: DatabasePath) {
147147
val readOnlyConfig = getDefaultDBConfig(true)
148148
openDatabase(readOnlyConfig) {
149149
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
150-
cursor.forEachRows {
150+
cursor.forEachRow {
151151
val book = bookList.first()
152152
var columnIndex = 0
153153
assertEquals(book.name, cursor.getString(++columnIndex))
@@ -180,7 +180,7 @@ class CommonBasicTest(private val path: DatabasePath) {
180180
val readOnlyConfig = getDefaultDBConfig(true)
181181
openDatabase(readOnlyConfig) {
182182
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
183-
cursor.forEachRows { rowIndex ->
183+
cursor.forEachRow { rowIndex ->
184184
val (name, price) = bookList[rowIndex].run { name to price }
185185
assertEquals(name, cursor.getString(1))
186186
assertEquals(price, cursor.getDouble(4))
@@ -197,7 +197,7 @@ class CommonBasicTest(private val path: DatabasePath) {
197197
val readOnlyConfig = getDefaultDBConfig(true)
198198
openDatabase(readOnlyConfig) { connection ->
199199
connection.withQuery(SQL.QUERY_BOOK, null) { cursor ->
200-
cursor.forEachRows { rowIndex ->
200+
cursor.forEachRow { rowIndex ->
201201
val book = bookList[rowIndex]
202202
var columnIndex = 0
203203
assertEquals(book.name, cursor.getString(++columnIndex))

sqllin-driver/src/jvmMain/kotlin/com/ctrip/sqllin/driver/JdbcCursor.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ internal class JdbcCursor(private val resultSet: ResultSet) : CommonCursor {
3838

3939
override fun getColumnIndex(columnName: String): Int = resultSet.findColumn(columnName) - 1
4040

41-
override fun forEachRows(block: (Int) -> Unit) {
41+
@Deprecated(
42+
message = "Please use the new API: forEachRow",
43+
replaceWith = ReplaceWith(expression = "forEachRow"),
44+
)
45+
override fun forEachRows(block: (Int) -> Unit) = forEachRow(block)
46+
47+
override fun forEachRow(block: (Int) -> Unit) {
4248
var index = 0
4349
while (next())
4450
block(index++)

sqllin-driver/src/linuxMain/kotlin/com/ctrip/sqllin/driver/platform/UtilsLinux.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2023 Ctrip.com.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.ctrip.sqllin.driver.platform
218

319
import kotlinx.cinterop.ByteVar

sqllin-driver/src/mingwMain/kotlin/com/ctrip/sqllin/driver/platform/UtilsMinGW.kt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* Copyright (C) 2023 Ctrip.com.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.ctrip.sqllin.driver.platform
218

319
import kotlinx.cinterop.ByteVar

sqllin-driver/src/nativeMain/kotlin/com/ctrip/sqllin/driver/NativeCursor.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ internal class NativeCursor(
4141

4242
override fun next(): Boolean = statement.step()
4343

44-
override fun forEachRows(block: (Int) -> Unit) {
44+
@Deprecated(
45+
message = "Please use the new API: forEachRow",
46+
replaceWith = ReplaceWith(expression = "forEachRow"),
47+
)
48+
override fun forEachRows(block: (Int) -> Unit) = forEachRow(block)
49+
50+
override fun forEachRow(block: (Int) -> Unit) {
4551
var index = 0
4652
while (next())
4753
block(index++)

sqllin-dsl/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ gradle.taskGraph.whenReady {
119119

120120
android {
121121
namespace = "com.ctrip.sqllin.dsl"
122-
compileSdk = 33
122+
compileSdk = 34
123123
defaultConfig {
124124
minSdk = 23
125125
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

sqllin-dsl/doc/getting-start-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
id("com.google.devtools.ksp")
1515
}
1616

17-
val sqllinVersion = "1.2.2"
17+
val sqllinVersion = "1.2.3"
1818

1919
kotlin {
2020
// ......

sqllin-dsl/doc/getting-start.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins {
1616
id("com.google.devtools.ksp")
1717
}
1818

19-
val sqllinVersion = "1.2.2"
19+
val sqllinVersion = "1.2.3"
2020

2121
kotlin {
2222
// ......

0 commit comments

Comments
 (0)