oxide-sql-sqlite 0.2.0

SQLite-specific SQL parser and builder extensions
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented1 out of 1 items with examples
  • Size
  • Source code size: 13.35 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.05 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 18s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • LeakIX/oxide-sql
    3 0 5
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • dannywillems

oxide-sql-sqlite

SQLite-specific extensions for oxide-sql-core.

How SQLite differs from other dialects

  • UPSERT: SQLite supports INSERT ... ON CONFLICT DO NOTHING and ON CONFLICT DO UPDATE SET ... (since SQLite 3.24.0). This crate provides [UpsertBuilder] for type-safe upsert construction.
  • RETURNING: SQLite supports RETURNING clauses on INSERT, UPDATE, and DELETE (since SQLite 3.35.0).
  • Identifier quoting: SQLite uses double quotes (") as the standard quoting style, though it also accepts backticks and square brackets. See SQLite keywords.
  • Type affinity: SQLite uses a type-affinity system rather than strict column types. Any column can store any value regardless of declared type (unless STRICT tables are used).
  • Limited ALTER TABLE: SQLite only supports RENAME TABLE, RENAME COLUMN, and ADD COLUMN. It does not support DROP COLUMN (before 3.35.0), ALTER COLUMN, or ADD CONSTRAINT.
  • AUTOINCREMENT: SQLite uses the AUTOINCREMENT keyword (not sequences or SERIAL like PostgreSQL/DuckDB).

Example

use oxide_sql_sqlite::UpsertBuilder;
use oxide_sql_core::builder::value::ToSqlValue;

// UPSERT example
let (sql, params) = UpsertBuilder::new()
    .into_table("users")
    .columns(&["id", "name", "email"])
    .values(vec![
        1_i64.to_sql_value(),
        "Alice".to_sql_value(),
        "alice@example.com".to_sql_value(),
    ])
    .on_conflict(&["id"])
    .do_update(&["name", "email"])
    .build();