pub struct Result { /* private fields */ }
Implementations§
source§impl Result
impl Result
sourcepub fn new(conn: &Connection, status: Status) -> Self
pub fn new(conn: &Connection, status: Status) -> Self
Constructs an empty Result
object with the given status.
See PQmakeEmptyPGresult.
sourcepub fn status(&self) -> Status
pub fn status(&self) -> Status
Returns the result status of the command.
See PQresultStatus.
sourcepub fn error_message(&self) -> Result<Option<String>>
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.
sourcepub fn error_field(&self, field: ErrorField) -> Result<Option<&'static str>>
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.
sourcepub fn ntuples(&self) -> usize
pub fn ntuples(&self) -> usize
Returns the number of rows (tuples) in the query result.
See PQntuples.
sourcepub fn nfields(&self) -> usize
pub fn nfields(&self) -> usize
Returns the number of columns (fields) in each row of the query result.
See PQnfields.
sourcepub fn field_name(&self, number: usize) -> Result<Option<String>>
pub fn field_name(&self, number: usize) -> Result<Option<String>>
Returns the column name associated with the given column number.
See PQfname.
sourcepub fn field_number(&self, name: &str) -> Option<usize>
pub fn field_number(&self, name: &str) -> Option<usize>
Returns the column number associated with the given column name.
See PQfnumber.
sourcepub fn field_table(&self, column: usize) -> Option<Oid>
pub fn field_table(&self, column: usize) -> Option<Oid>
Returns the OID of the table from which the given column was fetched.
See PQftable.
sourcepub fn field_tablecol(&self, column: usize) -> usize
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.
sourcepub fn field_format(&self, column: usize) -> Format
pub fn field_format(&self, column: usize) -> Format
Returns the format code indicating the format of the given column.
See PQfformat.
sourcepub fn field_type(&self, column: usize) -> Oid
pub fn field_type(&self, column: usize) -> Oid
Returns the data type associated with the given column number.
See PQftype.
sourcepub fn field_mod(&self, column: usize) -> Option<i32>
pub fn field_mod(&self, column: usize) -> Option<i32>
Returns the type modifier of the column associated with the given column number.
See PQfmod.
sourcepub fn field_size(&self, column: usize) -> Option<usize>
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.
sourcepub fn binary_tuples(&self) -> bool
pub fn binary_tuples(&self) -> bool
Returns true
if the Result
contains binary data and false
if it contains text data.
See PQbinaryTuples.
sourcepub fn value(&self, row: usize, column: usize) -> Option<&[u8]>
pub fn value(&self, row: usize, column: usize) -> Option<&[u8]>
Returns a single field value of one row of a Result
.
See PQgetvalue.
sourcepub fn is_null(&self, row: usize, column: usize) -> bool
pub fn is_null(&self, row: usize, column: usize) -> bool
Tests a field for a null value.
See PQgetisnull.
sourcepub fn length(&self, row: usize, column: usize) -> usize
pub fn length(&self, row: usize, column: usize) -> usize
Returns the actual length of a field value in bytes.
See PQgetlength.
sourcepub fn nparams(&self) -> usize
pub fn nparams(&self) -> usize
Returns the number of parameters of a prepared statement.
See PQnparams.
sourcepub fn param_type(&self, param: usize) -> Option<Oid>
pub fn param_type(&self, param: usize) -> Option<Oid>
Returns the data type of the indicated statement parameter.
See PQparamtype.
sourcepub fn print(&self, output: &dyn AsRawFd, option: &Options)
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.
sourcepub fn cmd_status(&self) -> Result<Option<String>>
pub fn cmd_status(&self) -> Result<Option<String>>
Returns the command status tag from the SQL command that generated the Result
.
See PQcmdStatus.
sourcepub fn cmd_tuples(&self) -> Result<usize>
pub fn cmd_tuples(&self) -> Result<usize>
Returns the number of rows affected by the SQL command.
See PQcmdTuples.
sourcepub fn oid_value(&self) -> Option<Oid>
pub fn oid_value(&self) -> Option<Oid>
Returns the OID of the inserted row.
See PQoidValue.
sourcepub fn oid_status(&self) -> Result<Option<String>>
👎Deprecated: This function is deprecated in favor of libpq::Result::oid_value
and is not thread-safe.
pub fn oid_status(&self) -> Result<Option<String>>
libpq::Result::oid_value
and is not thread-safe.See PQoidStatus.
sourcepub fn copy(&self, flags: i32) -> Result<Self>
pub fn copy(&self, flags: i32) -> Result<Self>
Makes a copy of a Result
object.
See PQcopyResult.
sourcepub fn set_attrs(&mut self, attributes: &[&Attribute]) -> Result
pub fn set_attrs(&mut self, attributes: &[&Attribute]) -> Result
Sets the attributes of a PGresult object.
See PQsetResultAttrs.
sourcepub fn set_value(
&mut self,
tuple: usize,
field: usize,
value: Option<&str>
) -> Result
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.