Lightweight 0.20261105.1
Loading...
Searching...
No Matches
RawColumnSlice.hpp
1// SPDX-License-Identifier: Apache-2.0
2#pragma once
3
4#include "../Api.hpp"
5#include "../DataBinder/SqlRawColumn.hpp"
6
7#include <cstddef>
8#include <string>
9
10namespace Lightweight::detail
11{
12
13/// Returns a view of @p rowCount consecutive rows of @p column, starting at @p firstRow.
14///
15/// The result shares the buffers of @p column (it owns nothing) and carries a copy of its metadata, so
16/// it can be bound and executed like the full column. Every row occupies `metadata.bufferLength` bytes
17/// in `data`, which is what makes the sub-range addressable by row.
18///
19/// @param column The column to slice; it must outlive the result.
20/// @param firstRow Zero-based index of the first row of the slice.
21/// @param rowCount Number of rows in the slice.
22/// @return The slice. Precondition: `firstRow + rowCount` does not exceed the rows of @p column.
23[[nodiscard]] LIGHTWEIGHT_API SqlRawColumn SliceRows(SqlRawColumn const& column, std::size_t firstRow, std::size_t rowCount);
24
25/// Renders one cell of @p column as text, for naming a row in a failure report.
26///
27/// NULL renders as `NULL`; character data as is; wide character data as UTF-8; integer, bit and floating
28/// point values in decimal; a GUID in its canonical text; date, time and timestamp values in ISO form;
29/// binary data as `0x` followed by upper-case hex, cut after 32 bytes and marked with an ellipsis.
30///
31/// @param column The column holding the cell.
32/// @param row Zero-based row index within @p column.
33/// @return The text of the cell.
34[[nodiscard]] LIGHTWEIGHT_API std::string DescribeRawCell(SqlRawColumn const& column, std::size_t row);
35
36} // namespace Lightweight::detail