{"id":23864319,"url":"https://github.com/as400jplpc/zig_sqlite","last_synced_at":"2026-04-22T16:35:20.113Z","repository":{"id":270763347,"uuid":"911384405","full_name":"AS400JPLPC/zig_sqlite","owner":"AS400JPLPC","description":"work sqlite ","archived":false,"fork":false,"pushed_at":"2025-01-16T21:16:29.000Z","size":130,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T12:45:51.548Z","etag":null,"topics":["sqlite","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AS400JPLPC.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-02T22:21:54.000Z","updated_at":"2025-01-16T21:16:30.000Z","dependencies_parsed_at":"2025-01-02T23:28:14.815Z","dependency_job_id":"4f861f34-7fd7-4652-9738-a715db7472e6","html_url":"https://github.com/AS400JPLPC/zig_sqlite","commit_stats":null,"previous_names":["as400jplpc/zig_sqlite"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_sqlite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_sqlite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_sqlite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AS400JPLPC%2Fzig_sqlite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AS400JPLPC","download_url":"https://codeload.github.com/AS400JPLPC/zig_sqlite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240177048,"owners_count":19760308,"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":["sqlite","zig"],"created_at":"2025-01-03T08:20:46.902Z","updated_at":"2026-04-22T16:35:15.075Z","avatar_url":"https://github.com/AS400JPLPC.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zig-sqlite\n\nzig 0.14.dev\n\nI thank \"[nDimensional](https://github.com/nDimensional/zig-sqlite)\"\nit is on this basis that I undertook to work, it remains simple, it is not a real duplication, because I updated so that it works from zig 0.14.dev.\nI added some functions:\n\n```\npub isDir( vdir : []const u8) bool ...\n\npub isDbxist( vdir : []const u8, fn_file_name:[]const u8) bool ...\n\npub open(vdir : []const u8, name: []const u8) !Database ...\n\npub fn open(vdir : []const u8, name: []const u8) !Database ...\n\npub fn openTmp(tDir: std.fs.Dir, name: []const u8) !Database ...\n\npub fn cbool(data : i32 ) bool ...\n\n```\n\n\n\n**TEST. Testsql.zig** :\n\na complete test cycle is made available to you\nand functional.\n\n\nSimple, low-level, explicitly-typed SQLite bindings for Zig.\n\n## Table of Contents\n\n- [Usage](#usage)\n  - [Methods](#methods)\n  - [Queries](#queries)\n- [Notes](#notes)\n- [Build options](#build-options)\n- [License](#license)\n\n- [Avancement](#avancement\n\n- [Conditionnement](#conditionnement\n\nThen add `sqlite` as an import to your root modules in `build.zig`:\n\n```zig\nfn build(b: *std.Build) void {\n    const app = b.addExecutable(.{ ... });\n    // ...\n\n    const sqlite = b.dependency(\"sqlite\", .{});\n    app.root_module.addImport(\"sqlite\", sqlite.module(\"sqlite\"));\n}\n```\n\n## Usage\n\nOpen databases using `Database.open` and close them with `db.close()`:\n\n```zig\nconst sql3 = @import(\"sqlite\");\n\n{\n    // in-memory database\n    const db = try sql3.open(\"sqlite\", \"db.sqlite\");\n    defer db.close();\n\n}\n\n{\n    // persistent database\n    const db = try sql3.Database.open(.{ .path = \"path/to/db.sqlite\" });\n    defer db.close();\n}\n```\n\n\nText and blob values must not be retained across steps. **You are responsible for copying them.**\n\n## Notes\n\nCrafting sensible Zig bindings for SQLite involves making tradeoffs between following the Zig philosophy (\"deallocation must succeed\") and matching the SQLite API, in which closing databases or finalizing statements may return error codes.\n\nThis library takes the following approach:\n\n- `Database.close` calls `sqlite3_close_v2` and panics if it returns an error code.\n- `Statement.finalize` calls `sqlite3_finalize` and panics if it returns an error code.\n- `Statement.step` automatically calls `sqlite3_reset` if `sqlite3_step` returns an error code.\n  - In SQLite, `sqlite3_reset` returns the error code from the most recent call to `sqlite3_step`. This is handled gracefully.\n- `Statement.reset` calls both `sqlite3_reset` and `sqlite3_clear_bindings`, and panics if either return an error code.\n\nThese should only result in panic through gross misuse or in extremely unusual situations, e.g. `sqlite3_reset` failing internally. All \"normal\" errors are faithfully surfaced as Zig errors.\n\n## Build options\n\n```zig\nstruct {\n    SQLITE_ENABLE_COLUMN_METADATA: bool = false,\n    SQLITE_ENABLE_DBSTAT_VTAB:     bool = false,\n    SQLITE_ENABLE_FTS3:            bool = false,\n    SQLITE_ENABLE_FTS4:            bool = false,\n    SQLITE_ENABLE_FTS5:            bool = false,\n    SQLITE_ENABLE_GEOPOLY:         bool = false,\n    SQLITE_ENABLE_ICU:             bool = false,\n    SQLITE_ENABLE_MATH_FUNCTIONS:  bool = false,\n    SQLITE_ENABLE_RBU:             bool = false,\n    SQLITE_ENABLE_RTREE:           bool = false,\n    SQLITE_ENABLE_STAT4:           bool = false,\n    SQLITE_OMIT_DECLTYPE:          bool = false,\n    SQLITE_OMIT_JSON:              bool = false,\n    SQLITE_USE_URI:                bool = false,\n    SQLITE_OMIT_DEPRECATED:        bool = false,\n}\n```\n\nSet these by passing e.g. `-DSQLITE_ENABLE_RTREE` in the CLI, or by setting `.SQLITE_ENABLE_RTREE = true` in the `args` parameter to `std.Build.dependency`. For example:\n\n```zig\npub fn build(b: *std.Build) !void {\n    // ...\n\n    const sqlite = b.dependency(\"sqlite\", .{ .SQLITE_ENABLE_RTREE = true,.SQLITE_OMIT_DEPRECATED = true  });\n}\n```\n##Conditionnment\n\npub const Blob = struct { data: []const u8 };\u003cBR/\u003e\npub const Text = struct { data: []const u8 };\u003cBR/\u003e\npub const Numeric = struct { data: []const u8 };\u003cBR/\u003e\npub const Date = struct { data: []const u8 };\u003cBR/\u003e\npub const Bool = struct { data: bool};\u003cBR/\u003e\n\nex: src-zig/sqlite.zig\u003cBR/\u003e\n\n\nlibsql/sqlite/sqlite.zig\u003cBR/\u003e\n```\nswitch (binding.type) {\n                        .int32 =\u003e try stmt.bindInt32(idx, @intCast(value)),\n                        .int64 =\u003e try stmt.bindInt64(idx, @intCast(value)),\n                        .float64 =\u003e try stmt.bindFloat64(idx, @floatCast(value)),\n                        .blob =\u003e try stmt.bindBlob(idx, value),\n                        .text =\u003e try stmt.bindText(idx, value),\n                        .numeric =\u003e try stmt.bindNumeric(idx, value),\n                        .date =\u003e try stmt.bindDate(idx, value),\n                        .boolean =\u003e try stmt.bindBoolean(idx, value),\n                    }\n```\n\ntext = null  -\u003e \"\"\u003cBR/\u003e\ndate = null  -\u003e \"\"\u003cBR/\u003e\nnumeric = null -\u003e \"\"\u003cBR/\u003e\nexample delivery date null = delivery not processed\u003cBR/\u003e\n\n## Avancement\n\n\u003cBR/\u003e\n→ 2025-01-07 01:00 update Implementation of extended procedures of the zig \"libsql\" lib while respecting the structure of SQLITE3 \u003cBR/\u003e\nThe Date function is under study.\u003cBR/\u003e.\n\u003cBR/\u003e\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas400jplpc%2Fzig_sqlite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fas400jplpc%2Fzig_sqlite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fas400jplpc%2Fzig_sqlite/lists"}