Skip to main content

Sql

Trait Sql 

Source
pub trait Sql: Classifier {
    // Provided methods
    fn classify_sql(&self, query: &[u8]) -> Type { ... }
    fn extract_keyword(&self, query: &[u8]) -> Vec<u8> ⓘ { ... }
}
Expand description

Classifies SQL text by its leading keyword: the logic shared by the SQL wire protocol classifiers (super::MySql, super::PostgreSql), which implement Classifier::classify for their packet format and hand the SQL text to Sql::classify_sql.

Handles leading whitespace, -- and /* */ comments, quoted literals and identifiers ('..', "..", `..`, $tag$..$tag$), mixed case, COPY ... TO (read) against COPY ... FROM (write), and CTEs (WITH ... SELECT reads, WITH ... INSERT writes).

PHP: Utopia\Query\Classifier\SQL.

Provided Methods§

Source

fn classify_sql(&self, query: &[u8]) -> Type

The classification of the SQL text query.

PHP: SQL::classifySQL().

Source

fn extract_keyword(&self, query: &[u8]) -> Vec<u8> ⓘ

The first keyword of query, uppercased (ASCII), after whitespace, comments and quoted literals; empty when there is none.

PHP: SQL::extractKeyword().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§