Skip to main content

SqlError

Enum SqlError 

Source
pub enum SqlError {
    Parse {
        line: usize,
        col: usize,
        msg: String,
    },
    UnknownTable(String),
    UnknownColumn {
        table: String,
        column: String,
    },
    AmbiguousColumn(String),
    TypeMismatch {
        column: String,
        expected: CandidDataTypeKind,
        got: String,
    },
    InvalidLiteral {
        column: String,
        expected: CandidDataTypeKind,
        reason: String,
    },
    MissingWhereClause,
    ParameterCountMismatch {
        expected: usize,
        got: usize,
    },
    TransactionAlreadyActive,
    NoActiveTransaction,
    Unsupported(String),
    Runtime(DbmsError),
}
Available on crate feature sql only.
Expand description

Errors returned while parsing, planning, or executing a SQL statement.

Variants§

§

Parse

The statement is not valid SQL for the supported grammar.

line and col are 1-based and point at the offending token.

Fields

§line: usize
§col: usize
§

UnknownTable(String)

The statement references a table, or a table qualifier, that does not exist.

§

UnknownColumn

The statement references a column that does not exist on table.

Fields

§table: String
§column: String
§

AmbiguousColumn(String)

An unqualified column name exists on more than one table of a join.

§

TypeMismatch

A literal or parameter has a type that cannot be used for column.

got is the kind of the offending literal (Integer, Float, String, Boolean) or the type name of the bound parameter.

Fields

§column: String
§

InvalidLiteral

A literal or parameter has the right kind but a value that column cannot hold, such as an out-of-range integer or a malformed date.

Fields

§column: String
§reason: String
§

MissingWhereClause

An UPDATE or DELETE statement has no WHERE clause.

§

ParameterCountMismatch

The number of bound parameters differs from the number of ? placeholders.

Fields

§expected: usize
§got: usize
§

TransactionAlreadyActive

BEGIN was issued together with a transaction ID.

§

NoActiveTransaction

COMMIT or ROLLBACK was issued without a transaction ID.

§

Unsupported(String)

The statement is valid SQL but uses a combination the engine cannot execute.

§

Runtime(DbmsError)

The DBMS rejected the statement while executing it.

Trait Implementations§

Source§

impl CandidType for SqlError

Source§

fn _ty() -> Type

Source§

fn _ty_doc() -> TypeDoc

Source§

fn id() -> TypeId

Source§

fn idl_serialize<__S>( &self, __serializer: __S, ) -> Result<(), <__S as Serializer>::Error>
where __S: Serializer,

Source§

fn ty() -> Type

Source§

impl Debug for SqlError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for SqlError

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<SqlError, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for SqlError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Error for SqlError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<DbmsError> for SqlError

Source§

fn from(source: DbmsError) -> SqlError

Converts to this type from the input type.
Source§

impl From<SqlError> for IcDbmsError

Source§

fn from(source: SqlError) -> Self

Converts to this type from the input type.
Source§

impl Serialize for SqlError

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CustomError for T
where T: Display + Debug + Send + Sync + 'static,

Source§

fn as_any(&self) -> &(dyn Any + Sync + Send + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + Sync + Send + 'static)

Source§

fn as_box_any(self: Box<T>) -> Box<dyn Any + Sync + Send>

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.