odbc_api/buffers.rs
1/*!
2# Using buffers to fetch results
3
4The most efficient way to query results is not to query an ODBC data source row by row, but to
5ask for a whole bulk of rows at once. The ODBC driver and driver manager will then fill these
6row sets into buffers which have been previously bound. This is also the most efficient way to
7query a single row many times across many queries, if the application can reuse the bound buffer.
8This crate allows you to provide your own buffers by implementing the [`crate::RowSetBuffer`]
9trait. However, that requires `unsafe` code.
10
11This crate also provides three implementations of the [`crate::RowSetBuffer`] trait, ready to be
12used in safe code:
13
14* [`crate::buffers::ColumnarBuffer`]: Binds to the result set column-wise. This is usually helpful
15 in data engineering or data science tasks. This buffer type can be used in situations where the
16 schema of the queried data is known at compile time, as well as for generic applications which
17 work with a wide range of different data. Check the struct documentation for examples.
18* [`crate::buffers::TextRowSet`]: Queries all data as text bound in columns. Since the columns are
19 homogeneous, you can also use this to iterate row-wise over the buffer. Excellent if you want
20 to print the contents of a table, or are for any reason only interested in the text
21 representation of the values.
22* [`crate::buffers::RowVec`]: A good choice if you know the schema at compile time and your
23 application logic is built in a row-by-row fashion, rather than column by column.
24*/
25
26mod any_buffer;
27mod bin_column;
28mod column_with_indicator;
29mod columnar;
30mod description;
31mod indicator;
32mod item;
33mod row_vec;
34mod text_column;
35
36pub use self::{
37 any_buffer::{AnyBuffer, AnySlice, AnySliceMut, ColumnarAnyBuffer},
38 bin_column::{BinColumn, BinColumnIt, BinColumnSliceMut, BinColumnView},
39 column_with_indicator::{NullableSlice, NullableSliceMut},
40 columnar::{ColumnBuffer, ColumnarBuffer, Resize, TextRowSet},
41 description::BufferDesc,
42 indicator::Indicator,
43 item::Item,
44 row_vec::{FetchRow, FetchRowMember, RowVec},
45 text_column::{
46 CharColumn, TextColumn, TextColumnIt, TextColumnSliceMut, TextColumnView, WCharColumn,
47 },
48};