rs_odbc/
stmt.rs

1#[double]
2use crate::api::ffi;
3use crate::api::Statement;
4use crate::attr::{Attr, AttrGet, AttrLen, AttrSet, StrLen};
5use crate::desc::{AppDesc, IPD, IRD};
6use crate::env::{OdbcVersion, SQL_OV_ODBC3, SQL_OV_ODBC3_80, SQL_OV_ODBC4};
7use crate::handle::{RefSQLHDESC, RefUnsafeSQLHDESC, UnsafeSQLHSTMT, SQLHSTMT};
8use crate::handle::{UnsafeSQLHDESC, SQLHDESC};
9use crate::str::{Ansi, OdbcChar, OdbcStr, Unicode};
10use crate::{
11    sqlreturn::SQLRETURN, Ident, OdbcBool, OdbcDefined, Ref, Scalar, SQLCHAR, SQLINTEGER, SQLULEN,
12    SQLWCHAR,
13};
14use core::mem::MaybeUninit;
15use mockall_double::double;
16use rs_odbc_derive::{odbc_type, Ident};
17
18pub(crate) mod private {
19    use super::*;
20
21    #[allow(non_snake_case)]
22    pub trait BaseStmtAttr<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, V: OdbcVersion>:
23        Attr<A> + AttrLen<Self::DefinedBy, SQLINTEGER>
24    {
25        fn update_handle(&self, _: &S)
26        where
27            Self: AttrSet<A>,
28        {
29        }
30
31        fn readA<'stmt>(
32            &mut self,
33            StatementHandle: &'stmt S,
34            StringLengthPtr: Option<&mut MaybeUninit<Self::StrLen>>,
35        ) -> SQLRETURN
36        where
37            A: Ident<Type = SQLINTEGER>,
38            Self: AttrGet<A> + Ansi + Ref<'stmt>,
39            MaybeUninit<Self::StrLen>: StrLen<SQLINTEGER>,
40        {
41            let ValuePtrLen = self.len();
42
43            unsafe {
44                ffi::SQLGetStmtAttrA(
45                    StatementHandle.as_SQLHANDLE(),
46                    A::IDENTIFIER,
47                    self.as_mut_SQLPOINTER(),
48                    ValuePtrLen,
49                    StringLengthPtr.map_or_else(core::ptr::null_mut, StrLen::as_mut_ptr),
50                )
51            }
52        }
53
54        fn readW<'stmt>(
55            &mut self,
56            StatementHandle: &'stmt S,
57            StringLengthPtr: Option<&mut MaybeUninit<Self::StrLen>>,
58        ) -> SQLRETURN
59        where
60            A: Ident<Type = SQLINTEGER>,
61            Self: AttrGet<A> + Unicode + Ref<'stmt>,
62            MaybeUninit<Self::StrLen>: StrLen<SQLINTEGER>,
63        {
64            let ValuePtrLen = self.len();
65
66            unsafe {
67                ffi::SQLGetStmtAttrW(
68                    StatementHandle.as_SQLHANDLE(),
69                    A::IDENTIFIER,
70                    self.as_mut_SQLPOINTER(),
71                    ValuePtrLen,
72                    StringLengthPtr.map_or_else(core::ptr::null_mut, StrLen::as_mut_ptr),
73                )
74            }
75        }
76    }
77
78    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
79        BaseStmtAttr<'desc, 'buf, S, A, V> for T
80    where
81        Self: Attr<A> + AttrLen<Self::DefinedBy, SQLINTEGER>,
82    {
83    }
84    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
85        BaseStmtAttr<'desc, 'buf, S, A, V> for [T]
86    where
87        Self: Attr<A> + AttrLen<Self::DefinedBy, SQLINTEGER>,
88    {
89    }
90    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, CH: OdbcChar, V: OdbcVersion>
91        BaseStmtAttr<'desc, 'buf, S, A, V> for OdbcStr<CH>
92    where
93        Self: Attr<A>,
94    {
95    }
96
97    // Implement BaseStmtAttr for uninitialized statement attributes
98    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
99        BaseStmtAttr<'desc, 'buf, S, A, V> for MaybeUninit<T>
100    where
101        T: BaseStmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
102        Self: AttrLen<Self::DefinedBy, SQLINTEGER>,
103    {
104    }
105    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
106        BaseStmtAttr<'desc, 'buf, S, A, V> for [MaybeUninit<T>]
107    where
108        [T]: BaseStmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
109        Self: AttrLen<Self::DefinedBy, SQLINTEGER>,
110    {
111    }
112    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, CH: OdbcChar, V: OdbcVersion>
113        BaseStmtAttr<'desc, 'buf, S, A, V> for OdbcStr<MaybeUninit<CH>>
114    where
115        OdbcStr<CH>: BaseStmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
116        Self: Attr<A>,
117    {
118    }
119
120    // Implement BaseStmtAttr for references to unsized (used by AttrSet)
121    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
122        BaseStmtAttr<'desc, 'buf, S, A, V> for &[T]
123    where
124        [T]: StmtAttr<'desc, 'buf, S, A, V>,
125        Self: AttrSet<A>,
126    {
127    }
128    impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, CH: OdbcChar, V: OdbcVersion>
129        BaseStmtAttr<'desc, 'buf, S, A, V> for &OdbcStr<CH>
130    where
131        OdbcStr<CH>: BaseStmtAttr<'desc, 'buf, S, A, V>,
132        Self: AttrSet<A>,
133    {
134    }
135}
136
137pub trait StmtAttr<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, V: OdbcVersion>:
138    private::BaseStmtAttr<'desc, 'buf, S, A, V>
139{
140}
141
142// Implement StmtAttr for all versions of SQLHSTMT statement attributes
143impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
144    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC3_80>, A, SQL_OV_ODBC3_80> for T
145where
146    T: StmtAttr<
147        'desc,
148        'buf,
149        SQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion>,
150        A,
151        <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion,
152    >,
153{
154}
155
156impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
157    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC4>, A, SQL_OV_ODBC4> for T
158where
159    T: StmtAttr<
160        'desc,
161        'buf,
162        SQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion>,
163        A,
164        <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion,
165    >,
166{
167}
168
169impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
170    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC3_80>, A, SQL_OV_ODBC3_80>
171    for [T]
172where
173    [T]: StmtAttr<
174        'desc,
175        'buf,
176        SQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion>,
177        A,
178        <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion,
179    >,
180{
181}
182
183impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
184    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC4>, A, SQL_OV_ODBC4> for [T]
185where
186    [T]: StmtAttr<
187        'desc,
188        'buf,
189        SQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion>,
190        A,
191        <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion,
192    >,
193{
194}
195
196impl<'conn, 'desc, 'buf, A: Ident, CH: OdbcChar>
197    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC3_80>, A, SQL_OV_ODBC3_80>
198    for OdbcStr<CH>
199where
200    OdbcStr<CH>: StmtAttr<
201        'desc,
202        'buf,
203        SQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion>,
204        A,
205        <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion,
206    >,
207{
208}
209
210impl<'conn, 'desc, 'buf, A: Ident, CH: OdbcChar>
211    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC4>, A, SQL_OV_ODBC4>
212    for OdbcStr<CH>
213where
214    OdbcStr<CH>: StmtAttr<
215        'desc,
216        'buf,
217        SQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion>,
218        A,
219        <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion,
220    >,
221{
222}
223
224// Implement StmtAttr for all versions of UnsafeSQLHSTMT statement attributes
225impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
226    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC3_80>, A, SQL_OV_ODBC3_80>
227    for T
228where
229    T: StmtAttr<
230        'desc,
231        'buf,
232        UnsafeSQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion>,
233        A,
234        <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion,
235    >,
236{
237}
238
239impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
240    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC4>, A, SQL_OV_ODBC4> for T
241where
242    T: StmtAttr<
243        'desc,
244        'buf,
245        UnsafeSQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion>,
246        A,
247        <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion,
248    >,
249{
250}
251
252impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
253    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC3_80>, A, SQL_OV_ODBC3_80>
254    for [T]
255where
256    [T]: StmtAttr<
257        'desc,
258        'buf,
259        UnsafeSQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion>,
260        A,
261        <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion,
262    >,
263{
264}
265
266impl<'conn, 'desc, 'buf, A: Ident, T: Scalar>
267    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC4>, A, SQL_OV_ODBC4>
268    for [T]
269where
270    [T]: StmtAttr<
271        'desc,
272        'buf,
273        UnsafeSQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion>,
274        A,
275        <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion,
276    >,
277{
278}
279
280impl<'conn, 'desc, 'buf, A: Ident, CH: OdbcChar>
281    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC3_80>, A, SQL_OV_ODBC3_80>
282    for OdbcStr<CH>
283where
284    OdbcStr<CH>: StmtAttr<
285        'desc,
286        'buf,
287        UnsafeSQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion>,
288        A,
289        <SQL_OV_ODBC3_80 as OdbcVersion>::PrevVersion,
290    >,
291{
292}
293
294impl<'conn, 'desc, 'buf, A: Ident, CH: OdbcChar>
295    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, SQL_OV_ODBC4>, A, SQL_OV_ODBC4>
296    for OdbcStr<CH>
297where
298    OdbcStr<CH>: StmtAttr<
299        'desc,
300        'buf,
301        UnsafeSQLHSTMT<'conn, 'desc, 'buf, <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion>,
302        A,
303        <SQL_OV_ODBC4 as OdbcVersion>::PrevVersion,
304    >,
305{
306}
307
308// Implement StmtAttr for uninitialized statement attributes
309impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
310    StmtAttr<'desc, 'buf, S, A, V> for MaybeUninit<T>
311where
312    T: StmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
313    Self: AttrLen<Self::DefinedBy, SQLINTEGER>,
314{
315}
316impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
317    StmtAttr<'desc, 'buf, S, A, V> for [MaybeUninit<T>]
318where
319    [T]: StmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
320    Self: AttrLen<Self::DefinedBy, SQLINTEGER>,
321{
322}
323impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, V: OdbcVersion>
324    StmtAttr<'desc, 'buf, S, A, V> for OdbcStr<MaybeUninit<SQLCHAR>>
325where
326    OdbcStr<SQLCHAR>: StmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
327{
328}
329impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, V: OdbcVersion>
330    StmtAttr<'desc, 'buf, S, A, V> for OdbcStr<MaybeUninit<SQLWCHAR>>
331where
332    OdbcStr<SQLWCHAR>: StmtAttr<'desc, 'buf, S, A, V> + AttrGet<A>,
333{
334}
335
336// Implement StmtAttr for references to unsized (used by AttrSet)
337impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, T: Scalar, V: OdbcVersion>
338    StmtAttr<'desc, 'buf, S, A, V> for &[T]
339where
340    [T]: StmtAttr<'desc, 'buf, S, A, V>,
341    Self: AttrSet<A>,
342{
343}
344impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, A: Ident, CH: OdbcChar, V: OdbcVersion>
345    StmtAttr<'desc, 'buf, S, A, V> for &OdbcStr<CH>
346where
347    OdbcStr<CH>: StmtAttr<'desc, 'buf, S, A, V>,
348    Self: AttrSet<A>,
349{
350}
351
352// Implement methods for setting and getting descriptor handles
353unsafe impl<'conn, 'desc, 'buf, A: Ident, V: OdbcVersion> Attr<A>
354    for Option<&'desc SQLHDESC<'conn, AppDesc<'buf>, V>>
355where
356    Option<&'desc UnsafeSQLHDESC<'conn, AppDesc<'buf>, V>>: Attr<A>,
357{
358    type DefinedBy = <Option<&'desc UnsafeSQLHDESC<'conn, AppDesc<'buf>, V>> as Attr<A>>::DefinedBy;
359}
360unsafe impl<'conn, 'desc, 'buf, A: Ident, DT, V: OdbcVersion> Attr<A>
361    for MaybeUninit<RefSQLHDESC<'conn, DT, V>>
362where
363    MaybeUninit<RefUnsafeSQLHDESC<'conn, DT, V>>: Attr<A>,
364{
365    type DefinedBy = <MaybeUninit<RefUnsafeSQLHDESC<'conn, DT, V>> as Attr<A>>::DefinedBy;
366}
367unsafe impl<'conn, 'desc, 'buf, A: Ident, DT, V: OdbcVersion> Attr<A>
368    for MaybeUninit<&'desc SQLHDESC<'conn, DT, V>>
369where
370    MaybeUninit<&'desc UnsafeSQLHDESC<'conn, DT, V>>: Attr<A>,
371{
372    type DefinedBy = <MaybeUninit<&'desc UnsafeSQLHDESC<'conn, DT, V>> as Attr<A>>::DefinedBy;
373}
374unsafe impl<'conn, 'buf, DT, A: Ident, V: OdbcVersion> AttrGet<A>
375    for MaybeUninit<RefSQLHDESC<'conn, DT, V>>
376where
377    MaybeUninit<RefUnsafeSQLHDESC<'conn, DT, V>>: AttrGet<A>,
378{
379}
380unsafe impl<'conn, 'desc, 'buf, A: Ident, V: OdbcVersion> AttrSet<A>
381    for Option<&'desc SQLHDESC<'conn, AppDesc<'buf>, V>>
382where
383    Option<&'desc UnsafeSQLHDESC<'conn, AppDesc<'buf>, V>>: AttrSet<A>,
384{
385}
386
387impl<T: Scalar> Ref<'_> for T {}
388impl<T: Scalar> Ref<'_> for [T] {}
389
390impl<CH> Ref<'_> for OdbcStr<CH> {}
391
392impl<T: Scalar> Ref<'_> for MaybeUninit<T> {}
393impl<T: Scalar> Ref<'_> for [MaybeUninit<T>] {}
394
395impl<'stmt, DT, V: OdbcVersion> Ref<'stmt> for MaybeUninit<RefSQLHDESC<'stmt, DT, V>> {}
396impl<'stmt, DT, V: OdbcVersion> Ref<'stmt> for MaybeUninit<RefUnsafeSQLHDESC<'stmt, DT, V>> {}
397
398//=====================================================================================//
399//-------------------------------------Attributes--------------------------------------//
400
401#[derive(Ident)]
402#[identifier(SQLINTEGER, 0)]
403#[allow(non_camel_case_types)]
404pub struct SQL_ATTR_QUERY_TIMEOUT;
405unsafe impl Attr<SQL_ATTR_QUERY_TIMEOUT> for SQLULEN {
406    type DefinedBy = OdbcDefined;
407}
408impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
409    StmtAttr<'desc, 'buf, S, SQL_ATTR_QUERY_TIMEOUT, SQL_OV_ODBC3> for SQLULEN
410{
411}
412unsafe impl AttrGet<SQL_ATTR_QUERY_TIMEOUT> for SQLULEN {}
413unsafe impl AttrSet<SQL_ATTR_QUERY_TIMEOUT> for SQLULEN {}
414
415#[derive(Ident)]
416#[identifier(SQLINTEGER, 1)]
417#[allow(non_camel_case_types)]
418pub struct SQL_ATTR_MAX_ROWS;
419unsafe impl Attr<SQL_ATTR_MAX_ROWS> for SQLULEN {
420    type DefinedBy = OdbcDefined;
421}
422impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
423    StmtAttr<'desc, 'buf, S, SQL_ATTR_MAX_ROWS, SQL_OV_ODBC3> for SQLULEN
424{
425}
426unsafe impl AttrGet<SQL_ATTR_MAX_ROWS> for SQLULEN {}
427unsafe impl AttrSet<SQL_ATTR_MAX_ROWS> for SQLULEN {}
428
429#[derive(Ident)]
430#[identifier(SQLINTEGER, 2)]
431#[allow(non_camel_case_types)]
432pub struct SQL_ATTR_NOSCAN;
433unsafe impl Attr<SQL_ATTR_NOSCAN> for Noscan {
434    type DefinedBy = OdbcDefined;
435}
436impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
437    StmtAttr<'desc, 'buf, S, SQL_ATTR_NOSCAN, SQL_OV_ODBC3> for Noscan
438{
439}
440unsafe impl AttrGet<SQL_ATTR_NOSCAN> for Noscan {}
441unsafe impl AttrSet<SQL_ATTR_NOSCAN> for Noscan {}
442
443#[derive(Ident)]
444#[identifier(SQLINTEGER, 3)]
445#[allow(non_camel_case_types)]
446pub struct SQL_ATTR_MAX_LENGTH;
447unsafe impl Attr<SQL_ATTR_MAX_LENGTH> for SQLULEN {
448    type DefinedBy = OdbcDefined;
449}
450impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
451    StmtAttr<'desc, 'buf, S, SQL_ATTR_MAX_LENGTH, SQL_OV_ODBC3> for SQLULEN
452{
453}
454unsafe impl AttrGet<SQL_ATTR_MAX_LENGTH> for SQLULEN {}
455unsafe impl AttrSet<SQL_ATTR_MAX_LENGTH> for SQLULEN {}
456
457#[derive(Ident)]
458#[identifier(SQLINTEGER, 6)]
459#[allow(non_camel_case_types)]
460pub struct SQL_ATTR_CURSOR_TYPE;
461// TODO: This attribute cannot be specified after the SQL statement has been prepared.
462unsafe impl Attr<SQL_ATTR_CURSOR_TYPE> for CursorType {
463    type DefinedBy = OdbcDefined;
464}
465impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
466    StmtAttr<'desc, 'buf, S, SQL_ATTR_CURSOR_TYPE, SQL_OV_ODBC3> for CursorType
467{
468}
469unsafe impl AttrGet<SQL_ATTR_CURSOR_TYPE> for CursorType {}
470unsafe impl AttrSet<SQL_ATTR_CURSOR_TYPE> for CursorType {}
471
472#[derive(Ident)]
473#[identifier(SQLINTEGER, 7)]
474#[allow(non_camel_case_types)]
475pub struct SQL_ATTR_CONCURRENCY;
476// TODO: This attribute cannot be specified for an open cursor
477unsafe impl Attr<SQL_ATTR_CONCURRENCY> for Concurrency {
478    type DefinedBy = OdbcDefined;
479}
480impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
481    StmtAttr<'desc, 'buf, S, SQL_ATTR_CONCURRENCY, SQL_OV_ODBC3> for Concurrency
482{
483}
484unsafe impl AttrGet<SQL_ATTR_CONCURRENCY> for Concurrency {}
485unsafe impl AttrSet<SQL_ATTR_CONCURRENCY> for Concurrency {}
486
487#[derive(Ident)]
488#[identifier(SQLINTEGER, 8)]
489#[allow(non_camel_case_types)]
490pub struct SQL_ATTR_KEYSET_SIZE;
491unsafe impl Attr<SQL_ATTR_KEYSET_SIZE> for SQLULEN {
492    type DefinedBy = OdbcDefined;
493}
494impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
495    StmtAttr<'desc, 'buf, S, SQL_ATTR_KEYSET_SIZE, SQL_OV_ODBC3> for SQLULEN
496{
497}
498unsafe impl AttrGet<SQL_ATTR_KEYSET_SIZE> for SQLULEN {}
499unsafe impl AttrSet<SQL_ATTR_KEYSET_SIZE> for SQLULEN {}
500
501#[derive(Ident)]
502#[identifier(SQLINTEGER, 10)]
503#[allow(non_camel_case_types)]
504pub struct SQL_ATTR_SIMULATE_CURSOR;
505unsafe impl Attr<SQL_ATTR_SIMULATE_CURSOR> for SimulateCursor {
506    type DefinedBy = OdbcDefined;
507}
508impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
509    StmtAttr<'desc, 'buf, S, SQL_ATTR_SIMULATE_CURSOR, SQL_OV_ODBC3> for SimulateCursor
510{
511}
512unsafe impl AttrGet<SQL_ATTR_SIMULATE_CURSOR> for SimulateCursor {}
513unsafe impl AttrSet<SQL_ATTR_SIMULATE_CURSOR> for SimulateCursor {}
514
515#[derive(Ident)]
516#[identifier(SQLINTEGER, 11)]
517#[allow(non_camel_case_types)]
518pub struct SQL_ATTR_RETRIEVE_DATA;
519unsafe impl Attr<SQL_ATTR_RETRIEVE_DATA> for RetrieveData {
520    type DefinedBy = OdbcDefined;
521}
522impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
523    StmtAttr<'desc, 'buf, S, SQL_ATTR_RETRIEVE_DATA, SQL_OV_ODBC3> for RetrieveData
524{
525}
526unsafe impl AttrGet<SQL_ATTR_RETRIEVE_DATA> for RetrieveData {}
527unsafe impl AttrSet<SQL_ATTR_RETRIEVE_DATA> for RetrieveData {}
528
529#[derive(Ident)]
530#[identifier(SQLINTEGER, 12)]
531#[allow(non_camel_case_types)]
532pub struct SQL_ATTR_USE_BOOKMARKS;
533unsafe impl Attr<SQL_ATTR_USE_BOOKMARKS> for UseBookmarks {
534    type DefinedBy = OdbcDefined;
535}
536impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
537    StmtAttr<'desc, 'buf, S, SQL_ATTR_USE_BOOKMARKS, SQL_OV_ODBC3> for UseBookmarks
538{
539}
540unsafe impl AttrGet<SQL_ATTR_USE_BOOKMARKS> for UseBookmarks {}
541unsafe impl AttrSet<SQL_ATTR_USE_BOOKMARKS> for UseBookmarks {}
542
543#[derive(Ident)]
544#[identifier(SQLINTEGER, 15)]
545#[allow(non_camel_case_types)]
546pub struct SQL_ATTR_ENABLE_AUTO_IPD;
547unsafe impl Attr<SQL_ATTR_ENABLE_AUTO_IPD> for OdbcBool {
548    type DefinedBy = OdbcDefined;
549}
550impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
551    StmtAttr<'desc, 'buf, S, SQL_ATTR_ENABLE_AUTO_IPD, SQL_OV_ODBC3> for OdbcBool
552{
553}
554unsafe impl AttrGet<SQL_ATTR_ENABLE_AUTO_IPD> for OdbcBool {}
555unsafe impl AttrSet<SQL_ATTR_ENABLE_AUTO_IPD> for OdbcBool {}
556
557#[derive(Ident)]
558#[identifier(SQLINTEGER, 14)]
559#[allow(non_camel_case_types)]
560// This is read-only attribute
561pub struct SQL_ATTR_ROW_NUMBER;
562unsafe impl Attr<SQL_ATTR_ROW_NUMBER> for SQLULEN {
563    type DefinedBy = OdbcDefined;
564}
565impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
566    StmtAttr<'desc, 'buf, S, SQL_ATTR_ROW_NUMBER, SQL_OV_ODBC3> for SQLULEN
567{
568}
569unsafe impl AttrGet<SQL_ATTR_ROW_NUMBER> for SQLULEN {}
570
571// TODO:
572//#[derive(Ident)]
573//#[identifier(SQLINTEGER, 16)]
574//#[allow(non_camel_case_types)]
575//pub struct SQL_ATTR_FETCH_BOOKMARK_PTR;
576
577//// The following are Header fields--------------------------------
578//
579//// TODO: This one could be special??
580//// Corresponds to ARD SQL_DESC_BIND_TYPE
581//#[derive(Ident)]
582//#[identifier(SQLINTEGER, 5)]
583//#[allow(non_camel_case_types)]
584//pub struct SQL_ATTR_ROW_BIND_TYPE;
585//
586// TODO: This cannot be supported until SQL_DESC_BIND_OFFSET_PTR is supported in descriptors
587//// Corresponds to APD SQL_DESC_BIND_OFFSET_PTR
588//#[derive(Ident)]
589//#[identifier(SQLINTEGER, 17)]
590//#[allow(non_camel_case_types)]
591//pub struct SQL_ATTR_PARAM_BIND_OFFSET_PTR;
592//
593//// Corresponds to APD SQL_DESC_BIND_TYPE
594//#[derive(Ident)]
595//#[identifier(SQLINTEGER, 18)]
596//#[allow(non_camel_case_types)]
597//pub struct SQL_ATTR_PARAM_BIND_TYPE;
598//
599//// Corresponds to APD SQL_DESC_ARRAY_STATUS_PTR
600//#[derive(Ident)]
601//#[identifier(SQLINTEGER, 18)]
602//#[allow(non_camel_case_types)]
603//pub struct SQL_ATTR_PARAM_OPERATION_PTR;
604//
605//// Corresponds to IPD SQL_DESC_ARRAY_STATUS_PTR
606//#[derive(Ident)]
607//#[identifier(SQLINTEGER, 20)]
608//#[allow(non_camel_case_types)]
609//pub struct SQL_ATTR_PARAM_STATUS_PTR;
610//
611//// Corresponds to IPD SQL_DESC_ROWS_PROCESSED_PTR
612//#[derive(Ident)]
613//#[identifier(SQLINTEGER, 21)]
614//#[allow(non_camel_case_types)]
615//pub struct SQL_ATTR_PARAMS_PROCESSED_PTR;
616//
617//// Corresponds to APD SQL_DESC_ARRAY_SIZE
618//#[derive(Ident)]
619//#[identifier(SQLINTEGER, 22)]
620//#[allow(non_camel_case_types)]
621//pub struct SQL_ATTR_PARAMSET_SIZE;
622//
623
624// TODO: This cannot be supported until SQL_DESC_BIND_OFFSET_PTR is supported in descriptors
625//// Corresponds to ARD SQL_DESC_BIND_OFFSET_PTR
626//#[derive(Ident)]
627//#[identifier(SQLINTEGER, 23)]
628//#[allow(non_camel_case_types)]
629//pub struct SQL_ATTR_ROW_BIND_OFFSET_PTR;
630//
631//// Corresponds to ARD SQL_DESC_ARRAY_STATUS_PTR
632//#[derive(Ident)]
633//#[identifier(SQLINTEGER, 24)]
634//#[allow(non_camel_case_types)]
635//pub struct SQL_ATTR_ROW_OPERATION_PTR;
636//
637//// Corresponds to IRD SQL_DESC_ARRAY_STATUS_PTR
638//#[derive(Ident)]
639//#[identifier(SQLINTEGER, 25)]
640//#[allow(non_camel_case_types)]
641//pub struct SQL_ATTR_ROW_STATUS_PTR;
642//
643//// Corresponds to IRD SQL_DESC_ROWS_PROCESSED_PTR
644//#[derive(Ident)]
645//#[identifier(SQLINTEGER, 26)]
646//#[allow(non_camel_case_types)]
647//pub struct SQL_ATTR_ROWS_FETCHED_PTR;
648//
649//// Corresponds to ARD SQL_DESC_ARRAY_SIZE
650//#[derive(Ident)]
651//#[identifier(SQLINTEGER, 27)]
652//#[allow(non_camel_case_types)]
653//pub struct SQL_ATTR_ROW_ARRAY_SIZE;
654//
655//#[identifier(SQLINTEGER, 29)]
656//#[derive(Ident)]
657//#[cfg(feature = "v3_8")]
658//#[allow(non_camel_case_types)]
659// TODO: This type MUST be Rc or similar
660//pub struct SQL_ATTR_ASYNC_STMT_EVENT;
661//
662//#[identifier(SQLINTEGER, 30)]
663//#[derive(Ident)]
664//#[cfg(feature = "v4")]
665//#[allow(non_camel_case_types)]
666//pub struct SQL_ATTR_SAMPLE_SIZE;
667//
668//#[identifier(SQLINTEGER, 31)]
669//#[derive(Ident)]
670//#[cfg(feature = "v4")]
671//#[allow(non_camel_case_types)]
672//pub struct SQL_ATTR_DYNAMIC_COLUMNS;
673//
674//#[identifier(SQLINTEGER, 32)]
675//#[derive(Ident)]
676//#[cfg(feature = "v4")]
677//#[allow(non_camel_case_types)]
678//pub struct SQL_ATTR_TYPE_EXCEPTION_BEHAVIOR;
679//
680//#[identifier(SQLINTEGER, 33)]
681//#[derive(Ident)]
682//#[cfg(feature = "v4")]
683//#[allow(non_camel_case_types)]
684//pub struct SQL_ATTR_LENGTH_EXCEPTION_BEHAVIOR;
685
686#[derive(Ident)]
687#[identifier(SQLINTEGER, 10010)]
688#[allow(non_camel_case_types)]
689pub struct SQL_ATTR_APP_ROW_DESC;
690unsafe impl<V: OdbcVersion> Attr<SQL_ATTR_APP_ROW_DESC>
691    for MaybeUninit<RefUnsafeSQLHDESC<'_, AppDesc<'_>, V>>
692{
693    type DefinedBy = OdbcDefined;
694}
695unsafe impl<V: OdbcVersion> Attr<SQL_ATTR_APP_ROW_DESC>
696    for Option<&UnsafeSQLHDESC<'_, AppDesc<'_>, V>>
697{
698    type DefinedBy = OdbcDefined;
699}
700
701impl<'conn, 'desc, 'buf, V: OdbcVersion>
702    private::BaseStmtAttr<
703        'desc,
704        'buf,
705        UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
706        SQL_ATTR_APP_ROW_DESC,
707        V,
708    > for MaybeUninit<RefUnsafeSQLHDESC<'conn, AppDesc<'buf>, V>>
709where
710    Self: Attr<SQL_ATTR_APP_ROW_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
711{
712    #[cfg(feature = "odbc_debug")]
713    fn readA<'stmt>(
714        &mut self,
715        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
716        _: Option<&mut MaybeUninit<Self::StrLen>>,
717    ) -> SQLRETURN {
718        get_ard(self, StatementHandle)
719    }
720
721    #[cfg(feature = "odbc_debug")]
722    fn readW<'stmt>(
723        &mut self,
724        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
725        _: Option<&mut MaybeUninit<Self::StrLen>>,
726    ) -> SQLRETURN {
727        get_ard(self, StatementHandle)
728    }
729}
730impl<'conn, 'desc, 'buf, V: OdbcVersion>
731    private::BaseStmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_APP_ROW_DESC, V>
732    for MaybeUninit<RefSQLHDESC<'conn, AppDesc<'buf>, V>>
733where
734    Self: Attr<SQL_ATTR_APP_ROW_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
735{
736    #[cfg(feature = "odbc_debug")]
737    fn readA<'stmt>(
738        &mut self,
739        StatementHandle: &'stmt SQLHSTMT<'conn, 'desc, 'buf, V>,
740        _: Option<&mut MaybeUninit<Self::StrLen>>,
741    ) -> SQLRETURN {
742        get_ard(self, StatementHandle)
743    }
744
745    #[cfg(feature = "odbc_debug")]
746    fn readW<'stmt>(
747        &mut self,
748        StatementHandle: &'stmt SQLHSTMT<'conn, 'desc, 'buf, V>,
749        _: Option<&mut MaybeUninit<Self::StrLen>>,
750    ) -> SQLRETURN {
751        get_ard(self, StatementHandle)
752    }
753}
754impl<'conn, 'desc, 'buf, S: Statement<'desc, 'buf, V>, V: OdbcVersion>
755    private::BaseStmtAttr<'desc, 'buf, S, SQL_ATTR_APP_ROW_DESC, V>
756    for Option<&'desc S::ExplicitARD>
757where
758    Self: Attr<SQL_ATTR_APP_ROW_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
759{
760    #[cfg(feature = "odbc_debug")]
761    fn update_handle(&self, StatementHandle: &UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>) {
762        StatementHandle.explicit_ard.set(*self);
763    }
764}
765
766impl<'conn, 'desc, 'buf, V: OdbcVersion>
767    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_APP_ROW_DESC, V>
768    for MaybeUninit<RefUnsafeSQLHDESC<'conn, AppDesc<'buf>, V>>
769where
770    Self: Attr<SQL_ATTR_APP_ROW_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
771{
772}
773impl<'conn, 'desc, 'buf, V: OdbcVersion>
774    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_APP_ROW_DESC, V>
775    for MaybeUninit<RefSQLHDESC<'conn, AppDesc<'buf>, V>>
776where
777    Self: Attr<SQL_ATTR_APP_ROW_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
778{
779}
780impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, V: OdbcVersion>
781    StmtAttr<'desc, 'buf, S, SQL_ATTR_APP_ROW_DESC, V> for Option<&'desc S::ExplicitARD>
782where
783    Self: Attr<SQL_ATTR_APP_ROW_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
784{
785}
786
787unsafe impl<V: OdbcVersion> AttrGet<SQL_ATTR_APP_ROW_DESC>
788    for MaybeUninit<RefUnsafeSQLHDESC<'_, AppDesc<'_>, V>>
789{
790}
791unsafe impl<V: OdbcVersion> AttrSet<SQL_ATTR_APP_ROW_DESC>
792    for Option<&UnsafeSQLHDESC<'_, AppDesc<'_>, V>>
793{
794}
795
796#[derive(Ident)]
797#[identifier(SQLINTEGER, 10011)]
798#[allow(non_camel_case_types)]
799pub struct SQL_ATTR_APP_PARAM_DESC;
800unsafe impl<V: OdbcVersion> Attr<SQL_ATTR_APP_PARAM_DESC>
801    for Option<&UnsafeSQLHDESC<'_, AppDesc<'_>, V>>
802{
803    type DefinedBy = OdbcDefined;
804}
805unsafe impl<V: OdbcVersion> Attr<SQL_ATTR_APP_PARAM_DESC>
806    for MaybeUninit<RefUnsafeSQLHDESC<'_, AppDesc<'_>, V>>
807{
808    type DefinedBy = OdbcDefined;
809}
810
811impl<'conn, 'desc, 'buf, V: OdbcVersion>
812    private::BaseStmtAttr<
813        'desc,
814        'buf,
815        UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
816        SQL_ATTR_APP_PARAM_DESC,
817        V,
818    > for MaybeUninit<RefUnsafeSQLHDESC<'conn, AppDesc<'buf>, V>>
819{
820    #[cfg(feature = "odbc_debug")]
821    fn readA<'stmt>(
822        &mut self,
823        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
824        _: Option<&mut MaybeUninit<Self::StrLen>>,
825    ) -> SQLRETURN {
826        get_ard(self, StatementHandle)
827    }
828
829    #[cfg(feature = "odbc_debug")]
830    fn readW<'stmt>(
831        &mut self,
832        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
833        _: Option<&mut MaybeUninit<Self::StrLen>>,
834    ) -> SQLRETURN {
835        get_ard(self, StatementHandle)
836    }
837}
838impl<'conn, 'desc, 'buf, V: OdbcVersion>
839    private::BaseStmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_APP_PARAM_DESC, V>
840    for MaybeUninit<RefSQLHDESC<'conn, AppDesc<'buf>, V>>
841{
842    #[cfg(feature = "odbc_debug")]
843    fn readA<'stmt>(
844        &mut self,
845        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
846        _: Option<&mut MaybeUninit<Self::StrLen>>,
847    ) -> SQLRETURN {
848        get_ard(self, StatementHandle)
849    }
850
851    #[cfg(feature = "odbc_debug")]
852    fn readW<'stmt>(
853        &mut self,
854        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
855        _: Option<&mut MaybeUninit<Self::StrLen>>,
856    ) -> SQLRETURN {
857        get_ard(self, StatementHandle)
858    }
859}
860impl<'conn, 'desc, 'buf, S: Statement<'desc, 'buf, V>, V: OdbcVersion>
861    private::BaseStmtAttr<'desc, 'buf, S, SQL_ATTR_APP_PARAM_DESC, V>
862    for Option<&'desc S::ExplicitAPD>
863where
864    Self: Attr<SQL_ATTR_APP_PARAM_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
865{
866    #[cfg(feature = "odbc_debug")]
867    fn update_handle(&self, StatementHandle: &UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>) {
868        StatementHandle.explicit_ard.set(*self);
869    }
870}
871
872impl<'conn, 'desc, 'buf, V: OdbcVersion>
873    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_APP_PARAM_DESC, V>
874    for MaybeUninit<RefUnsafeSQLHDESC<'conn, AppDesc<'buf>, V>>
875where
876    Self: Attr<SQL_ATTR_APP_PARAM_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
877{
878}
879impl<'conn, 'desc, 'buf, V: OdbcVersion>
880    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_APP_PARAM_DESC, V>
881    for MaybeUninit<RefSQLHDESC<'conn, AppDesc<'buf>, V>>
882where
883    Self: Attr<SQL_ATTR_APP_PARAM_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
884{
885}
886impl<'desc, 'buf, S: Statement<'desc, 'buf, V>, V: OdbcVersion>
887    StmtAttr<'desc, 'buf, S, SQL_ATTR_APP_PARAM_DESC, V> for Option<&'desc S::ExplicitAPD>
888where
889    Self: Attr<SQL_ATTR_APP_PARAM_DESC> + AttrLen<Self::DefinedBy, SQLINTEGER>,
890{
891}
892
893unsafe impl<V: OdbcVersion> AttrGet<SQL_ATTR_APP_PARAM_DESC>
894    for MaybeUninit<RefUnsafeSQLHDESC<'_, AppDesc<'_>, V>>
895{
896}
897unsafe impl<V: OdbcVersion> AttrSet<SQL_ATTR_APP_PARAM_DESC>
898    for Option<&UnsafeSQLHDESC<'_, AppDesc<'_>, V>>
899{
900}
901
902#[derive(Ident)]
903#[identifier(SQLINTEGER, 10012)]
904#[allow(non_camel_case_types)]
905// This is read-only attribute
906pub struct SQL_ATTR_IMP_ROW_DESC;
907unsafe impl<V: OdbcVersion> Attr<SQL_ATTR_IMP_ROW_DESC>
908    for MaybeUninit<RefUnsafeSQLHDESC<'_, IRD, V>>
909{
910    type DefinedBy = OdbcDefined;
911}
912
913impl<'conn, 'desc, 'buf, V: OdbcVersion>
914    private::BaseStmtAttr<
915        'desc,
916        'buf,
917        UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
918        SQL_ATTR_IMP_ROW_DESC,
919        V,
920    > for MaybeUninit<RefUnsafeSQLHDESC<'conn, IRD, V>>
921{
922    #[cfg(feature = "odbc_debug")]
923    fn readA<'stmt>(
924        &mut self,
925        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
926        _: Option<&mut MaybeUninit<Self::StrLen>>,
927    ) -> SQLRETURN {
928        get_ard(self, StatementHandle)
929    }
930
931    #[cfg(feature = "odbc_debug")]
932    fn readW<'stmt>(
933        &mut self,
934        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
935        _: Option<&mut MaybeUninit<Self::StrLen>>,
936    ) -> SQLRETURN {
937        get_ard(self, StatementHandle)
938    }
939}
940impl<'conn, 'desc, 'buf, V: OdbcVersion>
941    private::BaseStmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_IMP_ROW_DESC, V>
942    for MaybeUninit<RefSQLHDESC<'conn, IRD, V>>
943{
944    #[cfg(feature = "odbc_debug")]
945    fn readA<'stmt>(
946        &mut self,
947        StatementHandle: &'stmt SQLHSTMT<'conn, 'desc, 'buf, V>,
948        _: Option<&mut MaybeUninit<Self::StrLen>>,
949    ) -> SQLRETURN {
950        get_ard(self, StatementHandle)
951    }
952
953    #[cfg(feature = "odbc_debug")]
954    fn readW<'stmt>(
955        &mut self,
956        StatementHandle: &'stmt SQLHSTMT<'conn, 'desc, 'buf, V>,
957        _: Option<&mut MaybeUninit<Self::StrLen>>,
958    ) -> SQLRETURN {
959        get_ard(self, StatementHandle)
960    }
961}
962impl<'conn, 'desc, 'buf, V: OdbcVersion>
963    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_IMP_ROW_DESC, V>
964    for MaybeUninit<RefUnsafeSQLHDESC<'conn, IRD, V>>
965{
966}
967impl<'conn, 'desc, 'buf, V: OdbcVersion>
968    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_IMP_ROW_DESC, V>
969    for MaybeUninit<RefSQLHDESC<'conn, IRD, V>>
970{
971}
972
973unsafe impl<V: OdbcVersion> AttrGet<SQL_ATTR_IMP_ROW_DESC>
974    for MaybeUninit<RefUnsafeSQLHDESC<'_, IRD, V>>
975{
976}
977
978#[derive(Ident)]
979#[identifier(SQLINTEGER, 10013)]
980#[allow(non_camel_case_types)]
981// This is read-only attribute
982pub struct SQL_ATTR_IMP_PARAM_DESC;
983unsafe impl<V: OdbcVersion> Attr<SQL_ATTR_IMP_PARAM_DESC>
984    for MaybeUninit<RefUnsafeSQLHDESC<'_, IPD, V>>
985{
986    type DefinedBy = OdbcDefined;
987}
988
989impl<'conn, 'desc, 'buf, V: OdbcVersion>
990    private::BaseStmtAttr<
991        'desc,
992        'buf,
993        UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
994        SQL_ATTR_IMP_PARAM_DESC,
995        V,
996    > for MaybeUninit<RefUnsafeSQLHDESC<'conn, IPD, V>>
997{
998    #[cfg(feature = "odbc_debug")]
999    fn readA<'stmt>(
1000        &mut self,
1001        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
1002        _: Option<&mut MaybeUninit<Self::StrLen>>,
1003    ) -> SQLRETURN {
1004        get_ard(self, StatementHandle)
1005    }
1006
1007    #[cfg(feature = "odbc_debug")]
1008    fn readW<'stmt>(
1009        &mut self,
1010        StatementHandle: &'stmt UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>,
1011        _: Option<&mut MaybeUninit<Self::StrLen>>,
1012    ) -> SQLRETURN {
1013        get_ard(self, StatementHandle)
1014    }
1015}
1016impl<'conn, 'desc, 'buf, V: OdbcVersion>
1017    private::BaseStmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_IMP_PARAM_DESC, V>
1018    for MaybeUninit<RefSQLHDESC<'conn, IPD, V>>
1019{
1020    #[cfg(feature = "odbc_debug")]
1021    fn readA<'stmt>(
1022        &mut self,
1023        StatementHandle: &'stmt SQLHSTMT<'conn, 'desc, 'buf, V>,
1024        _: Option<&mut MaybeUninit<Self::StrLen>>,
1025    ) -> SQLRETURN {
1026        get_ard(self, StatementHandle)
1027    }
1028
1029    #[cfg(feature = "odbc_debug")]
1030    fn readW<'stmt>(
1031        &mut self,
1032        StatementHandle: &'stmt SQLHSTMT<'conn, 'desc, 'buf, V>,
1033        _: Option<&mut MaybeUninit<Self::StrLen>>,
1034    ) -> SQLRETURN {
1035        get_ard(self, StatementHandle)
1036    }
1037}
1038impl<'conn, 'desc, 'buf, V: OdbcVersion>
1039    StmtAttr<'desc, 'buf, UnsafeSQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_IMP_PARAM_DESC, V>
1040    for MaybeUninit<RefUnsafeSQLHDESC<'conn, IPD, V>>
1041{
1042}
1043impl<'conn, 'desc, 'buf, V: OdbcVersion>
1044    StmtAttr<'desc, 'buf, SQLHSTMT<'conn, 'desc, 'buf, V>, SQL_ATTR_IMP_PARAM_DESC, V>
1045    for MaybeUninit<RefSQLHDESC<'conn, IPD, V>>
1046{
1047}
1048
1049unsafe impl<V: OdbcVersion> AttrGet<SQL_ATTR_IMP_PARAM_DESC>
1050    for MaybeUninit<RefUnsafeSQLHDESC<'_, IPD, V>>
1051{
1052}
1053
1054#[derive(Ident)]
1055#[identifier(SQLINTEGER, -1)]
1056#[allow(non_camel_case_types)]
1057pub struct SQL_ATTR_CURSOR_SCROLLABLE;
1058unsafe impl Attr<SQL_ATTR_CURSOR_SCROLLABLE> for CursorScrollable {
1059    type DefinedBy = OdbcDefined;
1060}
1061impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
1062    StmtAttr<'desc, 'buf, S, SQL_ATTR_CURSOR_SCROLLABLE, SQL_OV_ODBC3> for CursorScrollable
1063{
1064}
1065unsafe impl AttrGet<SQL_ATTR_CURSOR_SCROLLABLE> for CursorScrollable {}
1066unsafe impl AttrSet<SQL_ATTR_CURSOR_SCROLLABLE> for CursorScrollable {}
1067
1068#[derive(Ident)]
1069#[identifier(SQLINTEGER, -2)]
1070#[allow(non_camel_case_types)]
1071pub struct SQL_ATTR_CURSOR_SENSITIVITY;
1072unsafe impl Attr<SQL_ATTR_CURSOR_SENSITIVITY> for CursorSensitivity {
1073    type DefinedBy = OdbcDefined;
1074}
1075impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
1076    StmtAttr<'desc, 'buf, S, SQL_ATTR_CURSOR_SENSITIVITY, SQL_OV_ODBC3> for CursorSensitivity
1077{
1078}
1079unsafe impl AttrGet<SQL_ATTR_CURSOR_SENSITIVITY> for CursorSensitivity {}
1080unsafe impl AttrSet<SQL_ATTR_CURSOR_SENSITIVITY> for CursorSensitivity {}
1081
1082#[derive(Ident)]
1083#[identifier(SQLINTEGER, 10014)]
1084#[allow(non_camel_case_types)]
1085pub struct SQL_ATTR_METADATA_ID;
1086unsafe impl Attr<SQL_ATTR_METADATA_ID> for OdbcBool {
1087    type DefinedBy = OdbcDefined;
1088}
1089impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
1090    StmtAttr<'desc, 'buf, S, SQL_ATTR_METADATA_ID, SQL_OV_ODBC3> for OdbcBool
1091{
1092}
1093unsafe impl AttrGet<SQL_ATTR_METADATA_ID> for OdbcBool {}
1094unsafe impl AttrSet<SQL_ATTR_METADATA_ID> for OdbcBool {}
1095
1096#[derive(Ident)]
1097#[identifier(SQLINTEGER, 4)]
1098#[allow(non_camel_case_types)]
1099pub struct SQL_ATTR_ASYNC_ENABLE;
1100// TODO: For drivers with statement level asynchronous execution support,
1101// the statement attribute SQL_ATTR_ASYNC_ENABLE is read only
1102// This attribute is reexported in conn.rs
1103unsafe impl Attr<SQL_ATTR_ASYNC_ENABLE> for AsyncEnable {
1104    type DefinedBy = OdbcDefined;
1105}
1106impl<'desc, 'buf, S: Statement<'desc, 'buf, SQL_OV_ODBC3>>
1107    StmtAttr<'desc, 'buf, S, SQL_ATTR_ASYNC_ENABLE, SQL_OV_ODBC3> for AsyncEnable
1108{
1109}
1110unsafe impl AttrGet<SQL_ATTR_ASYNC_ENABLE> for AsyncEnable {}
1111unsafe impl AttrSet<SQL_ATTR_ASYNC_ENABLE> for AsyncEnable {}
1112
1113// TODO: Not found in implementation
1114// #[cfg(feature = "v3_8")]
1115// SQL_ATTR_ASYNC_STMT_PCALLBACK
1116// #[cfg(feature = "v3_8")]
1117// SQL_ATTR_ASYNC_STMT_PCONTEXT
1118
1119//=====================================================================================//
1120
1121#[odbc_type(SQLULEN)]
1122pub struct Noscan;
1123pub const SQL_NOSCAN_OFF: Noscan = Noscan(0);
1124pub const SQL_NOSCAN_ON: Noscan = Noscan(1);
1125
1126#[odbc_type(SQLULEN)]
1127pub struct CursorType;
1128pub const SQL_CURSOR_FORWARD_ONLY: CursorType = CursorType(0);
1129pub const SQL_CURSOR_KEYSET_DRIVEN: CursorType = CursorType(1);
1130pub const SQL_CURSOR_DYNAMIC: CursorType = CursorType(2);
1131pub const SQL_CURSOR_STATIC: CursorType = CursorType(3);
1132
1133#[odbc_type(SQLULEN)]
1134pub struct Concurrency;
1135pub const SQL_CONCUR_READ_ONLY: Concurrency = Concurrency(1);
1136pub const SQL_CONCUR_LOCK: Concurrency = Concurrency(2);
1137pub const SQL_CONCUR_ROWVER: Concurrency = Concurrency(3);
1138pub const SQL_CONCUR_VALUES: Concurrency = Concurrency(4);
1139
1140#[odbc_type(SQLULEN)]
1141pub struct SimulateCursor;
1142pub const SQL_SC_NON_UNIQUE: SimulateCursor = SimulateCursor(0);
1143pub const SQL_SC_TRY_UNIQUE: SimulateCursor = SimulateCursor(1);
1144pub const SQL_SC_UNIQUE: SimulateCursor = SimulateCursor(2);
1145
1146#[odbc_type(SQLULEN)]
1147pub struct RetrieveData;
1148pub const SQL_RD_OFF: RetrieveData = RetrieveData(0);
1149pub const SQL_RD_ON: RetrieveData = RetrieveData(1);
1150
1151#[odbc_type(SQLULEN)]
1152pub struct UseBookmarks;
1153pub const SQL_UB_OFF: UseBookmarks = UseBookmarks(0);
1154pub const SQL_UB_ON: UseBookmarks = UseBookmarks(1);
1155
1156#[odbc_type(SQLULEN)]
1157pub struct AsyncEnable;
1158pub const SQL_ASYNC_ENABLE_OFF: AsyncEnable = AsyncEnable(0);
1159pub const SQL_ASYNC_ENABLE_ON: AsyncEnable = AsyncEnable(1);
1160
1161#[odbc_type(SQLULEN)]
1162pub struct CursorScrollable;
1163pub const SQL_NONSCROLLABLE: CursorScrollable = CursorScrollable(0);
1164pub const SQL_SCROLLABLE: CursorScrollable = CursorScrollable(1);
1165
1166#[odbc_type(SQLULEN)]
1167pub struct CursorSensitivity;
1168pub const SQL_UNSPECIFIED: CursorSensitivity = CursorSensitivity(0);
1169pub const SQL_INSENSITIVE: CursorSensitivity = CursorSensitivity(1);
1170pub const SQL_SENSITIVE: CursorSensitivity = CursorSensitivity(2);