Skip to content

Commit

Permalink
Prepare vendored sqlean to be published as a crate.
Browse files Browse the repository at this point in the history
  • Loading branch information
ignatz committed Dec 30, 2024
1 parent 7e43e3b commit d43a5fa
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 17 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion trailbase-extension/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ rand = "0.8.5"
regex = "1.11.0"
rusqlite = { workspace = true }
serde_json = "1.0.121"
# sqlite-loadable = { workspace = true }
uuid = { version = "1.7.0", default-features = false, features = ["std", "v7"] }
validator = "0.19.0"

Expand Down
2 changes: 1 addition & 1 deletion trailbase-sqlite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ schemars = "0.8.21"
serde = { version = "^1.0.203", features = ["derive"] }
serde_json = "1.0.122"
serde_rusqlite = "0.36.0"
sqlean = { path = "../vendor/sqlean" }
trailbase-sqlean = { path = "../vendor/sqlean" }
sqlite-vec = "0.1.6"
thiserror = "2.0.1"
tokio = { version = "^1.38.0", features = ["macros", "rt-multi-thread", "fs", "sync"] }
Expand Down
2 changes: 1 addition & 1 deletion trailbase-sqlite/src/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" fn init_trailbase_extensions(

// Init sqlean's stored procedures: "define", see:
// https://github.com/nalgeon/sqlean/blob/main/docs/define.md
let status = unsafe { sqlean::define_init(db as *mut sqlean::sqlite3) };
let status = unsafe { trailbase_sqlean::define_init(db as *mut trailbase_sqlean::sqlite3) };
if status != 0 {
log::error!("Failed to load sqlean::define",);
return status;
Expand Down
12 changes: 10 additions & 2 deletions vendor/sqlean/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
[package]
name = "sqlean"
name = "trailbase-sqlean"
version = "0.0.1"
edition = "2021"
license = "MIT"
homepage = "https://trailbase.io"
repository = "https://github.com/trailbaseio/trailbase"
readme = "README.md"

[badges]
appveyor = { repository = "trailbaseio/trailbase" }
maintenance = { status = "actively-developed" }

[dependencies]
libsqlite3-sys = "0.30.1"
libsqlite3-sys = { version = "0.30.1", features = ["bundled"] }

[build-dependencies]
bindgen = "0.71.0"
Expand Down
21 changes: 21 additions & 0 deletions vendor/sqlean/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024+ Sebastian Jeltsch

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions vendor/sqlean/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# TrailBase Sqlean

A build wrapper around the wonderful
[sqlean](https://github.com/nalgeon/sqlean) SQLite extensions.

NOTE: This crates is not intended for general use, at least for now. It
currently only builds a subset of sqlean's "define" feature to be used in
[TrailBase](https://trailbase.io).
3 changes: 2 additions & 1 deletion vendor/sqlean/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ fn build_object() {
// Disable SQLEAN's define-eval feature
.flag("-DDISABLE_DEFINE_EVAL");

let sqlite3_include_dir = env::var("DEP_SQLITE3_INCLUDE").expect("Set by libsqlite3-sys");
let sqlite3_include_dir =
env::var("DEP_SQLITE3_INCLUDE").expect("$DEP_SQLITE3_INCLUDE should be set by libsqlite3-sys");

cfg
.warnings(false)
Expand Down

0 comments on commit d43a5fa

Please sign in to comment.