Skip to content

Commit a721085

Browse files
committed
Vendor sqlite-nostd
1 parent bb88a91 commit a721085

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+16148
-113
lines changed

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

Cargo.lock

Lines changed: 15 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,3 @@ keywords = ["sqlite", "powersync"]
3535
license = "Apache-2.0"
3636
homepage = "https://powersync.com"
3737
repository = "https://github.com/powersync-ja/powersync-sqlite-core"
38-
39-
[workspace.dependencies]
40-
sqlite_nostd = { path="./sqlite-rs-embedded/sqlite_nostd" }

crates/core/Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ name = "powersync_core"
1313
crate-type = ["rlib"]
1414

1515
[dependencies]
16-
sqlite_nostd = { workspace=true }
16+
powersync_sqlite_nostd = { version = "=0.4.8", path = "../sqlite_nostd" }
1717
bytes = { version = "1.4", default-features = false }
1818
num-traits = { version = "0.2.15", default-features = false }
1919
num-derive = "0.3"
@@ -37,9 +37,7 @@ features = []
3737
[features]
3838
default = ["getrandom"]
3939

40-
loadable_extension = ["sqlite_nostd/loadable_extension"]
41-
static = ["sqlite_nostd/static"]
42-
omit_load_extension = ["sqlite_nostd/omit_load_extension"]
40+
static = ["powersync_sqlite_nostd/static"]
4341
# Enable to use the getrandom crate instead of sqlite3_randomness
4442
# Enable for Windows builds; do not enable for WASM
4543
getrandom = ["uuid/v4"]

crates/core/src/checkpoint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use alloc::string::String;
44
use alloc::vec::Vec;
55
use core::ffi::c_int;
66

7+
use powersync_sqlite_nostd as sqlite;
8+
use powersync_sqlite_nostd::{Connection, Context, Value};
79
use serde::Serialize;
810
use serde_json as json;
911
use sqlite::ResultCode;
10-
use sqlite_nostd as sqlite;
11-
use sqlite_nostd::{Connection, Context, Value};
1212

1313
use crate::create_sqlite_text_fn;
1414
use crate::error::PowerSyncError;

crates/core/src/crud_vtab.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ use core::ffi::{CStr, c_char, c_int, c_void};
77
use serde::Serialize;
88
use serde_json::value::RawValue;
99

10+
use powersync_sqlite_nostd::ManagedStmt;
11+
use powersync_sqlite_nostd::{self as sqlite, ColumnType};
1012
use sqlite::{Connection, ResultCode, Value};
11-
use sqlite_nostd::ManagedStmt;
12-
use sqlite_nostd::{self as sqlite, ColumnType};
1313

1414
use crate::error::PowerSyncError;
1515
use crate::ext::SafeManagedStmt;
@@ -101,7 +101,7 @@ impl VirtualTable {
101101
// Columns are (data TEXT, options INT HIDDEN)
102102
let data = args[0].text();
103103
let flags = match args[1].value_type() {
104-
sqlite_nostd::ColumnType::Null => TableInfoFlags::default(),
104+
sqlite::ColumnType::Null => TableInfoFlags::default(),
105105
_ => TableInfoFlags(args[1].int() as u32),
106106
};
107107

@@ -114,7 +114,7 @@ impl VirtualTable {
114114
CrudTransactionMode::Simple(simple) => {
115115
// Columns are (op TEXT, id TEXT, type TEXT, data TEXT, old_values TEXT, metadata TEXT, options INT HIDDEN)
116116
let flags = match args[6].value_type() {
117-
sqlite_nostd::ColumnType::Null => TableInfoFlags::default(),
117+
sqlite::ColumnType::Null => TableInfoFlags::default(),
118118
_ => TableInfoFlags(args[6].int() as u32),
119119
};
120120
let op = args[0].text();
@@ -364,7 +364,7 @@ extern "C" fn update(
364364
// Insert-only virtual table.
365365
// The primary functionality here is in begin, update, commit and rollback.
366366
// connect and disconnect configures the table and allocates the required resources.
367-
static MODULE: sqlite_nostd::module = sqlite_nostd::module {
367+
static MODULE: sqlite::module = sqlite::module {
368368
iVersion: 0,
369369
xCreate: None,
370370
xConnect: Some(connect),

crates/core/src/diff.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ extern crate alloc;
33
use alloc::string::{String, ToString};
44
use core::ffi::c_int;
55

6+
use powersync_sqlite_nostd as sqlite;
7+
use powersync_sqlite_nostd::{Connection, Context, Value};
68
use sqlite::ResultCode;
7-
use sqlite_nostd as sqlite;
8-
use sqlite_nostd::{Connection, Context, Value};
99

1010
use crate::constants::SUBTYPE_JSON;
1111
use crate::create_sqlite_text_fn;
1212
use crate::error::PowerSyncError;
13+
use powersync_sqlite_nostd::bindings::SQLITE_RESULT_SUBTYPE;
1314
use serde_json as json;
14-
use sqlite_nostd::bindings::SQLITE_RESULT_SUBTYPE;
1515

1616
fn powersync_diff_impl(
1717
ctx: *mut sqlite::context,

crates/core/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use alloc::{
66
string::{String, ToString},
77
};
88
use num_traits::FromPrimitive;
9-
use sqlite_nostd::{self as sqlite, Connection, Context, ResultCode, context, sqlite3};
9+
use powersync_sqlite_nostd::{self as sqlite, Connection, Context, ResultCode, context, sqlite3};
1010
use thiserror::Error;
1111

1212
use crate::{

crates/core/src/ext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use sqlite_nostd::{Connection, Destructor, ManagedStmt, ResultCode, sqlite3};
1+
use powersync_sqlite_nostd::{Connection, Destructor, ManagedStmt, ResultCode, sqlite3};
22

33
pub trait SafeManagedStmt {
44
fn exec(&self) -> Result<(), ResultCode>;

crates/core/src/fix_data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use alloc::string::String;
55

66
use crate::create_sqlite_optional_text_fn;
77
use crate::error::{PSResult, PowerSyncError};
8-
use sqlite_nostd::{self as sqlite, ColumnType, Value};
9-
use sqlite_nostd::{Connection, Context, ResultCode};
8+
use powersync_sqlite_nostd::{self as sqlite, ColumnType, Value};
9+
use powersync_sqlite_nostd::{Connection, Context, ResultCode};
1010

1111
use crate::ext::SafeManagedStmt;
1212
use crate::util::quote_identifier;

0 commit comments

Comments
 (0)