Struct libpq::result::Result

source ·
pub struct Result { /* private fields */ }

Implementations§

source§

impl Result

source

pub fn new(conn: &Connection, status: Status) -> Self

Constructs an empty Result object with the given status.

See PQmakeEmptyPGresult.

source

pub fn status(&self) -> Status

Returns the result status of the command.

See PQresultStatus.

source

pub fn error_message(&self) -> Result<Option<String>>

Returns the error message associated with the command, or an empty string if there was no error.

See PQresultErrorMessage.

source

pub fn error_field(&self, field: ErrorField) -> Result<Option<&'static str>>

Returns a reformatted version of the error message associated with a libpq::Result object.

See PQresultErrorField.

source

pub fn ntuples(&self) -> usize

Returns the number of rows (tuples) in the query result.

See PQntuples.

source

pub fn nfields(&self) -> usize

Returns the number of columns (fields) in each row of the query result.

See PQnfields.

source

pub fn field_name(&self, number: usize) -> Result<Option<String>>

Returns the column name associated with the given column number.

See PQfname.

source

pub fn field_number(&self, name: &str) -> Option<usize>

Returns the column number associated with the given column name.

See PQfnumber.

source

pub fn field_table(&self, column: usize) -> Option<Oid>

Returns the OID of the table from which the given column was fetched.

See PQftable.

source

pub fn field_tablecol(&self, column: usize) -> usize

Returns the column number (within its table) of the column making up the specified query result column.

See PQftablecol.

source

pub fn field_format(&self, column: usize) -> Format

Returns the format code indicating the format of the given column.

See PQfformat.

source

pub fn field_type(&self, column: usize) -> Oid

Returns the data type associated with the given column number.

See PQftype.

source

pub fn field_mod(&self, column: usize) -> Option<i32>

Returns the type modifier of the column associated with the given column number.

See PQfmod.

source

pub fn field_size(&self, column: usize) -> Option<usize>

Returns the size in bytes of the column associated with the given column number.

None indicates the data type is variable-length.

See PQfsize.

source

pub fn binary_tuples(&self) -> bool

Returns true if the Result contains binary data and false if it contains text data.

See PQbinaryTuples.

source

pub fn value(&self, row: usize, column: usize) -> Option<&[u8]>

Returns a single field value of one row of a Result.

See PQgetvalue.

source

pub fn is_null(&self, row: usize, column: usize) -> bool

Tests a field for a null value.

See PQgetisnull.

source

pub fn length(&self, row: usize, column: usize) -> usize

Returns the actual length of a field value in bytes.

See PQgetlength.

source

pub fn nparams(&self) -> usize

Returns the number of parameters of a prepared statement.

See PQnparams.

source

pub fn param_type(&self, param: usize) -> Option<Oid>

Returns the data type of the indicated statement parameter.

See PQparamtype.

source

pub fn print(&self, output: &dyn AsRawFd, option: &Options)

Prints out all the rows and, optionally, the column names to the specified output stream.

See PQprint.

source

pub fn cmd_status(&self) -> Result<Option<String>>

Returns the command status tag from the SQL command that generated the Result.

See PQcmdStatus.

source

pub fn cmd_tuples(&self) -> Result<usize>

Returns the number of rows affected by the SQL command.

See PQcmdTuples.

source

pub fn oid_value(&self) -> Option<Oid>

Returns the OID of the inserted row.

See PQoidValue.

source

pub fn oid_status(&self) -> Result<Option<String>>

👎Deprecated: This function is deprecated in favor of libpq::Result::oid_value and is not thread-safe.
source

pub fn copy(&self, flags: i32) -> Result<Self>

Makes a copy of a Result object.

See PQcopyResult.

source

pub fn set_attrs(&mut self, attributes: &[&Attribute]) -> Result

Sets the attributes of a PGresult object.

See PQsetResultAttrs.

source

pub fn set_value( &mut self, tuple: usize, field: usize, value: Option<&str> ) -> Result

Sets a tuple field value of a Result object.

See PQsetvalue.

source

pub unsafe fn alloc(&mut self, nbytes: usize) -> Result<*mut c_void>

Allocate subsidiary storage for a Result object.

See PQresultAlloc.

Safety

This function return a void* pointer.

source

pub fn display_tuples( &self, file: File, fill_align: bool, field_sep: Option<&str>, print_header: bool, quiet: bool )

Really old printing routines.

Trait Implementations§

source§

impl Clone for Result

source§

fn clone(&self) -> Result

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Result

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for Result

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Send for Result

source§

impl Sync for Result

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.