Oxide SQL
A type-safe SQL parser and builder for Rust with compile-time validation and SQL injection prevention.
Features
- Type-Safe SQL Building: Invalid SQL constructs are caught at compile time using the typestate pattern
- SQL Injection Prevention: All user input is automatically parameterized
- Hand-Written Parser: Recursive descent parser with Pratt expression parsing
- SQLite Extensions: SQLite-specific syntax like UPSERT
Quick Start
Add the dependencies to your Cargo.toml:
[dependencies]
oxide-sql-core = "0.1"
oxide-sql-sqlite = "0.1" # Optional, for SQLite-specific features
Why Oxide SQL?
- Compile-Time Safety: Catch SQL syntax errors before runtime
- Security First: SQL injection is prevented by design
- Zero Runtime Overhead: Type states are zero-sized types
- Extensible: Support for database-specific dialects
API Reference
See the crate overview rustdoc for the full API documentation with code examples.
Documentation
- Getting Started - Installation and basic usage
- SQL Builders - SELECT, INSERT, UPDATE, DELETE builders
- Type-Safe Schema - Define tables with derive macros
- SQL Security Guide - SQL injection and prevention
Web Framework
Looking for ORM, admin interface, authentication, forms, routing, and migrations? See Corrode, a Django-like web framework for Rust built on oxide-sql.