Database Assessment

SQLx : The Asynchronous, Safe, And Flexible SQL Library For Rust

SQLx is an async, pure Rust SQL crate featuring compile-time checked queries without a DSL.

  • Truly Asynchronous. Built from the ground-up using async/await for maximum concurrency.
  • Compile-time checked queries (if you want). See SQLx is not an ORM.
  • Database Agnostic. Support for PostgreSQL, MySQL, MariaDB, SQLite.
    • MSSQL was supported prior to version 0.7, but has been removed pending a full rewrite of the driver as part of our SQLx Pro initiative.
  • Pure Rust. The Postgres and MySQL/MariaDB drivers are written in pure Rust using zero unsafe†† code.
  • Runtime Agnostic. Works on different runtimes (async-std / tokio / actix) and TLS backends (native-tls, rustls).

† The SQLite driver uses the libsqlite3 C library as SQLite is an embedded database (the only way we could be pure Rust for SQLite is by porting all of SQLite to Rust).

†† SQLx uses #![forbid(unsafe_code)] unless the sqlite feature is enabled. The SQLite driver directly invokes the SQLite3 API via libsqlite3-sys, which requires unsafe.

  • Cross-platform. Being native Rust, SQLx will compile anywhere Rust is supported.
  • Built-in connection pooling with sqlx::Pool.
  • Row streaming. Data is read asynchronously from the database and decoded on demand.
  • Automatic statement preparation and caching. When using the high-level query API (sqlx::query), statements are prepared and cached per connection.
  • Simple (unprepared) query execution including fetching results into the same Row types used by the high-level API. Supports batch execution and returns results from all statements.
  • Transport Layer Security (TLS) where supported (MySQL, MariaDB and PostgreSQL).
  • Asynchronous notifications using LISTEN and NOTIFY for PostgreSQL.
  • Nested transactions with support for save points.
  • Any database driver for changing the database driver at runtime. An AnyPool connects to the driver indicated by the URL scheme.

Install

SQLx is compatible with the async-std, tokio, and actix runtimes; and, the native-tls and rustls TLS backends. When adding the dependency, you must choose a runtime feature that is runtime + tls.

# Cargo.toml
[dependencies]
# PICK ONE OF THE FOLLOWING:

# tokio (no TLS)
sqlx = { version = "0.8", features = [ "runtime-tokio" ] }
# tokio + native-tls
sqlx = { version = "0.8", features = [ "runtime-tokio", "tls-native-tls" ] }
# tokio + rustls with ring and WebPKI CA certificates
sqlx = { version = "0.8", features = [ "runtime-tokio", "tls-rustls-ring-webpki" ] }
# tokio + rustls with ring and platform's native CA certificates
sqlx = { version = "0.8", features = [ "runtime-tokio", "tls-rustls-ring-native-roots" ] }
# tokio + rustls with aws-lc-rs
sqlx = { version = "0.8", features = [ "runtime-tokio", "tls-rustls-aws-lc-rs" ] }

# async-std (no TLS)
sqlx = { version = "0.8", features = [ "runtime-async-std" ] }
# async-std + native-tls
sqlx = { version = "0.8", features = [ "runtime-async-std", "tls-native-tls" ] }
# async-std + rustls with ring and WebPKI CA certificates
sqlx = { version = "0.8", features = [ "runtime-async-std", "tls-rustls-ring-webpki" ] }
# async-std + rustls with ring and platform's native CA certificates
sqlx = { version = "0.8", features = [ "runtime-async-std", "tls-rustls-ring-native-roots" ] }
# async-std + rustls with aws-lc-rs
sqlx = { version = "0.8", features = [ "runtime-async-std", "tls-rustls-aws-lc-rs" ] }

For more information click here.

Varshini

Tamil has a great interest in the fields of Cyber Security, OSINT, and CTF projects. Currently, he is deeply involved in researching and publishing various security tools with Kali Linux Tutorials, which is quite fascinating.

Recent Posts

Awesome EDR Bypass : A Comprehensive Guide For Ethical Hackers

EDR bypass technology is not just for attackers. Many malware now have EDR bypass capabilities,…

7 hours ago

Better-Sliver : The Community-Driven Fork For Advanced Security Testing

Welcome to Better-Sliver, a fork of the Sliver project. This fork is intended to be…

7 hours ago

Fuzzing Lab : Mastering Software Testing Techniques With UCLA ACM Cyber

This is the repository for the Introduction to Fuzzing Lab run by ACM Cyber at…

8 hours ago

Apache HTTP Server Vulnerability Testing Tool

This repository provides a Proof of Concept (PoC) for testing various vulnerabilities in the Apache…

8 hours ago

Wez’s Terminal : A Rust-Powered GPU-Accelerated Terminal Emulator

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust Getting…

2 days ago

AutorizePro : Revolutionizing Authorization Testing With AI

一句话介绍工具: AutorizePro 是一款创新性的内置AI分析模块的专注于越权检测的 Burp 插件 (已有多个白帽反馈用工具嘎嘎挖到src洞, 每周末更新, 欢迎Star🌟以便持续跟踪项目最新版本功能) 工具背景 越权漏洞在黑盒测试、SRC挖掘中几乎是必测的一项,但手工逐个测试越权漏洞往往会耗费大量时间。 而自动化工具又因为接口的多样化,难以制定一个全面的检测逻辑而存在大量误报, 基于此产生了 AI辅助分析的检测工具 ➡️ AutorizePro…

2 days ago