pub enum ColumnFailure {
    ZeroSizedColumn {
        sql_type: OdbcDataType,
    },
    UnknownStringLength {
        sql_type: OdbcDataType,
        source: Error,
    },
    UnsupportedArrowType(ArrowDataType),
    FailedToDescribeColumn(Error),
    TooLarge {
        num_elements: usize,
        element_size: usize,
    },
}
Expand description

Read error related to a specific column

Variants§

§

ZeroSizedColumn

Fields

§sql_type: OdbcDataType

We are getting a display or column size from ODBC but it is not larger than 0.

§

UnknownStringLength

Fields

§sql_type: OdbcDataType
§source: Error

Unable to retrieve the column display size for the column.

§

UnsupportedArrowType(ArrowDataType)

The type specified in the arrow schema is not supported to be fetched from the database.

§

FailedToDescribeColumn(Error)

At ODBC api calls gaining information about the columns did fail.

§

TooLarge

Fields

§num_elements: usize
§element_size: usize

Implementations§

Provides the error with additional context of Error with column name and index.

Examples found in repository?
src/odbc_reader.rs (line 162)
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
    pub fn with(
        mut cursor: C,
        max_batch_size: usize,
        schema: Option<SchemaRef>,
        buffer_allocation_options: BufferAllocationOptions,
    ) -> Result<Self, Error> {
        // Infer schema if not given by the user
        let schema = if let Some(schema) = schema {
            schema
        } else {
            Arc::new(arrow_schema_from(&mut cursor)?)
        };

        let column_strategies: Vec<Box<dyn ReadStrategy>> = schema
            .fields()
            .iter()
            .enumerate()
            .map(|(index, field)| {
                let col_index = (index + 1).try_into().unwrap();
                choose_column_strategy(field, &mut cursor, col_index, buffer_allocation_options)
                    .map_err(|cause| cause.into_crate_error(field.name().clone(), index))
            })
            .collect::<Result<_, _>>()?;

        let descs = column_strategies.iter().map(|cs| cs.buffer_desc());

        let row_set_buffer = if buffer_allocation_options.fallibale_allocations {
            ColumnarAnyBuffer::try_from_descs(max_batch_size, descs)
                .map_err(|err| map_allocation_error(err, &schema))?
        } else {
            ColumnarAnyBuffer::from_descs(max_batch_size, descs)
        };
        let cursor = cursor.bind_buffer(row_set_buffer).unwrap();

        Ok(Self {
            column_strategies,
            schema,
            cursor,
        })
    }

Trait Implementations§

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
The lower-level source of this error, if any. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.