odbc_sys/sqlreturn.rs
1/// Indicates the overall success or failure of the function
2///
3/// Each function in ODBC returns a code, known as its return code, which indicates the overall
4/// success or failure of the function. Program logic is generally based on return codes.
5/// See [ODBC reference](https://docs.microsoft.com/en-us/sql/odbc/reference/develop-app/return-codes-odbc)
6#[must_use]
7#[derive(Debug, PartialEq, Eq, Clone, Copy)]
8#[repr(C)]
9pub struct SqlReturn(pub i16);
10
11impl SqlReturn {
12 /// `SQL_INVALID_HANDLE`; Function failed due to an invalid environment, connection, statement,
13 /// or descriptor handle.
14 ///
15 /// This indicates a programming error. No additional information is available from
16 /// `SQLGetDiagRec` or `SQLGetDiagField`. This code is returned only when the handle is a null
17 /// pointer or is the wrong type, such as when a statement handle is passed for an argument a
18 /// connection handle.
19 pub const INVALID_HANDLE: SqlReturn = SqlReturn(-2);
20
21 /// Function failed
22 ///
23 /// The application calls `SQLGetDiagRec` or `SQLGetDiagField` to retrieve additional
24 /// information. The contents of any output arguments to the function are undefined.
25 pub const ERROR: SqlReturn = SqlReturn(-1);
26
27 /// Function completed successfully
28 ///
29 /// The application calls `SQLGetDiagField` to retrieve additional information from the header
30 /// record.
31 pub const SUCCESS: SqlReturn = SqlReturn(0);
32
33 /// Function completed successfully, possibly with a nonfatal error (warning)
34 ///
35 /// The application calls `SQLGetDiagRec` or `SQLGetDiagField` to retrieve additional
36 /// information.
37 pub const SUCCESS_WITH_INFO: SqlReturn = SqlReturn(1);
38
39 /// A function that was started asynchronously is still executing
40 ///
41 /// The application `SQLGetDiagRec` or `SQLGetDiagField` to retrieve additional information if
42 /// any.
43 pub const STILL_EXECUTING: SqlReturn = SqlReturn(2);
44
45 /// More data is needed
46 ///
47 /// ,such as when a parameter data is sent at execution time or additional connection
48 /// information is required. The application calls `SQLGetDiagRec` or `SQLGetDiagField` to
49 /// retrieve additional information, if any.
50 pub const NEED_DATA: SqlReturn = SqlReturn(99);
51
52 /// No more data was available
53 ///
54 /// The application calls `SQLGetDiagRec` or `SQLGetDiagField` to retrieve additional
55 /// information. One or more driver-defined status records in class 02xxx may be returned.
56 pub const NO_DATA: SqlReturn = SqlReturn(100);
57
58 #[cfg(feature = "odbc_version_3_80")]
59 pub const PARAM_DATA_AVAILABLE: SqlReturn = SqlReturn(101);
60}