Rust

The building blocks every statement uses: identifiers, table names, tenant conditions, column types, parameter types, and the mapping of driver errors onto the library's errors.

Contents

use utopia_database::adapter::mariadb::sql::Binds;
Rust
pub struct Binds(pub Vec<(String, Value)>)

Bound values of a statement in the making, by placeholder, in the order they were added ($binds).

use utopia_database::adapter::mariadb::sql::bind_typed;
Rust
pub fn bind_typed(stmt: &mut Statement, key: &str, value: Value) -> Result<()>

$stmt->bindValue($key, $value, $this->getPDOType($value)).

use utopia_database::adapter::mariadb::sql::filter;
Rust
pub fn filter(value: &str) -> String

Keeps [A-Za-z0-9_-].

use utopia_database::adapter::mariadb::sql::has_sequence;
Rust
pub fn has_sequence(document: &Document) -> Result<bool>

!empty($document->getSequence()).

use utopia_database::adapter::mariadb::sql::id_value;
Rust
pub fn id_value(document: &Document) -> Value

$document->getId().

use utopia_database::adapter::mariadb::sql::internal_key;
Rust
pub fn internal_key(attribute: &str) -> &str

Undocumented.

use utopia_database::adapter::mariadb::sql::interpolate;
Rust
pub fn interpolate(value: &Value) -> String

Undocumented.

use utopia_database::adapter::mariadb::sql::json_encode;
Rust
pub fn json_encode(value: &Value) -> Value

The JSON text, or false when it fails.

use utopia_database::adapter::mariadb::sql::json_text;
Rust
pub fn json_text(value: &Value) -> String

As text ("" when it fails, as interpolating false gives).

use utopia_database::adapter::mariadb::sql::pdo_type;
Rust
pub fn pdo_type(value: &Value) -> Result<ParamType>

(MariaDB): strings and floats PARAM_STR, integers and booleans PARAM_INT, null PARAM_NULL.

use utopia_database::adapter::mariadb::sql::process_exception;
Rust
pub fn process_exception(e: PdoError, mysql: bool) -> Error

(MariaDB, and MySQL's codes first when mysql): driver errors with a known SQLSTATE and code become the library's errors; others stay PDOExceptions.

use utopia_database::adapter::mariadb::sql::quote;
Rust
pub fn quote(s: &str) -> String

(MariaDB): `string`.

use utopia_database::adapter::mariadb::sql::raw;
Rust
pub fn raw(e: PdoFailure) -> Error

A failed statement as it escapes unprocessed (PDOException).

use utopia_database::adapter::mariadb::sql::row_to_document;
Rust
pub fn row_to_document(mut row: Array, find: bool) -> Result<Document>

A fetched row as a document: internal columns renamed to their $ attributes, each renamed key moving to the end, in the order getDocument() (find = false) or find() renames them.

use utopia_database::adapter::mariadb::sql::sequence;
Rust
pub fn sequence(document: &Document) -> Result<Option<Value>>

$document->getSequence(): null, or the value as a string (the return type coerces it; an array is a TypeError).

use utopia_database::adapter::mariadb::sql::spatial_attributes;
Rust
pub fn spatial_attributes(collection: &Document) -> Vec<String>

Ids of the collection's spatial attribute documents.

use utopia_database::adapter::mariadb::sql::sql_type;
Rust
pub fn sql_type(kind: &str, size: i64, signed: bool, array: bool, required: bool, mysql: bool) -> Result<String>

(MariaDB).

use utopia_database::adapter::mariadb::sql::string_attribute;
Rust
pub fn string_attribute(document: &Document, key: &str, getter: &str) -> Result<Value>

A ?string getter of a document (getCreatedAt(), getUpdatedAt()): the raw value coerced to a string.

use utopia_database::adapter::mariadb::sql::tenant_value;
Rust
pub fn tenant_value(document: &Document) -> Value

$document->getTenant().

use utopia_database::adapter::mariadb::sql::value_name;
Rust
pub fn value_name(v: &Value) -> &str

How a TypeError names a value's type.

use utopia_database::adapter::mariadb::sql::violated_key;
Rust
pub fn violated_key(message: &str) -> Option<String>

The index name of a duplicate entry error (for key 'movies._uid' is _uid), or None.

Rust
pub const MAX_VARCHAR_LENGTH: i64 = 16381

Undocumented.