odbc_sys/
indicator.rs

1//! Special indicator values
2use crate::Len;
3
4/// Indicates `NULL` values.
5pub const NULL_DATA: Len = -1;
6
7/// Indicates that the size of the value is not known. ODBC returns this value in indicator buffers
8/// for truncated values of unknown size.
9pub const NO_TOTAL: Len = -4;
10
11/// Use this as the indicator argument to `SQLBindParameter` in order to indicate that the data is
12/// send at statement execution time.
13pub const DATA_AT_EXEC: Len = -2;
14
15/// Use result as the indicator argument to `SQLBindParameter` in order to indicate that the data is
16/// send at statement execution time. In contrast to `DATA_AT_EXEC` the total size is passed to the
17/// driver manager.
18pub fn len_data_at_exec(length: Len) -> Len {
19    const SQL_LEN_DATA_AT_EXEC_OFFSET: Len = -100;
20
21    (-length).checked_add(SQL_LEN_DATA_AT_EXEC_OFFSET).unwrap()
22}