external/unixODBC/inc/odbc/sql.h      |  110 ++++++++++++++++++++++++++++++++++
 external/unixODBC/inc/odbc/sqlext.h   |  107 ++++++++++++++++++++++++++++++++-
 external/unixODBC/inc/odbc/sqltypes.h |   38 +++++++++++
 external/unixODBC/inc/odbc/sqlucode.h |    4 +
 4 files changed, 258 insertions(+), 1 deletion(-)

New commits:
commit 88982b04ae2c451a5af62f7fc6c9502414590f92
Author:     Julien Nabet <[email protected]>
AuthorDate: Thu Nov 4 17:50:09 2021 +0100
Commit:     Julien Nabet <[email protected]>
CommitDate: Thu Nov 4 17:50:37 2021 +0100

    Revert "tdf#132499: consider ODBCVER >= 0x0300 and remove tests about it 
(unixODBC)"
    
    This reverts commit 0464b86787da269be7b16a6f1f124d774f78fa97.
    
    Reason for revert: This kind of change should be made upstream
    
    Change-Id: I0dfe9ec198f826f636a7b2b2ba593b66c7e14c5a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124691
    Tested-by: Julien Nabet <[email protected]>
    Reviewed-by: Julien Nabet <[email protected]>

diff --git a/external/unixODBC/inc/odbc/sql.h b/external/unixODBC/inc/odbc/sql.h
index 743ef31bd7bc..0341340bb0d2 100644
--- a/external/unixODBC/inc/odbc/sql.h
+++ b/external/unixODBC/inc/odbc/sql.h
@@ -30,7 +30,9 @@ extern "C" {
 #define SQL_DATA_AT_EXEC          (-2)
 #define SQL_SUCCESS                0
 #define SQL_SUCCESS_WITH_INFO      1
+#if (ODBCVER >= 0x0300)
 #define SQL_NO_DATA              100
+#endif
 #define SQL_ERROR                 (-1)
 #define SQL_INVALID_HANDLE        (-2)
 #define SQL_STILL_EXECUTING        2
@@ -47,36 +49,49 @@ extern "C" {
 #define SQL_MAX_MESSAGE_LENGTH   512
 
 /* date/time length constants */
+#if (ODBCVER >= 0x0300)
 #define SQL_DATE_LEN           10
 #define SQL_TIME_LEN            8  /* add P+1 if precision is nonzero */
 #define SQL_TIMESTAMP_LEN      19  /* add P+1 if precision is nonzero */
+#endif
 
 /* handle type identifiers */
+#if (ODBCVER >= 0x0300)
 #define SQL_HANDLE_ENV             1
 #define SQL_HANDLE_DBC             2
 #define SQL_HANDLE_STMT            3
 #define SQL_HANDLE_DESC            4
+#endif
 
 /* environment attribute */
+#if (ODBCVER >= 0x0300)
 #define SQL_ATTR_OUTPUT_NTS    10001
+#endif
 
 /* connection attributes */
+#if (ODBCVER >= 0x0300)
 #define SQL_ATTR_AUTO_IPD      10001
 #define SQL_ATTR_METADATA_ID   10014
+#endif  /* ODBCVER >= 0x0300 */
 
 /* statement attributes */
+#if (ODBCVER >= 0x0300)
 #define SQL_ATTR_APP_ROW_DESC       10010
 #define SQL_ATTR_APP_PARAM_DESC     10011
 #define SQL_ATTR_IMP_ROW_DESC       10012
 #define SQL_ATTR_IMP_PARAM_DESC     10013
 #define SQL_ATTR_CURSOR_SCROLLABLE  (-1)
 #define SQL_ATTR_CURSOR_SENSITIVITY (-2)
+#endif
 
 /* SQL_ATTR_CURSOR_SCROLLABLE values */
+#if (ODBCVER >= 0x0300)
 #define SQL_NONSCROLLABLE           0
 #define SQL_SCROLLABLE              1
+#endif  /* ODBCVER >= 0x0300 */
 
 /* identifiers of fields in the SQL descriptor */
+#if (ODBCVER >= 0x0300)
 #define SQL_DESC_COUNT                  1001
 #define SQL_DESC_TYPE                   1002
 #define SQL_DESC_LENGTH                 1003
@@ -91,8 +106,10 @@ extern "C" {
 #define SQL_DESC_UNNAMED                1012
 #define SQL_DESC_OCTET_LENGTH           1013
 #define SQL_DESC_ALLOC_TYPE             1099
+#endif
 
 /* identifiers of fields in the diagnostics area */
+#if (ODBCVER >= 0x0300)
 #define SQL_DIAG_RETURNCODE        1
 #define SQL_DIAG_NUMBER            2
 #define SQL_DIAG_ROW_COUNT         3
@@ -105,8 +122,10 @@ extern "C" {
 #define SQL_DIAG_CONNECTION_NAME  10
 #define SQL_DIAG_SERVER_NAME      11
 #define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12
+#endif
 
 /* dynamic function codes */
+#if (ODBCVER >= 0x0300)
 #define SQL_DIAG_ALTER_DOMAIN           3
 #define SQL_DIAG_ALTER_TABLE            4
 #define SQL_DIAG_CALL                   7
@@ -137,6 +156,7 @@ extern "C" {
 #define SQL_DIAG_SELECT_CURSOR         85
 #define SQL_DIAG_UNKNOWN_STATEMENT      0
 #define SQL_DIAG_UPDATE_WHERE          82
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL data type codes */
 #define SQL_UNKNOWN_TYPE    0
@@ -148,38 +168,52 @@ extern "C" {
 #define SQL_FLOAT           6
 #define SQL_REAL            7
 #define SQL_DOUBLE          8
+#if (ODBCVER >= 0x0300)
 #define SQL_DATETIME        9
+#endif
 #define SQL_VARCHAR        12
 
 /* One-parameter shortcuts for date/time data types */
+#if (ODBCVER >= 0x0300)
 #define SQL_TYPE_DATE      91
 #define SQL_TYPE_TIME      92
 #define SQL_TYPE_TIMESTAMP 93
+#endif
 
 /* Statement attribute values for cursor sensitivity */
+#if (ODBCVER >= 0x0300)
 #define SQL_UNSPECIFIED     0
 #define SQL_INSENSITIVE     1
 #define SQL_SENSITIVE       2
+#endif
 
 /* GetTypeInfo() request for all data types */
 #define SQL_ALL_TYPES       0
 
 /* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */
+#if (ODBCVER >= 0x0300)
 #define SQL_DEFAULT        99
+#endif
 
 /* SQLGetData() code indicating that the application row descriptor
  * specifies the data type
  */
+#if (ODBCVER >= 0x0300)
 #define SQL_ARD_TYPE      (-99)
+#endif
 
 /* SQL date/time type subcodes */
+#if (ODBCVER >= 0x0300)
 #define SQL_CODE_DATE       1
 #define SQL_CODE_TIME       2
 #define SQL_CODE_TIMESTAMP  3
+#endif
 
 /* CLI option values */
+#if (ODBCVER >= 0x0300)
 #define SQL_FALSE           0
 #define SQL_TRUE            1
+#endif
 
 /* values of NULLABLE field in descriptor */
 #define SQL_NO_NULLS        0
@@ -193,17 +227,23 @@ extern "C" {
 /* Values returned by SQLGetTypeInfo() to show WHERE clause
  * supported
  */
+#if (ODBCVER >= 0x0300)
 #define SQL_PRED_NONE     0
 #define SQL_PRED_CHAR     1
 #define SQL_PRED_BASIC    2
+#endif
 
 /* values of UNNAMED field in descriptor */
+#if (ODBCVER >= 0x0300)
 #define SQL_NAMED           0
 #define SQL_UNNAMED         1
+#endif
 
 /* values of ALLOC_TYPE field in descriptor */
+#if (ODBCVER >= 0x0300)
 #define SQL_DESC_ALLOC_AUTO 1
 #define SQL_DESC_ALLOC_USER 2
+#endif
 
 /* FreeStmt() options */
 #define SQL_CLOSE           0
@@ -231,11 +271,15 @@ extern "C" {
 #define SQL_NULL_HENV       0
 #define SQL_NULL_HDBC       0
 #define SQL_NULL_HSTMT      0
+#if (ODBCVER >= 0x0300)
 #define SQL_NULL_HDESC      0
 #define SQL_NULL_DESC       0
+#endif
 
 /* null handle used in place of parent handle when allocating HENV */
+#if (ODBCVER >= 0x0300)
 #define SQL_NULL_HANDLE     NULL
+#endif
 
 /* Values that may appear in the result set of SQLSpecialColumns() */
 #define SQL_SCOPE_CURROW    0
@@ -243,11 +287,15 @@ extern "C" {
 #define SQL_SCOPE_SESSION   2
 
 #define SQL_PC_UNKNOWN      0
+#if (ODBCVER >= 0x0300)
 #define SQL_PC_NON_PSEUDO   1
+#endif
 #define SQL_PC_PSEUDO       2
 
 /* Reserved value for the IdentifierType argument of SQLSpecialColumns() */
+#if (ODBCVER >= 0x0300)
 #define SQL_ROW_IDENTIFIER  1
+#endif
 
 /* Reserved values for UNIQUE argument of SQLStatistics() */
 #define SQL_INDEX_UNIQUE    0
@@ -261,41 +309,61 @@ extern "C" {
 /* SQLGetFunctions() values to identify ODBC APIs */
 #define SQL_API_SQLALLOCCONNECT         1
 #define SQL_API_SQLALLOCENV             2
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLALLOCHANDLE       1001
+#endif
 #define SQL_API_SQLALLOCSTMT            3
 #define SQL_API_SQLBINDCOL              4
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLBINDPARAM         1002
+#endif
 #define SQL_API_SQLCANCEL               5
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLCLOSECURSOR       1003
 #define SQL_API_SQLCOLATTRIBUTE         6
+#endif
 #define SQL_API_SQLCOLUMNS             40
 #define SQL_API_SQLCONNECT              7
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLCOPYDESC          1004
+#endif
 #define SQL_API_SQLDATASOURCES         57
 #define SQL_API_SQLDESCRIBECOL          8
 #define SQL_API_SQLDISCONNECT           9
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLENDTRAN           1005
+#endif
 #define SQL_API_SQLERROR               10
 #define SQL_API_SQLEXECDIRECT          11
 #define SQL_API_SQLEXECUTE             12
 #define SQL_API_SQLFETCH               13
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLFETCHSCROLL       1021
+#endif
 #define SQL_API_SQLFREECONNECT         14
 #define SQL_API_SQLFREEENV             15
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLFREEHANDLE        1006
+#endif
 #define SQL_API_SQLFREESTMT            16
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLGETCONNECTATTR    1007
+#endif
 #define SQL_API_SQLGETCONNECTOPTION    42
 #define SQL_API_SQLGETCURSORNAME       17
 #define SQL_API_SQLGETDATA             43
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLGETDESCFIELD      1008
 #define SQL_API_SQLGETDESCREC        1009
 #define SQL_API_SQLGETDIAGFIELD      1010
 #define SQL_API_SQLGETDIAGREC        1011
 #define SQL_API_SQLGETENVATTR        1012
+#endif
 #define SQL_API_SQLGETFUNCTIONS        44
 #define SQL_API_SQLGETINFO             45
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLGETSTMTATTR       1014
+#endif
 #define SQL_API_SQLGETSTMTOPTION       46
 #define SQL_API_SQLGETTYPEINFO         47
 #define SQL_API_SQLNUMRESULTCOLS       18
@@ -303,14 +371,20 @@ extern "C" {
 #define SQL_API_SQLPREPARE             19
 #define SQL_API_SQLPUTDATA             49
 #define SQL_API_SQLROWCOUNT            20
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLSETCONNECTATTR    1016
+#endif
 #define SQL_API_SQLSETCONNECTOPTION    50
 #define SQL_API_SQLSETCURSORNAME       21
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLSETDESCFIELD      1017
 #define SQL_API_SQLSETDESCREC        1018
 #define SQL_API_SQLSETENVATTR        1019
+#endif
 #define SQL_API_SQLSETPARAM            22
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLSETSTMTATTR       1020
+#endif
 #define SQL_API_SQLSETSTMTOPTION       51
 #define SQL_API_SQLSPECIALCOLUMNS      52
 #define SQL_API_SQLSTATISTICS          53
@@ -318,10 +392,12 @@ extern "C" {
 #define SQL_API_SQLTRANSACT            23
 
 /* Information requested by SQLGetInfo() */
+#if (ODBCVER >= 0x0300)
 #define SQL_MAX_DRIVER_CONNECTIONS           0
 #define SQL_MAXIMUM_DRIVER_CONNECTIONS      SQL_MAX_DRIVER_CONNECTIONS
 #define SQL_MAX_CONCURRENT_ACTIVITIES        1
 #define SQL_MAXIMUM_CONCURRENT_ACTIVITIES   SQL_MAX_CONCURRENT_ACTIVITIES
+#endif
 #define SQL_DATA_SOURCE_NAME                 2
 #define SQL_FETCH_DIRECTION                  8
 #define SQL_SERVER_NAME                     13
@@ -375,9 +451,12 @@ extern "C" {
 #define SQL_MAXIMUM_TABLES_IN_SELECT       SQL_MAX_TABLES_IN_SELECT
 #define SQL_MAX_USER_NAME_LEN              107
 #define SQL_MAXIMUM_USER_NAME_LENGTH       SQL_MAX_USER_NAME_LEN
+#if (ODBCVER >= 0x0300)
 #define SQL_OJ_CAPABILITIES                115
 #define SQL_OUTER_JOIN_CAPABILITIES        SQL_OJ_CAPABILITIES
+#endif /* ODBCVER >= 0x0300 */
 
+#if (ODBCVER >= 0x0300)
 #define SQL_XOPEN_CLI_YEAR               10000
 #define SQL_CURSOR_SENSITIVITY           10001
 #define SQL_DESCRIBE_PARAMETER           10002
@@ -385,11 +464,13 @@ extern "C" {
 #define SQL_COLLATION_SEQ                10004
 #define SQL_MAX_IDENTIFIER_LEN           10005
 #define SQL_MAXIMUM_IDENTIFIER_LENGTH    SQL_MAX_IDENTIFIER_LEN
+#endif /* ODBCVER >= 0x0300 */
 
 /* SQL_ALTER_TABLE bitmasks */
 #define SQL_AT_ADD_COLUMN                       0x00000001L
 #define SQL_AT_DROP_COLUMN                      0x00000002L
 
+#if (ODBCVER >= 0x0300)
 #define SQL_AT_ADD_CONSTRAINT                   0x00000008L
 
 /* The following bitmasks are ODBC extensions and defined in sqlext.h
@@ -409,12 +490,15 @@ extern "C" {
 *#define SQL_AT_CONSTRAINT_DEFERRABLE               0x00040000L
 *#define SQL_AT_CONSTRAINT_NON_DEFERRABLE           0x00080000L
 */
+#endif  /* ODBCVER >= 0x0300 */
 
 
 /* SQL_ASYNC_MODE values */
+#if (ODBCVER >= 0x0300)
 #define SQL_AM_NONE                         0
 #define SQL_AM_CONNECTION                   1
 #define SQL_AM_STATEMENT                    2
+#endif
 
 /* SQL_CURSOR_COMMIT_BEHAVIOR values */
 #define SQL_CB_DELETE                       0
@@ -483,8 +567,10 @@ extern "C" {
 
     SQLRETURN  SQL_API SQLAllocEnv(SQLHENV *EnvironmentHandle);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLAllocHandle(SQLSMALLINT HandleType,
                                       SQLHANDLE InputHandle, SQLHANDLE 
*OutputHandle);
+#endif
 
     SQLRETURN  SQL_API SQLAllocStmt(SQLHDBC ConnectionHandle,
                                     SQLHSTMT *StatementHandle);
@@ -494,14 +580,17 @@ extern "C" {
                                   SQLPOINTER TargetValue, SQLLEN BufferLength,
                                   SQLLEN *StrLen_or_Ind);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLBindParam(SQLHSTMT StatementHandle,
                                     SQLUSMALLINT ParameterNumber, SQLSMALLINT 
ValueType,
                                     SQLSMALLINT ParameterType, SQLULEN 
LengthPrecision,
                                     SQLSMALLINT ParameterScale, SQLPOINTER 
ParameterValue,
                                     SQLLEN *StrLen_or_Ind);
+#endif
 
     SQLRETURN  SQL_API SQLCancel(SQLHSTMT StatementHandle);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLCloseCursor(SQLHSTMT StatementHandle);
 
     SQLRETURN  SQL_API SQLColAttribute(SQLHSTMT StatementHandle,
@@ -511,6 +600,7 @@ extern "C" {
                                         /* spec says (SQLPOINTER) not (SQLEN*) 
- PAH */ );
                                         /* Ms now say SQLLEN* 
http://msdn.microsoft.com/library/en-us/odbc/htm/dasdkodbcoverview_64bit.asp - 
NG */
 
+#endif
 
 
     SQLRETURN  SQL_API SQLColumns(SQLHSTMT StatementHandle,
@@ -525,8 +615,10 @@ extern "C" {
                                   SQLCHAR *UserName, SQLSMALLINT NameLength2,
                                   SQLCHAR *Authentication, SQLSMALLINT 
NameLength3);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLCopyDesc(SQLHDESC SourceDescHandle,
                                    SQLHDESC TargetDescHandle);
+#endif
 
     SQLRETURN  SQL_API SQLDataSources(SQLHENV EnvironmentHandle,
                                       SQLUSMALLINT Direction, SQLCHAR 
*ServerName,
@@ -542,8 +634,10 @@ extern "C" {
 
     SQLRETURN  SQL_API SQLDisconnect(SQLHDBC ConnectionHandle);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLEndTran(SQLSMALLINT HandleType, SQLHANDLE Handle,
                                   SQLSMALLINT CompletionType);
+#endif
 
     SQLRETURN  SQL_API SQLError(SQLHENV EnvironmentHandle,
                                 SQLHDBC ConnectionHandle, SQLHSTMT 
StatementHandle,
@@ -558,21 +652,27 @@ extern "C" {
 
     SQLRETURN  SQL_API SQLFetch(SQLHSTMT StatementHandle);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLFetchScroll(SQLHSTMT StatementHandle,
                                       SQLSMALLINT FetchOrientation, SQLLEN 
FetchOffset);
+#endif
 
     SQLRETURN  SQL_API SQLFreeConnect(SQLHDBC ConnectionHandle);
 
     SQLRETURN  SQL_API SQLFreeEnv(SQLHENV EnvironmentHandle);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLFreeHandle(SQLSMALLINT HandleType, SQLHANDLE Handle);
+#endif
 
     SQLRETURN  SQL_API SQLFreeStmt(SQLHSTMT StatementHandle,
                                    SQLUSMALLINT Option);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLGetConnectAttr(SQLHDBC ConnectionHandle,
                                          SQLINTEGER Attribute, SQLPOINTER 
Value,
                                          SQLINTEGER BufferLength, SQLINTEGER 
*StringLength);
+#endif
 
     SQLRETURN  SQL_API SQLGetConnectOption(SQLHDBC ConnectionHandle,
                                            SQLUSMALLINT Option, SQLPOINTER 
Value);
@@ -586,6 +686,7 @@ extern "C" {
                                   SQLPOINTER TargetValue, SQLLEN BufferLength,
                                   SQLLEN *StrLen_or_Ind);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN   SQLGetDescField(SQLHDESC DescriptorHandle,
                                 SQLSMALLINT RecNumber, SQLSMALLINT 
FieldIdentifier,
                                 SQLPOINTER Value, SQLINTEGER BufferLength,
@@ -611,6 +712,7 @@ extern "C" {
     SQLRETURN  SQL_API SQLGetEnvAttr(SQLHENV EnvironmentHandle,
                                      SQLINTEGER Attribute, SQLPOINTER Value,
                                      SQLINTEGER BufferLength, SQLINTEGER 
*StringLength);
+#endif  /* ODBCVER >= 0x0300 */
 
     SQLRETURN  SQL_API SQLGetFunctions(SQLHDBC ConnectionHandle,
                                        SQLUSMALLINT FunctionId, SQLUSMALLINT 
*Supported);
@@ -619,9 +721,11 @@ extern "C" {
                                   SQLUSMALLINT InfoType, SQLPOINTER InfoValue,
                                   SQLSMALLINT BufferLength, SQLSMALLINT 
*StringLength);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLGetStmtAttr(SQLHSTMT StatementHandle,
                                       SQLINTEGER Attribute, SQLPOINTER Value,
                                       SQLINTEGER BufferLength, SQLINTEGER 
*StringLength);
+#endif  /* ODBCVER >= 0x0300 */
 
     SQLRETURN  SQL_API SQLGetStmtOption(SQLHSTMT StatementHandle,
                                         SQLUSMALLINT Option, SQLPOINTER Value);
@@ -644,9 +748,11 @@ extern "C" {
     SQLRETURN  SQL_API SQLRowCount(SQLHSTMT StatementHandle,
                                    SQLLEN *RowCount);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLSetConnectAttr(SQLHDBC ConnectionHandle,
                                          SQLINTEGER Attribute, SQLPOINTER 
Value,
                                          SQLINTEGER StringLength);
+#endif /* ODBCVER >= 0x0300 */
 
     SQLRETURN  SQL_API SQLSetConnectOption(SQLHDBC ConnectionHandle,
                                            SQLUSMALLINT Option, SQLULEN Value);
@@ -654,6 +760,7 @@ extern "C" {
     SQLRETURN  SQL_API SQLSetCursorName(SQLHSTMT StatementHandle,
                                         SQLCHAR *CursorName, SQLSMALLINT 
NameLength);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLSetDescField(SQLHDESC DescriptorHandle,
                                        SQLSMALLINT RecNumber, SQLSMALLINT 
FieldIdentifier,
                                        SQLPOINTER Value, SQLINTEGER 
BufferLength);
@@ -668,6 +775,7 @@ extern "C" {
     SQLRETURN  SQL_API SQLSetEnvAttr(SQLHENV EnvironmentHandle,
                                      SQLINTEGER Attribute, SQLPOINTER Value,
                                      SQLINTEGER StringLength);
+#endif /* ODBCVER >= 0x0300 */
 
     SQLRETURN  SQL_API SQLSetParam(SQLHSTMT StatementHandle,
                                    SQLUSMALLINT ParameterNumber, SQLSMALLINT 
ValueType,
@@ -675,9 +783,11 @@ extern "C" {
                                    SQLSMALLINT ParameterScale, SQLPOINTER 
ParameterValue,
                                    SQLLEN *StrLen_or_Ind);
 
+#if (ODBCVER >= 0x0300)
     SQLRETURN  SQL_API SQLSetStmtAttr(SQLHSTMT StatementHandle,
                                       SQLINTEGER Attribute, SQLPOINTER Value,
                                       SQLINTEGER StringLength);
+#endif
 
     SQLRETURN  SQL_API SQLSetStmtOption(SQLHSTMT StatementHandle,
                                         SQLUSMALLINT Option, SQLULEN Value);
diff --git a/external/unixODBC/inc/odbc/sqlext.h 
b/external/unixODBC/inc/odbc/sqlext.h
index 5a1c5ff43f52..5ad540c8a282 100644
--- a/external/unixODBC/inc/odbc/sqlext.h
+++ b/external/unixODBC/inc/odbc/sqlext.h
@@ -61,9 +61,12 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_NO_DATA_FOUND   SQL_NO_DATA
 
 /* an end handle type */
+#if (ODBCVER >= 0x0300)
 #define SQL_HANDLE_SENV     5
+#endif  /* ODBCVER >= 0x0300 */
 
 /* env attribute */
+#if (ODBCVER >= 0x0300)
 #define SQL_ATTR_ODBC_VERSION               200
 #define SQL_ATTR_CONNECTION_POOLING         201
 #define SQL_ATTR_CP_MATCH                   202
@@ -72,7 +75,9 @@ extern "C" {                         /* Assume C declarations 
for C++ */
 #define SQL_ATTR_UNIXODBC_SYSPATH           65001
 #define SQL_ATTR_UNIXODBC_VERSION           65002
 #define SQL_ATTR_UNIXODBC_ENVATTR           65003
+#endif  /* ODBCVER >= 0x0300 */
 
+#if (ODBCVER >= 0x0300)
 /* values for SQL_ATTR_CONNECTION_POOLING */
 #define SQL_CP_OFF                          0UL
 #define SQL_CP_ONE_PER_DRIVER               1UL
@@ -87,6 +92,7 @@ extern "C" {                         /* Assume C declarations 
for C++ */
 /* values for SQL_ATTR_ODBC_VERSION */
 #define SQL_OV_ODBC2                        2UL
 #define SQL_OV_ODBC3                        3UL
+#endif  /* ODBCVER >= 0x0300 */
 
 /* connection attributes */
 #define SQL_ACCESS_MODE                 101
@@ -103,6 +109,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_PACKET_SIZE                 112
 
 /* connection attributes with new names */
+#if (ODBCVER >= 0x0300)
 #define SQL_ATTR_ACCESS_MODE        SQL_ACCESS_MODE
 #define SQL_ATTR_AUTOCOMMIT         SQL_AUTOCOMMIT
 #define SQL_ATTR_CONNECTION_TIMEOUT 113
@@ -119,6 +126,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_ATTR_TRANSLATE_LIB      SQL_TRANSLATE_DLL
 #define SQL_ATTR_TRANSLATE_OPTION   SQL_TRANSLATE_OPTION
 #define SQL_ATTR_TXN_ISOLATION      SQL_TXN_ISOLATION
+#endif  /* ODBCVER >= 0x0300 */
 
 #define SQL_ATTR_CONNECTION_DEAD    1209    /* GetConnectAttr only */
 
@@ -165,6 +173,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_CUR_USE_DRIVER              2UL
 #define SQL_CUR_DEFAULT                 SQL_CUR_USE_DRIVER
 
+#if (ODBCVER >= 0x0300)
 /* values for SQL_ATTR_DISCONNECT_BEHAVIOR */
 #define SQL_DB_RETURN_TO_POOL           0UL
 #define SQL_DB_DISCONNECT               1UL
@@ -172,6 +181,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 
 /* values for SQL_ATTR_ENLIST_IN_DTC */
 #define SQL_DTC_DONE                    0L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* values for SQL_ATTR_CONNECTION_DEAD */
 #define SQL_CD_TRUE                 1L      /* Connection is closed/dead */
@@ -201,6 +211,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_ROW_NUMBER          14      /*      GetStmtOption Only */
 
 /* statement attributes for ODBC 3.0 */
+#if (ODBCVER >= 0x0300)
 #define SQL_ATTR_ASYNC_ENABLE               4
 #define SQL_ATTR_CONCURRENCY                SQL_CONCURRENCY
 #define SQL_ATTR_CURSOR_TYPE                SQL_CURSOR_TYPE
@@ -228,24 +239,31 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_ATTR_SIMULATE_CURSOR            SQL_SIMULATE_CURSOR
 #define SQL_ATTR_USE_BOOKMARKS              SQL_USE_BOOKMARKS
 
+#endif  /* ODBCVER >= 0x0300 */
 
 /* New defines for SEARCHABLE column in SQLGetTypeInfo */
 
+#if (ODBCVER >= 0x0300)
 #define SQL_COL_PRED_CHAR       SQL_LIKE_ONLY
 #define SQL_COL_PRED_BASIC      SQL_ALL_EXCEPT_LIKE
+#endif /* ODBCVER >= 0x0300 */
 
 
 
 /* whether an attribute is a pointer or not */
+#if (ODBCVER >= 0x0300)
 #define SQL_IS_POINTER                          (-4)
 #define SQL_IS_UINTEGER                         (-5)
 #define SQL_IS_INTEGER                          (-6)
 #define SQL_IS_USMALLINT                        (-7)
 #define SQL_IS_SMALLINT                         (-8)
+#endif  /* ODBCVER >= 0x0300 */
 
 /* the value of SQL_ATTR_PARAM_BIND_TYPE */
+#if (ODBCVER >= 0x0300)
 #define SQL_PARAM_BIND_BY_COLUMN            0UL
 #define SQL_PARAM_BIND_TYPE_DEFAULT         SQL_PARAM_BIND_BY_COLUMN
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_QUERY_TIMEOUT options */
 #define SQL_QUERY_TIMEOUT_DEFAULT       0UL
@@ -306,10 +324,13 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_UB_DEFAULT                  SQL_UB_OFF
 
 /* New values for SQL_USE_BOOKMARKS attribute */
+#if (ODBCVER >= 0x0300)
 #define SQL_UB_FIXED                    SQL_UB_ON
 #define SQL_UB_VARIABLE                 2UL
+#endif  /* ODBCVER >= 0x0300 */
 
 /* extended descriptor field */
+#if (ODBCVER >= 0x0300)
 #define SQL_DESC_ARRAY_SIZE                     20
 #define SQL_DESC_ARRAY_STATUS_PTR               21
 #define SQL_DESC_AUTO_UNIQUE_VALUE              SQL_COLUMN_AUTO_INCREMENT
@@ -341,16 +362,21 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_DESC_TABLE_NAME                     SQL_COLUMN_TABLE_NAME
 #define SQL_DESC_UNSIGNED                       SQL_COLUMN_UNSIGNED
 #define SQL_DESC_UPDATABLE                      SQL_COLUMN_UPDATABLE
+#endif /* ODBCVER >= 0x0300 */
 
 
 /* defines for diagnostics fields */
+#if (ODBCVER >= 0x0300)
 #define SQL_DIAG_CURSOR_ROW_COUNT           (-1249)
 #define SQL_DIAG_ROW_NUMBER                 (-1248)
 #define SQL_DIAG_COLUMN_NUMBER              (-1247)
+#endif /* ODBCVER >= 0x0300 */
 
 /* SQL extended datatypes */
 #define SQL_DATE                                9
+#if (ODBCVER >= 0x0300)
 #define SQL_INTERVAL                            10
+#endif  /* ODBCVER >= 0x0300 */
 #define SQL_TIME                                10
 #define SQL_TIMESTAMP                           11
 #define SQL_LONGVARCHAR                         (-1)
@@ -364,6 +390,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_GUID                (-11)
 #endif  /* ODBCVER >= 0x0350 */
 
+#if (ODBCVER >= 0x0300)
 /* interval code */
 #define SQL_CODE_YEAR               1
 #define SQL_CODE_MONTH              2
@@ -393,6 +420,22 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_INTERVAL_HOUR_TO_SECOND         (100 + SQL_CODE_HOUR_TO_SECOND)
 #define SQL_INTERVAL_MINUTE_TO_SECOND       (100 + SQL_CODE_MINUTE_TO_SECOND)
 
+#else
+#define SQL_INTERVAL_YEAR                       (-80)
+#define SQL_INTERVAL_MONTH                      (-81)
+#define SQL_INTERVAL_YEAR_TO_MONTH              (-82)
+#define SQL_INTERVAL_DAY                        (-83)
+#define SQL_INTERVAL_HOUR                       (-84)
+#define SQL_INTERVAL_MINUTE                     (-85)
+#define SQL_INTERVAL_SECOND                     (-86)
+#define SQL_INTERVAL_DAY_TO_HOUR                (-87)
+#define SQL_INTERVAL_DAY_TO_MINUTE              (-88)
+#define SQL_INTERVAL_DAY_TO_SECOND              (-89)
+#define SQL_INTERVAL_HOUR_TO_MINUTE             (-90)
+#define SQL_INTERVAL_HOUR_TO_SECOND             (-91)
+#define SQL_INTERVAL_MINUTE_TO_SECOND           (-92)
+#endif  /* ODBCVER >= 0x0300 */
+
 
 #define SQL_UNICODE             SQL_WCHAR
 #define SQL_UNICODE_VARCHAR     SQL_WVARCHAR
@@ -406,7 +449,9 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_C_SHORT   SQL_SMALLINT         /* SMALLINT                     */
 #define SQL_C_FLOAT   SQL_REAL             /* REAL                         */
 #define SQL_C_DOUBLE  SQL_DOUBLE           /* FLOAT, DOUBLE                */
+#if (ODBCVER >= 0x0300)
 #define SQL_C_NUMERIC       SQL_NUMERIC
+#endif  /* ODBCVER >= 0x0300 */
 #define SQL_C_DEFAULT 99
 
 #define SQL_SIGNED_OFFSET       (-20)
@@ -416,6 +461,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_C_DATE       SQL_DATE
 #define SQL_C_TIME       SQL_TIME
 #define SQL_C_TIMESTAMP  SQL_TIMESTAMP
+#if (ODBCVER >= 0x0300)
 #define SQL_C_TYPE_DATE                 SQL_TYPE_DATE
 #define SQL_C_TYPE_TIME                 SQL_TYPE_TIME
 #define SQL_C_TYPE_TIMESTAMP            SQL_TYPE_TIMESTAMP
@@ -432,10 +478,13 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_C_INTERVAL_HOUR_TO_MINUTE   SQL_INTERVAL_HOUR_TO_MINUTE
 #define SQL_C_INTERVAL_HOUR_TO_SECOND   SQL_INTERVAL_HOUR_TO_SECOND
 #define SQL_C_INTERVAL_MINUTE_TO_SECOND SQL_INTERVAL_MINUTE_TO_SECOND
+#endif  /* ODBCVER >= 0x0300 */
 #define SQL_C_BINARY     SQL_BINARY
 #define SQL_C_BIT        SQL_BIT
+#if (ODBCVER >= 0x0300)
 #define SQL_C_SBIGINT   (SQL_BIGINT+SQL_SIGNED_OFFSET)     /* SIGNED BIGINT */
 #define SQL_C_UBIGINT   (SQL_BIGINT+SQL_UNSIGNED_OFFSET)   /* UNSIGNED BIGINT 
*/
+#endif  /* ODBCVER >= 0x0300 */
 #define SQL_C_TINYINT    SQL_TINYINT
 #define SQL_C_SLONG      (SQL_C_LONG+SQL_SIGNED_OFFSET)    /* SIGNED INTEGER  
*/
 #define SQL_C_SSHORT     (SQL_C_SHORT+SQL_SIGNED_OFFSET)   /* SIGNED SMALLINT 
*/
@@ -444,7 +493,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_C_USHORT     (SQL_C_SHORT+SQL_UNSIGNED_OFFSET) /* UNSIGNED 
SMALLINT*/
 #define SQL_C_UTINYINT   (SQL_TINYINT+SQL_UNSIGNED_OFFSET) /* UNSIGNED 
TINYINT*/
 
-#if (SIZEOF_LONG_INT == 8) && !defined(BUILD_LEGACY_64_BIT_MODE)
+#if (ODBCVER >= 0x0300) && (SIZEOF_LONG_INT == 8) && 
!defined(BUILD_LEGACY_64_BIT_MODE)
 #define SQL_C_BOOKMARK   SQL_C_UBIGINT                     /* BOOKMARK        
*/
 #else
 #define SQL_C_BOOKMARK   SQL_C_ULONG                       /* BOOKMARK        
*/
@@ -456,18 +505,24 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 
 #define SQL_TYPE_NULL                   0
 
+#if (ODBCVER >= 0x0300)
 #define SQL_C_VARBOOKMARK       SQL_C_BINARY
+#endif  /* ODBCVER >= 0x0300 */
 
 /* define for SQL_DIAG_ROW_NUMBER and SQL_DIAG_COLUMN_NUMBER */
+#if (ODBCVER >= 0x0300)
 #define SQL_NO_ROW_NUMBER                       (-1)
 #define SQL_NO_COLUMN_NUMBER                    (-1)
 #define SQL_ROW_NUMBER_UNKNOWN                  (-2)
 #define SQL_COLUMN_NUMBER_UNKNOWN               (-2)
+#endif
 
 /* SQLBindParameter extensions */
 #define SQL_DEFAULT_PARAM            (-5)
 #define SQL_IGNORE                   (-6)
+#if (ODBCVER >= 0x0300)
 #define SQL_COLUMN_IGNORE           SQL_IGNORE
+#endif  /* ODBCVER >= 0x0300 */
 #define SQL_LEN_DATA_AT_EXEC_OFFSET  (-100)
 #define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
 
@@ -527,8 +582,10 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 /* are not in the X/Open spec.              */
 /********************************************/
 
+#if (ODBCVER >= 0x0300)
 #define SQL_API_SQLALLOCHANDLESTD   73
 #define SQL_API_SQLBULKOPERATIONS   24
+#endif /* ODBCVER >= 0x0300 */
 #define SQL_API_SQLBINDPARAMETER    72
 #define SQL_API_SQLBROWSECONNECT    55
 #define SQL_API_SQLCOLATTRIBUTES    6
@@ -583,12 +640,14 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 /*----------------------------------------------*/
 
 
+#if (ODBCVER >= 0x0300)
 #define SQL_API_ODBC3_ALL_FUNCTIONS 999
 #define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE    250     /* array of 250 words */
 
 
 #define SQL_FUNC_EXISTS(pfExists, uwAPI) ((*(((UWORD*) (pfExists)) + ((uwAPI) 
>> 4)) & (1 << ((uwAPI) & 0x000F)) ) ? SQL_TRUE : SQL_FALSE )
 
+#endif  /* ODBCVER >= 0x0300 */
 
 
 /************************************************/
@@ -688,6 +747,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 /* standard values are in sql.h.                 */
 /*-----------------------------------------------*/
 
+#if (ODBCVER >= 0x0300)
 #define SQL_ACTIVE_ENVIRONMENTS                 116
 #define SQL_ALTER_DOMAIN                        117
 
@@ -757,10 +817,12 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_DM_VER                              171
 #define SQL_INSERT_STATEMENT                    172
 #define SQL_UNION_STATEMENT                     SQL_UNION
+#endif  /* ODBCVER >= 0x0300 */
 
 #define SQL_DTC_TRANSITION_COST                 1750
 
 /* SQL_ALTER_TABLE bitmasks */
+#if (ODBCVER >= 0x0300)
 /* the following 5 bitmasks are defined in sql.h
 *#define SQL_AT_ADD_COLUMN                      0x00000001L
 *#define SQL_AT_DROP_COLUMN                     0x00000002L
@@ -781,6 +843,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE   0x00020000L
 #define SQL_AT_CONSTRAINT_DEFERRABLE            0x00040000L
 #define SQL_AT_CONSTRAINT_NON_DEFERRABLE        0x00080000L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_CONVERT_*  return value bitmasks */
 
@@ -803,6 +866,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_CVT_TIME                        0x00010000L
 #define SQL_CVT_TIMESTAMP                   0x00020000L
 #define SQL_CVT_LONGVARBINARY               0x00040000L
+#if (ODBCVER >= 0x0300)
 #define SQL_CVT_INTERVAL_YEAR_MONTH         0x00080000L
 #define SQL_CVT_INTERVAL_DAY_TIME           0x00100000L
 #define SQL_CVT_WCHAR                       0x00200000L
@@ -810,11 +874,14 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_CVT_WVARCHAR                    0x00800000L
 #define SQL_CVT_GUID                        0x01000000L
 
+#endif  /* ODBCVER >= 0x0300 */
 
 
 /* SQL_CONVERT_FUNCTIONS functions */
 #define SQL_FN_CVT_CONVERT                  0x00000001L
+#if (ODBCVER >= 0x0300)
 #define SQL_FN_CVT_CAST                     0x00000002L
+#endif  /* ODBCVER >= 0x0300 */
 
 
 /* SQL_STRING_FUNCTIONS functions */
@@ -838,13 +905,16 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_FN_STR_LOCATE_2                 0x00010000L
 #define SQL_FN_STR_SOUNDEX                  0x00020000L
 #define SQL_FN_STR_SPACE                    0x00040000L
+#if (ODBCVER >= 0x0300)
 #define SQL_FN_STR_BIT_LENGTH               0x00080000L
 #define SQL_FN_STR_CHAR_LENGTH              0x00100000L
 #define SQL_FN_STR_CHARACTER_LENGTH         0x00200000L
 #define SQL_FN_STR_OCTET_LENGTH             0x00400000L
 #define SQL_FN_STR_POSITION                 0x00800000L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_SQL92_STRING_FUNCTIONS */
+#if (ODBCVER >= 0x0300)
 #define SQL_SSF_CONVERT                     0x00000001L
 #define SQL_SSF_LOWER                       0x00000002L
 #define SQL_SSF_UPPER                       0x00000004L
@@ -853,6 +923,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_SSF_TRIM_BOTH                   0x00000020L
 #define SQL_SSF_TRIM_LEADING                0x00000040L
 #define SQL_SSF_TRIM_TRAILING               0x00000080L
+#endif /* ODBCVER >= 0x0300 */
 
 /* SQL_NUMERIC_FUNCTIONS functions */
 
@@ -882,12 +953,14 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_FN_NUM_TRUNCATE                 0x00800000L
 
 /* SQL_SQL92_NUMERIC_VALUE_FUNCTIONS */
+#if (ODBCVER >= 0x0300)
 #define SQL_SNVF_BIT_LENGTH                 0x00000001L
 #define SQL_SNVF_CHAR_LENGTH                0x00000002L
 #define SQL_SNVF_CHARACTER_LENGTH           0x00000004L
 #define SQL_SNVF_EXTRACT                    0x00000008L
 #define SQL_SNVF_OCTET_LENGTH               0x00000010L
 #define SQL_SNVF_POSITION                   0x00000020L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_TIMEDATE_FUNCTIONS functions */
 
@@ -908,15 +981,19 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_FN_TD_TIMESTAMPDIFF             0x00004000L
 #define SQL_FN_TD_DAYNAME                   0x00008000L
 #define SQL_FN_TD_MONTHNAME                 0x00010000L
+#if (ODBCVER >= 0x0300)
 #define SQL_FN_TD_CURRENT_DATE              0x00020000L
 #define SQL_FN_TD_CURRENT_TIME              0x00040000L
 #define SQL_FN_TD_CURRENT_TIMESTAMP         0x00080000L
 #define SQL_FN_TD_EXTRACT                   0x00100000L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_SQL92_DATETIME_FUNCTIONS */
+#if (ODBCVER >= 0x0300)
 #define SQL_SDF_CURRENT_DATE                0x00000001L
 #define SQL_SDF_CURRENT_TIME                0x00000002L
 #define SQL_SDF_CURRENT_TIMESTAMP           0x00000004L
+#endif /* ODBCVER >= 0x0300 */
 
 /* SQL_SYSTEM_FUNCTIONS functions */
 
@@ -940,6 +1017,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
  * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1,
  * SQL_KEYSET_CURSOR_ATTRIBUTES1, and SQL_STATIC_CURSOR_ATTRIBUTES1
  */
+#if (ODBCVER >= 0x0300)
 /* supported SQLFetchScroll FetchOrientation's */
 #define SQL_CA1_NEXT                        0x00000001L
 #define SQL_CA1_ABSOLUTE                    0x00000002L
@@ -967,11 +1045,13 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_CA1_BULK_UPDATE_BY_BOOKMARK     0x00020000L
 #define SQL_CA1_BULK_DELETE_BY_BOOKMARK     0x00040000L
 #define SQL_CA1_BULK_FETCH_BY_BOOKMARK      0x00080000L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* bitmasks for SQL_DYNAMIC_CURSOR_ATTRIBUTES2,
  * SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2,
  * SQL_KEYSET_CURSOR_ATTRIBUTES2, and SQL_STATIC_CURSOR_ATTRIBUTES2
  */
+#if (ODBCVER >= 0x0300)
 /* supported values for SQL_ATTR_SCROLL_CONCURRENCY */
 #define SQL_CA2_READ_ONLY_CONCURRENCY       0x00000001L
 #define SQL_CA2_LOCK_CONCURRENCY            0x00000002L
@@ -999,6 +1079,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_CA2_SIMULATE_NON_UNIQUE         0x00004000L
 #define SQL_CA2_SIMULATE_TRY_UNIQUE         0x00008000L
 #define SQL_CA2_SIMULATE_UNIQUE             0x00010000L
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_ODBC_API_CONFORMANCE values */
 
@@ -1084,8 +1165,10 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_GB_GROUP_BY_EQUALS_SELECT       0x0001
 #define SQL_GB_GROUP_BY_CONTAINS_SELECT     0x0002
 #define SQL_GB_NO_RELATION                  0x0003
+#if (ODBCVER >= 0x0300)
 #define SQL_GB_COLLATE                      0x0004
 
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_OWNER_USAGE masks */
 
@@ -1096,11 +1179,13 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_OU_PRIVILEGE_DEFINITION         0x00000010L
 
 /* SQL_SCHEMA_USAGE masks */
+#if (ODBCVER >= 0x0300)
 #define SQL_SU_DML_STATEMENTS           SQL_OU_DML_STATEMENTS
 #define SQL_SU_PROCEDURE_INVOCATION     SQL_OU_PROCEDURE_INVOCATION
 #define SQL_SU_TABLE_DEFINITION         SQL_OU_TABLE_DEFINITION
 #define SQL_SU_INDEX_DEFINITION         SQL_OU_INDEX_DEFINITION
 #define SQL_SU_PRIVILEGE_DEFINITION     SQL_OU_PRIVILEGE_DEFINITION
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_QUALIFIER_USAGE masks */
 
@@ -1110,12 +1195,14 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_QU_INDEX_DEFINITION             0x00000008L
 #define SQL_QU_PRIVILEGE_DEFINITION         0x00000010L
 
+#if (ODBCVER >= 0x0300)
 /* SQL_CATALOG_USAGE masks */
 #define SQL_CU_DML_STATEMENTS           SQL_QU_DML_STATEMENTS
 #define SQL_CU_PROCEDURE_INVOCATION     SQL_QU_PROCEDURE_INVOCATION
 #define SQL_CU_TABLE_DEFINITION         SQL_QU_TABLE_DEFINITION
 #define SQL_CU_INDEX_DEFINITION         SQL_QU_INDEX_DEFINITION
 #define SQL_CU_PRIVILEGE_DEFINITION     SQL_QU_PRIVILEGE_DEFINITION
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_SUBQUERIES masks */
 
@@ -1173,6 +1260,7 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 
 /* Here start return values for ODBC 3.0 SQLGetInfo */
 
+#if (ODBCVER >= 0x0300)
 /* SQL_AGGREGATE_FUNCTIONS bitmasks */
 #define SQL_AF_AVG                      0x00000001L
 #define SQL_AF_COUNT                    0x00000002L
@@ -1468,14 +1556,17 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 #define SQL_US_UNION                            SQL_U_UNION
 #define SQL_US_UNION_ALL                        SQL_U_UNION_ALL
 
+#endif  /* ODBCVER >= 0x0300 */
 
 /* SQL_DTC_TRANSITION_COST bitmasks */
 #define SQL_DTC_ENLIST_EXPENSIVE                0x00000001L
 #define SQL_DTC_UNENLIST_EXPENSIVE              0x00000002L
 
 /* additional SQLDataSources fetch directions */
+#if (ODBCVER >= 0x0300)
 #define SQL_FETCH_FIRST_USER                31
 #define SQL_FETCH_FIRST_SYSTEM              32
+#endif  /* ODBCVER >= 0x0300 */
 
 
 /* Defines for SQLSetPos */
@@ -1490,10 +1581,12 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 /* Operations in SQLBulkOperations */
 #define SQL_ADD                      4
 #define SQL_SETPOS_MAX_OPTION_VALUE         SQL_ADD
+#if (ODBCVER >= 0x0300)
 #define SQL_UPDATE_BY_BOOKMARK       5
 #define SQL_DELETE_BY_BOOKMARK       6
 #define SQL_FETCH_BY_BOOKMARK        7
 
+#endif /*  ODBCVER >= 0x0300 */
 
 /* Lock options in SQLSetPos */
 #define SQL_LOCK_NO_CHANGE           0               /*      1.0 FALSE */
@@ -1529,9 +1622,11 @@ extern "C" {                         /* Assume C 
declarations for C++ */
 
 
 /* Defines for SQLTables */
+#if (ODBCVER >= 0x0300)
 #define SQL_ALL_CATALOGS                "%"
 #define SQL_ALL_SCHEMAS                 "%"
 #define SQL_ALL_TABLE_TYPES             "%"
+#endif  /* ODBCVER >= 0x0300 */
 
 /* Options for SQLDriverConnect */
 #define SQL_DRIVER_NOPROMPT             0
@@ -1561,11 +1656,14 @@ SQLRETURN SQL_API SQLDriverConnect(
 #define SQL_ROW_NOROW                    3
 #define SQL_ROW_ADDED                    4
 #define SQL_ROW_ERROR                    5
+#if (ODBCVER >= 0x0300)
 #define SQL_ROW_SUCCESS_WITH_INFO        6
 #define SQL_ROW_PROCEED                  0
 #define SQL_ROW_IGNORE                   1
+#endif
 
 /* value for SQL_DESC_ARRAY_STATUS_PTR */
+#if (ODBCVER >= 0x0300)
 #define SQL_PARAM_SUCCESS               0
 #define SQL_PARAM_SUCCESS_WITH_INFO     6
 #define SQL_PARAM_ERROR                 5
@@ -1574,6 +1672,7 @@ SQLRETURN SQL_API SQLDriverConnect(
 
 #define SQL_PARAM_PROCEED               0
 #define SQL_PARAM_IGNORE                1
+#endif  /* ODBCVER >= 0x0300 */
 
 /* Defines for SQLForeignKeys (UPDATE_RULE and DELETE_RULE) */
 #define SQL_CASCADE                      0
@@ -1582,6 +1681,7 @@ SQLRETURN SQL_API SQLDriverConnect(
 #define SQL_NO_ACTION            3
 #define SQL_SET_DEFAULT          4
 
+#if (ODBCVER >= 0x0300)
 /* Note that the following are in a different column of SQLForeignKeys than */
 /* the previous #defines.   These are for DEFERRABILITY.                    */
 
@@ -1589,6 +1689,7 @@ SQLRETURN SQL_API SQLDriverConnect(
 #define SQL_INITIALLY_IMMEDIATE         6
 #define SQL_NOT_DEFERRABLE          7
 
+#endif  /* ODBCVER >= 0x0300 */
 
 /* Defines for SQLBindParameter and
                            SQLProcedureColumns (returned in the result set) */
@@ -1645,9 +1746,11 @@ SQLRETURN SQL_API SQLBrowseConnect(
     SQLSMALLINT        cbConnStrOutMax,
     SQLSMALLINT       *pcbConnStrOut);
 
+#if (ODBCVER >= 0x0300)
 SQLRETURN   SQL_API SQLBulkOperations(
     SQLHSTMT            StatementHandle,
     SQLSMALLINT         Operation);
+#endif  /* ODBCVER >= 0x0300 */
 
 SQLRETURN SQL_API SQLColAttributes(
     SQLHSTMT           hstmt,
@@ -1810,10 +1913,12 @@ SQLRETURN SQL_API SQLBindParameter(
 #define SQL_MINUTE_TO_SECOND            SQL_CODE_MINUTE_TO_SECOND
 #endif /* ODBC_STD */
 
+#if (ODBCVER >= 0x0300)
 SQLRETURN SQL_API SQLAllocHandleStd(
     SQLSMALLINT     fHandleType,
     SQLHANDLE       hInput,
     SQLHANDLE      *phOutput);
+#endif
 
 /*      Deprecated defines from prior versions of ODBC */
 #define SQL_DATABASE_NAME               16    /* Use 
SQLGetConnectOption/SQL_CURRENT_QUALIFIER */
diff --git a/external/unixODBC/inc/odbc/sqltypes.h 
b/external/unixODBC/inc/odbc/sqltypes.h
index a1fbf837b44b..939c5d29bd60 100644
--- a/external/unixODBC/inc/odbc/sqltypes.h
+++ b/external/unixODBC/inc/odbc/sqltypes.h
@@ -131,10 +131,12 @@ typedef void*               HINSTANCE;
  ***************************/
 typedef unsigned char   SQLCHAR;
 
+#if (ODBCVER >= 0x0300)
 typedef unsigned char   SQLDATE;
 typedef unsigned char   SQLDECIMAL;
 typedef double          SQLDOUBLE;
 typedef double          SQLFLOAT;
+#endif
 
 /*
  * can't use a long it fails on 64 platforms
@@ -192,26 +194,42 @@ typedef SQLULEN         SQLTRANSID;
 typedef SQLLEN          SQLROWOFFSET;
 #endif
 
+#if (ODBCVER >= 0x0300)
 typedef unsigned char   SQLNUMERIC;
+#endif
 
 typedef void *          SQLPOINTER;
 
+#if (ODBCVER >= 0x0300)
 typedef float           SQLREAL;
+#endif
 
 typedef signed short int   SQLSMALLINT;
 typedef unsigned short  SQLUSMALLINT;
 
+#if (ODBCVER >= 0x0300)
 typedef unsigned char   SQLTIME;
 typedef unsigned char   SQLTIMESTAMP;
 typedef unsigned char   SQLVARCHAR;
+#endif
 
 typedef SQLSMALLINT     SQLRETURN;
 
+#if (ODBCVER >= 0x0300)
 typedef void *                  SQLHANDLE;
 typedef SQLHANDLE               SQLHENV;
 typedef SQLHANDLE               SQLHDBC;
 typedef SQLHANDLE               SQLHSTMT;
 typedef SQLHANDLE               SQLHDESC;
+#else
+typedef void *                  SQLHENV;
+typedef void *                  SQLHDBC;
+typedef void *                  SQLHSTMT;
+/*
+ * some things like PHP won't build without this
+ */
+typedef void *                  SQLHANDLE;
+#endif
 
 /****************************
  * These are cast into the actual struct that is being passed around. The
@@ -220,9 +238,15 @@ typedef SQLHANDLE               SQLHDESC;
  * These are deprecated in favour of SQLHENV, SQLHDBC, SQLHSTMT
  ***************************/
 
+#if (ODBCVER >= 0x0300)
 typedef SQLHANDLE               HENV;
 typedef SQLHANDLE               HDBC;
 typedef SQLHANDLE               HSTMT;
+#else
+typedef void *                  HENV;
+typedef void *                  HDBC;
+typedef void *                  HSTMT;
+#endif
 
 
 /****************************
@@ -268,7 +292,9 @@ typedef struct tagDATE_STRUCT
         SQLUSMALLINT   day;
 } DATE_STRUCT;
 
+#if (ODBCVER >= 0x0300)
 typedef DATE_STRUCT SQL_DATE_STRUCT;
+#endif
 
 typedef struct tagTIME_STRUCT
 {
@@ -277,7 +303,9 @@ typedef struct tagTIME_STRUCT
         SQLUSMALLINT   second;
 } TIME_STRUCT;
 
+#if (ODBCVER >= 0x0300)
 typedef TIME_STRUCT SQL_TIME_STRUCT;
+#endif
 
 typedef struct tagTIMESTAMP_STRUCT
 {
@@ -290,9 +318,12 @@ typedef struct tagTIMESTAMP_STRUCT
         SQLUINTEGER    fraction;
 } TIMESTAMP_STRUCT;
 
+#if (ODBCVER >= 0x0300)
 typedef TIMESTAMP_STRUCT    SQL_TIMESTAMP_STRUCT;
+#endif
 
 
+#if (ODBCVER >= 0x0300)
 typedef enum
 {
     SQL_IS_YEAR                     = 1,
@@ -310,7 +341,9 @@ typedef enum
     SQL_IS_MINUTE_TO_SECOND         = 13
 } SQLINTERVAL;
 
+#endif
 
+#if (ODBCVER >= 0x0300)
 typedef struct tagSQL_YEAR_MONTH
 {
         SQLUINTEGER     year;
@@ -337,10 +370,12 @@ typedef struct tagSQL_INTERVAL_STRUCT
 
 } SQL_INTERVAL_STRUCT;
 
+#endif
 
 #endif
 
 #ifndef ODBCINT64
+# if (ODBCVER >= 0x0300)
 # if (SIZEOF_LONG_INT == 8)
 #   define ODBCINT64        long
 #   define UODBCINT64   unsigned long
@@ -367,6 +402,7 @@ struct __bigint_struct_u
 #  endif
 # endif
 #endif
+#endif
 
 #ifdef ODBCINT64
 typedef ODBCINT64   SQLBIGINT;
@@ -379,6 +415,7 @@ typedef UODBCINT64  SQLUBIGINT;
 /****************************
  * cursor and bookmark
  ***************************/
+#if (ODBCVER >= 0x0300)
 #define SQL_MAX_NUMERIC_LEN     16
 typedef struct tagSQL_NUMERIC_STRUCT
 {
@@ -387,6 +424,7 @@ typedef struct tagSQL_NUMERIC_STRUCT
     SQLCHAR     sign;   /* 1=pos 0=neg */
     SQLCHAR     val[SQL_MAX_NUMERIC_LEN];
 } SQL_NUMERIC_STRUCT;
+#endif
 
 #if (ODBCVER >= 0x0350)
 #ifdef GUID_DEFINED
diff --git a/external/unixODBC/inc/odbc/sqlucode.h 
b/external/unixODBC/inc/odbc/sqlucode.h
index 0ecc21d4d23f..366dab75127a 100644
--- a/external/unixODBC/inc/odbc/sqlucode.h
+++ b/external/unixODBC/inc/odbc/sqlucode.h
@@ -94,6 +94,7 @@ SQLRETURN SQL_API SQLGetCursorNameW(
     SQLSMALLINT        cbCursorMax,
     SQLSMALLINT    *pcbCursor);
 
+#if (ODBCVER >= 0x0300)
 SQLRETURN  SQL_API SQLSetDescFieldW(SQLHDESC DescriptorHandle,
                                       SQLSMALLINT RecNumber,
                                    SQLSMALLINT FieldIdentifier,
@@ -143,6 +144,7 @@ SQLRETURN SQL_API SQLGetDiagRecW(
     SQLSMALLINT    *pcbErrorMsg);
 
 
+#endif
 
 
 SQLRETURN SQL_API SQLPrepareW(
@@ -440,6 +442,7 @@ SQLRETURN SQL_API SQLGetCursorNameA(
     SQLSMALLINT        cbCursorMax,
     SQLSMALLINT    *pcbCursor);
 
+#if (ODBCVER >= 0x0300)
 SQLRETURN SQL_API SQLGetDescFieldA(
     SQLHDESC           hdesc,
     SQLSMALLINT        iRecord,
@@ -488,6 +491,7 @@ SQLRETURN SQL_API SQLGetStmtAttrA(
     SQLINTEGER         cbValueMax,
     SQLINTEGER     *pcbValue);
 
+#endif
 
 SQLRETURN SQL_API   SQLGetTypeInfoA(
     SQLHSTMT            StatementHandle,

Reply via email to