odbc_sys/
sql_data_type.rs

1#[repr(C)]
2#[derive(Debug, PartialEq, Eq, Clone, Copy)]
3pub struct SqlDataType(pub i16);
4
5impl SqlDataType {
6    pub const UNKNOWN_TYPE: SqlDataType = SqlDataType(0);
7    // also called SQL_VARIANT_TYPE since odbc 4.0
8    pub const CHAR: SqlDataType = SqlDataType(1);
9    pub const NUMERIC: SqlDataType = SqlDataType(2);
10    pub const DECIMAL: SqlDataType = SqlDataType(3);
11    /// Exact numeric value with precision 10 and scale 0 (signed: `-2[31] <= n <= 2[31] - 1`,
12    /// unsigned: `0 <= n <= 2[32] - 1`).  An application uses `SQLGetTypeInfo` or `SQLColAttribute`
13    /// to determine whether a particular data type or a particular column in a result set is
14    /// unsigned.
15    pub const INTEGER: SqlDataType = SqlDataType(4);
16    pub const SMALLINT: SqlDataType = SqlDataType(5);
17    pub const FLOAT: SqlDataType = SqlDataType(6);
18    pub const REAL: SqlDataType = SqlDataType(7);
19    /// Signed, approximate, numeric value with a binary precision 53 (zero or absolute value
20    /// `10[-308]` to `10[308]`).
21    pub const DOUBLE: SqlDataType = SqlDataType(8);
22    pub const DATETIME: SqlDataType = SqlDataType(9);
23    pub const VARCHAR: SqlDataType = SqlDataType(12);
24    #[cfg(feature = "odbc_version_4")]
25    pub const UDT: SqlDataType = SqlDataType(17);
26    #[cfg(feature = "odbc_version_4")]
27    pub const ROW: SqlDataType = SqlDataType(19);
28    #[cfg(feature = "odbc_version_4")]
29    pub const ARRAY: SqlDataType = SqlDataType(50);
30    #[cfg(feature = "odbc_version_4")]
31    pub const MULTISET: SqlDataType = SqlDataType(55);
32
33    // one-parameter shortcuts for date/time data types
34    pub const DATE: SqlDataType = SqlDataType(91);
35    pub const TIME: SqlDataType = SqlDataType(92);
36    /// Year, month, day, hour, minute, and second fields, with valid values as defined for the DATE
37    /// and TIME data types.
38    pub const TIMESTAMP: SqlDataType = SqlDataType(93);
39    #[cfg(feature = "odbc_version_4")]
40    pub const TIME_WITH_TIMEZONE: SqlDataType = SqlDataType(94);
41    #[cfg(feature = "odbc_version_4")]
42    pub const TIMESTAMP_WITH_TIMEZONE: SqlDataType = SqlDataType(95);
43
44    // SQL extended datatypes:
45    pub const EXT_TIME_OR_INTERVAL: SqlDataType = SqlDataType(10);
46    pub const EXT_TIMESTAMP: SqlDataType = SqlDataType(11);
47    pub const EXT_LONG_VARCHAR: SqlDataType = SqlDataType(-1);
48    pub const EXT_BINARY: SqlDataType = SqlDataType(-2);
49    pub const EXT_VAR_BINARY: SqlDataType = SqlDataType(-3);
50    pub const EXT_LONG_VAR_BINARY: SqlDataType = SqlDataType(-4);
51    pub const EXT_BIG_INT: SqlDataType = SqlDataType(-5);
52    pub const EXT_TINY_INT: SqlDataType = SqlDataType(-6);
53    pub const EXT_BIT: SqlDataType = SqlDataType(-7);
54    pub const EXT_W_CHAR: SqlDataType = SqlDataType(-8);
55    pub const EXT_W_VARCHAR: SqlDataType = SqlDataType(-9);
56    pub const EXT_W_LONG_VARCHAR: SqlDataType = SqlDataType(-10);
57    pub const EXT_GUID: SqlDataType = SqlDataType(-11);
58}