pdo
ModuleThe adapter writes SQL with named placeholders (:_uid) and binds values
with a PDO parameter type. PDO (ATTR_EMULATE_PREPARES) substitutes the
placeholders client side with quoted literals and sends the statement as
plain text with PQexec; with ATTR_STRINGIFY_FETCHES every fetched
value is a string. Pdo reproduces that, so the server sees the same
text and the adapter reads the same values:
Contents
use utopia_database::adapter::postgres::pdo::Executed;pub struct ExecutedA statement's result: what execute() returned, the rows and the row count.
use utopia_database::adapter::postgres::pdo::Pdo;pub struct PdoThe PDO handle: one connection.
use utopia_database::adapter::postgres::pdo::PdoError;pub struct PdoErrorA driver error (PDOException): its SQLSTATE, the driver's native code
(errorInfo[1], 7 for server errors) and its message.
use utopia_database::adapter::postgres::pdo::Statement;pub struct StatementA prepared statement: SQL with named placeholders and bound values.
use utopia_database::adapter::postgres::pdo::ParamType;pub enum ParamTypeA PDO parameter type (PDO::PARAM_*).
use utopia_database::adapter::postgres::pdo::PdoFailure;pub enum PdoFailureA failed execute(): a driver error, or another exception (a value
that cannot be converted to a string).
From.use utopia_database::adapter::postgres::pdo::Rendering;pub enum RenderingWhy a statement could not be rendered.
use utopia_database::adapter::postgres::pdo::error_of;pub fn error_of(outcome: &Outcome, query: &[u8]) -> PdoErrorThe PDOException of a failed result (pdo_pgsql_error then
pdo_handle_error).
use utopia_database::adapter::postgres::pdo::fetch;pub fn fetch(oid: u32, value: Option<&Bytes>) -> ValueOne fetched value (pgsql_stmt_get_col, then PDO's stringify).
use utopia_database::adapter::postgres::pdo::libpq_message;pub fn libpq_message(outcome: &Outcome, query: &[u8]) -> StringThe libpq message of an error result (PQresultErrorMessage), as
pqBuildErrorMessage3 writes it with the default verbosity, for the
query query it answered.
use utopia_database::adapter::postgres::pdo::quote;pub fn quote(s: &[u8]) -> Option<Vec<u8>>$pdo->quote($string) (PQescapeStringConn in quotes): None when the
string, up to its first NUL, is not valid UTF-8.
use utopia_database::adapter::postgres::pdo::rows;pub fn rows(outcome: &Outcome) -> Vec<Array>The rows of a result as fetchAll(PDO::FETCH_ASSOC) returns them with
ATTR_STRINGIFY_FETCHES.
use utopia_database::adapter::postgres::pdo::to_long;pub fn to_long(value: &Value) -> i64Undocumented.