use thiserror::Error;
use crate::reader::ColumnFailure;
#[derive(Error, Debug)]
pub enum Error {
#[error("Unable to retrieve number of columns in result set.\n{0}")]
UnableToRetrieveNumCols(odbc_api::Error),
#[error(
"There is a problem with the SQL type of the column with name: {} and index {}:\n{source}",
name,
index
)]
ColumnFailure {
name: String,
index: usize,
source: ColumnFailure,
},
#[error(
"The Odbc buffer is limited to a size of {max_bytes_per_batch} bytes. Yet a single row \
does require up to {bytes_per_row}. This means the buffer is not large enough to hold a \
single row of data. Please note that the buffers in ODBC must always be able to hold the \
largest possible value of variadic types. You should either set a higher upper bound for \
the buffer size, or limit the length of the variadic columns."
)]
OdbcBufferTooSmall {
max_bytes_per_batch: usize,
bytes_per_row: usize,
},
}