1pub use self::{
12 attributes::*, bulk_operation::*, c_data_type::*, desc::*, fetch_orientation::*, functions::*,
13 indicator::*, info_type::*, interval::*, nullability::*, param_type::*, sql_data_type::*,
14 sqlreturn::*, set_pos::*,
15};
16use std::os::raw::{c_int, c_void};
17
18mod attributes;
19mod bulk_operation;
20mod c_data_type;
21mod desc;
22mod fetch_orientation;
23mod functions;
24mod indicator;
25mod info_type;
26mod interval;
27mod nullability;
28mod param_type;
29mod set_pos;
30mod sql_data_type;
31mod sqlreturn;
32
33pub enum Obj {}
35
36pub enum Env {}
37
38pub enum Dbc {}
39
40pub enum Stmt {}
41
42pub enum Description {}
43
44pub type Handle = *mut Obj;
45pub type HEnv = *mut Env;
46pub type HDesc = *mut Description;
47
48pub type HDbc = *mut Dbc;
51pub type HStmt = *mut Stmt;
52
53pub type SmallInt = i16;
54pub type USmallInt = u16;
55pub type Integer = i32;
56pub type UInteger = u32;
57pub type Pointer = *mut c_void;
58pub type Char = u8;
59pub type SChar = i8;
60pub type WChar = u16;
61
62pub type Len = isize;
63pub type ULen = usize;
64pub type HWnd = Pointer;
65pub type RetCode = i16;
66
67#[cfg(target_pointer_width = "64")]
69pub type SetPosIRow = u64;
70#[cfg(not(target_pointer_width = "64"))]
72pub type SetPosIRow = i16;
73
74pub const NTS: isize = -3;
76pub const NTSL: isize = -3;
77
78pub const MAX_MESSAGE_LENGTH: SmallInt = 512;
80pub const SQLSTATE_SIZE: usize = 5;
81pub const SQLSTATE_SIZEW: usize = 10;
82
83#[repr(u16)]
85#[derive(Debug, PartialEq, Eq, Clone, Copy)]
86pub enum FreeStmtOption {
87 Close = 0,
93 Unbind = 2,
101 ResetParams = 3,
106}
107
108#[repr(i16)]
110#[derive(Debug, PartialEq, Eq, Clone, Copy)]
111pub enum HandleType {
112 Env = 1,
113 Dbc = 2,
114 Stmt = 3,
115 Desc = 4,
116 DbcInfoToken = 6
120}
121
122#[repr(u16)]
124#[derive(Debug, PartialEq, Eq, Clone, Copy)]
125pub enum DriverConnectOption {
126 NoPrompt = 0,
127 Complete = 1,
128 Prompt = 2,
129 CompleteRequired = 3,
130}
131
132pub const IS_POINTER: i32 = -4;
136pub const IS_UINTEGER: i32 = -5;
138pub const IS_INTEGER: i32 = -6;
140pub const IS_USMALLINT: i32 = -7;
142pub const IS_SMALLINT: i32 = -8;
144
145#[repr(C)]
147#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)]
148pub struct YearMonth {
149 pub year: UInteger,
150 pub month: UInteger,
151}
152
153#[repr(C)]
155#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)]
156pub struct DaySecond {
157 pub day: UInteger,
158 pub hour: UInteger,
159 pub minute: UInteger,
160 pub second: UInteger,
161 pub fraction: UInteger,
162}
163
164#[repr(C)]
166#[derive(Copy, Clone)]
167pub union IntervalUnion {
168 pub year_month: YearMonth,
169 pub day_second: DaySecond,
170}
171
172#[repr(C)]
174#[derive(Clone, Copy)]
175pub struct IntervalStruct {
176 pub interval_type: c_int,
177 pub interval_sign: SmallInt,
178 pub interval_value: IntervalUnion,
179}
180
181#[repr(C)]
183#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)]
184pub struct Date {
185 pub year: SmallInt,
186 pub month: USmallInt,
187 pub day: USmallInt,
188}
189
190#[repr(C)]
192#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)]
193pub struct Time {
194 pub hour: USmallInt,
195 pub minute: USmallInt,
196 pub second: USmallInt,
197}
198
199#[repr(C)]
201#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)]
202pub struct Timestamp {
203 pub year: SmallInt,
204 pub month: USmallInt,
205 pub day: USmallInt,
206 pub hour: USmallInt,
207 pub minute: USmallInt,
208 pub second: USmallInt,
209 pub fraction: UInteger,
210}
211
212#[repr(C)]
214#[derive(Debug, Default, PartialEq, Eq, Clone, Copy, Hash)]
215pub struct Guid {
216 pub d1: u32,
217 pub d2: u16,
218 pub d3: u16,
219 pub d4: [u8; 8],
220}
221
222#[repr(i32)]
224#[derive(Debug, PartialEq, Eq, Clone, Copy)]
225pub enum ConnectionAttribute {
226 AsyncEnable = 4,
227 AccessMode = 101,
228 AutoCommit = 102,
229 LoginTimeout = 103,
230 Trace = 104,
231 TraceFile = 105,
232 TranslateLib = 106,
233 TranslateOption = 107,
234 TxnIsolation = 108,
235 CurrentCatalog = 109,
236 OdbcCursors = 110,
237 QuietMode = 111,
238 PacketSize = 112,
239 ConnectionTimeout = 113,
240 DisconnectBehaviour = 114,
241 AsyncDbcFunctionsEnable = 117,
242 AsyncDbcEvent = 119,
243 EnlistInDtc = 1207,
244 EnlistInXa = 1208,
245 ConnectionDead = 1209,
246 AutoIpd = 10001,
247 MetadataId = 10014,
248}
249
250#[repr(i32)]
252#[derive(Debug, PartialEq, Eq, Clone, Copy)]
253pub enum HeaderDiagnosticIdentifier {
254 ReturnCode = 1,
256 Number = 2,
258 RowCount = 3,
260 SqlState = 4,
262 Native = 5,
264 MessageText = 6,
266 DynamicFunction = 7,
268 ClassOrigin = 8,
270 SubclassOrigin = 9,
272 ConnectionName = 10,
274 ServerName = 11,
276 DynamicFunctionCode = 12,
278 CursorRowCount = -1249,
280 RowNumber = -1248,
282 ColumnNumber = -1247,
284}
285
286#[repr(i32)]
287#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
288pub enum AsyncConnectionBehavior {
289 On = 1,
291 #[default]
293 Off = 0,
294}
295
296#[repr(i32)]
297#[derive(Debug, PartialEq, Eq, Clone, Copy)]
298pub enum DynamicDiagnosticIdentifier {
299 AlterDomain = 3,
301 AlterTable = 4,
303 Call = 7,
305 CreateAssertion = 6,
307 CreateCharacterSet = 8,
309 CreateCollation = 10,
311 CreateDomain = 23,
313 CreateIndex = -1,
315 CreateSchema = 64,
317 CreateTable = 77,
319 CreateTranslation = 79,
321 CreateView = 84,
323 DeleteWhere = 19,
325 DropAssertion = 24,
327 DropCharacterSet = 25,
329 DropCollation = 26,
331 DropDomain = 27,
333 DropIndex = -2,
335 DropSchema = 31,
337 DropTable = 32,
339 DropTranslation = 33,
341 DropView = 36,
343 DynamicDeleteCursor = 38,
345 DynamicUpdateCursor = 81,
347 Grant = 48,
349 Insert = 50,
351 Revoke = 59,
353 SelectCursor = 85,
355 UnknownStatement = 0,
357 UpdateWhere = 82,
359}
360
361#[repr(i16)]
363#[derive(Debug, PartialEq, Eq, Clone, Copy)]
364pub enum CompletionType {
365 Commit = 0,
366 Rollback = 1,
367}
368
369pub const MAX_NUMERIC_LEN: usize = 16;
370#[repr(C)]
371#[derive(Debug, PartialEq, Eq, Clone, Copy, Default)]
372pub struct Numeric {
373 pub precision: Char,
374 pub scale: SChar,
376 pub sign: Char,
378 pub val: [Char; MAX_NUMERIC_LEN],
379}