{"id":29305785,"url":"https://github.com/lodosgroup/sqlite3-wrapper","last_synced_at":"2025-07-07T06:01:48.427Z","repository":{"id":41993248,"uuid":"469707822","full_name":"lodosgroup/sqlite3-wrapper","owner":"lodosgroup","description":"zero dependency, minimal sqlite3 wrapper built for lod package manager","archived":false,"fork":false,"pushed_at":"2023-08-21T18:11:31.000Z","size":2727,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T04:47:47.813Z","etag":null,"topics":["ffi","sqlite","sqlite3","wrapper"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/min-sqlite3-sys","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lodosgroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-03-14T11:42:03.000Z","updated_at":"2024-01-16T22:05:16.000Z","dependencies_parsed_at":"2023-08-10T04:27:58.129Z","dependency_job_id":null,"html_url":"https://github.com/lodosgroup/sqlite3-wrapper","commit_stats":null,"previous_names":["lodosgroup/sqlite3-wrapper","foss-lodpm/sqlite3-wrapper"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/lodosgroup/sqlite3-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodosgroup%2Fsqlite3-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodosgroup%2Fsqlite3-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodosgroup%2Fsqlite3-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodosgroup%2Fsqlite3-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lodosgroup","download_url":"https://codeload.github.com/lodosgroup/sqlite3-wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodosgroup%2Fsqlite3-wrapper/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264011031,"owners_count":23543731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffi","sqlite","sqlite3","wrapper"],"created_at":"2025-07-07T06:00:59.937Z","updated_at":"2025-07-07T06:01:48.406Z","avatar_url":"https://github.com/lodosgroup.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Very minimal sqlite wrapper package built specifically for lod package manager and Unix systems. If you need complete box of sqlite database, consider using [rusqlite](https://github.com/rusqlite/rusqlite).\n\n## Adding lib to the project\nIn your Cargo.toml:\n\n```toml\n[dependencies]\nmin-sqlite3-sys = \"1.4\"\n```\n\nIn build.rs of your binary crate:\n```rust\nuse std::{env, path::Path};\n\nfn main() {\n    let home_path = env::var(\"HOME\").expect(\"HOME environment variable is not set.\");\n    let target_dir = Path::new(\u0026home_path).join(\".local/share/min_sqlite3_sys\");\n\n    println!(\"cargo:rustc-link-arg=-Wl,-rpath={}\", target_dir.display());\n}\n```\n\n## Usage\nSimple usage:\n\n```rust\nuse std::path::Path;\n\nuse min_sqlite3_sys::prelude::*;\n\nfn main() {\n    let db = Database::open(Path::new(\"example.db\")).unwrap();\n    let statement = String::from(\n        \"CREATE TABLE IF NOT EXISTS items(\n                 id      PRIMARY KEY,\n                 name    TEXT,\n                 tag     TEXT\n             );\n         \",\n    );\n\n    let status = db.execute(\n        statement,\n        None::\u003cBox\u003cdyn FnOnce(SqlitePrimaryResult, String)\u003e\u003e,\n    ).unwrap();\n\n    if status != SqlitePrimaryResult::Ok {\n        // handle the problem\n    }\n\n    db.close();\n}\n```\n\nSimple usage with callback function:\n```rust\nuse std::path::Path;\n\nuse min_sqlite3_sys::prelude::*;\n\nfn callback_function(status: SqlitePrimaryResult, sql_statement: String) {\n    println!(\n        \"{} did not successfully executed. The error status is: {:?}.\",\n        sql_statement, status\n    );\n}\n\nfn main() {\n    let db = Database::open(Path::new(\"example.db\")).unwrap();\n    let statement = String::from(\n        \"CREATE TABLE IF NOT EXISTS items(\n                 id      PRIMARY KEY,\n                 name    TEXT,\n                 tag     TEXT\n             );\n         \",\n    );\n\n    db.execute(statement, Some(callback_function)).unwrap();\n\n    db.close();\n}\n```\n\nSimple usage with retrieving some data:\n```rust\n#![allow(dead_code)]\nuse std::path::Path;\n\nuse min_sqlite3_sys::prelude::*;\n\nfn callback_function(status: SqlitePrimaryResult, sql_statement: String) {\n    println!(\n        \"{} did not successfully executed. The error status is: {:?}.\",\n        sql_statement, status\n    );\n}\n\n#[derive(Debug)]\nstruct Item {\n    id: i64,\n    name: String,\n    tag: String,\n}\n\nfn main() {\n    let db = Database::open(Path::new(\"example.db\")).unwrap();\n    let statement = String::from(\"SELECT * FROM items WHERE name = 'Onur';\");\n\n    let mut sql = db.prepare(statement, Some(callback_function)).unwrap();\n\n    // Iterate the results\n    while let PreparedStatementStatus::FoundRow = sql.execute_prepared() {\n        println!(\n            \"id = {}, name = {}, tag = {}\",\n            sql.get_data::\u003ci64\u003e(0).unwrap(),\n            sql.get_data::\u003cString\u003e(1).unwrap(),\n            sql.get_data::\u003cString\u003e(2).unwrap(),\n        );\n\n        // Or simply\n        println!(\n            \"{:?}\",\n            Item {\n                id: sql.get_data(0).unwrap(),\n                name: sql.get_data(1).unwrap(),\n                tag: sql.get_data(2).unwrap(),\n            }\n        );\n    }\n    // Must be called for each `prepare()` result.\n    sql.kill();\n\n    db.close();\n}\n```\n\nSimple usage with retrieving some data + binding values:\n```rust\n#![allow(dead_code)]\nuse std::path::Path;\n\nuse min_sqlite3_sys::prelude::*;\n\nfn callback_function(status: SqlitePrimaryResult, sql_statement: String) {\n    println!(\n        \"{} did not successfully executed. The error status is: {:?}.\",\n        sql_statement, status\n    );\n}\n\n#[derive(Debug)]\nstruct Item {\n    id: i64,\n    name: String,\n    tag: String,\n}\n\nfn main() {\n    let db = Database::open(Path::new(\"example.db\")).unwrap();\n    let statement = String::from(\"SELECT * FROM items WHERE name = ?;\");\n\n    let mut sql = db.prepare(statement, Some(callback_function)).unwrap();\n    let status = sql.bind_val(1, \"Onur\");\n    // You can do some checks by\n    assert_eq!(status, SqlitePrimaryResult::Ok);\n    // or\n    if status == SqlitePrimaryResult::Range {\n    \tpanic!(\"Out of index on sql.bind_val!\");\n    }\n\n    // Iterate the results\n    while let PreparedStatementStatus::FoundRow = sql.execute_prepared() {\n        println!(\n            \"id = {}, name = {}, tag = {}\",\n            sql.get_data::\u003ci64\u003e(0).unwrap(),\n            sql.get_data::\u003cString\u003e(1).unwrap(),\n            sql.get_data::\u003cString\u003e(2).unwrap(),\n        );\n\n        // Or simply\n        println!(\n            \"{:?}\",\n            Item {\n                id: sql.get_data(0).unwrap(),\n                name: sql.get_data(1).unwrap(),\n                tag: sql.get_data(2).unwrap(),\n            }\n        );\n    }\n    // Must be called for each `prepare()` result.\n    sql.kill();\n\n    db.close();\n}\n```\n\n## Notes\nIn order to not inflate the build outputs of your projects, the library executes sqlite functions from dynamic library using C ABI via FFI. Meaning, your build output will not include sqlite sources.\n\nThis library does not use any SQLite library on your system to ensure that the package doesn't get affected by SQLite versions. Instead, the sqlite3-builder crate compiles the sqlite3 sources under the c_source directory as dynamic library and puts that under the '~/.local/share/min_sqlite3_sys'.\n\n## License\nThis package is covered under the MIT license. See the LICENSE file for more info.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flodosgroup%2Fsqlite3-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flodosgroup%2Fsqlite3-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flodosgroup%2Fsqlite3-wrapper/lists"}