Struct odbc_api::ColumnDescription
source · pub struct ColumnDescription {
pub name: Vec<SqlChar>,
pub data_type: DataType,
pub nullability: Nullability,
}
Expand description
Describes the type and attributes of a column.
Fields§
§name: Vec<SqlChar>
Column name. May be empty if unavailable.
data_type: DataType
Type of the column
nullability: Nullability
Indicates whether the column is nullable or not.
Implementations§
source§impl ColumnDescription
impl ColumnDescription
sourcepub fn new(name: &str, data_type: DataType, nullability: Nullability) -> Self
pub fn new(name: &str, data_type: DataType, nullability: Nullability) -> Self
In production, an ‘empty’ ColumnDescription
is expected to be constructed via the
Default
trait. It is then filled using crate::ResultSetMetadata::describe_col
. When
writing test cases however it might be desirable to directly instantiate a
ColumnDescription
. This constructor enabels you to do that, without caring which type
SqlChar
resolves to.
sourcepub fn name_to_string(&self) -> Result<String, DecodeUtf16Error>
pub fn name_to_string(&self) -> Result<String, DecodeUtf16Error>
Converts the internal UTF16 representation of the column name into UTF8 and returns the
result as a String
.
sourcepub fn could_be_nullable(&self) -> bool
pub fn could_be_nullable(&self) -> bool
true
if the column is Nullable
or it is not know whether the column is nullable. false
if and only if the column is NoNulls
.
Trait Implementations§
source§impl Clone for ColumnDescription
impl Clone for ColumnDescription
source§fn clone(&self) -> ColumnDescription
fn clone(&self) -> ColumnDescription
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ColumnDescription
impl Debug for ColumnDescription
source§impl Default for ColumnDescription
impl Default for ColumnDescription
source§fn default() -> ColumnDescription
fn default() -> ColumnDescription
Returns the “default value” for a type. Read more