Skip to content

Commit e85dbe6

Browse files
committed
add DATA_AT_EXEC
1 parent cf22bab commit e85dbe6

File tree

5 files changed

+48
-10
lines changed

5 files changed

+48
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "odbc-sys"
3-
version = "0.18.0"
3+
version = "0.18.1"
44
authors = ["Markus Klein <[email protected]>"]
55
license = "MIT"
66
description = "ODBC ffi bindings"

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
0.18.1
5+
------
6+
7+
* Add `DATA_AT_EXEC`
8+
* Add `fn len_data_at_exec`
9+
410
0.18.0
511
------
612

src/functions.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@ use crate::{
77

88
// static linking is not currently supported here for windows
99
#[cfg_attr(windows, link(name = "odbc32"))]
10-
#[cfg_attr(all(not(windows), not(feature = "static"), not(feature = "iodbc")), link(name = "odbc"))]
11-
#[cfg_attr(all(not(windows), feature = "static", not(feature = "iodbc")), link(name = "odbc", kind = "static"))]
12-
#[cfg_attr(all(not(windows), not(feature = "static"), feature = "iodbc"), link(name = "iodbc"))]
13-
#[cfg_attr(all(not(windows), feature = "static", feature = "iodbc"), link(name = "iodbc", kind = "static"))]
10+
#[cfg_attr(
11+
all(not(windows), not(feature = "static"), not(feature = "iodbc")),
12+
link(name = "odbc")
13+
)]
14+
#[cfg_attr(
15+
all(not(windows), feature = "static", not(feature = "iodbc")),
16+
link(name = "odbc", kind = "static")
17+
)]
18+
#[cfg_attr(
19+
all(not(windows), not(feature = "static"), feature = "iodbc"),
20+
link(name = "iodbc")
21+
)]
22+
#[cfg_attr(
23+
all(not(windows), feature = "static", feature = "iodbc"),
24+
link(name = "iodbc", kind = "static")
25+
)]
1426
extern "system" {
1527
/// Allocates an environment, connection, statement, or descriptor handle.
1628
///

src/indicator.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//! Special indicator values
2+
use crate::Len;
3+
4+
/// Indicates `NULL` values.
5+
pub 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.
9+
pub 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.
13+
pub 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.
18+
pub fn len_data_at_exec(length: Len) -> Len {
19+
const SQL_LEN_DATA_AT_EXEC_OFFSET: Len = -100;
20+
21+
-(length) + SQL_LEN_DATA_AT_EXEC_OFFSET
22+
}

src/lib.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
1111
pub use self::{
1212
attributes::*, bulk_operation::*, c_data_type::*, desc::*, fetch_orientation::*, functions::*,
13-
info_type::*, interval::*, nullability::*, param_type::*, sql_data_type::*, sqlreturn::*,
13+
indicator::*, info_type::*, interval::*, nullability::*, param_type::*, sql_data_type::*,
14+
sqlreturn::*,
1415
};
1516
use std::os::raw::{c_int, c_void};
1617

@@ -20,6 +21,7 @@ mod c_data_type;
2021
mod desc;
2122
mod fetch_orientation;
2223
mod functions;
24+
mod indicator;
2325
mod info_type;
2426
mod interval;
2527
mod nullability;
@@ -72,10 +74,6 @@ pub const MAX_MESSAGE_LENGTH: SmallInt = 512;
7274
pub const SQLSTATE_SIZE: usize = 5;
7375
pub const SQLSTATE_SIZEW: usize = 10;
7476

75-
// Special SQLGetData indicator values
76-
pub const NULL_DATA: Len = -1;
77-
pub const NO_TOTAL: Len = -4;
78-
7977
/// SQL Free Statement options
8078
#[repr(u16)]
8179
#[derive(Debug, PartialEq, Eq, Clone, Copy)]

0 commit comments

Comments
 (0)