winapi_ui_automation/um/
sqltypes.rs

1// Licensed under the Apache License, Version 2.0
2// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4// All files in the project carrying such notice may not be copied, modified, or distributed
5// except according to those terms.
6//! This module defines the types used in ODBC
7use ctypes::*;
8#[cfg(target_pointer_width = "64")]
9use shared::basetsd::{INT64, UINT64};
10use shared::guiddef::GUID;
11use shared::windef::HWND;
12pub type SQLCHAR = c_uchar;
13pub type SQLSCHAR = c_schar;
14pub type SQLDATE = c_uchar;
15pub type SQLDECIMAL = c_uchar;
16pub type SQLDOUBLE = c_double;
17pub type SQLFLOAT = c_double;
18pub type SQLINTEGER = c_long;
19pub type SQLUINTEGER = c_ulong;
20#[cfg(target_pointer_width = "64")]
21pub type SQLLEN = INT64;
22#[cfg(target_pointer_width = "64")]
23pub type SQLULEN = UINT64;
24#[cfg(target_pointer_width = "64")]
25pub type SQLSETPOSIROW = UINT64;
26#[cfg(target_pointer_width = "32")]
27pub type SQLLEN = SQLINTEGER;
28#[cfg(target_pointer_width = "32")]
29pub type SQLULEN = SQLUINTEGER;
30#[cfg(target_pointer_width = "32")]
31pub type SQLSETPOSIROW = SQLUSMALLINT;
32pub type SQLROWCOUNT = SQLULEN;
33pub type SQLROWSETSIZE = SQLULEN;
34pub type SQLTRANSID = SQLULEN;
35pub type SQLROWOFFSET = SQLLEN;
36pub type SQLNUMERIC = c_uchar;
37pub type SQLPOINTER = *mut c_void;
38pub type SQLREAL = c_float;
39pub type SQLSMALLINT = c_short;
40pub type SQLUSMALLINT = c_ushort;
41pub type SQLTIME = c_uchar;
42pub type SQLTIMESTAMP = c_uchar;
43pub type SQLVARCHAR = c_uchar;
44pub type SQLRETURN = SQLSMALLINT;
45pub type SQLHANDLE = *mut c_void;
46pub type SQLHENV = SQLHANDLE;
47pub type SQLHDBC = SQLHANDLE;
48pub type SQLHSTMT = SQLHANDLE;
49pub type SQLHDESC = SQLHANDLE;
50//pub type UCHAR = c_uchar;
51pub type SCHAR = c_schar;
52//pub type SQLSCHAR = SCHAR;
53pub type SDWORD = c_long;
54pub type SWORD = c_short;
55pub type UDWORD = c_ulong;
56//pub type UWORD = c_ushort;
57//#[cfg(target_pointer_width = "32")]
58//pub type SQLUINTEGER = UDWORD;
59pub type SLONG = c_long;
60pub type SSHORT = c_short;
61//pub type ULONG = c_ulong;
62//pub type USHORT = c_ushort;
63pub type SDOUBLE = c_double;
64pub type LDOUBLE = c_double;
65pub type SFLOAT = c_float;
66pub type PTR = *mut c_void;
67pub type HENV = *mut c_void;
68pub type HDBC = *mut c_void;
69pub type HSTMT = *mut c_void;
70pub type RETCODE = c_short;
71pub type SQLHWND = HWND;
72STRUCT!{struct DATE_STRUCT {
73    year: SQLSMALLINT,
74    month: SQLUSMALLINT,
75    day: SQLUSMALLINT,
76}}
77pub type SQL_DATE_STRUCT = DATE_STRUCT;
78STRUCT!{struct TIME_STRUCT {
79    hour: SQLUSMALLINT,
80    minute: SQLUSMALLINT,
81    second: SQLUSMALLINT,
82}}
83pub type SQL_TIME_STRUCT = TIME_STRUCT;
84STRUCT!{struct TIMESTAMP_STRUCT {
85    year: SQLSMALLINT,
86    month: SQLUSMALLINT,
87    day: SQLUSMALLINT,
88    hour: SQLUSMALLINT,
89    minute: SQLUSMALLINT,
90    second: SQLUSMALLINT,
91    fraction: SQLUINTEGER,
92}}
93pub type SQL_TIMESTAMP_STRUCT = TIMESTAMP_STRUCT;
94ENUM!{enum SQLINTERVAL {
95    SQL_IS_YEAR = 1,
96    SQL_IS_MONTH = 2,
97    SQL_IS_DAY = 3,
98    SQL_IS_HOUR = 4,
99    SQL_IS_MINUTE = 5,
100    SQL_IS_SECOND = 6,
101    SQL_IS_YEAR_TO_MONTH = 7,
102    SQL_IS_DAY_TO_HOUR = 8,
103    SQL_IS_DAY_TO_MINUTE = 9,
104    SQL_IS_DAY_TO_SECOND = 10,
105    SQL_IS_HOUR_TO_MINUTE = 11,
106    SQL_IS_HOUR_TO_SECOND = 12,
107    SQL_IS_MINUTE_TO_SECOND = 13,
108}}
109STRUCT!{struct SQL_YEAR_MONTH_STRUCT {
110    year: SQLUINTEGER,
111    month: SQLUINTEGER,
112}}
113STRUCT!{struct SQL_DAY_SECOND_STRUCT {
114    day: SQLUINTEGER,
115    hour: SQLUINTEGER,
116    minute: SQLUINTEGER,
117    second: SQLUINTEGER,
118    fraction: SQLUINTEGER,
119}}
120UNION!{union SQL_INTERVAL_STRUCT_intval {
121    [u32; 5],
122    year_month year_month_mut: SQL_YEAR_MONTH_STRUCT,
123    day_second day_second_mut: SQL_DAY_SECOND_STRUCT,
124}}
125STRUCT!{struct SQL_INTERVAL_STRUCT {
126    interval_type: SQLINTERVAL,
127    interval_sign: SQLSMALLINT,
128    intval: SQL_INTERVAL_STRUCT_intval,
129}}
130pub type ODBCINT64 = __int64;
131pub type SQLBIGINT = ODBCINT64;
132pub type SQLUBIGINT = __uint64;
133pub const SQL_MAX_NUMERIC_LEN: usize = 16;
134STRUCT!{struct SQL_NUMERIC_STRUCT {
135    precision: SQLCHAR,
136    scale: SQLSCHAR,
137    sign: SQLCHAR,
138    val: [SQLCHAR; SQL_MAX_NUMERIC_LEN],
139}}
140pub type SQLGUID = GUID;
141pub type BOOKMARK = SQLULEN;
142pub type SQLWCHAR = wchar_t;