Skip to content

Commit

Permalink
has_truncated_values -> find_truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
pacman82 committed Sep 27, 2023
1 parent dee4fb6 commit 7456856
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion odbc-api/src/buffers/columnar.rs
Expand Up @@ -104,7 +104,7 @@ where
Ok(())
}

fn has_truncated_values(&self) -> Option<Indicator> {
fn find_truncation(&self) -> Option<Indicator> {
self.columns
.iter()
.find_map(|col_buffer| col_buffer.1.has_truncated_values(*self.num_rows))
Expand Down
8 changes: 4 additions & 4 deletions odbc-api/src/cursor.rs
Expand Up @@ -390,7 +390,7 @@ pub unsafe trait RowSetBuffer {
unsafe fn bind_colmuns_to_cursor(&mut self, cursor: StatementRef<'_>) -> Result<(), Error>;

/// Find an indicator larger than the maximum element size of the buffer.
fn has_truncated_values(&self) -> Option<Indicator>;
fn find_truncation(&self) -> Option<Indicator>;
}

unsafe impl<T: RowSetBuffer> RowSetBuffer for &mut T {
Expand All @@ -410,8 +410,8 @@ unsafe impl<T: RowSetBuffer> RowSetBuffer for &mut T {
(*self).bind_colmuns_to_cursor(cursor)
}

fn has_truncated_values(&self) -> Option<Indicator> {
(**self).has_truncated_values()
fn find_truncation(&self) -> Option<Indicator> {
(**self).find_truncation()
}
}

Expand Down Expand Up @@ -722,7 +722,7 @@ fn error_handling_for_fetch(
// while we are limited in the amount we can check. The second check serves as an optimization
// for the happy path.
if error_for_truncation && result == SqlResult::SuccessWithInfo(()) {
if let Some(indicator) = buffer.has_truncated_values() {
if let Some(indicator) = buffer.find_truncation() {
return Err(Error::TooLargeValueForBuffer { indicator });
}
}
Expand Down
2 changes: 1 addition & 1 deletion odbc-api/tests/common.rs
Expand Up @@ -209,7 +209,7 @@ where
Ok(())
}

fn has_truncated_values(&self) -> Option<Indicator> {
fn find_truncation(&self) -> Option<Indicator> {
unimplemented!()
}
}

0 comments on commit 7456856

Please sign in to comment.