Skip to content

Commit afd82e7

Browse files
cleanup readme
1 parent 522a909 commit afd82e7

File tree

4 files changed

+16
-26
lines changed

4 files changed

+16
-26
lines changed

README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,9 @@ The PowerSync Kotlin Multiplatform SDK is currently in a beta release. It can be
4646
Current limitations:
4747

4848
- Integration with SQLDelight schema and API generation (ORM) is not yet supported.
49-
- Supports only a single database file.
5049

5150
Future work/ideas:
52-
53-
- Improved error handling.
5451
- Attachments helper package.
55-
- Management of DB connections on each platform natively.
56-
- Supporting additional targets (JVM, Wasm).
5752

5853
## Installation
5954

core/src/androidMain/kotlin/com/powersync/DatabaseDriverFactory.android.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
11
package com.powersync
22

33
import android.content.Context
4-
import android.os.Build
5-
import androidx.annotation.RequiresApi
64
import com.powersync.db.internal.InternalSchema
75
import kotlinx.coroutines.CoroutineScope
86
import org.sqlite.SQLiteCommitListener
9-
import java.util.Properties
107

118
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING", "SqlNoDataSourceInspection")
129
public actual class DatabaseDriverFactory(
1310
private val context: Context,
1411
) {
15-
@RequiresApi(Build.VERSION_CODES.O)
1612
internal actual fun createDriver(
1713
scope: CoroutineScope,
1814
dbFilename: String,
1915
dbDirectory: String?,
2016
): PsSqlDriver {
2117
val schema = InternalSchema
2218

23-
// WAL Mode properties
24-
val properties = Properties()
25-
properties.setProperty("journal_mode", "WAL")
26-
properties.setProperty("journal_size_limit", "${6 * 1024 * 1024}")
27-
properties.setProperty("busy_timeout", "30000")
28-
properties.setProperty("cache_size", "${50 * 1024}")
29-
3019
val dbPath =
3120
if (dbDirectory != null) {
3221
"$dbDirectory/$dbFilename"
@@ -38,7 +27,7 @@ public actual class DatabaseDriverFactory(
3827
val driver =
3928
JdbcSqliteDriver(
4029
url = "jdbc:sqlite:$dbPath",
41-
properties = properties,
30+
properties = buildDefaultWalProperties(),
4231
)
4332

4433
migrateDriver(driver, schema)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.powersync
2+
3+
import java.util.Properties
4+
5+
internal fun buildDefaultWalProperties(): Properties {
6+
// WAL Mode properties
7+
val properties = Properties()
8+
properties.setProperty("journal_mode", "WAL")
9+
properties.setProperty("journal_size_limit", "${6 * 1024 * 1024}")
10+
properties.setProperty("busy_timeout", "30000")
11+
properties.setProperty("cache_size", "${50 * 1024}")
12+
13+
return properties
14+
}

core/src/jvmMain/kotlin/com/powersync/DatabaseDriverFactory.jvm.kt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.powersync
33
import com.powersync.db.internal.InternalSchema
44
import kotlinx.coroutines.CoroutineScope
55
import org.sqlite.SQLiteCommitListener
6-
import java.util.Properties
76

87
@Suppress("EXPECT_ACTUAL_CLASSIFIERS_ARE_IN_BETA_WARNING", "SqlNoDataSourceInspection")
98
public actual class DatabaseDriverFactory {
@@ -14,13 +13,6 @@ public actual class DatabaseDriverFactory {
1413
): PsSqlDriver {
1514
val schema = InternalSchema
1615

17-
// WAL Mode properties
18-
val properties = Properties()
19-
properties.setProperty("journal_mode", "WAL")
20-
properties.setProperty("journal_size_limit", "${6 * 1024 * 1024}")
21-
properties.setProperty("busy_timeout", "30000")
22-
properties.setProperty("cache_size", "${50 * 1024}")
23-
2416
val dbPath =
2517
if (dbDirectory != null) {
2618
"$dbDirectory/$dbFilename"
@@ -31,7 +23,7 @@ public actual class DatabaseDriverFactory {
3123
val driver =
3224
JdbcSqliteDriver(
3325
url = "jdbc:sqlite:$dbPath",
34-
properties = properties,
26+
properties = buildDefaultWalProperties(),
3527
)
3628

3729
migrateDriver(driver, schema)

0 commit comments

Comments
 (0)