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 use um::sqltypes::{
7     SQLHANDLE, SQLHDBC, SQLHENV, SQLHSTMT, SQLINTEGER, SQLLEN, SQLPOINTER, SQLRETURN, SQLSMALLINT,
8     SQLUSMALLINT,
9 };
10 pub const SQL_NULL_DATA: SQLLEN = -1;
11 pub const SQL_DATA_AT_EXEC: SQLLEN = -2;
12 pub const SQL_SUCCESS: SQLRETURN = 0;
13 pub const SQL_SUCCESS_WITH_INFO: SQLRETURN = 1;
14 pub const SQL_NO_DATA: SQLRETURN = 100;
15 pub const SQL_PARAM_DATA_AVAILABLE: SQLRETURN = 101;
16 pub const SQL_ERROR: SQLRETURN = -1;
17 pub const SQL_INVALID_HANDLE: SQLRETURN = -2;
18 pub const SQL_STILL_EXECUTING: SQLRETURN = 2;
19 pub const SQL_NEED_DATA: SQLRETURN = 99;
20 pub const SQL_NTS: SQLSMALLINT = -3;
21 pub const SQL_MAX_MESSAGE_LENGTH: usize = 512;
22 pub const SQL_DATE_LEN: usize = 10;
23 pub const SQL_TIME_LEN: usize = 8;
24 pub const SQL_TIMESTAMP_LEN: usize = 19;
25 pub const SQL_HANDLE_ENV: SQLSMALLINT = 1;
26 pub const SQL_HANDLE_DBC: SQLSMALLINT = 2;
27 pub const SQL_HANDLE_STMT: SQLSMALLINT = 3;
28 pub const SQL_HANDLE_DESC: SQLSMALLINT = 4;
29 pub const SQL_ATTR_OUTPUT_NTS: SQLINTEGER = 10001;
30 pub const SQL_ATTR_AUTO_IPD: SQLINTEGER = 10001;
31 pub const SQL_ATTR_METADATA_ID: SQLINTEGER = 10014;
32 pub const SQL_ATTR_APP_ROW_DESC: SQLINTEGER = 10010;
33 pub const SQL_ATTR_APP_PARAM_DESC: SQLINTEGER = 10011;
34 pub const SQL_ATTR_IMP_ROW_DESC: SQLINTEGER = 10012;
35 pub const SQL_ATTR_IMP_PARAM_DESC: SQLINTEGER = 10013;
36 pub const SQL_ATTR_CURSOR_SCROLLABLE: SQLINTEGER = -1;
37 pub const SQL_ATTR_CURSOR_SENSITIVITY: SQLINTEGER = -2;
38 pub const SQL_UNKNOWN_TYPE: SQLSMALLINT = 0;
39 pub const SQL_CHAR: SQLSMALLINT = 1;
40 pub const SQL_NUMERIC: SQLSMALLINT = 2;
41 pub const SQL_DECIMAL: SQLSMALLINT = 3;
42 pub const SQL_INTEGER: SQLSMALLINT = 4;
43 pub const SQL_SMALLINT: SQLSMALLINT = 5;
44 pub const SQL_FLOAT: SQLSMALLINT = 6;
45 pub const SQL_REAL: SQLSMALLINT = 7;
46 pub const SQL_DOUBLE: SQLSMALLINT = 8;
47 pub const SQL_DATETIME: SQLSMALLINT = 9;
48 pub const SQL_VARCHAR: SQLSMALLINT = 12;
49 pub const SQL_TYPE_DATE: SQLSMALLINT = 91;
50 pub const SQL_TYPE_TIME: SQLSMALLINT = 92;
51 pub const SQL_TYPE_TIMESTAMP: SQLSMALLINT = 93;
52 pub const SQL_NO_NULLS: SQLSMALLINT = 0;
53 pub const SQL_NULLABLE: SQLSMALLINT = 1;
54 pub const SQL_NULLABLE_UNKNOWN: SQLSMALLINT = 2;
55 pub const SQL_CLOSE: SQLUSMALLINT = 0;
56 pub const SQL_DROP: SQLUSMALLINT = 1;
57 pub const SQL_UNBIND: SQLUSMALLINT = 2;
58 pub const SQL_RESET_PARAMS: SQLUSMALLINT = 3;
59 pub const SQL_NULL_HANDLE: SQLHANDLE = 0 as SQLHANDLE;
60 extern "system" {
SQLAllocHandle( handleType: SQLSMALLINT, inputHandle: SQLHANDLE, outputHandle: *mut SQLHANDLE, ) -> SQLRETURN61     pub fn SQLAllocHandle(
62         handleType: SQLSMALLINT,
63         inputHandle: SQLHANDLE,
64         outputHandle: *mut SQLHANDLE,
65     ) -> SQLRETURN;
SQLDisconnect( connectionHandle: SQLHDBC, ) -> SQLRETURN66     pub fn SQLDisconnect(
67         connectionHandle: SQLHDBC,
68     ) -> SQLRETURN;
SQLFetch( statementHandle: SQLHSTMT, ) -> SQLRETURN69     pub fn SQLFetch(
70         statementHandle: SQLHSTMT,
71     ) -> SQLRETURN;
SQLFreeHandle( handleType: SQLSMALLINT, handle: SQLHANDLE, ) -> SQLRETURN72     pub fn SQLFreeHandle(
73         handleType: SQLSMALLINT,
74         handle: SQLHANDLE,
75     ) -> SQLRETURN;
SQLFreeStmt( statementHandle: SQLHSTMT, option: SQLUSMALLINT, ) -> SQLRETURN76     pub fn SQLFreeStmt(
77         statementHandle: SQLHSTMT,
78         option: SQLUSMALLINT,
79     ) -> SQLRETURN;
SQLGetData( statementHandle: SQLHSTMT, columnNumber: SQLUSMALLINT, targetType: SQLSMALLINT, targetValue: SQLPOINTER, bufferLength: SQLLEN, strLen_or_IndPtr: *mut SQLLEN, ) -> SQLRETURN80     pub fn SQLGetData(
81         statementHandle: SQLHSTMT,
82         columnNumber: SQLUSMALLINT,
83         targetType: SQLSMALLINT,
84         targetValue: SQLPOINTER,
85         bufferLength: SQLLEN,
86         strLen_or_IndPtr: *mut SQLLEN,
87     ) -> SQLRETURN;
SQLNumResultCols( statementHandle: SQLHSTMT, columnCount: *mut SQLSMALLINT, ) -> SQLRETURN88     pub fn SQLNumResultCols(
89         statementHandle: SQLHSTMT,
90         columnCount: *mut SQLSMALLINT,
91     ) -> SQLRETURN;
SQLRowCount( statementHandle: SQLHSTMT, rowCount: *mut SQLLEN, ) -> SQLRETURN92     pub fn SQLRowCount(
93         statementHandle: SQLHSTMT,
94         rowCount: *mut SQLLEN,
95     ) -> SQLRETURN;
SQLSetConnectAttr( connectionHandle: SQLHDBC, attribute: SQLINTEGER, value: SQLPOINTER, stringLength: SQLINTEGER, ) -> SQLRETURN96     pub fn SQLSetConnectAttr(
97         connectionHandle: SQLHDBC,
98         attribute: SQLINTEGER,
99         value: SQLPOINTER,
100         stringLength: SQLINTEGER,
101     ) -> SQLRETURN;
SQLSetEnvAttr( environmentHandle: SQLHENV, attribute: SQLINTEGER, value: SQLPOINTER, stringLength: SQLINTEGER, ) -> SQLRETURN102     pub fn SQLSetEnvAttr(
103         environmentHandle: SQLHENV,
104         attribute: SQLINTEGER,
105         value: SQLPOINTER,
106         stringLength: SQLINTEGER,
107     ) -> SQLRETURN;
108 }
109