Skip to content

Commit

Permalink
compile without warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pacman82 committed Nov 28, 2022
1 parent 1307101 commit 2ac343a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 36 deletions.
4 changes: 2 additions & 2 deletions odbc-api/src/buffers/any_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use super::{
},
columnar::ColumnBuffer,
text_column::TextColumnSliceMut,
BinColumn, BinColumnView, BufferDesc, CharColumn, ColumnarBuffer, Item,
NullableSlice, NullableSliceMut, TextColumn, TextColumnView, WCharColumn,
BinColumn, BinColumnView, BufferDesc, CharColumn, ColumnarBuffer, Item, NullableSlice,
NullableSliceMut, TextColumn, TextColumnView, WCharColumn,
};

#[allow(deprecated)]
Expand Down
3 changes: 1 addition & 2 deletions odbc-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ pub use self::{
columnar_bulk_inserter::{BoundInputSlice, ColumnarBulkInserter},
connection::{escape_attribute_value, Connection},
cursor::{
BlockCursor, BlockCursorPolling, Cursor, CursorImpl, CursorPolling, CursorRow,
RowSetBuffer
BlockCursor, BlockCursorPolling, Cursor, CursorImpl, CursorPolling, CursorRow, RowSetBuffer,
},
driver_complete_option::DriverCompleteOption,
environment::{DataSourceInfo, DriverInfo, Environment},
Expand Down
44 changes: 12 additions & 32 deletions odbc-api/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use common::{cursor_to_string, Profile, SingleColumnRowSetBuffer, ENV};

use odbc_api::{
buffers::{
BufferDesc, BufferDescription, BufferKind, ColumnarAnyBuffer, ColumnarBuffer, Indicator,
Item, TextColumn, TextRowSet,
BufferDesc, ColumnarAnyBuffer, ColumnarBuffer, Indicator, Item, TextColumn, TextRowSet,
},
handles::{OutputStringBuffer, Statement},
parameter::InputParameter,
Expand Down Expand Up @@ -723,9 +722,7 @@ fn columnar_insert_timestamp(profile: &Profile) {
let (conn, table) = profile.given(&table_name, &["DATETIME2"]).unwrap();

// Fill buffer with values
let desc = BufferDesc::Timestamp {
nullable: true,
};
let desc = BufferDesc::Timestamp { nullable: true };
let prepared = conn.prepare(&table.sql_insert()).unwrap();
let mut prebound = prepared.into_column_inserter(10, [desc]).unwrap();

Expand Down Expand Up @@ -778,9 +775,7 @@ fn columnar_insert_int_raw(profile: &Profile) {
let (conn, table) = profile.given(&table_name, &["INTEGER"]).unwrap();

// Fill buffer with values
let desc = BufferDesc::I32 {
nullable: true,
};
let desc = BufferDesc::I32 { nullable: true };
let prepared = conn.prepare(&table.sql_insert()).unwrap();
let mut prebound = prepared.into_column_inserter(10, [desc]).unwrap();

Expand Down Expand Up @@ -821,9 +816,7 @@ fn columnar_insert_timestamp_ms(profile: &Profile) {
.prepare(&format!("INSERT INTO {table_name} (a) VALUES (?)"))
.unwrap();
// Fill buffer with values
let desc = BufferDesc::Timestamp {
nullable: true,
};
let desc = BufferDesc::Timestamp { nullable: true };
let mut prebound = prepared.into_column_inserter(10, [desc]).unwrap();

// Input values to insert. Note that the last element has > 5 chars and is going to trigger a
Expand Down Expand Up @@ -928,7 +921,7 @@ fn columnar_insert_varchar(profile: &Profile) {
let desc = BufferDesc::Text {
// Buffer size purposefully chosen too small, so we would get a panic if `set_max_len` would
// not work.
max_str_len: 5
max_str_len: 5,
};
let mut prebound = prepared.into_column_inserter(4, [desc]).unwrap();
// Fill buffer with values
Expand Down Expand Up @@ -1032,9 +1025,7 @@ fn adaptive_columnar_insert_varchar(profile: &Profile) {
None,
Some(&b"Hello, World!"[..]),
];
let mut prebound = prepared
.into_column_inserter(input.len(), [desc])
.unwrap();
let mut prebound = prepared.into_column_inserter(input.len(), [desc]).unwrap();
prebound.set_num_rows(input.len());
let mut col_view = prebound.column_mut(0).as_text_view().unwrap();
for (index, &text) in input.iter().enumerate() {
Expand Down Expand Up @@ -1069,7 +1060,7 @@ fn adaptive_columnar_insert_varbin(profile: &Profile) {
let desc = BufferDesc::Binary {
// Buffer size purposefully chosen too small, so we need to increase the buffer size if we
// encounter larger inputs.
length: 1
length: 1,
};
// Input values to insert.
let input = [
Expand All @@ -1084,9 +1075,7 @@ fn adaptive_columnar_insert_varbin(profile: &Profile) {
let prepared = conn
.prepare(&format!("INSERT INTO {table_name} (a) VALUES (?)"))
.unwrap();
let mut prebound = prepared
.into_column_inserter(input.len(), [desc])
.unwrap();
let mut prebound = prepared.into_column_inserter(input.len(), [desc]).unwrap();
prebound.set_num_rows(input.len());
let mut writer = prebound.column_mut(0).as_bin_view().unwrap();
for (row_index, &bytes) in input.iter().enumerate() {
Expand Down Expand Up @@ -1130,13 +1119,8 @@ fn columnar_insert_wide_varchar(profile: &Profile) {
Some(U16String::from_str("Hello, World!")),
];
// Fill buffer with values
let desc = BufferDescription {
kind: BufferKind::WText { max_str_len: 20 },
nullable: true,
};
let mut prebound = prepared
.into_any_column_inserter(input.len(), [desc])
.unwrap();
let desc = BufferDesc::WText { max_str_len: 20 };
let mut prebound = prepared.into_column_inserter(input.len(), [desc]).unwrap();
prebound.set_num_rows(input.len());
let mut writer = prebound.column_mut(0).as_w_text_view().unwrap();
for (row_index, value) in input
Expand Down Expand Up @@ -3334,9 +3318,7 @@ fn grow_batch_size_during_bulk_insert(profile: &Profile) {
let mut prepared = conn
.prepare(&format!("INSERT INTO {table_name} (a) VALUES (?)"))
.unwrap();
let desc = BufferDesc::I32 {
nullable: false,
};
let desc = BufferDesc::I32 { nullable: false };
// The first batch is inserted with capacity 1
let mut prebound = prepared.column_inserter(1, [desc]).unwrap();
prebound.set_num_rows(1);
Expand Down Expand Up @@ -3377,9 +3359,7 @@ fn bulk_inserter_owning_connection(profile: &Profile) {
let mut prepared = conn
.into_prepared(&format!("INSERT INTO {table_name} (a) VALUES (?)"))
.unwrap();
let desc = BufferDesc::I32 {
nullable: false,
};
let desc = BufferDesc::I32 { nullable: false };
// Insert a batch
let mut prebound = prepared.column_inserter(1, [desc]).unwrap();
prebound.set_num_rows(1);
Expand Down

0 comments on commit 2ac343a

Please sign in to comment.