Expand description
A buffer large enough to hold an SOLState for diagnostics
Tuple Fields§
§0: [u8; 5]Implementations§
source§impl State
impl State
sourcepub const INVALID_STATE_TRANSACTION: State = _
pub const INVALID_STATE_TRANSACTION: State = _
Can be returned from SQLDisconnect
sourcepub const INVALID_ATTRIBUTE_VALUE: State = _
pub const INVALID_ATTRIBUTE_VALUE: State = _
Given the specified Attribute value, an invalid value was specified in ValuePtr.
sourcepub const INVALID_SQL_DATA_TYPE: State = _
pub const INVALID_SQL_DATA_TYPE: State = _
An invalid data type has been bound to a statement. Is also returned by SQLFetch if trying to fetch into a 64Bit Integer Buffer.
sourcepub const STRING_DATA_RIGHT_TRUNCATION: State = _
pub const STRING_DATA_RIGHT_TRUNCATION: State = _
String or binary data returned for a column resulted in the truncation of nonblank character or non-NULL binary data. If it was a string value, it was right-truncated.
sourcepub const INDICATOR_VARIABLE_REQUIRED_BUT_NOT_SUPPLIED: State = _
pub const INDICATOR_VARIABLE_REQUIRED_BUT_NOT_SUPPLIED: State = _
StrLen_or_IndPtr was a null pointer and NULL data was retrieved.
sourcepub fn from_chars_with_nul(code: &[SqlChar; 6]) -> Self
pub fn from_chars_with_nul(code: &[SqlChar; 6]) -> Self
Drops terminating zero and changes char type, if required
Examples found in repository?
src/handles/diagnostics.rs (line 199)
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
fn diagnostic_record(
&self,
rec_number: i16,
message_text: &mut [SqlChar],
) -> Option<DiagnosticResult> {
// Diagnostic records in ODBC are indexed starting with 1
assert!(rec_number > 0);
// The total number of characters (excluding the terminating NULL) available to return in
// `message_text`.
let mut text_length = 0;
let mut state = [0; SQLSTATE_SIZE + 1];
let mut native_error = 0;
let ret = unsafe {
sql_get_diag_rec(
self.handle_type(),
self.as_handle(),
rec_number,
state.as_mut_ptr(),
&mut native_error,
mut_buf_ptr(message_text),
clamp_small_int(message_text.len()),
&mut text_length,
)
};
let result = DiagnosticResult {
state: State::from_chars_with_nul(&state),
native_error,
text_length,
};
match ret {
SqlReturn::SUCCESS | SqlReturn::SUCCESS_WITH_INFO => Some(result),
SqlReturn::NO_DATA => None,
SqlReturn::ERROR => panic!("rec_number argument of diagnostics must be > 0."),
unexpected => panic!("SQLGetDiagRec returned: {:?}", unexpected),
}
}