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
The function returned an error state. Check diagnostics.
Implementations§
source§impl SqlResult<()>
impl SqlResult<()>
sourcepub fn into_result_bool(self, handle: &impl Diagnostics) -> Result<bool, Error>
pub fn into_result_bool(self, handle: &impl Diagnostics) -> Result<bool, Error>
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).
source§impl<T> SqlResult<T>
impl<T> SqlResult<T>
sourcepub fn into_result(self, handle: &impl Diagnostics) -> Result<T, Error>
pub fn into_result(self, handle: &impl Diagnostics) -> Result<T, Error>
Self::Success and Self::SuccessWithInfo are mapped to Ok. In case of
Self::SuccessWithInfo any diagnostics are logged. Self::Error is mapped to error.
sourcepub fn into_result_option(
self,
handle: &impl Diagnostics
) -> Result<Option<T>, Error>
pub fn into_result_option( self, handle: &impl Diagnostics ) -> Result<Option<T>, Error>
Like Self::into_result, but SqlResult::NoData is mapped to None, and any success
is mapped to Some.
sourcepub fn into_result_with(
self,
handle: &impl Diagnostics,
no_data: Option<T>,
need_data: Option<T>
) -> Result<T, Error>
pub fn into_result_with( self, handle: &impl Diagnostics, no_data: Option<T>, need_data: Option<T> ) -> Result<T, Error>
Most flexible way of converting an SqlResult to an idiomatic Result.
Parameters
handle: This handle is used to extract diagnostics in caseselfisSqlResult::SuccessWithInfoorSqlResult::Error.error_for_truncation: Intended to be used to be used after bulk fetching into a buffer. Iferror_for_truncationistrueany diagnostics are inspected for truncation. If any truncation is found an error is returned.no_data: Controls the behaviour forSqlResult::NoData.Noneindicates that the result is never expected to beSqlResult::NoDataand would panic in that case.Some(value)would causeSqlResult::NoDatato be mapped toOk(value).need_data: Controls the behaviour forSqlResult::NeedData.Noneindicates that the result is never expected to beSqlResult::NeedDataand would panic in that case.Some(value)would causeSqlResult::NeedDatato be mapped toOk(value).