odbc_api::handles

Trait Diagnostics

Source
pub trait Diagnostics {
    // Required method
    fn diagnostic_record(
        &self,
        rec_number: i16,
        message_text: &mut [SqlChar],
    ) -> Option<DiagnosticResult>;

    // Provided method
    fn diagnostic_record_vec(
        &self,
        rec_number: i16,
        message_text: &mut Vec<SqlChar>,
    ) -> Option<DiagnosticResult> { ... }
}
Expand description

Report diagnostics from the last call to an ODBC function using a handle.

Required Methods§

Source

fn diagnostic_record( &self, rec_number: i16, message_text: &mut [SqlChar], ) -> Option<DiagnosticResult>

Call this method to retrieve diagnostic information for the last call to an ODBC function.

Returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information

See: Diagnostic Messages

§Arguments
  • rec_number - Indicates the status record from which the application seeks information. Status records are numbered from 1. Function panics for values smaller < 1.
  • message_text - Buffer in which to return the diagnostic message text string. If the number of characters to return is greater than the buffer length, the message is truncated. To determine that a truncation occurred, the application must compare the buffer length to the actual number of bytes available, which is found in [self::DiagnosticResult::text_length]
§Result
  • Some(rec) - The function successfully returned diagnostic information. message. No diagnostic records were generated.
  • None - rec_number was greater than the number of diagnostic records that existed for the specified Handle. The function also returns NoData for any positive rec_number if there are no diagnostic records available.

Provided Methods§

Source

fn diagnostic_record_vec( &self, rec_number: i16, message_text: &mut Vec<SqlChar>, ) -> Option<DiagnosticResult>

Call this method to retrieve diagnostic information for the last call to an ODBC function. This method builds on top of Self::diagnostic_record, if the message does not fit in the buffer, it will grow the message buffer and extract it again.

See: Diagnostic Messages

§Arguments
  • rec_number - Indicates the status record from which the application seeks information. Status records are numbered from 1. Function panics for values smaller < 1.
  • message_text - Buffer in which to return the diagnostic message text string. If the number of characters to return is greater than the buffer length, the buffer will be grown to be large enough to hold it.
§Result
  • Some(rec) - The function successfully returned diagnostic information. message. No diagnostic records were generated. To determine that a truncation occurred, the application must compare the buffer length to the actual number of bytes available, which is found in [self::DiagnosticResult::text_length].
  • None - rec_number was greater than the number of diagnostic records that existed for the specified Handle. The function also returns NoData for any positive rec_number if there are no diagnostic records available.

Implementors§