pub enum SqlResult<T> {
    Success(T),
    SuccessWithInfo(T),
    NoData,
    NeedData,
    StillExecuting,
    Error {
        function: &'static str,
    },
}
Expand description

Result of an ODBC function call. Variants hold the same meaning as the constants associated with SqlReturn. This type may hold results, but it is still the responsibility of the user to fetch and handle the diagnostics in case of an Error.

Variants§

§

Success(T)

The function has been executed successfully.

§

SuccessWithInfo(T)

The function has been executed successfully. There have been warnings.

§

NoData

Meaning depends on the function emitting NoData.

§

NeedData

Emmitted by execute in case delayed parameters have been bound and their input values are now required.

§

StillExecuting

The function was started asynchronously and is still executing.

§

Error

Fields

§function: &'static str

Name of the ODBC Api call which caused the error. This might help interpreting associatedif the error ODBC diagnostics if the error is bubbeld all the way up to the end users output, but the context is lost.

The function returned an error state. Check diagnostics.

Implementations§

Use this instead of Self::into_result if you expect SqlResult::NoData to be a valid value. SqlResult::NoData is mapped to Ok(false), all other success values are Ok(true).

Self::Success and Self::SuccessWithInfo are mapped to Ok. In case of Self::SuccessWithInfo any diagnostics are logged. Self::Error is mapped to error.

Like Self::into_result, but SqlResult::NoData is mapped to None, and any success is mapped to Some.

Most flexible way of converting an SqlResult to an idiomatic Result.

Parameters
  • handle: This handle is used to extract diagnostics in case self is SqlResult::SuccessWithInfo or SqlResult::Error.
  • error_for_truncation: Intended to be used to be used after bulk fetching into a buffer. If error_for_truncation is true any diagnostics are inspected for truncation. If any truncation is found an error is returned.
  • no_data: Controls the behaviour for SqlResult::NoData. None indicates that the result is never expected to be SqlResult::NoData and would panic in that case. Some(value) would cause SqlResult::NoData to be mapped to Ok(value).
  • need_data: Controls the behaviour for SqlResult::NeedData. None indicates that the result is never expected to be SqlResult::NeedData and would panic in that case. Some(value) would cause SqlResult::NeedData to be mapped to Ok(value).

Append a return value a successful to Result

True if variant is SqlResult::Error.

Applies f to any value wrapped in Success or SuccessWithInfo.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. 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.