Skip to content

Fix some docs #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sqllin-driver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ our project. Finally we still choose based on Android Framework Java API.

In Native platforms, things look different. We can call SQLite C API directly, this is the most intuitive way.
The ability of Kotlin/Native interop with C is very perfect, but in Kotlin/Native you must use some APIs to
complete interop with C that very difficult to understanding, like: `memScoped`, `CPointer`, `CPointerVarOf`, `toKString` etc..
complete interop with C that very difficult to understanding, like: `memScoped`, `CPointer`, `CPointerVarOf`, `toKString`, etc..
So, in the beginning, I chose the [SQLiter](https://github.com/touchlab/SQLiter), that's a Kotlin/Native multiplatform
library. If I use it, I can put the Kotlin-C interop translate to Kotlin language-internal calls. It is very
convenient. [SQLiter](https://github.com/touchlab/SQLiter) also is the driver that
Expand All @@ -30,6 +30,8 @@ example, [SQLiter](https://github.com/touchlab/SQLiter) updates very infrequentl
it still hasn't been merged, and no one replied to me. And, after Kotlin `1.8.0`, Kotlin/Native added a new target:
`watchosDeviceArm64`. Due to [SQLiter](https://github.com/touchlab/SQLiter) updates infrequently, SQLlin can't support
`watchosDeviceArm64` either. So, I decided to implement interop with SQLite C APIs by myself as I originally conceived.
Before the version `1.1.0`, _sqllin-driver_ use [SQLiter](https://github.com/touchlab/SQLiter), and after `1.1.0`(including),
_sqllin-driver_ use the _New Native Driver_.

Whatever, [SQLiter](https://github.com/touchlab/SQLiter) still is a good project. I referred to a lot of designs and code
details from it and use them in _New Native Driver_ in _sqllin-driver_ .
Expand Down
3 changes: 2 additions & 1 deletion sqllin-driver/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Windows(mingwX86, mingwX64)。

但是在几个月后,我发现使用 [SQLiter](https://github.com/touchlab/SQLiter) 也有许多缺点。比如说,[SQLiter](https://github.com/touchlab/SQLiter) 的更新频率非常低。我提交了一个 PR
很长时间没有被合并,也没有人回复我。并且,在 Kotlin `1.8.0` 之后,Kotlin/Native 新增了一个目标平台:`watchosDeviceArm64`。由于 [SQLiter](https://github.com/touchlab/SQLiter)
更新缓慢,SQLlin 也同样无法支持 `watchosDeviceArm64`。所以我决定自己重新实现与 SQLite C API 的互操作,就像最开始构想的那样。
更新缓慢,SQLlin 也同样无法支持 `watchosDeviceArm64`。所以我决定自己重新实现与 SQLite C API 的互操作,就像最开始构想的那样。在 `1.1.0` 版本之前,_sqllin-driver_ 使用
[SQLiter](https://github.com/touchlab/SQLiter),而在 `1.1.0`(包含)之后 _sqllin-driver_ 则使用*新 Native 驱动*。

无论如何,[SQLiter](https://github.com/touchlab/SQLiter) 仍然是一个非常棒的项目。我参考了许多它的设计与实现细节并将它们用在了 _sqllin-driver_ 的*新 Native 驱动*中。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ package com.ctrip.sqllin.driver

internal abstract class NativeDatabaseConnection : DatabaseConnection {

internal abstract fun createStatement(sql: String): SQLiteStatement
abstract fun createStatement(sql: String): SQLiteStatement

internal fun bindParamsToSQL(sql: String, bindParams: Array<Any?>?): SQLiteStatement = createStatement(sql).apply {
protected fun bindParamsToSQL(sql: String, bindParams: Array<Any?>?): SQLiteStatement = createStatement(sql).apply {
bindParams?.run {
require(isNotEmpty()) { "Empty bindArgs" }
forEachIndexed { index, any ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
package com.ctrip.sqllin.driver

/**
* SQLite native statement abstruct APIs
* SQLite native statement abstract APIs
* @author yaqiao
*/

internal interface SQLiteStatement {
Expand Down
6 changes: 3 additions & 3 deletions 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.0.1"
val sqllinVersion = "1.1.0"

kotlin {
// ......
Expand All @@ -28,7 +28,7 @@ kotlin {
implementation("com.ctrip.kotlin:sqllin-driver:$sqllinVersion")

// The sqllin-dsl serialization and deserialization depends on kotlinx-serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
}
}
// ......
Expand Down Expand Up @@ -147,7 +147,7 @@ data class Person(
你定义的 DBEntity 的属性名应与数据库表的列名相对应。DBEntity 不应该拥有名字与表中的所有列名均不相同的属性,但是
DBEntity 的属性数量可以比表中列的数量少。

`@DBRow` 的参数 `tableName` 表示数据库中的表明,请确保传入正确的值。如果不手动传入,_sqllin-processor_
`@DBRow` 的参数 `tableName` 表示数据库中的表名,请确保传入正确的值。如果不手动传入,_sqllin-processor_
将会使用类名作为表名,比如 `Person` 类的默认表名是"Person"。

在 _sqllin-dsl_ 中,对象序列化为 SQL 语句,或者从游标中反序列化依赖 _kotlinx.serialization_,所以你需要在你的 data class
Expand Down
4 changes: 2 additions & 2 deletions 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.0.1"
val sqllinVersion = "1.1.0"

kotlin {
// ......
Expand All @@ -30,7 +30,7 @@ kotlin {
implementation("com.ctrip.kotlin:sqllin-driver:$sqllinVersion")

// The sqllin-dsl serialization and deserialization depends on kotlinx-serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
}
}
// ......
Expand Down