pub trait ResultSetMetadata: AsStatementRef {
// Provided methods
fn describe_col(
&mut self,
column_number: u16,
column_description: &mut ColumnDescription,
) -> Result<(), Error> { ... }
fn num_result_cols(&mut self) -> Result<i16, Error> { ... }
fn column_is_unsigned(&mut self, column_number: u16) -> Result<bool, Error> { ... }
fn col_octet_length(
&mut self,
column_number: u16,
) -> Result<Option<NonZeroUsize>, Error> { ... }
fn col_display_size(
&mut self,
column_number: u16,
) -> Result<Option<NonZeroUsize>, Error> { ... }
fn col_precision(&mut self, column_number: u16) -> Result<isize, Error> { ... }
fn col_scale(&mut self, column_number: u16) -> Result<isize, Error> { ... }
fn col_name(&mut self, column_number: u16) -> Result<String, Error> { ... }
fn column_names(&mut self) -> Result<ColumnNamesIt<'_, Self>, Error> { ... }
fn col_data_type(&mut self, column_number: u16) -> Result<DataType, Error> { ... }
}
Expand description
Provides Metadata of the resulting the result set. Implemented by Cursor
types and prepared
queries. Fetching metadata from a prepared query might be expensive (driver dependent), so your
application should fetch the Metadata it requires from the Cursor
if possible.
See also: https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/result-set-metadata
Provided Methods§
Sourcefn describe_col(
&mut self,
column_number: u16,
column_description: &mut ColumnDescription,
) -> Result<(), Error>
fn describe_col( &mut self, column_number: u16, column_description: &mut ColumnDescription, ) -> Result<(), Error>
Fetch a column description using the column index.
§Parameters
column_number
: Column index.0
is the bookmark column. The other column indices start with1
.column_description
: Holds the description of the column after the call. This method does not provide strong exception safety as the value of this argument is undefined in case of an error.
Sourcefn num_result_cols(&mut self) -> Result<i16, Error>
fn num_result_cols(&mut self) -> Result<i16, Error>
Number of columns in result set. Can also be used to see whether executing a prepared
Statement (crate::Prepared
) would yield a result set, as this would return 0
if it
does not.
See also: https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlnumresultcols-function
Sourcefn column_is_unsigned(&mut self, column_number: u16) -> Result<bool, Error>
fn column_is_unsigned(&mut self, column_number: u16) -> Result<bool, Error>
true
if a given column in a result set is unsigned or not a numeric type, false
otherwise.
column_number
: Index of the column, starting at 1.
Sourcefn col_octet_length(
&mut self,
column_number: u16,
) -> Result<Option<NonZeroUsize>, Error>
fn col_octet_length( &mut self, column_number: u16, ) -> Result<Option<NonZeroUsize>, Error>
Size in bytes of the columns. For variable sized types this is the maximum size, excluding a terminating zero.
column_number
: Index of the column, starting at 1.
Sourcefn col_display_size(
&mut self,
column_number: u16,
) -> Result<Option<NonZeroUsize>, Error>
fn col_display_size( &mut self, column_number: u16, ) -> Result<Option<NonZeroUsize>, Error>
Maximum number of characters required to display data from the column. If the driver is
unable to provide a maximum None
is returned.
column_number
: Index of the column, starting at 1.
Sourcefn col_precision(&mut self, column_number: u16) -> Result<isize, Error>
fn col_precision(&mut self, column_number: u16) -> Result<isize, Error>
Precision of the column.
Denotes the applicable precision. For data types SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, and all the interval data types that represent a time interval, its value is the applicable precision of the fractional seconds component.
Sourcefn col_scale(&mut self, column_number: u16) -> Result<isize, Error>
fn col_scale(&mut self, column_number: u16) -> Result<isize, Error>
The applicable scale for a numeric data type. For DECIMAL and NUMERIC data types, this is the defined scale. It is undefined for all other data types.
Sourcefn col_name(&mut self, column_number: u16) -> Result<String, Error>
fn col_name(&mut self, column_number: u16) -> Result<String, Error>
The column alias, if it applies. If the column alias does not apply, the column name is returned. If there is no column name or a column alias, an empty string is returned.
Sourcefn column_names(&mut self) -> Result<ColumnNamesIt<'_, Self>, Error>
fn column_names(&mut self) -> Result<ColumnNamesIt<'_, Self>, Error>
Use this if you want to iterate over all column names and allocate a String
for each one.
This is a wrapper around col_name
introduced for convenience.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.