Skip to content

Commit

Permalink
Merge pull request #65 from qiaoyuang/main
Browse files Browse the repository at this point in the history
Update version to 1.2.3
  • Loading branch information
qiaoyuang authored Nov 28, 2023
2 parents 827a78d + 5bd04a5 commit f369fdc
Show file tree
Hide file tree
Showing 27 changed files with 602 additions and 417 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ jobs:
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: always()
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: always()
if: failure()

build-on-windows:
runs-on: windows-latest
Expand Down Expand Up @@ -165,14 +165,14 @@ jobs:
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: always()
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: always()
if: failure()

build-on-linux:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -265,11 +265,11 @@ jobs:
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: always()
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: always()
if: failure()
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ jobs:
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: always()
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: always()
if: failure()

- name: Publish to MavenCentral
run: ./publish_apple_android_jvm.sh
Expand Down Expand Up @@ -163,14 +163,14 @@ jobs:
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: always()
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: always()
if: failure()

- name: Publish to MavenCentral
run: ./gradlew :sqllin-driver:publishMingwX64PublicationToMavenRepository && ./gradlew :sqllin-dsl:publishMingwX64PublicationToMavenRepository
Expand Down Expand Up @@ -266,14 +266,14 @@ jobs:
with:
name: Test-Reports
path: sqllin-driver/build/reports
if: always()
if: failure()

- name: Upload sqllin-dsl Reports
uses: actions/upload-artifact@v2
with:
name: Test-Reports
path: sqllin-dsl/build/reports
if: always()
if: failure()

- name: Publish to MavenCentral
run: ./publish_linux_processor.sh
30 changes: 27 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,30 @@

- Date format: YYYY-MM-dd

## v1.2.3 / 2023-11-28

### All

* Update `Kotlin`'s version to `1.9.21`

### sqllin-dsl

* Now, the `ORDER_BY` clause could ignore the `OrderByWay` parameter like SQL.
* Optimize the performance in concurrent scenarios. Some types have changed, but users don't need to change the code.
* Now, `SelectStatement` has been changed to lazy deserialization mode, that's means the first time you invoke the
function `SelectStatement#getResults` will consume more time. But, correspondingly, executing `SELECT` statements will be faster.
* Add the `enableSimpleSQLLog` parameter to `Database`'s constructor, default by `true`, if you set it to
`false`, you can disable the simple SQL logout.

### sqllin-driver

* Deprecated the public API `CommonCursor#forEachRows`, you can replace with `CommonCursor#forEachRow`. This
change just for fixing a typo :). And, the `CommonCursor#forEachRows` will be removed in next version.

### sqllin-processor

* Update `KSP`'s version to `1.9.21-1.0.15`

## v1.2.2 / 2023-11-08

### All
Expand Down Expand Up @@ -35,13 +59,13 @@
* Fix the problem: [Native driver does not respect isReadOnly](https://github.com/ctripcorp/SQLlin/issues/50). ***On native platforms***.
Now, if a user set `isReadOnly = true` in `DatabaseConfigurtaion`, the database file must exist. And, if opening in read-write mode
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
a runtime exception. Thanks for [@nbransby](https://github.com/nbransby)
a runtime exception. Thanks for [@nbransby](https://github.com/nbransby).

### sqllin-processor

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

## v1.2.0 / 2023-09-19

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

### sqllin-dsl

* 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
* 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.

### sqllin-driver

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
dependencies {
val kotlinVersion: String by project
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.android.tools.build:gradle:8.1.2")
classpath("com.android.tools.build:gradle:8.1.4")
}
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
VERSION=1.2.2
VERSION=1.2.3
GROUP=com.ctrip.kotlin

kotlinVersion=1.9.20
kspVersion=1.9.20-1.0.13
kotlinVersion=1.9.21
kspVersion=1.9.21-1.0.15
coroutinesVersion=1.7.3

#Maven Publish Information
Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ kotlin {

android {
namespace = "com.ctrip.sqllin.sample"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 23
}
Expand Down
2 changes: 1 addition & 1 deletion sqllin-driver/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ gradle.taskGraph.whenReady {

android {
namespace = "com.ctrip.sqllin.driver"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ internal class AndroidCursor(private val cursor: Cursor) : CommonCursor {

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

override fun forEachRows(block: (Int) -> Unit) {
@Deprecated(
message = "Please use the new API: forEachRow",
replaceWith = ReplaceWith(expression = "forEachRow"),
)
override fun forEachRows(block: (Int) -> Unit) = forEachRow(block)

override fun forEachRow(block: (Int) -> Unit) {
if (!cursor.moveToFirst()) return
var index = 0
do block(index++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ package com.ctrip.sqllin.driver
* @author yaqiao
*/

public interface CommonCursor {
@OptIn(ExperimentalStdlibApi::class)
public interface CommonCursor : AutoCloseable {

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

public fun getColumnIndex(columnName: String): Int

@Deprecated(
message = "Please use the new API: forEachRow",
replaceWith = ReplaceWith(expression = "forEachRow"),
)
public fun forEachRows(block: (Int) -> Unit)
public fun forEachRow(block: (Int) -> Unit)

public fun next(): Boolean

public fun close()
public override fun close()
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class CommonBasicTest(private val path: DatabasePath) {
val readOnlyConfig = getDefaultDBConfig(true)
openDatabase(readOnlyConfig) {
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
cursor.forEachRows { rowIndex ->
cursor.forEachRow { rowIndex ->
val book = bookList[rowIndex]
var columnIndex = 0
assertEquals(book.name, cursor.getString(++columnIndex))
Expand Down Expand Up @@ -121,7 +121,7 @@ class CommonBasicTest(private val path: DatabasePath) {
val readOnlyConfig = getDefaultDBConfig(true)
openDatabase(readOnlyConfig) {
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
cursor.forEachRows { rowIndex ->
cursor.forEachRow { rowIndex ->
val (name, price) = when (rowIndex) {
0 -> "The Da Vinci Code" to 18.99
1 -> "The Lost Symbol" to 25.88
Expand All @@ -147,7 +147,7 @@ class CommonBasicTest(private val path: DatabasePath) {
val readOnlyConfig = getDefaultDBConfig(true)
openDatabase(readOnlyConfig) {
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
cursor.forEachRows {
cursor.forEachRow {
val book = bookList.first()
var columnIndex = 0
assertEquals(book.name, cursor.getString(++columnIndex))
Expand Down Expand Up @@ -180,7 +180,7 @@ class CommonBasicTest(private val path: DatabasePath) {
val readOnlyConfig = getDefaultDBConfig(true)
openDatabase(readOnlyConfig) {
it.withQuery(SQL.QUERY_BOOK, null) { cursor ->
cursor.forEachRows { rowIndex ->
cursor.forEachRow { rowIndex ->
val (name, price) = bookList[rowIndex].run { name to price }
assertEquals(name, cursor.getString(1))
assertEquals(price, cursor.getDouble(4))
Expand All @@ -197,7 +197,7 @@ class CommonBasicTest(private val path: DatabasePath) {
val readOnlyConfig = getDefaultDBConfig(true)
openDatabase(readOnlyConfig) { connection ->
connection.withQuery(SQL.QUERY_BOOK, null) { cursor ->
cursor.forEachRows { rowIndex ->
cursor.forEachRow { rowIndex ->
val book = bookList[rowIndex]
var columnIndex = 0
assertEquals(book.name, cursor.getString(++columnIndex))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ internal class JdbcCursor(private val resultSet: ResultSet) : CommonCursor {

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

override fun forEachRows(block: (Int) -> Unit) {
@Deprecated(
message = "Please use the new API: forEachRow",
replaceWith = ReplaceWith(expression = "forEachRow"),
)
override fun forEachRows(block: (Int) -> Unit) = forEachRow(block)

override fun forEachRow(block: (Int) -> Unit) {
var index = 0
while (next())
block(index++)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2023 Ctrip.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.ctrip.sqllin.driver.platform

import kotlinx.cinterop.ByteVar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Copyright (C) 2023 Ctrip.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.ctrip.sqllin.driver.platform

import kotlinx.cinterop.ByteVar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,13 @@ internal class NativeCursor(

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

override fun forEachRows(block: (Int) -> Unit) {
@Deprecated(
message = "Please use the new API: forEachRow",
replaceWith = ReplaceWith(expression = "forEachRow"),
)
override fun forEachRows(block: (Int) -> Unit) = forEachRow(block)

override fun forEachRow(block: (Int) -> Unit) {
var index = 0
while (next())
block(index++)
Expand Down
2 changes: 1 addition & 1 deletion sqllin-dsl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ gradle.taskGraph.whenReady {

android {
namespace = "com.ctrip.sqllin.dsl"
compileSdk = 33
compileSdk = 34
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion sqllin-dsl/doc/getting-start-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id("com.google.devtools.ksp")
}

val sqllinVersion = "1.2.2"
val sqllinVersion = "1.2.3"

kotlin {
// ......
Expand Down
2 changes: 1 addition & 1 deletion sqllin-dsl/doc/getting-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
id("com.google.devtools.ksp")
}

val sqllinVersion = "1.2.2"
val sqllinVersion = "1.2.3"

kotlin {
// ......
Expand Down
Loading

0 comments on commit f369fdc

Please sign in to comment.