Skip to content

Commit 7702fbc

Browse files
authored
Merge pull request #92 from qiaoyuang/main
Fix the grammar of documents
2 parents b337337 + 3c24dfb commit 7702fbc

File tree

8 files changed

+74
-75
lines changed

8 files changed

+74
-75
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fun sample() {
2525
}
2626
}
2727
```
28-
SQLlin is able to insert Kotlin objects into database directly, and could query Kotlin objects directly from database. The serialization
28+
SQLlin is able to insert Kotlin objects into database directly, and could query Kotlin objects from database directly. The serialization
2929
and deserialization ability based on [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization).
3030

3131
SQLlin supports these platforms:

sqllin-driver/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,24 @@
44

55
## Design
66

7-
Initially, we need a multiplatform available low-level Kotlin API to call SQLite. Because we think _sqllin-dsl_
8-
should be platform independent. So, we need the _sqllin-driver_, and _sqllin-dsl_ based on it. Our goal is
7+
Initially, we needed a multiplatform available low-level Kotlin APIs to call SQLite. Because we thought _sqllin-dsl_
8+
should be platform-independent. So, we needed _sqllin-driver_, and _sqllin-dsl_ on top of it. Our goal was
99
writing the common APIs in Kotlin Multiplatform common source set and they have different implementations on
1010
different platforms.
1111

12-
In Android, not many ways to choose from. If we use the Android Framework SQLite Java APIs, everything will be simple,
13-
but defect is many SQLite parameters cannot take effect on systems below Android P. If we writing JNI code
12+
On Android, there are no many ways to choose from. If we use Android Framework SQLite Java APIs, everything will be simple,
13+
but defect is many SQLite parameters cannot take effect on systems below Android P. If we write JNI code
1414
to call SQLite C functions by ourselves, above problem will be resolved, but this will lead to a bigger problem:
15-
In systems above Android N, Google doesn't allow developers call system built-in SQLite C functions in NDK. If
15+
On systems above Android N, Google doesn't allow developers call system built-in SQLite C functions in NDK. If
1616
we firmly choose this plan, we have to compile the SQLite source code into _sqllin-driver_, this will complicate
17-
our project. Finally, we still choose based on Android Framework Java API.
18-
19-
In Native platforms, things look different. We can call SQLite C API directly, this is a most intuitive plan.
20-
The interoperability of Kotlin/Native with C is very perfect, but in Kotlin/Native you must use some APIs that
21-
very difficult to understanding to interop with C, like: `memScoped`, `CPointer`, `CPointerVarOf`, `toKString`, etc..
22-
So, at the beginning, I chose the [SQLiter](https://github.com/touchlab/SQLiter), that's a Kotlin/Native multiplatform
23-
library. If I use it, I can put the Kotlin-C interop translate to Kotlin language-internal calls. It is very
24-
convenient. [SQLiter](https://github.com/touchlab/SQLiter) also is the driver that
25-
[SQLDelight](https://github.com/cashapp/sqldelight) to call SQLite C library on native platforms. It is not only
17+
our project. Finally, we still choose to use Android Framework Java API.
18+
19+
On Native platforms, things look different. We can call SQLite C APIs directly, this is a most intuitive plan.
20+
The interoperability of Kotlin/Native with C is perfect, but in Kotlin/Native you must use some APIs to interop with C
21+
that very difficult to understand, like: `memScoped`, `CPointer`, `CPointerVarOf`, `toKString`, etc..
22+
So, at the beginning, I chose the [SQLiter](https://github.com/touchlab/SQLiter), it is a Kotlin/Native multiplatform
23+
library. If I use it, I can put the Kotlin-C interop translate to Kotlin language-internal calling. It is very
24+
convenient. [SQLiter](https://github.com/touchlab/SQLiter) also is the driver of [SQLDelight](https://github.com/cashapp/sqldelight) calling SQLite C library on native platforms. It not only
2625
supports iOS, but also supports all the operating systems of Apple, Linux(x64) and Windows(mingwX86, mingwX64).
2726

2827
But a few months later. I found using [SQLiter](https://github.com/touchlab/SQLiter) also has some disadvantages. For

sqllin-dsl/doc/advanced-query.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
中文版请见[这里](advanced-query-cn.md)
44

5-
We have learned basic query and using SQL functions in query condition. Let's learn some query’s advanced skills.
5+
We have learned basic querying and using SQL functions in querying conditions. Let's learn some advanced skills of querying.
66

77
## Unions
88

9-
The _UNION_ operator used for merge two _SELECT_ statements' results and these results must be of the same type.
9+
The _UNION_ operator is used for merge two _SELECT_ statements' results and these results must be of the same type.
1010

11-
In SQL, _UNION_ operator between with the two _SELECT_ statements, but in SQLlin, we use a higher-order function to
11+
In SQL, the _UNION_ operator between with the two _SELECT_ statements, but in SQLlin, we use a higher-order function to
1212
implement _UNION_:
1313

1414
```kotlin
@@ -25,8 +25,8 @@ fun sample() {
2525
}
2626
```
2727

28-
You just need to write your _SELECT_ statements in `UNION {...}` block. There must be at least two _SELECT_ statements
29-
inside the `UNION {...}` block, if not, you will get a `IllegalStateException` when runtime.
28+
You just need to write your _SELECT_ statements in the `UNION {...}` block. There must be at least two _SELECT_ statements
29+
inside the `UNION {...}` block, if not, you will get a `IllegalStateException` at runtime.
3030

3131
If you want to use _UNION_ and _UNION ALL_ interchangeably, just use `UNION {...}` or `UNION_ALL {...}` block nesting:
3232

@@ -59,7 +59,7 @@ SELECT * FROM person WHERE name = "Tom"
5959

6060
## Subqueries
6161

62-
SQLlin doesn't yet support subqueries, we will develop as soon as possible.
62+
SQLlin doesn't support subqueries yet, we will develop as soon as possible.
6363

6464
## Join
6565

@@ -92,7 +92,7 @@ data class CrossJoinStudent(
9292
)
9393
```
9494

95-
The `Transcript` represents a other table. And the `Student` represents the join query results' type(so `Student`
95+
The `Transcript` represents an other table. And the `Student` represents the join querying results' type (so `Student`
9696
doesn't need to be annotated `@DBRow`), it owns all column names that belong to `Person` and `Transcript`.
9797

9898
### Cross Join
@@ -111,8 +111,8 @@ The `CROSS_JOIN` function receives one or multiple `Table`s as parameters. In no
111111
depended on the `Table` that be generated by _sqllin-processor_, but _JOIN_ operator will change it to specific type. In above sample, `CROSS_JOIN` changes
112112
the type to `CrossJoinStudent`.
113113

114-
Note, because of _CROSS JOIN_ owns feature in SQL. If the columns that be queried by _SELECT_ statement that with _CROSS JOIN_ clause include the same
115-
name column in the two tables, this will causing the query to fail. Because of a class isn't allowed to have multiple properties those have same name, _sqllin-dsl_
114+
Note, because _CROSS JOIN_ owns feature in SQL. If the columns that be queried by a _SELECT_ statement that with _CROSS JOIN_ clause include the same
115+
name columns in the two tables, this will cause the querying to fail. Because a class isn't allowed to have multiple properties those have same names, _sqllin-dsl_
116116
doesn't support the _CROSS JOIN_ with columns of the same name.
117117

118118
### Inner Join
@@ -130,15 +130,15 @@ fun joinSample() {
130130
```
131131

132132
The `INNER_JOIN` is similar to `CROSS_JOIN`, the deference is `INNER_JOIN` need to connect a `USING` or `ON` clause. If a _INNER JOIN_ statement
133-
without the `USING` or `ON` clause, it is incomplete, but your code still be compiled and will do nothing in runtime.
133+
without the `USING` or `ON` clause, it is incomplete, but your code still be compiled and will do nothing at runtime.
134134

135-
The `NATURAL_INNER_JOIN` will produce a complete _SELECT_ statement(the same with `CROSS_JOIN`). So, you can't add `USING` or `ON` clause behind it, this is
135+
The `NATURAL_INNER_JOIN` will produce a complete _SELECT_ statement (same with `CROSS_JOIN`). So, you can't add a `USING` or `ON` clause behind it, this is
136136
guaranteed by Kotlin compiler.
137137

138-
Note, the behavior of `INNER_JOIN` clause with `ON` clause is same to `CROSS_JOIN`, you can't select the column that has same name in two tables.
138+
Note, the behavior of a `INNER_JOIN` clause with a `ON` clause is same with `CROSS_JOIN`, you can't select a column that has same name in two tables.
139139

140-
The `INNER_JOIN` have an alias that named `JOIN`, and `NATURAL_INNER_JOIN` also have an alias that named `NATURAL_JOIN`. That's liked you can
141-
bypass the `INNER` keyword in SQL's inner join query.
140+
The `INNER_JOIN` have an alias that named `JOIN`, and `NATURAL_INNER_JOIN` also have an alias that named `NATURAL_JOIN`. This is just like you can
141+
bypass a `INNER` keyword in SQL's inner join querying.
142142

143143

144144
### Left Outer Join
@@ -155,8 +155,8 @@ fun joinSample() {
155155
}
156156
```
157157

158-
The `LEFT_OUTER_JOIN`'s usage is very similar to `INNER_JOIN`, the difference just is their API names.
158+
The `LEFT_OUTER_JOIN`'s usage is very similar with `INNER_JOIN`, the difference just is their API names.
159159

160160
## Finally
161161

162-
You have learned all usage with SQLlin, enjoy it and stay concerned about SQLlin's update :)
162+
You have learned all usages with SQLlin, enjoy it and stay Stay tuned for SQLlin's updates :)

sqllin-dsl/doc/concurrency-safety.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ unpredictable consequences. So, the best way is when you want to operate your
66
database, create a `Database` object, and when you finish your operating, close it immediately.
77

88
But, that's very inconvenient, we always have to create a database connection and
9-
close it frequently, that is a waste of resources. For example, if we are developing
10-
an Android app, and in a single page(Activity/Fragment), we hope we can keep a
11-
`Database` object, when we want to operate the database in background threads(or
9+
close it frequently, this is a waste of resources. For example, if we are developing
10+
an Android app, and in a single page (Activity/Fragment), we hope we can keep a
11+
`Database` object, when we want to operate the database in background threads (or
1212
coroutines), just use it, and, close it in certain lifecycle
13-
functions(`onDestroy`, `onStop`, etc..).
13+
functions (`onDestroy`, `onStop`, etc.).
1414

15-
In that time, we should make sure the concurrency safety that we sharing the `Database`
16-
object between different threads(or coroutines). So, start with the version `1.2.2`, we can
15+
At that time, we should make sure the concurrency safety that we share the `Database`
16+
object between different threads (or coroutines). So, start with the version `1.2.2`, we can
1717
use the new API `Database#suspendedScope` to replace the usage of `database {}`. For
1818
example, if we have some old code:
1919

sqllin-dsl/doc/getting-start.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
## Installation via Maven with Gradle
88

9-
Add the _sqllin-dsl_, _sqllin-driver_ and _sqllin-processor_ dependencies into your `build.gradle.kts`:
9+
Add the dependencies of _sqllin-dsl_, _sqllin-driver_ and _sqllin-processor_ into your `build.gradle.kts`:
1010

1111
```kotlin
1212
plugins {
@@ -47,7 +47,7 @@ dependencies {
4747
}
4848
```
4949

50-
> Note: If you want to add dependiences of SQLlin into your Kotlin/Native exectable program project, sometimes you need to add the `linkerOpts`
50+
> Note: If you want to add dependencies of SQLlin into your Kotlin/Native executable program projects, sometimes you need to add the `linkerOpts`
5151
> of SQLite into your `build.gradle.kts` correctly. You can refer to [issue #48](https://github.com/ctripcorp/SQLlin/issues/48) to get more information.
5252
5353
## Creating the Database
@@ -61,7 +61,7 @@ val database = Database(name = "Person.db", path = getGlobalPath(), version = 1)
6161
```
6262

6363
The `DatabasePath` is the second parameter `path`'s type, it is represented differently on different platforms.
64-
In Android, you can get it through [`Context`](https://developer.android.com/reference/android/content/Context), and you can get it through string in native platforms.
64+
On Android, you can get it through [`Context`](https://developer.android.com/reference/android/content/Context), and you can get it through string on native platforms.
6565
For example, you can define a expect function in your common source set:
6666

6767
```kotlin
@@ -86,7 +86,7 @@ val applicationContext: Context
8686
}
8787
```
8888

89-
In your iOS source set(similar in other Apple platforms), you can implement it by:
89+
In your iOS source set (similar with other Apple platforms), you can implement it by:
9090

9191
```kotlin
9292
import com.ctrip.sqllin.driver.DatabasePath
@@ -100,7 +100,7 @@ actual fun getGlobalDatabasePath(): DatabasePath =
100100

101101
```
102102

103-
You can config more SQLite arguments when you creating the `Database` instance:
103+
You can config more SQLite arguments when you create the `Database` instance:
104104

105105
```kotlin
106106
import com.ctrip.sqllin.driver.DatabaseConfiguration
@@ -127,10 +127,10 @@ val database = Database(
127127
```
128128

129129
Note, because of limitation by Android Framework, the `inMemory`, `busyTimeout`, `lookasideSlotSize`, `lookasideSlotCount`
130-
only work on Android 9 and higher. And, because of [sqlite-jdbc](https://github.com/xerial/sqlite-jdbc)(SQLlin base on it on JVM) doesn't support
130+
only work on Android 9 and higher. And, because [sqlite-jdbc](https://github.com/xerial/sqlite-jdbc)(SQLlin is based on it on JVM) doesn't support
131131
`sqlite3_config()`, the `lookasideSlotSize` and `lookasideSlotCount` don't work on JVM target.
132132

133-
Now, the operations that change database structure have not supported by DSL yet. So, you need to write these SQL statements by string
133+
Now, the operations that change database structure haven't been supported by DSL yet. So, you need to write these SQL statements by string
134134
as in `create` and `upgrade` parameters.
135135

136136
Usually, you just need to create one `Database` instance in your component lifecycle. So, you need to close database manually when the lifecycle ended:
@@ -143,7 +143,7 @@ override fun onDestroy() {
143143

144144
## Defining Your database entity
145145

146-
In _sqllin-dsl_, you can insert and query objects directly. So, you need to use the correct way to define your data class. For example:
146+
In _sqllin-dsl_, you can insert and query objects directly. So, you need to use the correct way to define your data classes. For example:
147147

148148
```kotlin
149149
import com.ctrip.sqllin.dsl.annotation.DBRow
@@ -157,14 +157,14 @@ data class Person(
157157
)
158158
```
159159

160-
Your database entity's property names should same with the database table's column names. The database entity cannot have properties with names different from all
161-
column names in the table. But the count of your database entity's properties can less than the count of columns.
160+
Your database entities' property names should be same with the database table's column names. The database entities cannot have properties with names different from all
161+
column names in the table. But the count of your database entities' properties can less than the count of columns.
162162

163163
The `@DBRow`'s param `tableName` represents the table name in Database, please ensure pass
164164
the correct value. If you don't pass the parameter manually, _sqllin-processor_ will use the class
165165
name as table name, for example, `Person`'s default table name is "Person".
166166

167-
In _sqllin-dsl_, objects serialization to SQL and deserialization from cursor depend on _kotlinx.serialization_. So, you also need to add the `@Serializable` onto your data class.
167+
In _sqllin-dsl_, objects are serialized to SQL and deserialized from cursor depend on _kotlinx.serialization_. So, you also need to add the `@Serializable` onto your data classes.
168168

169169
## Next Step
170170

0 commit comments

Comments
 (0)