Quellcode durchsuchen

Added database.odbc.

Brucey vor 3 Jahren
Ursprung
Commit
76f8ab11ec
100 geänderte Dateien mit 29819 neuen und 0 gelöschten Zeilen
  1. 282 0
      odbc.mod/common.bmx
  2. 30 0
      odbc.mod/doc/intro.bbdoc
  3. 45 0
      odbc.mod/iodbc/AUTHORS
  4. 16 0
      odbc.mod/iodbc/COPYING
  5. 2758 0
      odbc.mod/iodbc/ChangeLog
  6. 48 0
      odbc.mod/iodbc/IAFA-PACKAGE
  7. 229 0
      odbc.mod/iodbc/INSTALL
  8. 16 0
      odbc.mod/iodbc/LICENSE
  9. 29 0
      odbc.mod/iodbc/LICENSE.BSD
  10. 481 0
      odbc.mod/iodbc/LICENSE.LGPL
  11. 253 0
      odbc.mod/iodbc/Makefile.am
  12. 415 0
      odbc.mod/iodbc/NEWS
  13. 489 0
      odbc.mod/iodbc/PORT.OpenLink
  14. 400 0
      odbc.mod/iodbc/README
  15. 320 0
      odbc.mod/iodbc/README.md
  16. 104 0
      odbc.mod/iodbc/README_GIT
  17. 99 0
      odbc.mod/iodbc/README_GIT.md
  18. 187 0
      odbc.mod/iodbc/README_MACOSX
  19. 166 0
      odbc.mod/iodbc/README_MACOSX.md
  20. 109 0
      odbc.mod/iodbc/acinclude.m4
  21. 84 0
      odbc.mod/iodbc/admin/Makefile.am
  22. 196 0
      odbc.mod/iodbc/admin/gtk-2.0.m4
  23. 194 0
      odbc.mod/iodbc/admin/gtk.m4
  24. 93 0
      odbc.mod/iodbc/admin/libiodbc.pc.in
  25. 261 0
      odbc.mod/iodbc/admin/libiodbc.spec.in
  26. 150 0
      odbc.mod/iodbc/admin/mkinstalldirs
  27. 38 0
      odbc.mod/iodbc/admin/openlink.m4
  28. 208 0
      odbc.mod/iodbc/autogen.sh
  29. 74 0
      odbc.mod/iodbc/bin/Makefile.am
  30. 214 0
      odbc.mod/iodbc/bin/iodbc-config.in
  31. 774 0
      odbc.mod/iodbc/configure.ac
  32. 23 0
      odbc.mod/iodbc/debian/README.Debian
  33. 253 0
      odbc.mod/iodbc/debian/changelog
  34. 1 0
      odbc.mod/iodbc/debian/compat
  35. 64 0
      odbc.mod/iodbc/debian/control
  36. 82 0
      odbc.mod/iodbc/debian/copyright
  37. 1 0
      odbc.mod/iodbc/debian/iodbc.files
  38. 7 0
      odbc.mod/iodbc/debian/iodbc.install
  39. 4 0
      odbc.mod/iodbc/debian/iodbc.lintian-overrides
  40. 1 0
      odbc.mod/iodbc/debian/iodbc.undocumented
  41. 1 0
      odbc.mod/iodbc/debian/libiodbc2-dev.examples
  42. 7 0
      odbc.mod/iodbc/debian/libiodbc2-dev.files
  43. 11 0
      odbc.mod/iodbc/debian/libiodbc2-dev.install
  44. 5 0
      odbc.mod/iodbc/debian/libiodbc2.docs
  45. 2 0
      odbc.mod/iodbc/debian/libiodbc2.examples
  46. 3 0
      odbc.mod/iodbc/debian/libiodbc2.files
  47. 3 0
      odbc.mod/iodbc/debian/libiodbc2.install
  48. 2 0
      odbc.mod/iodbc/debian/libiodbc2.lintian-overrides
  49. 1 0
      odbc.mod/iodbc/debian/libiodbc2.undocumented
  50. 57 0
      odbc.mod/iodbc/debian/rules
  51. 3 0
      odbc.mod/iodbc/debian/watch
  52. 307 0
      odbc.mod/iodbc/drvproxy/ConfigDSN.c
  53. 205 0
      odbc.mod/iodbc/drvproxy/ConfigDriver.c
  54. 77 0
      odbc.mod/iodbc/drvproxy/Info.c
  55. 131 0
      odbc.mod/iodbc/drvproxy/Makefile.am
  56. 177 0
      odbc.mod/iodbc/drvproxy/drvconn.c
  57. 5 0
      odbc.mod/iodbc/drvproxy/drvproxy.exp
  58. 89 0
      odbc.mod/iodbc/drvproxy/gtk/Makefile.am
  59. 680 0
      odbc.mod/iodbc/drvproxy/gtk/gensetup.c
  60. 114 0
      odbc.mod/iodbc/drvproxy/gtk/gui.h
  61. 282 0
      odbc.mod/iodbc/drvproxy/gtk/loginbox.c
  62. 106 0
      odbc.mod/iodbc/drvproxy/gui.h
  63. 137 0
      odbc.mod/iodbc/drvproxy/login.c
  64. 126 0
      odbc.mod/iodbc/drvproxy/mac/Base.lproj/IODBCProxy_LoginController.xib
  65. 254 0
      odbc.mod/iodbc/drvproxy/mac/Base.lproj/IODBCProxy_SetupController.xib
  66. 99 0
      odbc.mod/iodbc/drvproxy/mac/IODBCProxy_LoginController.h
  67. 178 0
      odbc.mod/iodbc/drvproxy/mac/IODBCProxy_LoginController.m
  68. 110 0
      odbc.mod/iodbc/drvproxy/mac/IODBCProxy_SetupController.h
  69. 277 0
      odbc.mod/iodbc/drvproxy/mac/IODBCProxy_SetupController.m
  70. 92 0
      odbc.mod/iodbc/drvproxy/mac/confirm.c
  71. BIN
      odbc.mod/iodbc/drvproxy/mac/confirm.png
  72. 83 0
      odbc.mod/iodbc/drvproxy/mac/gensetup.c
  73. 87 0
      odbc.mod/iodbc/drvproxy/mac/gui.h
  74. 88 0
      odbc.mod/iodbc/drvproxy/mac/loginbox.c
  75. 88 0
      odbc.mod/iodbc/drvproxy/mac/utils.h
  76. 241 0
      odbc.mod/iodbc/drvproxy/mac/utils.m
  77. 75 0
      odbc.mod/iodbc/etc/Makefile.am
  78. 22 0
      odbc.mod/iodbc/etc/odbc.ini.sample
  79. 6 0
      odbc.mod/iodbc/etc/odbcinst.ini.sample
  80. 89 0
      odbc.mod/iodbc/include/Makefile.am
  81. 250 0
      odbc.mod/iodbc/include/iodbc.h
  82. 400 0
      odbc.mod/iodbc/include/iodbcext.h
  83. 83 0
      odbc.mod/iodbc/include/iodbcinst.h
  84. 160 0
      odbc.mod/iodbc/include/iodbcunix.h
  85. 84 0
      odbc.mod/iodbc/include/isql.h
  86. 84 0
      odbc.mod/iodbc/include/isqlext.h
  87. 84 0
      odbc.mod/iodbc/include/isqltypes.h
  88. 114 0
      odbc.mod/iodbc/include/macos_config.h
  89. 639 0
      odbc.mod/iodbc/include/odbcinst.h
  90. 1187 0
      odbc.mod/iodbc/include/sql.h
  91. 2573 0
      odbc.mod/iodbc/include/sqlext.h
  92. 429 0
      odbc.mod/iodbc/include/sqltypes.h
  93. 818 0
      odbc.mod/iodbc/include/sqlucode.h
  94. 115 0
      odbc.mod/iodbc/iodbc/Makefile.am
  95. 281 0
      odbc.mod/iodbc/iodbc/bmx_misc.c
  96. 2520 0
      odbc.mod/iodbc/iodbc/catalog.c
  97. 4036 0
      odbc.mod/iodbc/iodbc/connect.c
  98. 269 0
      odbc.mod/iodbc/iodbc/dlproc.c
  99. 121 0
      odbc.mod/iodbc/iodbc/dlproc.h
  100. 2054 0
      odbc.mod/iodbc/iodbc/execute.c

+ 282 - 0
odbc.mod/common.bmx

@@ -0,0 +1,282 @@
+' Copyright (c) 2007-2022 Bruce A Henderson
+' All rights reserved.
+'
+' Redistribution and use in source and binary forms, with or without
+' modification, are permitted provided that the following conditions are met:
+'     * Redistributions of source code must retain the above copyright
+'       notice, this list of conditions and the following disclaimer.
+'     * Redistributions in binary form must reproduce the above copyright
+'       notice, this list of conditions and the following disclaimer in the
+'       documentation and/or other materials provided with the distribution.
+'     * Neither the auther nor the names of its contributors may be used to 
+'       endorse or promote products derived from this software without specific
+'       prior written permission.
+'
+' THIS SOFTWARE IS PROVIDED BY Bruce A Henderson ``AS IS'' AND ANY
+' EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+' WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+' DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+' DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+' (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+' LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+' ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+' (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+' SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+'
+SuperStrict
+
+?linux
+Import "source.bmx"
+Import "src/include/*.h"
+Import "-ldl"
+?macos
+Import "source.bmx"
+Import "src/include/*.h"
+?win32
+Import "-lodbc32"
+?
+
+Import brl.blitz
+Import "odbchelper.c"
+
+Const SQL_AM_CONNECTION:Int = 1
+Const SQL_AM_NONE:Int = 0
+Const SQL_AM_STATEMENT:Int = 2
+Const SQL_API_SQLALLOCHANDLE:Int = 1001
+Const SQL_API_SQLBINDPARAM:Int = 1002
+Const SQL_API_SQLCLOSECURSOR:Int = 1003
+Const SQL_API_SQLCOLATTRIBUTE:Int = 6
+Const SQL_API_SQLCOPYDESC:Int = 1004
+Const SQL_API_SQLENDTRAN:Int = 1005
+Const SQL_API_SQLFETCHSCROLL:Int = 1021
+Const SQL_API_SQLFREEHANDLE:Int = 1006
+Const SQL_API_SQLGETCONNECTATTR:Int = 1007
+Const SQL_API_SQLGETDESCFIELD:Int = 1008
+Const SQL_API_SQLGETDESCREC:Int = 1009
+Const SQL_API_SQLGETDIAGFIELD:Int = 1010
+Const SQL_API_SQLGETDIAGREC:Int = 1011
+Const SQL_API_SQLGETENVATTR:Int = 1012
+Const SQL_API_SQLGETSTMTATTR:Int = 1014
+Const SQL_API_SQLSETCONNECTATTR:Int = 1016
+Const SQL_API_SQLSETDESCFIELD:Int = 1017
+Const SQL_API_SQLSETDESCREC:Int = 1018
+Const SQL_API_SQLSETENVATTR:Int = 1019
+Const SQL_API_SQLSETSTMTATTR:Int = 1020
+Const SQL_ARD_TYPE:Int = -99
+Const SQL_AT_ADD_CONSTRAINT:Int = 8
+Const SQL_ATTR_APP_PARAM_DESC:Int = 10011
+Const SQL_ATTR_APP_ROW_DESC:Int = 10010
+Const SQL_ATTR_AUTO_IPD:Int = 10001
+Const SQL_ATTR_CURSOR_SCROLLABLE:Int = -1
+Const SQL_ATTR_CURSOR_SENSITIVITY:Int = -2
+Const SQL_ATTR_IMP_PARAM_DESC:Int = 10013
+Const SQL_ATTR_IMP_ROW_DESC:Int = 10012
+Const SQL_ATTR_METADATA_ID:Int = 10014
+Const SQL_ATTR_OUTPUT_NTS:Int = 10001
+Const SQL_CATALOG_NAME:Int = 10003
+Const SQL_CODE_DATE:Int = 1
+Const SQL_CODE_TIME:Int = 2
+Const SQL_CODE_TIMESTAMP:Int = 3
+Const SQL_COLLATION_SEQ:Int = 10004
+Const SQL_CURSOR_SENSITIVITY:Int = 10001
+Const SQL_DATE_LEN:Int = 10
+Const SQL_DATETIME:Int = 9
+Const SQL_DEFAULT:Int = 99
+Const SQL_DESC_ALLOC_AUTO:Int = 1
+Const SQL_DESC_ALLOC_TYPE:Int = 1099
+Const SQL_DESC_ALLOC_USER:Int = 2
+Const SQL_DESC_COUNT:Int = 1001
+Const SQL_DESC_DATA_PTR:Int = 1010
+Const SQL_DESC_DATETIME_INTERVAL_CODE:Int = 1007
+Const SQL_DESC_INDICATOR_PTR:Int = 1009
+Const SQL_DESC_LENGTH:Int = 1003
+Const SQL_DESC_NAME:Int = 1011
+Const SQL_DESC_NULLABLE:Int = 1008
+Const SQL_DESC_OCTET_LENGTH:Int = 1013
+Const SQL_DESC_OCTET_LENGTH_PTR:Int = 1004
+Const SQL_DESC_PRECISION:Int = 1005
+Const SQL_DESC_SCALE:Int = 1006
+Const SQL_DESC_TYPE:Int = 1002
+Const SQL_DESC_UNNAMED:Int = 1012
+Const SQL_DESCRIBE_PARAMETER:Int = 10002
+Const SQL_DIAG_ALTER_DOMAIN:Int = 3
+Const SQL_DIAG_ALTER_TABLE:Int = 4
+Const SQL_DIAG_CALL:Int = 7
+Const SQL_DIAG_CLASS_ORIGIN:Int = 8
+Const SQL_DIAG_CONNECTION_NAME:Int = 10
+Const SQL_DIAG_CREATE_ASSERTION:Int = 6
+Const SQL_DIAG_CREATE_CHARACTER_SET:Int = 8
+Const SQL_DIAG_CREATE_COLLATION:Int = 10
+Const SQL_DIAG_CREATE_DOMAIN:Int = 23
+Const SQL_DIAG_CREATE_INDEX:Int = -1
+Const SQL_DIAG_CREATE_SCHEMA:Int = 64
+Const SQL_DIAG_CREATE_TABLE:Int = 77
+Const SQL_DIAG_CREATE_TRANSLATION:Int = 79
+Const SQL_DIAG_CREATE_VIEW:Int = 84
+Const SQL_DIAG_DELETE_WHERE:Int = 19
+Const SQL_DIAG_DROP_ASSERTION:Int = 24
+Const SQL_DIAG_DROP_CHARACTER_SET:Int = 25
+Const SQL_DIAG_DROP_COLLATION:Int = 26
+Const SQL_DIAG_DROP_DOMAIN:Int = 27
+Const SQL_DIAG_DROP_INDEX:Int = -2
+Const SQL_DIAG_DROP_SCHEMA:Int = 31
+Const SQL_DIAG_DROP_TABLE:Int = 32
+Const SQL_DIAG_DROP_TRANSLATION:Int = 33
+Const SQL_DIAG_DROP_VIEW:Int = 36
+Const SQL_DIAG_DYNAMIC_DELETE_CURSOR:Int = 38
+Const SQL_DIAG_DYNAMIC_FUNCTION:Int = 7
+Const SQL_DIAG_DYNAMIC_FUNCTION_CODE:Int = 12
+Const SQL_DIAG_DYNAMIC_UPDATE_CURSOR:Int = 81
+Const SQL_DIAG_GRANT:Int = 48
+Const SQL_DIAG_INSERT:Int = 50
+Const SQL_DIAG_MESSAGE_TEXT:Int = 6
+Const SQL_DIAG_NATIVE:Int = 5
+Const SQL_DIAG_NUMBER:Int = 2
+Const SQL_DIAG_RETURNCODE:Int = 1
+Const SQL_DIAG_REVOKE:Int = 59
+Const SQL_DIAG_ROW_COUNT:Int = 3
+Const SQL_DIAG_SELECT_CURSOR:Int = 85
+Const SQL_DIAG_SERVER_NAME:Int = 11
+Const SQL_DIAG_SQLSTATE:Int = 4
+Const SQL_DIAG_SUBCLASS_ORIGIN:Int = 9
+Const SQL_DIAG_UNKNOWN_STATEMENT:Int = 0
+Const SQL_DIAG_UPDATE_WHERE:Int = 82
+
+' handle types
+Const SQL_HANDLE_DBC:Int = 2
+Const SQL_HANDLE_DESC:Int = 4
+Const SQL_HANDLE_ENV:Int = 1
+Const SQL_HANDLE_STMT:Int = 3
+
+Const SQL_INSENSITIVE:Int = 1
+Const SQL_MAX_CONCURRENT_ACTIVITIES:Int = 1
+Const SQL_MAX_DRIVER_CONNECTIONS:Int = 0
+Const SQL_MAX_IDENTIFIER_LEN:Int = 10005
+Const SQL_MAXIMUM_CONCURRENT_ACTIVITIES:Int = SQL_MAX_CONCURRENT_ACTIVITIES
+Const SQL_MAXIMUM_DRIVER_CONNECTIONS:Int = SQL_MAX_DRIVER_CONNECTIONS
+Const SQL_MAXIMUM_IDENTIFIER_LENGTH:Int = SQL_MAX_IDENTIFIER_LEN
+Const SQL_NAMED:Int = 0
+Const SQL_NO_DATA:Int = 100
+Const SQL_NONSCROLLABLE:Int = 0
+Const SQL_NULL_HANDLE:Int = 0
+Const SQL_NULL_HDESC:Int = 0
+Const SQL_OJ_CAPABILITIES:Int = 115
+Const SQL_OUTER_JOIN_CAPABILITIES:Int = SQL_OJ_CAPABILITIES
+Const SQL_PC_NON_PSEUDO:Int = 1
+Const SQL_PRED_BASIC:Int = 2
+Const SQL_PRED_CHAR:Int = 1
+Const SQL_PRED_NONE:Int = 0
+Const SQL_ROW_IDENTIFIER:Int = 1
+Const SQL_SCROLLABLE:Int = 1
+Const SQL_SENSITIVE:Int = 2
+Const SQL_TIME_LEN:Int = 8
+Const SQL_TIMESTAMP_LEN:Int = 19
+
+' booleans
+Const SQL_FALSE:Int = 0
+Const SQL_TRUE:Int = 1
+
+Const SQL_TYPE_DATE:Int = 91
+Const SQL_TYPE_TIME:Int = 92
+Const SQL_TYPE_TIMESTAMP:Int = 93
+Const SQL_UNNAMED:Int = 1
+Const SQL_UNSPECIFIED:Int = 0
+Const SQL_XOPEN_CLI_YEAR:Int = 10000
+
+Const SQL_UNKNOWN_TYPE:Int = 0
+Const SQL_CHAR:Int = 1
+Const SQL_NUMERIC:Int = 2
+Const SQL_DECIMAL:Int = 3
+Const SQL_INTEGER:Int = 4
+Const SQL_SMALLINT:Int = 5
+Const SQL_FLOAT:Int = 6
+Const SQL_REAL:Int = 7
+Const SQL_DOUBLE:Int = 8
+Const SQL_ALL_TYPES:Int = 0
+Const SQL_LONGVARCHAR:Int = -1
+Const SQL_BINARY:Int = -2
+Const SQL_VARBINARY:Int = -3
+Const SQL_LONGVARBINARY:Int = -4
+Const SQL_BIGINT:Int = -5
+Const SQL_TINYINT:Int = -6
+Const SQL_BIT:Int = -7
+Const SQL_GUID:Int = -11
+Const SQL_DATE:Int = 9
+Const SQL_TIME:Int = 10
+Const SQL_TIMESTAMP:Int = 11
+
+' status values
+Const SQL_SUCCESS:Int = 0
+Const SQL_SUCCESS_WITH_INFO	:Int = 1
+Const SQL_STILL_EXECUTING:Int = 2
+Const SQL_ERROR:Int = -1
+Const SQL_INVALID_HANDLE:Int = -2
+Const SQL_NEED_DATA:Int = 99
+'Const SQL_NO_DATA:Int = 100
+
+Const SQL_NO_NULLS:Int = 0
+Const SQL_NULLABLE:Int = 1
+Const SQL_NULLABLE_UNKNOWN:Int = 2
+
+Const SQL_NULL_DATA:Int = -1
+Const SQL_DATA_AT_EXEC:Int = -2
+Const SQL_NO_TOTAL:Int = -4
+
+?win32
+Extern "win32"
+?linux
+Extern
+?macos
+Extern
+?
+'	Function SQLAllocHandle:Int(handleType:Int, inputHandle:Byte Ptr, outputHandle:Byte Ptr)
+
+
+
+End Extern
+
+Extern	
+	Function bmx_odbc_SQLAllocHandle:Int(_type:Int, a:Byte Ptr, handle:Byte Ptr)
+	Function bmx_odbc_freeEnvHandle:Int(handle:Byte Ptr)
+	Function bmx_odbc_freeStmtHandle:Int(handle:Byte Ptr)
+
+	Function bmx_odbc_envError:String(envHandle:Byte Ptr, code:Int Ptr)
+	Function bmx_odbc_connError:String(envHandle:Byte Ptr, code:Int Ptr)
+	Function bmx_odbc_stmtError:String(envHandle:Byte Ptr, code:Int Ptr)
+	Function bmx_odbc_setattr_odbc3(envHandle:Byte Ptr)
+	Function bmx_odbc_SQLDriverConnect:Int(handle:Byte Ptr, connectString:Byte Ptr, connLength:Int)
+	Function bmx_odbc_toggleTransaction:Int(handle:Byte Ptr, toggle:Int)
+	Function bmx_odbc_commitTransaction:Int(handle:Byte Ptr)
+	Function bmx_odbc_rollbackTransaction:Int(handle:Byte Ptr)
+	
+	Function bmx_odbc_disconnectAndFree(handle:Byte Ptr)
+	Function bmx_odbc_SQLRowCount:Int(stmt:Byte Ptr, num:Int Ptr)
+	
+	Function bmx_odbc_setForwardCursor:Int(stmt:Byte Ptr)
+	Function bmx_odbc_execute:Int(stmt:Byte Ptr, query:Byte Ptr, size:Int)
+	
+	Function bmx_odbc_SQLNumResultCols(stmt:Byte Ptr, count:Int Ptr)
+	Function bmx_odbc_SQLDescribeCol:Int(stmt:Byte Ptr, column:Int, columnName:Byte Ptr, bufferLength:Int, ..
+		nameLength:Int Ptr, dataType:Int Ptr, columnSize:Int Ptr, decimalDigits:Int Ptr, ..
+		nullable:Int Ptr)
+	Function bmx_odbc_SQLFetchScroll:Int(stmt:Byte Ptr)
+	
+	Function bmx_odbc_SQLGetData_int:Int(stmt:Byte Ptr, index:Int, value:Int Ptr, indicator:Int Ptr)
+	Function bmx_odbc_SQLGetData_long:Int(stmt:Byte Ptr, index:Int, value:Long Ptr, indicator:Int Ptr)
+	Function bmx_odbc_SQLGetData_double:Int(stmt:Byte Ptr, index:Int, value:Double Ptr, indicator:Int Ptr)
+	Function bmx_odbc_SQLGetData_string:Int(stmt:Byte Ptr, index:Int, buffer:Byte Ptr, bufferLength:Int, indicator:Int Ptr)
+	Function bmx_odbc_SQLGetData_datetime:Int(stmt:Byte Ptr, index:Int, y:Int Ptr, m:Int Ptr, d:Int Ptr, hh:Int Ptr, mm:Int Ptr, ss:Int Ptr, indicator:Int Ptr)
+	Function bmx_odbc_SQLGetData_date:Int(stmt:Byte Ptr, index:Int, y:Int Ptr, m:Int Ptr, d:Int Ptr, indicator:Int Ptr)
+	Function bmx_odbc_SQLGetData_time:Int(stmt:Byte Ptr, index:Int, hh:Int Ptr, mm:Int Ptr, ss:Int Ptr, indicator:Int Ptr)
+	
+	Function bmx_odbc_prepare:Int(stmt:Byte Ptr, query:Byte Ptr, size:Int)
+	Function bmx_odbc_executePrepared:Int(stmt:Byte Ptr)
+	
+	Function bmx_odbc_SQLBindParameter_int:Int(stmt:Byte Ptr, index:Int, value:Int Ptr, isNull:Int Ptr)
+	Function bmx_odbc_SQLBindParameter_double:Int(stmt:Byte Ptr, index:Int, value:Double Ptr, isNull:Int Ptr)
+	Function bmx_odbc_SQLBindParameter_long:Int(stmt:Byte Ptr, index:Int, value:Long Ptr, isNull:Int Ptr)
+	Function bmx_odbc_SQLBindParameter_string:Int(stmt:Byte Ptr, index:Int, value:Byte Ptr, length:Int, isNull:Int Ptr)
+	
+	Function bmx_odbc_SQLTables:Int(stmt:Byte Ptr, _type:Byte Ptr, length:Int)
+	
+End Extern

+ 30 - 0
odbc.mod/doc/intro.bbdoc

@@ -0,0 +1,30 @@
+<p>
+The DBODBC database driver allows you to connect to databases using ODBC through the standard API provided
+by the Database Framework module.
+</p>
+<h2>Requirements</h2>
+<p>To connect to databases via ODBC you will need the database-specific ODBC driver installed.</p>
+<p>Windows comes with some drivers as default - Jet/Access/etc.</p>
+<p>For other platforms/databases, see the database documentation for details of where to acquire drivers... (e.g. Oracle website for oracle drivers... etc)</p>
+<h3>Platform Specifics</h3>
+<p>Windows users may need to copy the file libodbc32.a from their MinGW distribution to their BlitzMax/lib folder. This is for compiling applications only. Since Windows comes with the relevant DLLs for using ODBC, runtime applications don't have any other dependencies. See your platform documentation for configuring ODBC data sources.</p>
+<p>For Linux/Mac, the iODBC library is provided, and is compiled into your applications.</p>
+<p>OS X comes with ODBC Administrator (in the Utilities folder) for configuring ODBC data sources.</p>
+<p>
+For linux, the <a href="http://www.iodbc.org">iODBC Website</a> describes how to set up ODBC data sources.
+</p>
+<h2>Accessing an ODBC Database</h2>
+<p>To enable an ODBC connection, you pass a <i>dbtype</i> of &quot;<b>ODBC</b>&quot; to the
+<a href="../../database.mod/doc/commands.html#LoadDatabase">LoadDatabase</a> function.
+</p>
+<p>The <i>server</i> parameter is the name of the DSN (data source name) through which you are connecting. If this is a FileDSN, you should provide this as a FULL path to the file.</p>
+<p>Depending on the DSN settings, the following parameters may, or may not, be required - things such as database, host, port, user, password can generally be defined in the DSN. Your mileage may vary.</p>
+<p>The second parameter <i>dbname</i> is the name of the database to connect to.</p>
+<p>The other parameters, <i>host</i>, <i>port</i>, <i>user</i> and <i>password</i> will vary in requirements depending on the type of database you are connecting to.
+</p>
+<h2>Prepared Statement Placeholders</h2>
+<p>ODBC uses the question mark - ? - notation for placeholders.<br>
+Each question mark represents a separate placeholder to which you need to bind a value.</p>
+<h2>SQL with ODBC</h2>
+<p>SQL syntanx with ODBC varies with the type of database you are connecting to. See the database-specific documentation for details.
+</p>

+ 45 - 0
odbc.mod/iodbc/AUTHORS

@@ -0,0 +1,45 @@
+#
+#  $Id$
+#
+#  List of Authors/Contributers
+#
+#  The iODBC driver manager
+#
+
+Original Author:
+----------------
+Ke Jin <[email protected]> 						(kj)
+
+
+Current Maintainer:
+-------------------
+Patrick van Kleef <[email protected]>				(pvk)
+
+
+Contributors:
+-------------
+Per Schroder <[email protected]>			 			(ps)
+  - Added VMS port
+
+George Kodinov <[email protected]> 	 		(gk)
+  - Added ODBC 3.x support
+
+Emmanuel Poitier <[email protected]>				(ep)
+  - Added iodbcinst support
+  - Added iodbcadm-gtk
+
+Christian Hammers <[email protected]>					(ch)
+  - Maintainer of iODBC packaging for the Debian project
+
+Sergei Malinin <[email protected]>				(sm)
+  - Added Unicode support
+
+Tim Haynes <webmaster{at}iodbc.org>					(th)
+  - Maintainer iODBC.org web site
+
+Max Khon <fjoe{at}samodelkin.net>					(mk)
+  - iODBC fixes and extentions
+
+
+This list is not complete. If you have contributed to this project and
+want to appear on this list, please email the current maintainer.

+ 16 - 0
odbc.mod/iodbc/COPYING

@@ -0,0 +1,16 @@
+iODBC Driver Manager
+Copyright (C) 1995 Ke Jin <[email protected]>
+Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+All Rights Reserved.
+
+This software is released under either the GNU Library General Public
+License (see LICENSE.LGPL) or the BSD License (see LICENSE.BSD).
+
+Note that the only valid version of the LGPL license as far as this
+project is concerned is the original GNU Library General Public License
+Version 2, dated June 1991.
+
+While not mandated by the BSD license, any patches you make to
+the iODBC may be contributed back into the iODBC project at your
+discretion. Contributions will benefit the Open Source and Data Access
+community as a whole. Submissions may be made at http://www.iodbc.org.

+ 2758 - 0
odbc.mod/iodbc/ChangeLog

@@ -0,0 +1,2758 @@
+2021-06-07  Patrick van Kleef  <[email protected]>
+
+	Updated NEWS
+
+	Updated README_MACOSX to add notes for macOS 11 Big Sur
+
+2021-05-20  Patrick van Kleef  <[email protected]>
+
+	Fixed iODBC Administrator base cpu flag for catalina and big sure builds
+
+	Fixed length of error message buffer
+
+2021-05-09  Patrick van Kleef  <[email protected]>
+
+	Fixed make distcheck
+
+	Fixed small portability issues and removed support for very old Mac OS X versions
+
+2021-05-09  Patrick van Kleef  <[email protected]>
+
+	Fixed use macOS instead of Mac OS X
+
+2021-04-28  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'feature/big_sur' into develop
+
+	Fixed title to show CPU architecture used
+
+2021-04-28  Patrick van Kleef  <[email protected]>
+
+	Upgraded to use recent versions of Xcode
+
+	* Minimum Xcode version is set to Xcode 8.0
+	* Minimum Mac OS deployment target is Mac OS X 10.9
+	* Migrated dialogs and plist files
+	* Migrated translation support
+	* Removed build support for older versions
+
+2021-04-12  Patrick van Kleef  <[email protected]>
+
+	Added support for building on Big Sur
+
+2021-04-12  Patrick van Kleef  <[email protected]>
+
+	Simplified build rules for Mac OS X and Mac OS 11
+
+	* Added support for building Apple Silicon on BigSur
+	* Fixed support for building i386 on Mojave and older
+	* Fixed backward compatible building for Mac OS 10.9 where possible
+	* Removed build rules for deprecated platforms Mac OS X 10.6 and older
+
+2021-04-12  Patrick van Kleef  <[email protected]>
+
+	Added missing import
+
+	Fixed local include files from <> to ""
+
+2021-02-24  Patrick van Kleef  <[email protected]>
+
+	Removed deprecated iODBCcfmbridge for PPC
+
+2021-02-24  Patrick van Kleef  <[email protected]>
+
+	Fixed dialog and menu definitions
+
+	The dialogs have been converted to the format used by Xcode 8 or
+	newer and are tagged to be compatible with machines running Mac OS
+	X 10.9 or newer.
+
+2021-02-24  Patrick van Kleef  <[email protected]>
+
+	Fixed pass iODBC version via environment variable to xcodebuild
+
+	Updated DOCTYPE of plist files
+
+	Updated version to 3.52.15 to start a new development cycle
+
+	Converted .strings files to UTF-8
+
+2021-02-17  Patrick van Kleef  <[email protected]>
+
+	Merge tag 'v3.52.14' into develop
+
+	Tagged for final release
+
+2021-02-17  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'release/3.52.14'
+
+	Updated version and build date for release 3.52.14
+
+	Updated ChangeLog and NEWS
+
+2021-02-17  Ted Thibodeau  <[email protected]>
+
+	Small documentation fixes
+
+2021-02-17  Patrick van Kleef  <[email protected]>
+
+	Fixed issue with return buffer
+
+	Fixed cast
+
+	Fixed argument type
+
+	Fixed mode flags
+
+	Fixed missing check on pcbConnStrOut
+
+2021-02-09  Patrick van Kleef  <[email protected]>
+
+	Fixed always build with PIC on linux
+
+	Updated version to 3.53.14-rc4
+
+2021-02-09  Sergey Malinin  <[email protected]>
+
+	SQLSetEnvAttr doesn't return SQL_SUCCESS for option SQL_ATTR_APP_UNICODE_TYPE
+
+2021-02-08  Patrick van Kleef  <[email protected]>
+
+	Updated version to 3.53.14-rc3
+
+2021-02-08  Sergey Malinin  <[email protected]>
+
+	Fix issue with switch ODBC driver to best supported unicode codepage
+
+2021-01-03  Patrick van Kleef  <[email protected]>
+
+	Updated Copyright to include 2021
+
+2020-05-29  Sergey Malinin  <[email protected]>
+
+	Remove outdated file
+
+	Remove old code
+
+	Fix __WtoU8()
+
+2020-05-20  Patrick van Kleef  <[email protected]>
+
+	Updated version to rc2
+
+2020-05-20  Sergey Malinin  <[email protected]>
+
+	Fix include files for /usr/local/iODBC/include
+
+2020-05-20  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'feature/2020_05_20_fix_SQLGetConnectOption' into develop
+
+2020-05-20  Sergey Malinin  <[email protected]>
+
+	Fix missprint in SQLBrowseConnect
+
+	SQLGetConnectOption returned wrong value for SQL_CURRENT_QUALIFIER and SQL_TRANSLATE_DLL for some cases
+
+2020-03-06  Sergey Malinin  <[email protected]>
+
+	Fix mixing calls to SQLFetchScroll with SQLFetch
+
+	Fix unicode conversion issues
+
+2020-03-05  Patrick van Kleef  <[email protected]>
+
+	Updated version to rc1
+
+2020-03-05  Sergey Malinin  <[email protected]>
+
+	Fix issues with Unicode <=> Ansi conversions, remove old Windows code
+
+2020-03-03  Patrick van Kleef  <[email protected]>
+
+	Fixed issues checking for underscore
+
+2020-03-03  Sergey Malinin  <[email protected]>
+
+	Add DataDirect options to iodbcext.h
+
+2020-03-01  Sergey Malinin  <[email protected]>
+
+	Fix for ansi buffers allocation
+
+2020-01-02  Patrick van Kleef  <[email protected]>
+
+	Updated Copyright
+
+2019-12-06  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'feature/2019_09_11_fix_ansi_conversions' into develop
+
+2019-12-06  Sergey Malinin  <[email protected]>
+
+	Increase size of buffers for Wide=>Ansi conversion
+
+	Update code for conversion between Ansi and Unicode
+
+2019-12-06  Patrick van Kleef  <[email protected]>
+
+	Fixed compiler warnings
+
+	Fixed issue with tracing
+
+	Fixed compiler warning
+
+2019-09-10  Patrick van Kleef  <[email protected]>
+
+	Updated build number
+
+2019-09-09  Sergey Malinin  <[email protected]>
+
+	Fix truncate data in SQLGetPrivateProfileStringW
+
+2019-08-15  Patrick van Kleef  <[email protected]>
+
+	Fixed small issues building on recent versions of Mac OS X
+
+2019-08-13  iODBC Maintainer  <[email protected]>
+
+	Updated version to 3.52.14
+
+2019-07-25  Patrick van Kleef  <[email protected]>
+
+	Fixed issue with older compilers
+
+2019-07-23  Sergey Malinin  <[email protected]>
+
+	Added initial support for Unicode UTF-8 and UTF-16 codepages
+
+	Enable transparent conversions between UCS4, UTF-8 and UTF-16 codepages
+
+2019-07-23  Patrick van Kleef  <[email protected]>
+
+	Update documentation
+
+	Started new development cycle 3.52.14
+
+2019-07-23  Patrick van Kleef  <[email protected]>
+
+	Merge tag 'v3.52.13' into develop
+
+	Tagged stable release
+
+2019-07-23  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'release/3.52.13'
+
+	Updated iODBC version to 03.52.13
+
+	Updated documentation
+
+	Merge branch 'feature/pthread_fix' into develop
+
+	Fixed small memory leaks
+
+	Fixed issue with memory use after free and potential memory leak
+
+2019-07-10  Patrick van Kleef  <[email protected]>
+
+	Fixed issue holding global lock too long in SQLError, SQLGetDiagRec and SQLGetDiagField
+
+2019-07-09  Patrick van Kleef  <[email protected]>
+
+	Disable empty initialization block
+
+2019-06-25  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'feature/fixes' into develop
+
+	Removed unneeded checks
+
+	Fixed package versioning
+
+	Fixed issue with arg expansion while generating config.nice script
+
+2019-06-25  Sergey Malinin  <[email protected]>
+
+	Fixed missing check for section
+
+	Fixed issue using heap after free in SQLConnect_internal
+
+	Fixed issue in Mac Cocoa code
+
+2019-05-02  Sergey Malinin  <[email protected]>
+
+	Fixed SQLSetStmtAttr to cache the correct values for SQL_ATTR_ROW_ARRAY_SIZE and SQL_ATTR_ROW_BIND_TYPE
+
+	Closes: 35
+
+2019-05-02  Sergey Malinin  <[email protected]>
+
+	Added missing define SQL_CONVERT_GUID
+
+	Closes: 31
+
+2019-01-01  Patrick van Kleef  <[email protected]>
+
+	Updated Copyright to include 2019
+
+2018-06-26  Adam Majer  <[email protected]>
+
+	non-void function needs to return a value
+
+2018-06-26  Sam Hatchett  <[email protected]>
+
+	fixes an issue where build fails on Alpine
+
+2018-06-26  Patrick van Kleef  <[email protected]>
+
+	Added extra validation for SQLAllocHandle (SQL_HANDLE_DESC, ...)
+
+	Fixed valgrind reporting write after free in SQLFreeHandle
+
+2018-01-02  Patrick van Kleef  <[email protected]>
+
+	Updated Copyright to 2018
+
+2017-11-01  iODBC Maintainer  <[email protected]>
+
+	Updated BUILD id to 171101
+
+2017-11-01  Sergey Malinin  <[email protected]>
+
+	Fix iODBC crash issue https://github.com/openlink/iODBC/issues/23
+
+2017-11-01  iODBC Maintainer  <[email protected]>
+
+	Fixed format specifiers and some casts to fix trace output
+
+	Added GCC __attribute__ for checking format string
+
+2017-01-11  Sergey Malinin  <[email protected]>
+
+	Fix iODBC apps/frameworks  CFBundleGetInfoString attribute
+
+2017-01-10  iODBC Maintainer  <[email protected]>
+
+	Updated copyright to include 2017
+
+2016-11-02  iODBC Maintainer  <[email protected]>
+
+	Fixed typo
+
+2016-07-12  iODBC Maintainer  <[email protected]>
+
+	Merge branch 'release/3.52.12' into develop
+
+	Merge branch 'release/3.52.12'
+
+	Updated version to 3.52.12 for final release
+
+	Updated NEWS and changelog
+
+	Fixed artifact in text conversion
+
+	Updated build number to 160712 for release
+
+	Regenerated text versions of README*.md files
+
+	Updated README files and converted them to MarkDown format
+
+	Fixed compiler warning
+
+2016-07-07  Patrick van Kleef  <[email protected]>
+
+	Fixed autoconf/automake warning
+
+	Renamed configure.in to configure.ac
+
+	Renamed bootstrap.sh to autogen.sh
+
+2016-07-07  iODBC Maintainer  <[email protected]>
+
+	Removed deprecated file
+
+	Merge branch 'feature/remove_carbon' into develop
+
+	Fixed indentation
+
+2016-07-05  iODBC Maintainer  <[email protected]>
+
+	Fixed typo
+
+2016-07-04  iODBC Maintainer  <[email protected]>
+
+	Ignore mac build directories
+
+	Removed hooks to call graphical bundles if not building frameworks
+
+	Fixed EXTRA_DIST to package all the new Cocoa based code
+
+	Fixed issues building on Mac OS X 10.10 and 10.11
+
+	Renamed mac_cocoa/ -> mac/
+
+	Removed old Carbon based UI code
+
+2016-06-21  Sergey Malinin  <[email protected]>
+
+	Fix UI
+
+	- rename title of dialog to "iODBC Data Source Administrator (64-Bit Edition)" for 64bit version
+	- fix crash for ODBC Driver Add and Configure UI
+
+2016-06-13  Sergey Malinin  <[email protected]>
+
+	Update iODBC UI
+
+	- update behavior for DoubleClick action in DSNchoose(execute OK) and DSNmanage(execute Configure) dialogs
+	- rewrite loader of file list for FileDSN to Cocoa
+
+2016-06-08  Sergey Malinin  <[email protected]>
+
+	Fix missprint
+
+	Update for OS X Office2016 fix for recreate properly link, when source file was deleted and recreated
+
+2016-06-07  Sergey Malinin  <[email protected]>
+
+	Fix issue with MSOffice2016 and UserDSN access
+
+2016-06-07  iODBC Maintainer  <[email protected]>
+
+	Fixed pool alloc
+
+2016-06-06  Sergey Malinin  <[email protected]>
+
+	Fix FileDSN tab, new button was added for choose FileDSN dir
+
+2016-06-03  Sergey Malinin  <[email protected]>
+
+	Fix issue when dialog getting lost behind another dialog
+
+2016-06-02  Sergey Malinin  <[email protected]>
+
+	Fix double free issue and update xib file for resolve resource compilation issue
+
+2016-05-31  iODBC Maintainer  <[email protected]>
+
+	Updated copyright to include 2016
+
+2016-05-30  Sergey Malinin  <[email protected]>
+
+	Fix Memory alloc issues in iODBC
+
+2016-05-26  iODBC Maintainer  <[email protected]>
+
+	Updated version to 3.52.12-dev to start next development cycle
+
+	Merge branch 'feature/2015_08_11_CocoaPort' into develop
+
+2016-05-26  Sergey Malinin  <[email protected]>
+
+	Fix typo 'divers' => 'drivers'
+
+2016-05-26  Sergey Malinin  <[email protected]>
+
+	Fix iODBC DM
+
+	- improve the starting speed of iODBC DM
+	- fix UI names 'iODBC Administrator'  => 'iODBC Administrator64'  in iODBC Administrator64.app
+
+2016-05-26  Sergey Malinin  <[email protected]>
+
+	Fix TLOGIN structure
+
+	Fixed issue with Proxy Login/Setup dialogs
+
+	Rename Makefiles
+
+	Fix resource localised paths and split iODBCDemo package on two packages
+
+	Remove cfrelease(bundle_dll) calls in connect.c
+
+	Remove cfrelease(bundle_dll) calls
+
+	Add latest changes
+
+	Fix permissions
+
+2016-05-26  Sergey Malinin  <[email protected]>
+
+	Add latest fixes for CocoaPort
+
+	- convert UI dialogs for Xcode4.6 format
+	- fix issue with release bundle ref
+	- update version to 3.52.12
+
+2016-05-26  Sergey Malinin  <[email protected]>
+
+	Fix iODBCdemo resources
+
+	Fix func for conversion char/wchar to NSString
+
+	Fix permissions
+
+	Fix UI, rename iODBCAdminitirator64bit to iODBCAdminitirator64
+
+	Fix iODBCadministrator
+
+	Fix year and update iODBC Administrator
+
+	Port iODBC DM to Cocoa UI
+
+2016-05-26  iODBC Maintainer  <[email protected]>
+
+	Merge branch 'release/3.52.11' into develop
+
+	Merge branch 'release/3.52.11'
+
+	Updated version to 3.52.11 for internal release
+
+2016-03-10  iODBC Maintainer  <[email protected]>
+
+	Added xcodebuild option for Mac OS X 10.11
+
+	Fixed issue with Xcode on Mac OS X 10.10 Xcode 7.2.1
+
+	Fixed use only major.minor of Mac OS X version to configure flags
+
+2016-03-03  iODBC Maintainer  <[email protected]>
+
+	Updated build numbers
+
+	Fixed merge issue
+
+	Updated Copyright to 2016
+
+2016-03-03  Bo Anderson  <[email protected]>
+
+	Fixed iODBCdrvproxy XIBs not compiling to NIBs on OS X.
+
+2016-01-12  iODBC Maintainer  <[email protected]>
+
+	Updated Copyright to 2016
+
+2015-09-28  OpenLink Software  <[email protected]>
+
+	Merge pull request #13 from Bo98/drvproxy-nib-fix
+
+	Fixed iODBCdrvproxy XIBs not compiling to NIBs on OS X
+
+2015-09-28  OpenLink Software  <[email protected]>
+
+	Merge pull request #10 from Bo98/drvconn-free-fix
+
+	Fixed crash when passing an empty connect string with no window handle
+
+2015-09-28  OpenLink Software  <[email protected]>
+
+	Merge pull request #11 from Bo98/osx-dev-build-fixes
+
+	Fixed iODBCadm and iODBCdrvproxy Development build errors on OS X
+
+2015-09-28  OpenLink Software  <[email protected]>
+
+	Merge pull request #12 from Bo98/create_dsnsetup-crash-fix
+
+	OS X: Fixed crash when create_dsnsetup fails to load the window
+
+2015-09-28  Bo Anderson  <[email protected]>
+
+	Fixed iODBCdrvproxy XIBs not compiling to NIBs on OS X.
+
+	Fixed crash when create_dsnsetup fails to load the window.
+
+	Fixed iODBCadm and iODBCdrvproxy Development build errors on OS X.
+
+	Fixed crash when passing an empty connect string with no window handle.
+
+2015-07-21  Sergey Malinin  <[email protected]>
+
+	Fix iODBCdemo issue with UID/PWD values
+
+2015-07-17  Sergey Malinin  <[email protected]>
+
+	Added support for x86_64 to iODBC Demo
+
+2015-07-15  Sergey Malinin  <[email protected]>
+
+	Fix crash ODBCdemo - error message overwrite stack data
+
+2015-07-13  Sergey Malinin  <[email protected]>
+
+	Fixed crash in iODBC DM on push of "Test" button when 64bit ODBC driver is used.
+
+2015-02-27  Sergey Malinin  <[email protected]>
+
+	Fixed issue in SQLGetInfo
+
+2015-02-10  iODBC Maintainer  <[email protected]>
+
+	Merge branch 'hotfix/3.52.10.1' into develop
+
+	Merge branch 'hotfix/3.52.10.1'
+
+	Added missing file to distribution
+
+	Updated version to 3.52.11-dev to signal start of new development cycle
+
+	Merge branch 'release/3.52.10' into develop
+
+	Merge branch 'release/3.52.10'
+
+	Updated NEWS
+
+	Updated version number to 3.52.10 for final release
+
+	Added missing files from distribution
+
+2015-02-06  Sergey Malinin  <[email protected]>
+
+	Fix Unicode conversion issues
+
+	- SQLGetDiagField(,,,SQL_DIAG_MESSAGE_TEXT,,,) - possible memory overwrite
+	- SQLGetDiagField() - output string truncation when SQLGetDiagFieldW is call with ANSI ODBC driver
+	- SQLGetConnectAttr() - output string truncation when SQLGetConnectAttrW is call with ANSI ODBC driver
+	- SQLGetDescField() - output string truncation when SQLGetDescFieldW is call with ANSI ODBC driver
+	- SQLColAttribute() - output string truncation when SQLColAttributeW is call with ANSI ODBC driver
+
+2015-02-05  iODBC Maintainer  <[email protected]>
+
+	Updated version to 3.52.10-rc1 for upcoming release
+
+	Updated NEWS
+
+	Updated version strings to 3.52.10 for upcoming release
+
+2015-02-05  Sergey Malinin  <[email protected]>
+
+	Fixed UI elements
+
+	* Use SingleLine attribute for all textFields
+	* Fixed messages below the various tabs
+
+2015-01-31  iODBC Maintainer  <[email protected]>
+
+	Install iODBC Administrator in /Applications/iODBC/
+
+2015-01-31  Patrick van Kleef  <[email protected]>
+
+	Ignore error if directory already exists
+
+	Renamedd OpenLink ODBC Administrator to iODBC Administrator
+
+	Fixed About dialog and other text to make a more generic Administrator
+
+2015-01-31  Sergey Malinin  <[email protected]>
+
+	Fixed FileDSN default path
+
+	From /Library/ODBC/ODBCDataSources => $HOME/Documents
+
+2015-01-31  Sergey Malinin  <[email protected]>
+
+	Fixed FileDSN save dialog and Set Trace file option
+
+2015-01-29  iODBC Maintainer  <[email protected]>
+
+	Fixed app names/titles to iODBC Demo Unicode and iODBC Demo Ansi
+
+	Fixed permissions
+
+2015-01-29  Sergey Malinin  <[email protected]>
+
+	Updated iODBCdemo on Mac OS X to support blue links in gridView
+
+2015-01-28  Sergey Malinin  <[email protected]>
+
+	Fixed issue with ~/Library/ODBC/odbc[inst].ini on Mac OS X
+
+	iODBC creates ~/.odbc[inst].ini when ~/Library/ODBC/odbc[inst].ini does not exist
+	* If $HOME/.odbc[inst].ini exists, import it and after this
+	  replace it with link to $HOME/Library/ODBC/.odbc[inst].ini
+	* open $HOME/Library/ODBC/odbc[inst].ini always and doesn't use $HOME/odbc[inst].ini
+
+2015-01-21  Sergey Malinin  <[email protected]>
+
+	Fixed Mac OS X file chooser dialogs to return long file names
+
+2015-01-07  iODBC Maintainer  <[email protected]>
+
+	Fixed About
+
+	Fixed branding
+
+	Fixed typo
+
+	Added build support for Mac OS X 10.10
+
+	Updated About dialogs
+
+	Updated copyright to include 2015
+
+2015-01-06  iODBC Maintainer  <[email protected]>
+
+	Updated iODBC version timestamp
+
+2015-01-06  Sergey Malinin  <[email protected]>
+
+	Fix  - OSX iODBC Demo.app shows gridView with columns, that could not be resized, for "SPARQL DESCRIBE..." queries
+
+2015-01-05  iODBC Maintainer  <[email protected]>
+
+	Updated copyright to include 2015
+
+2014-04-15  iODBC Maintainer  <[email protected]>
+
+	Updated version to 3.52.10-dev to signal start of new development cycle
+
+	Merge branch 'release/3.52.9' into develop
+
+	Merge branch 'release/3.52.9'
+
+	Updated Debian build files
+
+	Updated iODBC package version to 3.52.9 for final release
+
+2014-04-15  Patrick van Kleef  <[email protected]>
+
+	Updated NEWS
+
+	Merge fixes
+
+2014-04-15  iODBC Maintainer  <[email protected]>
+
+	Added support for Mac OS X 10.9
+
+2014-04-15  Patrick van Kleef  <[email protected]>
+
+	Removed ChangeLog as it is generated
+
+	Added unix build directories to ignore list
+
+2014-04-15  Patrick van Kleef  <[email protected]>
+
+	Partially reverted recent change for version autoconf/libtool
+
+	Recent changes did not work properly with the minimum required versions
+	of autoconf and libtool
+
+2014-04-15  Patrick van Kleef  <[email protected]>
+
+	Updated files to reflect minimum versions of autoconf/automake/libtool
+
+2014-04-01  iODBC Maintainer  <[email protected]>
+
+	Updated version to 3.32.9-dev
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Miscellaneous fixes from a developer from Teragram
+
+	configure.in:
+
+	* Rewrote the "underscore before symbols" code snippet to eliminate
+	   warnings (e.g. improper main() prototype) and potential optimizing-out
+	   of the fnord() function
+	* Use ${CFLAGS} with ${CC}, as the former may contain important flags
+	* Fail if pthread.h is not found, otherwise the configuration falls into
+	   a state where threading is enabled, but the header is missing
+
+	include/sqltypes.h:
+	* Need to check whether _MSC_VER is defined before using it in a cpp
+	   conditional, otherwise -Wundef gives a warning
+
+	iodbc/dlproc.h:
+	* Simplified the conditional affecting the definition of HDLL. (Is there
+	   any non-Win32 system that provides this type?)
+
+	http://sourceforge.net/p/iodbc/mailman/message/29560355/
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Build system updates
+
+	++ acinclude.m4
+	* Properly quote macro name in AC_DEFUN
+	* Use AC_LINK_IFELSE instead of the obsolete AC_TRY_LINK
+
+	++ admin/gtk-2.0.m4, admin/gtk.m4
+	* Properly quote macro name in AC_DEFUN
+
+	++ bootstrap.sh
+	* Call the various Autotools initialization programs with --warnings=all
+	   where applicable, to help with QA (and autoconf also gets no-obsolete so
+	   we don't hear about the obsolete usages still in the GTK m4 macros)
+
+	++ configure.in
+	* Use AC_CONFIG_HEADERS instead of the obsolete AM_CONFIG_HEADER
+	* Use AS_HELP_STRING instead of the obsolete AC_HELP_STRING
+	* Don't use A[CS]_HELP_STRING inside an echo "...", as this is not how the
+	   macro is intended to be used, and it doesn't do much good anyway
+	* Use AM_PROG_CC_C_O because AC_PROG_CC_C_O is not sufficient
+	* Replaced the obsolete AC_LIBTOOL_DLOPEN and AM_PROG_LIBTOOL macros with
+	   a call to LT_INIT
+	* Fixed the doc string for --disable-gui
+	* Use AC_RUN_IFELSE instead of the obsolete AC_TRY_RUN
+	* Can't use a variable in the doc string for --with-iodbc-filedsnpath, so
+	   replaced "$inidir" with "INIDIR"
+	* Rewrote the config info summary at the end to use "cat <<EOF" instead of
+	   a bunch of echo commands; this is more readable and makes getting the
+	   tabs right a *lot* easier
+
+	++ drvproxy/Makefile.am, drvproxy/gtk/Makefile.am, iodbc/Makefile.am,
+	    iodbc/trace/Makefile.am, iodbcadm/Makefile.am,
+	    iodbcadm/gtk/Makefile.am, iodbcinst/Makefile.am, samples/Makefile.am
+	* Use AM_CPPFLAGS instead of the obsolete variable name INCLUDES
+
+	http://sourceforge.net/p/iodbc/mailman/message/29590554/
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Fixed infinite loop in connection pool
+
+	http://sourceforge.net/p/iodbc/mailman/message/29986083/
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Fix build warning messages and using "strlen" function with unicode data
+
+	- fix build warning messages
+	- fix using strlen with unicode data
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Fix check, if Unicode driver is used
+
+	http://sourceforge.net/p/iodbc/mailman/message/31801152/
+
+2014-04-01  iODBC Maintainer  <[email protected]>
+
+	Merge branch 'feature/fix_pkg_config_and_odbc_config' into develop
+
+	Fixed typo
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Fixes for the pkg-config file and iodbc-config
+
+	http://sourceforge.net/p/iodbc/mailman/message/29721400/
+
+2014-04-01  Sergey Malinin  <[email protected]>
+
+	Fix issue, when SQLCancel is call from another thread
+
+	From a developer at MySQL/Sun/Oracle, an issue with SQLCancel()
+	http://sourceforge.net/p/iodbc/mailman/message/31944526/
+
+2014-03-27  Sergey Malinin  <[email protected]>
+
+	SQLInstallDriverEx does not work when driver library is read-only
+
+2014-02-17  iODBC Maintainer  <[email protected]>
+
+	Updated copyright year
+
+2013-01-08  iODBC Maintainer  <[email protected]>
+
+	Fixed missing declaration
+
+	Fixed issue with dladdr prototype on linux
+
+	Fixed issue with build dependancy when using make -j6
+
+	Fixed compiler warnings on newer Xcode compilers Mac OS X
+
+	Added support for Mac OS X 10.8
+
+	Added support for Mac OS X 10.8
+
+	Fixed issue with SDKs path on Mac OS X 10.7
+
+	Added support for Mac OS X 10.7
+
+	Fixed deprecated macro
+
+2013-01-04  Patrick van Kleef  <[email protected]>
+
+	Updated copyright to include 2013
+
+2012-03-27  Patrick van Kleef  <[email protected]>
+
+	Added missing file
+
+2012-03-27  Patrick van Kleef  <[email protected]>
+
+	Merge branch 'release/v3.52.8' into develop
+
+	Merge branch 'release/v3.52.8'
+
+	Updated documentation
+
+	Added info to NEWS
+
+	Updated changelog
+
+	Updated version number to 3.52.8
+
+	Added support for Mac OS X 10.7
+
+2012-03-26  Patrick van Kleef  <[email protected]>
+
+	Fixed list of files to be distributed
+
+	Updated version to 3.52.8-rc1
+
+	Removed old .cvsignore files
+
+	Merge branch 'feature/mac_ui' into develop
+
+	Updated version of iODBC Demo to 1.1
+
+	Converted build rules to compile the UI from new .xib files
+
+	Fixed problem installing CFMSupport
+
+	Converted old .nib format to .xib format
+
+	Added Mac OS X build files to ignore list
+
+	Added more files to ignore
+
+	Added initial .gitignore
+
+2012-03-12  Patrick van Kleef  <[email protected]>
+
+	* Updated copyright to 2012
+
+2011-08-10  Patrick van Kleef  <[email protected]>
+
+	* Fixed issue with using buffer after free
+
+	* Updated copyright year
+
+2010-09-04  Patrick van Kleef  <[email protected]>
+
+	* Fixed use ssize_t where appropriate
+
+	* Fixed compiler warning
+
+	* Fixed version info
+
+	* Fixed warnings
+
+	* Fixed issue with strlen if param can be NULL
+
+	* Fixed use ssize_t for length of string * Fixed tracing SQLGetData using multiple chunks * Fixed problem tracing on big-endian machines
+
+	* Removed unused variables
+
+	* Fixed wrong type label
+
+2009-09-10  Patrick van Kleef  <[email protected]>
+
+	* Fixed version
+
+	*** empty log message ***
+
+	*** empty log message ***
+
+	* Updated version of package to 3.52.7 for final release * Updated library versions
+
+	* Fixed loading libdrvproxy.so.2 and libiodbcadm.so.2 using major version   number. * Removed libdrvproxy.{a|so} and libiodbcadm.{a|so} from packaging   since they are not development libraries that user applications   should try to link with.
+
+	* Fixed instructions
+
+	*** empty log message ***
+
+	* Fixed distribution packaging
+
+2009-09-09  Patrick van Kleef  <[email protected]>
+
+	* Removed deprecated file
+
+	* Removed space from file name
+
+	* Moved iodbcunix.h from sql.h to sqltypes.h
+
+	* Fixed description
+
+	* Updated debian files
+
+	* Fixed compiler warnings
+
+	* Updated version info
+
+	* Fixed compile flags
+
+	* Fixed check for wchar.h on Mac framework build
+
+	* Moved symbol files
+
+	* Added install rules for iODBC CFM bridge
+
+	* Added iODBC CFM Bridge code
+
+	* Added support for overruling CFLAGS, CC and other environment vars
+
+	* Updated Mac OS X build instructions
+
+	* Fixed building/installing iODBC Demo Unicode version * Removed sudo from rules, user should perform 'sudo make install"
+
+2009-09-08  Patrick van Kleef  <[email protected]>
+
+	* Fixed portability between various versions of Mac OS X
+
+	* Updated version info
+
+	* Added support for building solaris 2.10 on AMD64 and Sparc
+
+	* Added support for Mac OS X 10.6
+
+	*** empty log message ***
+
+	* Added defines for Virtuoso ODBC SPASQL extensions
+
+	* Fixed case label for x86_64 linux systems
+
+	* Fixed compiler warning
+
+	* FIxed namespace for internal dlopen functions
+
+	* Added support for Mac OS X 10.6
+
+	* Added support for Mac OS X 10.5
+
+2009-09-07  Patrick van Kleef  <[email protected]>
+
+	* Fixed allow installation in temp directory structure
+
+	* Fixed typo
+
+	* More files to ignore
+
+	* Fixed install rules
+
+	* Fixed copyright year
+
+	* Fixed support to quit application from decoration
+
+	* Added iODBCdemo sample program for Mac OS X
+
+2009-09-02  Patrick van Kleef  <[email protected]>
+
+	* Fixed prototype
+
+	* Fixed find relevant section instead of reading all entries in the file
+
+2009-09-01  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Ignore files from libtool 2.x
+
+	* Set minimum requirement for auto* tools to match RedHat Enterprise 4
+
+	* Use newer RPM macros for building to fix building on x86_64 * Fixed configure to completely disable building UI extensions when   using rpmbuild --define 'noadmin 1' .....
+
+	* Fixed prototype
+
+	*** empty log message ***
+
+	*** empty log message ***
+
+	* Fixed group box size
+
+2009-08-31  Patrick van Kleef  <[email protected]>
+
+	* Fixed wrong text on tab
+
+2009-08-30  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Fixed unload bug  deref wrong pointer
+
+	* Added support for $S (sequence number) in TraceFile
+
+	* When tracefile length has reached its limit, try to open a new tracefile
+
+	* Fixed default window sizes
+
+	* Fixed typos
+
+	* Fixed typos
+
+	* Updated copyright year to 2009
+
+	* Fixed licensing information
+
+	* Fixed GTK based administrative code to use resizable windows
+
+2009-06-24  Patrick van Kleef  <[email protected]>
+
+	* Updated release number
+
+2009-02-23  Patrick van Kleef  <[email protected]>
+
+	* Moved Mac OS X gui components
+
+	* Moved Mac OS X gui components
+
+2009-02-16  Patrick van Kleef  <[email protected]>
+
+	* Added support for Mac OS X 10.5
+
+	* Fixed missing function
+
+	* Removed old endif
+
+2009-01-30  Sergey Malinin  <[email protected]>
+
+	* Added additional translations between unicode and ansi components (sm)
+
+	* Added additional translations between unicode and ansi components (sm)
+
+2008-10-30  Patrick van Kleef  <[email protected]>
+
+	* Updated spec file to latest standards
+
+2008-04-25  Patrick van Kleef  <[email protected]>
+
+	* Fixed Connection Pooling UI
+
+2008-03-14  Patrick van Kleef  <[email protected]>
+
+	* Fixed bug checking for odbc_ver on connect handle
+
+2007-10-08  Patrick van Kleef  <[email protected]>
+
+	* Updated version to 3.52.6 for final release (pvk)
+
+	*** empty log message ***
+
+	* Updated version to 3.52.6 for final release (pvk)
+
+	*** empty log message ***
+
+	* Fixed problem returning memory allocation error when max length of buffer   was set to 0.
+
+2007-10-07  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Updated instructions to get CVS tree from sourceforge archive
+
+	* Fixed checking for driver version when not connected
+
+	* Fixed typo
+
+	* Fixed for openbsd
+
+	* Fixed towlower on older Mac OS X systems * Use dummy towlower on systems that have no native support
+
+	* Fixed wchar check for FreeBSD 4.8 (pvk)
+
+	* Fixed checking pthread library on OSF 3.x and OSF 4.x (pvk)
+
+	* Fixed problem with C variable scope (pvk)
+
+2007-10-02  Patrick van Kleef  <[email protected]>
+
+	* Removed AutoReqProv:no setting
+
+2007-10-01  Patrick van Kleef  <[email protected]>
+
+	* Disabled building/installing old libodbc.a as this can interfere with   other driver managers * Fixed License keyword * Updated version of rpm
+
+2007-09-10  Patrick van Kleef  <[email protected]>
+
+	* Don't keep odbc mutex unnecessary long
+
+	* Split locking section into smaller segements
+
+2007-09-04  Patrick van Kleef  <[email protected]>
+
+	* Fixed typos
+
+	* Fixed return code when driver could not be found
+
+	* Fixed error messages
+
+	* Use SQLFetchScroll on ODBC 3.x
+
+	* Added missing SQLStmtOptionA to export list
+
+	* Fixed checking for driver version when not connected
+
+2007-02-02  Sergey Malinin  <[email protected]>
+
+	* Added initial support for gtk+ 2.x (sm)
+
+	* Fixed Unicode bug in SQLBrowseConnect * Added SQLBrowseConnectW to export-symbol list   (sm)
+
+2007-01-08  Patrick van Kleef  <[email protected]>
+
+	* Minor text changes (pvk)
+
+2007-01-05  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Updated version to 3.53.5 (pvk)
+
+	* Added support for RedHat FC6 64bit (pvk)
+
+	*** empty log message ***
+
+	* Reverted incomplete patch (pvk)
+
+2007-01-03  Sergey Malinin  <[email protected]>
+
+	* Fixed buffer size calculation (sm)
+
+	* Fixed problem connecting with FileDSN (sm)
+
+	* Fixed missing newline when showing parameters (sm)
+
+2006-12-21  Patrick van Kleef  <[email protected]>
+
+	* Increased limit of tracedump char and hex data to 1000 lines max (pvk)
+
+	* Limit the size of the tracefile to about 1Gb (pvk)
+
+2006-12-21  Sergey Malinin  <[email protected]>
+
+	* Fixed problems with FileDSN in GTK build (sm)
+
+2006-12-15  Patrick van Kleef  <[email protected]>
+
+	* Updated version to 3.52.5-rc2
+
+	* Added configure option to set default FileDSN directory (pvk)
+
+2006-12-15  Sergey Malinin  <[email protected]>
+
+	* Allow user to bypass connection check when adding a FileDSN (sm)
+
+2006-12-12  Patrick van Kleef  <[email protected]>
+
+	* Removed bogus free (pvk)
+
+	* Removed duplicate error message box (pvk)
+
+2006-12-11  Patrick van Kleef  <[email protected]>
+
+	* Incorporated diff from debian web site (pvk)
+
+	* Updated version to 3.52.5-rc1
+
+	* Fixed problem when driver has not yet been connected (pvk)
+
+	* Use SQL_SUCCEEDED macro to increase readability (pvk)
+
+	* Fixed problem always returning SQL_ERROR due to logic bug (pvk)
+
+	* Call ODBC 2.x functions in driver if application uses ODBC 2.x only   (pvk)
+
+2006-09-25  Sergey Malinin  <[email protected]>
+
+	* Call ODBC 2.x functions in driver if application uses ODBC 2.x only   (sm)
+
+2006-08-03  Patrick van Kleef  <[email protected]>
+
+	* Added missing header to distribution
+
+2006-07-17  Patrick van Kleef  <[email protected]>
+
+	* Removed procid reference from code and simplified call mechanism (pvk)
+
+2006-07-11  Patrick van Kleef  <[email protected]>
+
+	* Simplified CALL_DRIVER and CALL_UDRIVER macros
+
+2006-07-10  Patrick van Kleef  <[email protected]>
+
+	* Merged FileDSN and ConnectionPooling support from iODBC-3_52_4-DEVEL
+
+	* Merged FileDSN and ConnectionPooling support from iODBC-3_52_4-DEVEL
+
+	* Merged FileDSN support from iODBC-3_52_4-DEVEL into HEAD
+
+	* Use highlighting in overview screen (pvk)
+
+	* Rewrote bootstrap script to be more verbose about programs/versions   needed (pvk)
+
+2006-04-27  Sergey Malinin  <[email protected]>
+
+	* Skip {..}  when parsing connect string (sm)
+
+2006-03-21  Patrick van Kleef  <[email protected]>
+
+	* Use localtime_r (pvk)
+
+2006-03-06  Patrick van Kleef  <[email protected]>
+
+	* Fixed typo in function prototype (pvk)
+
+2006-03-03  Patrick van Kleef  <[email protected]>
+
+	* Updated Info strings (pvk)
+
+2006-02-24  Sergey Malinin  <[email protected]>
+
+	* Let the driver manager call the setup dialogs for now and then   call the driver with SQL_DRIVER_NOPROMPT (sm)
+
+2006-02-13  Patrick van Kleef  <[email protected]>
+
+	* Version information is inserted by installer scripts (pvk)
+
+	* Added sccid to all sections to get string with load type into binary (pvk)
+
+2006-02-08  Patrick van Kleef  <[email protected]>
+
+	* Remove ppc64 from universal builds (pvk)
+
+2006-02-03  Patrick van Kleef  <[email protected]>
+
+	* Fixed include file problem on Mac OS X 10.3 (pvk)
+
+	* Added realclean rule (pvk)
+
+2006-01-26  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Finalized iODBC-3.52.4 release (pvk)
+
+	* Updated version number to 3.52.4 (pvk)
+
+	* Add -Wl,+s to HP/UX builds to enable SHLIB_PATH handling (pvk)
+
+	* Moved darwin specific -DNO_FRAMEWORKS from PORT.OpenLink to configure.in * Updated build instructions for Mac OS X   (pvk)
+
+	* Updated version number and build number in preparation for release (pvk)
+
+	* Fixed copyright notice (pvk)
+
+	* Added missing include directory (pvk)
+
+2006-01-25  Patrick van Kleef  <[email protected]>
+
+	* Added project files for Mac OS X 10.4 Universal builds (pvk)
+
+	* Make it easier to change buildstyles (pvk)
+
+	* Fixed order in which targets need to be installed (pvk)
+
+	* Converted Xcode project files for Mac OS X 10.4 Universal builds (pvk)
+
+	* Fixed bug in determining which version of Mac OS X we build on (pvk)
+
+	* Cleanup Mac OS X project files (pvk)
+
+	* Cleanup Mac OS X project files (pvk)
+
+	* Cleanup Mac OS X project files (pvk)
+
+	* Updated version number (pvk)
+
+2006-01-24  Patrick van Kleef  <[email protected]>
+
+	* Simplified building process (pvk)
+
+	* Fixed include paths (pvk)
+
+	* Fixed wchar_t issue on Mac OS X (pvk)
+
+	* Added new version macros for Mac OS X build (pvk)
+
+	* Fixed building and installing iodbctest and iodbctestw (pvk)
+
+	* Files to ignore (pvk)
+
+	* Added guard against including sqlext.h twice (pvk)
+
+	* Fixed include paths building on Mac OS X (pvk)
+
+	* Added proper header file for prototypes * Fixed typo in function name   (pvk)
+
+	* Fixed compiler warnings (pvk)
+
+	* Fixed some compiler warnings (pvk)
+
+2006-01-20  Patrick van Kleef  <[email protected]>
+
+	* Clarify which version of the LGPL license this project adheres to   (pvk)
+
+	* Fixed temporary framework search paths * Fixed framework version for non-standard build   (pvk)
+
+	* Moved dlf.[ch] and unicode.[ch] to iodbcinst (pvk)
+
+	* Use iodbcinst_common and gtk/libdrvproxy-gtk.la convenience libraries   instead of referring to individual object files   (pvk)
+
+	* Use iodbcinst_common and gtk/libiodbcadm-gtk.la convenience libraries   instead of referring to individual object files   (pvk)
+
+	* Added more functions to export (pvk)
+
+	* Use new iodbcinst_common library so iodbc does not need to be linked   against libiodbcinst. This created problems on various platforms like HP/UX   with static link paths being inserted into the libiodbc.so library   (pvk)
+
+	* Created convenience library with common objects that are used in more   than one place (pvk)
+
+	* Moved dlf.[ch] and unicode.[ch] to iodbcinst (pvk)
+
+	* Moved confirm.c and question.xpm from drvproxy/gtk to iodbcadm/gtk (pvk)
+
+2006-01-18  Patrick van Kleef  <[email protected]>
+
+	* If towlower does not exist and we cannot use Frameworks, then just return   the original character  (pvk)
+
+	* Added support for Mac OS X 10.2 (pvk)
+
+	* On AIX we prefer the cc_r7 compiler instead of the cc compiler (pvk)
+
+	* Temporarily disabled --disable-odbc3 untill all parts of iODBC DM have   been fixed to compile with ODBCVER=0x0250 (pvk)
+
+	* Unicode and ANSI functions did not exist in ODBC 2.50 (pvk)
+
+2006-01-17  Patrick van Kleef  <[email protected]>
+
+	* Fixed errors when compiling iODBC for ODBC 2.50 specs (pvk)
+
+	* Fixed ODBCVER (pvk)
+
+2006-01-13  Patrick van Kleef  <[email protected]>
+
+	* Added support for SUSE Linux on AMD opteron (pvk)
+
+	* Added missing header files for function prototypes (pvk)
+
+2006-01-12  Patrick van Kleef  <[email protected]>
+
+	* Added support for building on Apple Mac OS X 10.4 ppc, ppc64 and i386   all in one   (pvk)
+
+2006-01-11  Patrick van Kleef  <[email protected]>
+
+	* Allow # as extra comment character on reading the odbc.ini file. (pvk)
+
+	* If subsequent SQLExecute returns SQL_ERROR, set handle state back to   en_stmt_prepared and leave the prep_state as is.  (pvk)
+
+	* Fixed typo in local variable decl (pvk)
+
+2005-11-07  Patrick van Kleef  <[email protected]>
+
+	* Added missing file (pvk)
+
+	*** empty log message ***
+
+	* Finalized iODBC-3.52.3 release (pvk)
+
+	* Fixed build issue with previously installed libraries (pvk)
+
+2005-11-04  Patrick van Kleef  <[email protected]>
+
+	* Fixed problem building on Mac OS X 64bit (pvk)
+
+	* Apple does not provide certain frameworks in 64bit mode yet (pvk)
+
+	* Added Unicode symbols (pvk)
+
+	* Added option to build in current directory (pvk)
+
+	* Updated DM build number and library version number (pvk)
+
+	* Updated version number to 3.52.3 (pvk)
+
+	* Added check for more wchar functions (pvk)
+
+	* Added support for AIX 5.x (pvk)
+
+	* Removed check for xml2 which is not needed for iODBC (pvk)
+
+	* Added support for HP/UX Itanium (pvk)
+
+	* Fixed support for building on Mac OS X 10.3 and 10.4 in Darwin mode (pvk)
+
+	* Added detection for glibtoolize for Mac OS X build (pvk)
+
+	* Apple does not provide certain frameworks in 64bit mode yet (pvk)
+
+2005-10-08  Patrick van Kleef  <[email protected]>
+
+	* Include config.h if present (pvk)
+
+	* Fixed calculating end of buffer without lvalue cast as some   compilers did not like this construction   (pvk)
+
+	* Ignore files from copied from autoconf/automake/libtool (pvk)
+
+	* Resurrected mkinstalldirs (pvk)
+
+	* Added timestamp to ENTER/EXIT trace lines to get better idea of   where application time was spend; inside or outside of ODBC calls.   (pvk)
+
+	* Removed files that are distributed by autoconf/automake/libtoolize (pvk)
+
+	* Updated build version and library version (pvk)
+
+	* Fixed problem with truncated messages in ODBC_Error function (pvk)
+
+	* C++ normally has wchar_t (pvk)
+
+	* Fixed problem with symbol hiding unicode translation functions (pvk)
+
+2005-09-12  Sergey Malinin  <[email protected]>
+
+	* Avoid calling _iodbcdm_drvconn_dialbox twice (sm)
+
+2005-09-12  Patrick van Kleef  <[email protected]>
+
+	* Removed semicolon from end of statement block * Small code cleanup   (pvk)
+
+2005-09-12  Sergey Malinin  <[email protected]>
+
+	* Set config mode before looking for driver name (sm)
+
+	* Fixed problem with ODBC_BOTH_DSN (sm)
+
+2005-08-30  Patrick van Kleef  <[email protected]>
+
+	* Reordered InfoTypes based on ODBC version * Fixed problem with some types like SQL_POS_OPERATION and   SQL_POSITIONED_STATEMENTS which where flagged ODBC 2.x only by mistake   (pvk)
+
+2005-08-22  Max Khon  <[email protected]>
+
+	* Fixed NUL termination problem * DSN input was not disabled correctly   (mk)
+
+	* Fixed NUL termination problem (mk)
+
+2005-08-16  Patrick van Kleef  <[email protected]>
+
+	* Fixed minor build problems on Mac OS X * Allow both Xcode 1.5 and 2.1 style build directories   (pvk)
+
+	* Disable Carbon framework in Mac OS X 64bit port (pvk)
+
+	* Fixed problem mixing framework type header files, which are prefixed   with framework name, and internal header files   (pvk)
+
+	* Add iodbcinst.h to install target (pvk)
+
+	* Do not distribute iodbc.h header anymore (pvk)
+
+2005-08-15  Patrick van Kleef  <[email protected]>
+
+	* Install iodbctest and iodbctestw in   /Library/Application Support/iODBC/bin   (pvk)
+
+	* Fixed include files for Mac OS X framework build (pvk)
+
+2005-08-03  Patrick van Kleef  <[email protected]>
+
+	* Added 'reconnect' command to iodbctest (pvk)
+
+2005-07-29  Sergey Malinin  <[email protected]>
+
+	* Added defines for Mac OS X 10.3 and newer (sergei)
+
+	* Fixed typo (sergei)
+
+2005-07-27  Sergey Malinin  <[email protected]>
+
+	* Improve the quality of error messages for dynamic linker problems   (sergei)
+
+2005-07-27  Patrick van Kleef  <[email protected]>
+
+	* Added Max (pvk)
+
+2005-07-27  Max Khon  <[email protected]>
+
+	* Recalculate cbConnStrIn as szConnStrIn might have been changed by   iodbcdm_drvconn_dialbox   (mk)
+
+2005-07-19  Patrick van Kleef  <[email protected]>
+
+	* Changed SQL_DRIVER_PROMPT to SQL_DRIVER_COMPLETE which still allows   drivers that have graphical setup screens to use them, but fixes a   problem with the MyODBC driver which returns a very cryptic   "No DSN entered".   (pvk)
+
+2005-07-16  Patrick van Kleef  <[email protected]>
+
+	* Added initial support for pkg-config spec file (pvk)
+
+	* Fixed problem with SQLDriverConnect when graphical library could not   be found, the driver manager automatically returned an error when   performing SQLDriverConnect (....., SQL_DRIVER_PROMPT).   Instead we now silently continue to call the driver and hope it either   asks for the missing connection parameters, or return an error.   (pvk)
+
+	* Added support for DSN-less connections (pvk)
+
+2005-05-13  Patrick van Kleef  <[email protected]>
+
+	* Renamed iodbcinst.h to odbcinst.h (pvk)
+
+	* Replaced enum bool with int (pvk)
+
+	* Use getprogname on Mac OS X 10.3 and above (pvk)
+
+	* Fixed frameworkname for iODBCinst (pvk)
+
+	* Added support for sqlucode.h (pvk)
+
+2005-05-12  Patrick van Kleef  <[email protected]>
+
+	* Renamed iodbcinst.h to odbcinst.h (pvk)
+
+	* Renamed iodbcinst.h to odbcinst.h (pvk)
+
+2005-03-22  Patrick van Kleef  <[email protected]>
+
+	* Added missing unicode.[ch] into project file (pvk)
+
+2005-03-14  Sergey Malinin  <[email protected]>
+
+	* Added Unicode functions to gtk graphical code * Fixed small Unicode bugs   (sm)
+
+2005-03-09  Patrick van Kleef  <[email protected]>
+
+	* Removed space from -D compile flag (pvk)
+
+2005-03-03  Patrick van Kleef  <[email protected]>
+
+	* Stubs for gtk code until we can fix the Unicode part (pvk)
+
+2005-03-02  Sergey Malinin  <[email protected]>
+
+	* Build iODBCadm as a bundle rather than a Framework * Fixed problems calling drvproxy code from iodbcadm   (sm)
+
+	* Added support for missing wchar functions (ep+sm)
+
+2005-03-02  Patrick van Kleef  <[email protected]>
+
+	* Indented code to improve readability (pvk)
+
+2005-03-02  Sergey Malinin  <[email protected]>
+
+	* Added support for iodbcinst Unicode functions (ep+sm)
+
+2005-03-02  Patrick van Kleef  <[email protected]>
+
+	* Updated debian build files with latest fixes from Christian (pvk)
+
+2005-03-01  Patrick van Kleef  <[email protected]>
+
+	* Ignore config.nice (pvk)
+
+	* Explain which layouts are available instead of cryptic error (pvk)
+
+	* Added extra configure flag --disable-libodbc to disable the building of   the additional libodbc.so library some programs are linked against   (pvk)
+
+2005-02-15  Patrick van Kleef  <[email protected]>
+
+	* Fixed problem compiling iodbctest.c with C++ compiler (pvk)
+
+2005-02-14  Patrick van Kleef  <[email protected]>
+
+	* Added initial support for building on MAC OS X 10.4 (pvk)
+
+	* Don't stop the build process if strip fails on Darwin (pvk)
+
+2005-02-14  Sergey Malinin  <[email protected]>
+
+	* Fixed symbol clash between Oracle instant client and iODBC on Mac OS X   (sergei)
+
+2005-02-08  Patrick van Kleef  <[email protected]>
+
+	* Removed static declaration from Done_iODBC (pvk)
+
+2005-02-04  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Finalized 3.52.2 release (pvk)
+
+	* Put in final release stamp (pvk)
+
+	* Added Mac OS X specific iodbc-config script for framework link (pvk)
+
+2005-02-01  Patrick van Kleef  <[email protected]>
+
+	* Ignore build directories (pvk)
+
+	* Updated version number to 3.52.2 (pvk)
+
+	* Added Port.OpenLink script to package distribution (pvk)
+
+	* Fixed iODBC initialization code * Added global lock around SQLAllocHandleSTD (SQL_HANDLE_HENV)   (pvk)
+
+	* Close tracefile after the last environment handle has been freed (pvk)
+
+	* Make sure trace_stop can be called multiple times (pvk)
+
+	* Fixed iODBC initialization code * Added global lock around SQLAllocEnv/SQLAllocHandle (SQL_HANDLE_HENV)   (pvk)
+
+	* Do not stop tracing prematurely (pvk)
+
+2005-01-31  Patrick van Kleef  <[email protected]>
+
+	* Fixed whitespace (pvk)
+
+	* Allow root to trace odbc sessions, but make sure we do not overwrite   any existing files   (pvk)
+
+	* Changed parsing of TraceFile to avoid buffer overruns (pvk)
+
+	* Added Driver Manager version to start of trace * Added date/time finished to end of trace * Changed date/time format   (pvk)
+
+2005-01-21  Patrick van Kleef  <[email protected]>
+
+	* Build sample programs with static iODBC libraries (pvk)
+
+	* Removed generated file (pvk)
+
+	* Added script OpenLink uses to port iODBC as reference (pvk)
+
+	* Added bootstrap.sh in package distribution * Added admin/gtk.m4 so target machines without GTK can still use   bootstrap.sh to setup the automake/autoconf configuration   (pvk)
+
+2004-12-15  Patrick van Kleef  <[email protected]>
+
+	* When a driver specific SQLSetConnectAttr fails return SQL_SUCCESS_WITH_INFO   rather than failing the connection   (pvk)
+
+	* Only Darwin needs this special build rule (pvk)
+
+	* Only call SQLGetDiagRec on allocated handles (pvk)
+
+	* Fixed C++ prototype problems with older code on 32bit (pvk)
+
+	* Use $DESTDIR/$libdir to make libodbc symlinks (pvk)
+
+2004-11-03  Patrick van Kleef  <[email protected]>
+
+	* Fixed argument check to be case insensitive (pvk)
+
+2004-10-23  Patrick van Kleef  <[email protected]>
+
+	* Fixed null pointer problem (pvk)
+
+2004-10-15  Patrick van Kleef  <[email protected]>
+
+	* Use returned size of buffer if possible instead of relying on SQL_NTS   (pvk)
+
+2004-10-04  Patrick van Kleef  <[email protected]>
+
+	* Added DESTDIR in make install for packaging in different dir (pvk)
+
+2004-09-29  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Updated NEWS with highlights of new release * Added tag iODBC-3_52_1 to mark final release   (pvk)
+
+2004-09-29  Emmanuel Poitier  <[email protected]>
+
+	* Fixed Mac OS X install problems (ep)
+
+2004-09-29  Patrick van Kleef  <[email protected]>
+
+	* Fixed RPM build/package issue on RedHat 9 (pvk)
+
+	*** empty log message ***
+
+	* Keep deprecated SQLROWCOUNT,SQLROWSETSIZE,SQLTRANSID and SQLROWOFFSET   types around for backward compatibility (pvk)
+
+2004-09-28  Patrick van Kleef  <[email protected]>
+
+	* Added missing files for Mac OS X build (pvk)
+
+	* Set project version to 3.52.1 (pvk)
+
+	* Added support for SQL_BINARY fields (pvk)
+
+	* Use SQL_DRIVER_PROMPT to call GUI setup if available (pvk)
+
+	* Final fixes for SQLLEN definition (pvk)
+
+	* Fixed problem with ODBCINT64 definition (pvk)
+
+	* Make sure SQLGUID structure is the same size on both 32 and 64bit   platforms (pvk)
+
+	* Moved some typedefs around (pvk)
+
+	* Small fixes to align with ms header file (pvk)
+
+	* Explain prototype choice SQLColAttribute (pvk)
+
+	* Mask out old and unused windows types (pvk)
+
+	* Added compile time check for sizeof(long) (pvk)
+
+	* Added symbolic tracing for SQLColAttribute (pvk)
+
+	* Indentation + standard copyright header (pvk)
+
+2004-09-10  Patrick van Kleef  <[email protected]>
+
+	* Added new layer so drivers can be logically unloaded without being   physically unloaded. This is needed to resolve an outstanding memory   leak, while protecting the application from crashing if the unloaded driver   registered an on_exit hook. A new flag UnloadSafe can be added to a   driver to note it is safe to physically unload the driver.   (pvk)
+
+2004-08-26  Patrick van Kleef  <[email protected]>
+
+	* Fixed SQLSetDescRec trace function (pvk)
+
+	* Fixed "statement not reached" warning (pvk)
+
+	* Converted SQLUINTEGER to SQLULEN for 64bit handling (pvk)
+
+2004-08-20  Patrick van Kleef  <[email protected]>
+
+	* Fixed build issue on non Mac OS X machines (pvk)
+
+2004-08-20  Emmanuel Poitier  <[email protected]>
+
+	* Fix to build non-framework version of iODBC on Mac OS X (ep)
+
+2004-08-16  Patrick van Kleef  <[email protected]>
+
+	* Enhanced support for tracing SQLGetFunctions (pvk)
+
+2004-08-13  Patrick van Kleef  <[email protected]>
+
+	* Increased size of output buffer for DSN to 1024 (pvk)
+
+2004-07-13  Tim Haynes  <[email protected]>
+
+	* Set basic permissions (th)
+
+2004-07-13  Emmanuel Poitier  <[email protected]>
+
+	* Added script to link Framework build into /usr/local/iODBC on Mac OS X * Fixed problem rewriting header files for Framework build   (ep)
+
+2004-07-13  Patrick van Kleef  <[email protected]>
+
+	* Allow other ini files besides odbc.ini and odbcinst.ini to support   FileDSN functions   (pvk)
+
+	* Added standard headers to get some basic typedefs like wchar_t * Added C calling conventions for C++   (pvk)
+
+	* Replaces wchar.h with stdlib.h (pvk)
+
+2004-07-13  Emmanuel Poitier  <[email protected]>
+
+	* Small fixes for Mac OS X build (ep)
+
+2004-07-07  Patrick van Kleef  <[email protected]>
+
+	* Do not assume . is in PATH when reading the libiodbc.la file (pvk)
+
+	* Make sure we use shl_open on HP/UX (pvk)
+
+	* Removed INT64 and UINT64 types as they clash on various Unix versions   (pvk)
+
+2004-07-06  Patrick van Kleef  <[email protected]>
+
+	* Added support for iodbcunix.h and iodbcext.h headers (pvk)
+
+	* Fixed 64bit cast problems (pvk)
+
+	* Fixed prototypes (pvk)
+
+	* Use ssize_t and size_t for string lengths * Fixed 64bit cast issues   (pvk)
+
+	* Fixed 64bit cast problems (pvk)
+
+	* Initial support for ODBC 3.52 API SQLLEN (pvk)
+
+	* Initialize SQLGetPrivateProfileString return buffer to empty string (pvk)
+
+	* Perform assignment in two steps for some older compilers (pvk)
+
+	* Use _mandir macro for path to man pages (pvk)
+
+	* Enhanced method for detecting pthread support on various platforms (pvk)
+
+	* Use AC_HELP_STRING to format --help texts (pvk)
+
+	* Handle UTF-8 sequences of 5 and 6 bytes * Skip bad UTF-8 sequences replacing them with a # in the trace   (pvk)
+
+2004-07-05  Patrick van Kleef  <[email protected]>
+
+	* Fixed typo in HP/UX shared library name handling (pvk)
+
+2004-06-24  Emmanuel Poitier  <[email protected]>
+
+	* Added project build file for iodbctestw (ep)
+
+	* Small fixes for Mac OS X build (ep)
+
+2004-06-22  Patrick van Kleef  <[email protected]>
+
+	* Small indentation fixes   (pvk)
+
+	* Fixed compiler warnings * Small indentation fixes   (pvk)
+
+	* Removed unused functions * Small indentation cleanups   (pvk)
+
+2004-06-21  Patrick van Kleef  <[email protected]>
+
+	* Fixed C and C++ compiler warnings * Small indentation fixes   (pvk)
+
+	* Preparations for adding ODBC64 support (pvk)
+
+2004-06-19  Patrick van Kleef  <[email protected]>
+
+	* Removed obsolete FAR keyword (pvk)
+
+	* Simplified version number maintenance (pvk)
+
+	* Added initial man pages (pvk)
+
+2004-06-18  Patrick van Kleef  <[email protected]>
+
+	* Fixed problems in SQLSetScrollOption emulation when driver does not   support this function (pvk)
+
+	* Added checks to make sure all stages succeed properly (pvk)
+
+	* Added extra tool needed to compile sample directory (pvk)
+
+	* Export Unicode and ANSI names of ODBC functions (pvk)
+
+	* Install sample source and Makefile in binary distributions (pvk)
+
+	* Added Unicode support * Added extra datatypes   (pvk)
+
+2004-05-13  Patrick van Kleef  <[email protected]>
+
+	* Added iodbcext.h (pvk)
+
+2004-05-13  Sergey Malinin  <[email protected]>
+
+	* Added support for SQLGetEnvAttr(SQL_ATTR_WCHAR_SIZE) extension (sm)
+
+2004-04-20  Patrick van Kleef  <[email protected]>
+
+	* Fixed NULL pointer dereference when connection fails (pvk)
+
+2004-03-18  Emmanuel Poitier  <[email protected]>
+
+	* Removed dependency on Carbon libraries for now so the driver manager   works on non console sessions (ep)
+
+2004-03-15  Patrick van Kleef  <[email protected]>
+
+	* Increased input buffer to 4096 (pvk)
+
+2004-02-24  Patrick van Kleef  <[email protected]>
+
+	*** empty log message ***
+
+	* Updated NEWS with highlights of new release * Updated version and build numbers to 3.51.2   (pvk)
+
+2004-02-24  Tim Haynes  <[email protected]>
+
+	* Fixed build problem on panther (th)
+
+2004-02-23  Patrick van Kleef  <[email protected]>
+
+	* Fixed build problem with older make programs (pvk)
+
+	* Fixed problem building on FreeBSD * Clean symbolic links   (pvk)
+
+	* Regenerated ChangeLog (pvk)
+
+	* Remove config.nice when making distributions (pvk)
+
+	* Updated version information in preparation of final release (pvk)
+
+	* Added --include-deps * Print comment on using --enable-maintainer-mode   (pvk)
+
+2004-02-23  Tim Haynes  <[email protected]>
+
+	* Fixed problem building iodbctest program on Mac OS X (th)
+
+	* Removed Framework build (th)
+
+	* Check for pbxbuild (jaguar) or xcodebuild (panther)   (th)
+
+2004-02-23  Patrick van Kleef  <[email protected]>
+
+	* Updated copyright string (pvk)
+
+	* Added support for config.nice script (pvk)
+
+	* Removed debug code (pvk)
+
+	* Automatically regenerate libiodb.spec script when configure.in   changes (pvk)
+
+2004-02-20  Patrick van Kleef  <[email protected]>
+
+	* Added --with-layout to simplify installation layouts for different   distributions like Debian, Gentoo, FreeBSD etc   (pvk)
+
+	* Added missing file in distcheck (pvk)
+
+	* Small documentation enhancements and clarifications (pvk)
+
+	* Renewed build utilities (pvk)
+
+	* Fixed license explaination * Fixed URL to source code on www.iodbc.org site   (pvk)
+
+2004-02-19  Patrick van Kleef  <[email protected]>
+
+	* Fixed problem with finding install_libodbc.sh shell script (pvk)
+
+	* If the allocation of the statement handle in the drivermanager fails,   also release the statement handle in the driver   (pvk)
+
+	* Fixed prototype problem on Linux (pvk)
+
+2004-02-18  Patrick van Kleef  <[email protected]>
+
+	* Fixed typo in fprintf format (pvk)
+
+	* Initialise native_error to 0 as some drivers do not set this field (pvk)
+
+2004-02-18  Emmanuel Poitier  <[email protected]>
+
+	* Increased size of local variables to accommodate larger input * Added SQLRowCount to display number of affected rows on DDL/DML   statements   (ep)
+
+	* Removed compiler warning (ep)
+
+	* Initialise some local variables (ep)
+
+	* Added missing prototype (ep)
+
+	* Updated Mac OS X build project (ep)
+
+2004-02-18  Patrick van Kleef  <[email protected]>
+
+	* Added support for displaying NativeError number * Added support for SQLDiagRec when compiling for ODBC 3.x   (pvk)
+
+	* Fixed problem with SQLCloseCursor * Replaced call to SQLFreeStmt (hstmt, SQL_CLOSE) with SQLCloseCursor   when compiling for ODBC 3.x   (pvk)
+
+	* Removed call to SQLSetConnectOption(SQL_OPT_TRACEFILE) (pvk)
+
+	* SQLCloseCursor should not return SQLState 24000 as this is up to the   Driver not the DriverManager (pvk)
+
+2004-02-17  Patrick van Kleef  <[email protected]>
+
+	* Fixed compiler warnings * Fixed size calculation for variable length string and binary fields   (pvk)
+
+	* Fixed small compiler warnings * Use snprintf when available to guard against buffer overruns * Fixed problem with empty strings   (pvk)
+
+	* Added missing trace function for SQLSetDescRec (pvk)
+
+	* Removed stale message handler (pvk)
+
+	* Added support for asprintf and snprintf to guard against buffer overflows   (pvk)
+
+	* Create symbolic links for libodbc.a and libodbc.so for applications that   need it (pvk)
+
+	* Added support for snprintf (pvk)
+
+	* Increased size of buf to fix potential stack overwrite (pvk)
+
+	* Removed duplicate call to MEM_FREE (pvk)
+
+	* Changed command line arguments for cvs2cl (pvk)
+
+	* Added Tim (pvk)
+
+2004-02-17  Tim Haynes  <[email protected]>
+
+	* Small text clarifications (th)
+
+2004-02-17  Patrick van Kleef  <[email protected]>
+
+	* Added check for asnprintf and snprintf (pvk)
+
+	* Added tracing to SQLSetDescRec (pvk)
+
+2003-09-08  Patrick van Kleef  <[email protected]>
+
+	* Added README.CVS to documentation (pvk)
+
+	* Merged previous Changelogs into NEWS file * Use cvs2cl script to generate Changelog information from CVS   (pvk)
+
+	* Updated version and build numbers to 3.51.1 (pvk)
+
+	* Added basic instructions for using the CVS tree (pvk)
+
+	* Renamed bootstrap to bootstrap.sh and made it more developer friendly   (pvk)
+
+2003-09-07  Patrick van Kleef  <[email protected]>
+
+	* Upgraded to libtool-1.4.3 (pvk)
+
+	* Updated package information and version/build strings (pvk)
+
+	* Rewrote check for Dl_info type (pvk)
+
+	* Removed symbol clash on iodbc_version between various components   (pvk)
+
+	* Removed symbol clash on iodbc_version between various components   (pvk)
+
+	* Added check for OS dependent compilers and flags for building   threaded programs (pvk)
+
+	* Display version number of Driver Manager (pvk)
+
+	* Removed symbol clash on iodbc_version between various components * Simplified getting version information from various components for   iodbcadm-gtk   (pvk)
+
+	* Added check for const handling (pvk)
+
+2003-09-05  Patrick van Kleef  <[email protected]>
+
+	* Added check for FreeBSD wchar_t define (pvk)
+
+	* Do not use -static on convenience libraries (pvk)
+
+2003-09-04  Patrick van Kleef  <[email protected]>
+
+	* Moved iodbc/iodbc.h to include/iodbc.h (pvk)
+
+2003-09-04  Emmanuel Poitier  <[email protected]>
+
+	* Updated build instructions for MyODBC on Mac OS X (ep)
+
+2003-09-04  Patrick van Kleef  <[email protected]>
+
+	* Use <iodbc.h> instead of <config.h> (pvk)
+
+	* Moved iodbc/iodbc.h to include/iodbc.h (pvk)
+
+2003-09-03  Emmanuel Poitier  <[email protected]>
+
+	* Small fixes for MAC OS X (ep)
+
+2003-09-03  Patrick van Kleef  <[email protected]>
+
+	* Added check for OS dependent libraries (pvk)
+
+2003-09-03  Emmanuel Poitier  <[email protected]>
+
+	* Small cleanups for MAC OS X build (ep)
+
+2003-09-03  Patrick van Kleef  <[email protected]>
+
+	* Small changes to fix problems indicated by gcc compiler warnings (pvk)
+
+	* Fixed buffer size allocation using SQLGetPrivateProfileString * Always use a char buffer for SQLGetPrivateProfileString   (pvk)
+
+	* Use correct trace functions (pvk)
+
+2003-09-02  Patrick van Kleef  <[email protected]>
+
+	* Added checks for wchar.h and wcslen, wcscpy and wcsncpy and provide   our own implementation if they do not exist in the standard C library   (pvk)
+
+2003-08-29  Patrick van Kleef  <[email protected]>
+
+	* Fixed dependency problem between iodbc and iodbcinst (pvk)
+
+	* Fixed state transition for SQLExecDirect (pvk)
+
+	* Fixed state transitions for SQLFetch/SQLMoreresults (pvk)
+
+	* Added libiodbcinst.la to the library dependency list (pvk)
+
+	* Compile iodbcinst before iodbc (pvk)
+
+	* Removed libiodbcinst.la as this is already implicit from libiodbc.la (pvk)
+
+	* Added $(LIBADD_DL) to --static-libs (pvk)
+
+2003-08-22  Patrick van Kleef  <[email protected]>
+
+	* Added info for new release (pvk)
+
+	* Updated version number to 3.51.00 to indicate start of new development   cycle (pvk)
+
+	* Merged iODBC-3_0_6-DEVEL tree onto main trunk   (pvk)
+
+2002-04-29  Patrick van Kleef  <[email protected]>
+
+	* Added instructions on how to build MyODBC using the Mac OS X frameworks   (pvk)
+
+	* Wrote final entries for V3.0.6 release (pvk)
+
+2002-04-29  Patrick van Kleef  <[email protected]>
+
+	* Install iODBC frameworks always in /Library/Frameworks (pvk)
+
+	* Fixed problems with iODBC header files when building with Mac OS X
+	  frameworks (pvk)
+
+2002-04-29  Patrick van Kleef  <[email protected]>
+
+	* Added relative search path for iODBC framework (pvk)
+
+2002-04-29  Christian Hammers  <[email protected]>
+
+	* Added packaging rules for the Debian project (ch)
+
+2002-04-26  Emmanuel Poitier  <[email protected]>
+
+	* Changed includes to <iODBC/sql.h> for framework builds (ep)
+
+2002-04-26  Patrick van Kleef  <[email protected]>
+
+	* Added define in config.h for building GUI extentions (pvk)
+
+2002-04-26  Emmanuel Poitier  <[email protected]>
+
+	* Added initial build environment for Mac OS X framework (ep)
+
+	* Use /Library/Preferences instead of the old /System/Library/Preferences   (ep)
+
+	* When using Apple Frameworks we need to provide the framework name (ep)
+
+	* Cleaned some unused variables (ep)
+
+	* If we are not compiling with GUI enabled, make sure we do not   have any GUI references in our library (ep)
+
+	* Cleaned some unused variables (ep)
+
+2002-04-26  Emmanuel Poitier  <[email protected]>
+
+	* Set default version if the package has not been configured (ep)
+
+	* Add default path for MacOS X preferences (ep)
+
+2002-04-25  Patrick van Kleef  <[email protected]>
+
+	* Fixed GTK detection to enable GUI components * Fixed warnings from latest autoconf * Added check for DL_info datatype * Updated library version number to 3:6:1   (pvk)
+
+	* Install the odbctest program with the rest of the package (pvk)
+
+2002-04-25  Emmanuel Poitier  <[email protected]>
+
+	* Create a new TOPLEVEL window if the user did not provide a valid   window handle (ep)
+
+2002-04-25  Patrick van Kleef  <[email protected]>
+
+	* Fixed detection of Dl_info structure (pvk)
+
+	* Makefile cleanups (pvk)
+
+	* Ignore the autom4te.cache dir (pvk)
+
+	* Updated RedHat RPM spec file to latest release (pvk)
+
+	* Upgraded to automake 1.6.1 (pvk)
+
+	* Only build .tar.gz and .zip distributions for now (pvk)
+
+2002-03-14  Patrick van Kleef  <[email protected]>
+
+	* Added support for automake 1.6, autoconf 2.53 and libtool 1.4.2 (pvk)
+
+	* Updated comment to reflect dual LGPL/BSD license (pvk)
+
+	* Updated comment to reflect dual LGPL/BSD license (pvk)
+
+	* Added include of iodbc.h (pvk)
+
+	* Fixed multiple definitions of CFLAGS in generated Makefile (pvk)
+
+2002-01-31  Emmanuel Poitier  <[email protected]>
+
+	* Added support for mapping SQLError to either SQLGetDiagRec or SQLError   in the driver (epoitier)
+
+2001-10-08  Patrick van Kleef  <[email protected]>
+
+	* Print the version information of the connected driver * Renamed functions from DB_xxxx to ODBC_xxxx   (pvk)
+
+2001-09-11  Patrick van Kleef  <[email protected]>
+
+	* Updated version number to 3.0.6 (pvk)
+
+	* Wrote entries for V3.0.6 (pvk)
+
+	* Fixed wrong argument to SQLEndTran call (pvk)
+
+	* Fixed spelling errors (pvk)
+
+	* Added state transitions to SQLFetchScroll (pvk)
+
+	* Fixed typo in mapping SQL_COLUMN_NAME, SQL_COLUMN_NULLABLE, or   SQL_COLUMN_COUNT in SQLColumnAttributes (pvk)
+
+	* Fixed bug in cleanup code for descriptors * Fixed getting correct descriptor from driver
+
+	* Return immediately if the arguments to SQLSetPos are wrong (pvk)
+
+	* Added better support for skipping comments in string (pvk)
+
+	* Added support for Driver specific connect options (pvk)
+
+2001-06-12  Patrick van Kleef  <[email protected]>
+
+	* Finalized notes for 3.0.5 release (pvk)
+
+	* SQLMoreResults always returned SQL_NO_DATA_FOUND (pvk)
+
+2001-06-11  Patrick van Kleef  <[email protected]>
+
+	* Added new package libiodbc-admin (pvk)
+
+	* Added support for multiple result sets (pvk)
+
+	* Added configure flag --enable-gui to switch building the GUI parts of   the iODBC administrator (pvk)
+
+	* iODBC is now released under either the GNU Library General Public License   or the BSD License. See files COPYING, COPYING.LGPL and COPYING.BSD for   details (pvk)
+
+	* Fixed portability issue with dladdr function (pvk)
+
+	* Check if setenv function exists in standard libraries, otherwise use   an internal copy (pvk)
+
+	* Fixed typo (pvk)
+
+	* Added sample odbcinst.ini file (pvk)
+
+2001-06-07  Patrick van Kleef  <[email protected]>
+
+	* Wrote entries for V3.0.5 (pvk)
+
+	* More files to ignore (pvk)
+
+	* Added new iodbcinst, iodbcadm, drvproxy directories (pvk)
+
+	* Added new contributor (pvk)
+
+2001-06-07  Emmanuel Poitier  <[email protected]>
+
+	* Added new iodbcinst library (ep)
+
+2001-06-07  Patrick van Kleef  <[email protected]>
+
+	* Added modified BSD license file (pvk)
+
+2001-06-07  Emmanuel Poitier  <[email protected]>
+
+	* Added GUI frontend (ep)
+
+	* Added new iodbcadm library and iodbcadm-gtk frontend (ep)
+
+2001-06-06  Emmanuel Poitier  <[email protected]>
+
+	* Rewrote SQLDriverConnect(..., SQL_DRIVER_PROMPT) to use GUI where   appropriate (ep)
+
+	* Added version and libname symbols (ep)
+
+	* Fixed compiler warning on older compilers (ep)
+
+	* Added dlopen support for Macintosh, Beos and MACX (ep)
+
+	* Added support for Macintosh, Beos and MACX (ep)
+
+2001-06-04  Patrick van Kleef  <[email protected]>
+
+	* Only top Makefile.am needs AUTOMAKE_OPTIONS setting (pvk)
+
+	* Added notes (pvk)
+
+	* More files to ignore (pvk)
+
+	* Add -f to gzip (pvk)
+
+	* More files to ignore (pvk)
+
+	* Some files to ignore (pvk)
+
+2001-06-04  Patrick van Kleef  <[email protected]>
+
+	* Added new config.h (generated from configure.in) (pvk)
+
+	* Linux RPM spec file now automatically contains proper version number (pvk)
+
+	* Set version number to 3.0.4 (pvk)
+
+2001-06-04  Patrick van Kleef  <[email protected]>
+
+	* Added new config.h (generated from configure.in) (pvk)
+
+	* The libiodbc.spec file was moved to the admin directory (pvk)
+
+	* Updated version number to 3.0.4 (pvk)
+
+	* Renamed config.h to iodbc.h (pvk)
+
+2001-06-04  Patrick van Kleef  <[email protected]>
+
+	* Renamed config.h to iodbc.h (pvk)
+
+	* Added new config.h (generated from configure.in) (pvk)
+
+2001-06-04  Patrick van Kleef  <[email protected]>
+
+	* Linux RPM spec file now automatically contains proper version number (pvk)
+
+	* Major archive restructuring in preparation of adding iodbcinst code (pvk)
+
+	* Major archive restructuring in preparation of adding iodbcinst code (pvk)
+
+	* Major archive restructuring in preparation of adding iodbcinst code (pvk)
+
+	* Major archive restructuring in preparation of adding iodbcinst code (pvk)
+
+2001-06-01  Patrick van Kleef  <[email protected]>
+
+	* Added support for automake 1.4-p2, autoconf 2.50 and libtool 1.4 (pvk)
+
+	* Fixed problem with shl_unload on HP/UX (pvk)
+
+	* iODBC does not need a handle to itself on HP/UX (pvk)
+
+2001-06-01  Patrick van Kleef  <[email protected]>
+
+	* Added usage information when called with -? (pvk)
+
+	 * Added more datatypes (pvk)
+
+2001-06-01  Patrick van Kleef  <[email protected]>
+
+	* Rewrote DYLD support for MacOS X/Darwin 1.2 (pvk)
+
+	* Disallow root to start a debug session as this is a security risk (pvk)
+
+	* Added checks for ODBC 3.x date, time and timestamp defines (pvk)
+
+	* Return Driver Type name instead of DSN Description (pvk)
+
+	* Removed stub for SQLGetPrivateProfileString (pvk)
+
+2000-07-05  Patrick van Kleef  <[email protected]>
+
+	* Translation of SQL_OJ_CAPABILITIES should only be done in ODBC 3.x (todd)
+
+	* Fixed typo (pvk)
+
+2000-06-14  Patrick van Kleef  <[email protected]>
+
+	* Fixed initialization of cip flag which resulted in function sequence   errors (pvk)
+
+	* Added call to SQLCloseCursor for ODBC 3.x (pvk)
+
+2000-02-01  Patrick van Kleef  <[email protected]>
+
+	* Wrote ChangeLog entries for V3.0.1 and V3.0.2 distribution (pvk)
+
+	* Incremented package version number to 3.0.2 (pvk)
+
+	* SQLNumResult calls is also called from within iODBC, so it needs   a wrapper function (pvk)
+
+	* Check the pointer instead of the content (pvk)
+
+2000-01-28  Patrick van Kleef  <[email protected]>
+
+	* Added extra check for ANSI C Compilers (pvk)
+
+	* Forgot to update pcbDSN and pcbDesc fields (pvk)
+
+	* Incremented package version number to 3.0.1 (pvk)
+
+	* Incremented package version number to 3.0.1 (pvk)
+
+	* Added new argument --libtool-libs (pvk)
+
+	* Added check for pthread library (pvk)
+
+	* Added new header file for thread-safe codebase (pvk)
+
+	* Added thread-safe macros to the codebase (pvk)
+
+	* Added thread-safe macros and definitions (pvk)
+
+2000-01-26  Patrick van Kleef  <[email protected]>
+
+	* Use $(MAKE) instead of plain make command (pvk)
+
+2000-01-21  Patrick van Kleef  <[email protected]>
+
+	* Ignore generated files (pvk)
+
+	* Removed generated files in favor of the bootstrap script (pvk)
+
+	* Added shell script for freshly checked out CVS tree (pvk)
+
+1999-12-16  Patrick van Kleef  <[email protected]>
+
+	* Refreshed generated files (pvk)
+
+	* Wrote ChangeLog entries for V3.0.0 distribution (pvk)
+
+	* Start using some of the ODBC 3.x API calls (pvk)
+
+	* Notify a ODBC 2.x driver when the internal rowset size changes (pvk)
+
+	* Added support for SQLCloseCursor (pvk)
+
+	* Added backward compatibility for SQL_OJ_CAPABILITIES call to ODBC 2.x   driver (pvk)
+
+	* Updated RPM specification file to reflect the new build (pvk)
+
+1999-12-16  Patrick van Kleef  <[email protected]>
+
+	* Set library version for ODBC 3.x interface to 3:0:1 (pvk)
+
+	* Set library version for ODBC 2.x interface to 2:51:0 (pvk)
+
+1999-12-15  Patrick van Kleef  <[email protected]>
+
+	* Added initial support for MacOS X aka Rhapsody (pvk)
+
+	* Added initial support for MacOS X aka Rhapsody (pvk)
+
+1999-12-13  Patrick van Kleef  <[email protected]>
+
+	* Only use the [ODBC Data Sources] section to populate the SQLDataSources   call
+
+	* Simplified mapping of API calls to function pointers or text (pvk)
+
+	* Removed unneeded defines (pvk)
+
+1999-12-10  Patrick van Kleef  <[email protected]>
+
+	* Ignore iodbc-config generated script (pvk)
+
+	* Refreshed generated files (pvk)
+
+	* Added config script to get information about the installed version   of iODBC. (pvk)
+
+	* Set default directory for system wide odbc.ini to /etc (pvk)
+
+	* Rewrote checks for dlopen checking (pvk)
+
+1999-12-09  Patrick van Kleef  <[email protected]>
+
+	* Removed spurious #endif (pvk)
+
+1999-12-09  George Kodinov  <[email protected]>
+
+	* Added initial ODBC 3.x support (gk)
+
+	* Added initial ODBC 3.x support (gk)
+
+1999-12-09  Patrick van Kleef  <[email protected]>
+
+	* Changed to ODBC 3.x mode (pvk)
+
+	* Regenerated files (pvk)
+
+	* Added new contributor (pvk)
+
+	* Regenerated files (pvk)
+
+	* Reran libtoolize version 1.3.4 (pvk)
+
+1999-12-09  Patrick van Kleef  <[email protected]>
+
+	* Added maintainer mode (pvk)
+
+	* Added support for ODBC 2.x and ODBC 3.x (pvk)
+
+1999-12-09  Patrick van Kleef  <[email protected]>
+
+	* Rewrote header files to support ODBC 3.5 specification (pvk)
+
+1999-06-25  Patrick van Kleef  <[email protected]>
+
+	* Added latest changes to the log
+
+	* Changed typedef for SQLHENV, SQLHDBC, SQLSTMT to be void * instead of   SQLINTEGER. Although this is contra to the official header files, it   makes life a lot easier when you have ODBC 2.0 code you want to use
+
+	* Added latest changes to the log
+
+	* Updated README to reflect the current state of the project (pvk)
+
+1999-06-25  Patrick van Kleef  <[email protected]>
+
+	* Added sql.h, sqlext.h, sqltypes.h to the list of installable headers (pvk)
+
+	* Set AutoReqProv flag to yes to allow rpm to automatically calculate
+	  dependancies (pvk)
+
+1999-06-25  Patrick van Kleef  <[email protected]>
+
+	* Regenerated file (pvk)
+
+	* Fixed check for default SYS_ODBC_INI when configure --prefix=/xxx is   used (pvk)
+
+	* Regenerated (pvk)
+
+	* Added sql.h, sqlext.h and sqltypes.h to the list of installable   include files (pvk)
+
+	* Use sql.h and sqlext.h instead of the nonstandard names isql.h and   isqlext.h (pvk)
+
+	* Renamed isql.h, isqlext.h and isqltypes.h to sql.h sqlext.h and sqtypes.h   and added dummy files for backward compatibility (pvk)
+
+	* Return SQL_SUCCESS on setting SQL_OPT_TRACEFILE (pvk)
+
+	* Removed empty line as this causes confusion to some linkers (pvk)
+
+	* Added target for binary tar distribution (pvk)
+
+1999-04-26  Patrick van Kleef  <[email protected]>
+
+	* Simplify building RPMS files on Linux (pvk)
+
+	* Removed CVS Id tag from header so Makefile.am and the generated   Makefile.in can be committed together rather than separate (pvk)
+
+	* Search for odbc.ini in various places (pvk)
+
+	* Set default system wide odbc.ini to /etc/odbc.ini if not configured   otherwise (pvk)
+
+	* Checked in generated files (pvk)
+
+	* Figure out location for system wide odbc.ini (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Checked in generated files (pvk)
+
+	* Use -I$(top_srcdir) to find the include files (pvk)
+
+	* Added source directory path to export file iodbc.exp (pvk)
+
+	* Checked in generated file (pvk)
+
+	* Added main.c to the list of files to be distributed. (pvk)
+
+	* Checked in generated file (pvk)
+
+	* Added iodbc.exp file which contains the symbol list of all symbols we   want to export using libtool. (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Added isqltypes.h (pvk)
+
+	* Updated library version to 2.0.50 (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Added Windows link file for iodbc.dll (pvk)
+
+	* Include isqltypes.h as a global include rather than a local include   file (pvk)
+
+	* Small code cleanups (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Code cleanups (pvk)
+
+	* Fixed errors in Windows macros (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Checked in new generated files (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Updated version number of package to 2.50.2 (pvk)
+
+	* Updated version number of library to 2:50:0 (pvk)
+
+1999-04-24  Patrick van Kleef  <[email protected]>
+
+	* Updated to more recent version of libtool 1.2f (pvk)
+
+	* Code cleanups (pvk)
+
+	* Added rudementary SQLGetPrivateProfileString call (pvk)
+
+	* Close open file handle (pvk)
+
+	* Use the internal form of the handle instead of the external   representation (pvk)
+
+	* Fixed some typo's (pvk)
+
+	* Use the libtool define to check for underscore representation (pvk)
+
+	* Added NEAR definition and HWND type for UNIX/VMS (pvk)
+
+1999-03-22  Patrick van Kleef  <[email protected]>
+
+	* Fixed a couple of typos (pvk)
+
+1999-03-17  Patrick van Kleef  <[email protected]>
+
+	* Added missing arguments to prototype (pvk)
+
+	* Added support for SQL_DATE, SQL_TIME and SQL_TIMESTAMP (pvk)
+
+1999-03-17  Per Schroder  <[email protected]>
+
+	* Added support for VMS (ps)
+
+1999-03-17  Patrick van Kleef  <[email protected]>
+
+	* Added Per Schroder who contributed the VMS patches to the iODBC project
+
+1999-03-17  Per Schroder  <[email protected]>
+
+	* Added support for VMS (ps)
+
+	* Added support for VMS (ps)
+
+1999-03-17  Patrick van Kleef  <[email protected]>
+
+	* Wrote new handle validation checks to make the driver manager more   resistant to handle misuse (pvk)
+
+	* Rewrote all function prototypes to conform to ODBC 2.51 standard (pvk)
+
+	* Rewrote all function prototypes to conform to ODBC 2.51 standard (pvk)
+
+	* Added file isqltypes.h (pvk)
+
+	* Rewrote all function prototypes to conform to ODBC 2.51 standard (pvk)
+
+1999-03-16  Patrick van Kleef  <[email protected]>
+
+	* Added handle type definitions (pvk)
+
+	* Added new file with ODBC 2.51 types (pvk)
+
+	* Added full support for ODBC 2.51 specifications (pvk)
+
+1999-01-25  Patrick van Kleef  <[email protected]>
+
+	* Removed 2 copyright sccs stamps and comments as requested by Ke Jin (pvk)
+
+1999-01-19  Patrick van Kleef  <[email protected]>
+
+	* Prefix should of cause be / instead of /usr if we want to install   /etc/odbc.ini
+
+	* Added support for automake 1.4, autoconf 2.13 and libtool 1.2a
+
+	* Added sample odbc.ini file
+
+	* Changed reading of tokens from .ini file. We should really rewrite all   of these functions.
+
+	* Added specification file for Linux RPM builds
+
+	* Use NEED_USCORE to set _SQL if needed
+
+	* Removed as automake/autoconf/libtool can do this portable
+
+	* Added to comply to GNU standards
+
+	* Set default options
+
+	* Added unwanted files
+
+	* Version number is now set to 2.50
+
+	* Moved Changes.log into ChangeLog to comply with GNU standards
+
+	* Added new files to comply with standard GNU source packages
+
+	* Added missing typedefs, constants and prototypes
+
+	* Moves HWND typedef to isql.h
+
+	* Added proper support for SQLDataSources * SQLDrivers now returns SQL_NO_MORE_DATA so applications will not   go into infinite loops when trying to retrieve driver information
+
+	* Removed hwnd argument from SQLBrowseConnect as this is not part of the   API
+
+	* Added sample directory framework
+
+	* Removed as libtool does this automatically
+
+1999-01-18  Patrick van Kleef  <[email protected]>
+
+	* Moved iODBC licensing to LGPL as per Ke Jin's request
+
+	* Removed old build code
+
+	* Added information on LGPL licensing
+
+	* Re-indented code * Code cleanups * Added LGPL notice in all opening comments
+
+1998-12-27  Patrick van Kleef  <[email protected]>
+
+	* Added new comment to beginning of file * Reindented code
+
+	* Checkin of initial version from Ke Jin
+
+	* Checkin of initial version from Ke Jin

+ 48 - 0
odbc.mod/iodbc/IAFA-PACKAGE

@@ -0,0 +1,48 @@
+Title:	iODBC Driver Manager 
+
+Version:	3.52.11
+
+Description:	iODBC (independent Open Database Connectivity) 
+		driver manager is compatible with ODBC 3.x specification
+		and performs exactly same jobs of ODBC 3.x driver
+		manager (i.e. driver loading, Parameters and function
+		sequence checking, driver's function Invoking, etc.).
+
+		Any ODBC driver that works with ODBC 3.0 driver manager
+		will also work with iODBC driver manager and vice versa.
+
+		Applications (using ODBC function calls) linked with
+		iODBC driver manager will be able to simultaneously
+		access different type of data sources within one process
+		through suitable ODBC drivers.
+		
+Original Author:		Ke Jin <[email protected]>
+Source Code 
+Enhancement Contributors:	OpenLink Software
+Source Maintainers:		iODBC Maintainer <[email protected]>
+Web Site:                       http://www.iodbc.org/
+
+Platforms:	SunOS (Sparc)		4.1.x
+		HP/UX (s700/s800)	9.x, 10.x
+		HP/UX (s300/s400) 	9.x 
+		IBM AIX			3.x, 4.x 
+		Solaris (Sparc)		2.x
+		Solaris (PCx86)		2.x
+		SGI Irix 		5.x, 6.x
+		NCR SVR4 		3.x
+		UnixWare SVR4.2  	1.x, 2.x
+		DEC Unix (OSF/1)	3.x, 4.x
+		FreeBSD			2.x
+		BSDI BSD/OS		2.x
+		Linux ELF 		1.2.x
+		SCO OpenServer		5.x 
+		Concurrent MAX/OS	1.x 
+		DG/UX			5.x
+
+License Policy:	Freely Redistributable under either the
+		GNU Library General Public License (LGPL) 
+		(see file LICENSE.LGPL for details)
+		or the BSD License
+		(see file LICENSE.BSD for details)
+
+Keywords:	ODBC, database, SQL, OpenLink

+ 229 - 0
odbc.mod/iodbc/INSTALL

@@ -0,0 +1,229 @@
+Copyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
+
+   This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  (Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.)
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You only need
+`configure.ac' if you want to change it or regenerate `configure' using
+a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  Run `./configure --help'
+for details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not support the `VPATH'
+variable, you have to compile the package for one architecture at a
+time in the source code directory.  After you have installed the
+package for one architecture, use `make distclean' before reconfiguring
+for another architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' cannot figure out
+automatically, but needs to determine by the type of machine the package
+will run on.  Usually, assuming the package is built to be run on the
+_same_ architectures, `configure' can figure that out, but if it prints
+a message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the `--target=TYPE' option to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+   Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+will cause the specified gcc to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+`configure' Invocation
+======================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

+ 16 - 0
odbc.mod/iodbc/LICENSE

@@ -0,0 +1,16 @@
+iODBC Driver Manager
+Copyright (C) 1995 Ke Jin <[email protected]>
+Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+All Rights Reserved.
+
+This software is released under either the GNU Library General Public
+License (see LICENSE.LGPL) or the BSD License (see LICENSE.BSD).
+
+Note that the only valid version of the LGPL license as far as this
+project is concerned is the original GNU Library General Public License
+Version 2, dated June 1991.
+
+While not mandated by the BSD license, any patches you make to
+the iODBC may be contributed back into the iODBC project at your
+discretion. Contributions will benefit the Open Source and Data Access
+community as a whole. Submissions may be made at http://www.iodbc.org.

+ 29 - 0
odbc.mod/iodbc/LICENSE.BSD

@@ -0,0 +1,29 @@
+iODBC Driver Manager
+Copyright (C) 1995 Ke Jin <[email protected]>
+Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+    this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the
+    documentation and/or other materials provided with the distribution.
+ 3. Neither the name of OpenLink Software nor the names of its
+    contributors may be used to endorse or promote products derived from
+    this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR CONTRIBUTORS
+BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.

+ 481 - 0
odbc.mod/iodbc/LICENSE.LGPL

@@ -0,0 +1,481 @@
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+    		    51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+		  GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License").  Each licensee is
+addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    c) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    d) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public
+    License along with this library; if not, write to the Free
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!

+ 253 - 0
odbc.mod/iodbc/Makefile.am

@@ -0,0 +1,253 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1995 Ke Jin <[email protected]>
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+AUTOMAKE_OPTIONS	= gnu dist-zip 1.9.6
+
+SUBDIRS 		= admin bin etc man include iodbcinst iodbc iodbcadm drvproxy samples
+
+ACLOCAL_AMFLAGS		= -I admin
+
+EXTRA_DIST		= \
+	$(srcdir)/IAFA-PACKAGE \
+	$(srcdir)/LICENSE \
+	$(srcdir)/LICENSE.LGPL \
+	$(srcdir)/LICENSE.BSD \
+	$(srcdir)/README \
+	$(srcdir)/README.md \
+	$(srcdir)/README_GIT \
+	$(srcdir)/README_GIT.md \
+	$(srcdir)/README_MACOSX \
+	$(srcdir)/README_MACOSX.md \
+	$(srcdir)/autogen.sh \
+	$(srcdir)/PORT.OpenLink \
+	$(srcdir)/acinclude.m4 \
+	$(srcdir)/drvproxy/*.exp \
+	$(srcdir)/mac/drvproxy.exp \
+	$(srcdir)/mac/framework-include.sh \
+	$(srcdir)/mac/GNUmakefile \
+	$(srcdir)/mac/iodbc-config.macos \
+	$(srcdir)/mac/iodbc.exp \
+	$(srcdir)/mac/iODBC/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBC/Info-iODBC.plist \
+	$(srcdir)/mac/iODBC/iODBC.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBC/iODBC.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBC/iODBC.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBC/iODBC.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iodbcadm.exp \
+	$(srcdir)/mac/iODBCadm/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCadm/Info-iODBCadm.plist \
+	$(srcdir)/mac/iODBCadm/iODBCadm.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCadm/iODBCadm.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCadm/iODBCadm.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCadm/iODBCadm.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCadministrator/*.h \
+	$(srcdir)/mac/iODBCadministrator/*.m \
+	$(srcdir)/mac/iODBCadministrator/Base.lproj/MainMenu.xib \
+	$(srcdir)/mac/iODBCadministrator/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCadministrator/en.lproj/iODBCAdministrator.icns \
+	$(srcdir)/mac/iODBCadministrator/en.lproj/odbcman.tiff \
+	$(srcdir)/mac/iODBCadministrator/Info-iODBC_Administrator.plist \
+	$(srcdir)/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCadministrator/iODBCadministrator.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCadministrator64/*.h \
+	$(srcdir)/mac/iODBCadministrator64/*.m \
+	$(srcdir)/mac/iODBCadministrator64/Base.lproj/MainMenu.xib \
+	$(srcdir)/mac/iODBCadministrator64/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCadministrator64/en.lproj/iODBCAdministrator.icns \
+	$(srcdir)/mac/iODBCadministrator64/en.lproj/odbcman.tiff \
+	$(srcdir)/mac/iODBCadministrator64/Info-iODBC_Administrator.plist \
+	$(srcdir)/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCadministrator64/iODBCadministrator64.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCdemo/*.h \
+	$(srcdir)/mac/iODBCdemo/*.m \
+	$(srcdir)/mac/iODBCdemo/Base.lproj/ExecSQL.xib \
+	$(srcdir)/mac/iODBCdemo/Base.lproj/MainMenu.xib \
+	$(srcdir)/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCdemo/DemoAnsi/DemoAnsi.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCdemo/DemoAnsi/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCdemo/DemoAnsi/InfoAnsi.plist \
+	$(srcdir)/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCdemo/DemoUnicode/DemoUnicode.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCdemo/DemoUnicode/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCdemo/DemoUnicode/InfoUnicode.plist \
+	$(srcdir)/mac/iODBCdemo/DSNchooserController.xib \
+	$(srcdir)/mac/iODBCdemo/en.lproj/Credits.rtf \
+	$(srcdir)/mac/iODBCdemo/en.lproj/iODBCdemo.icns \
+	$(srcdir)/mac/iODBCdemo/iodbcdemo_Prefix.pch \
+	$(srcdir)/mac/iODBCdrvproxy/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCdrvproxy/Info-iODBCdrvproxy.plist \
+	$(srcdir)/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCdrvproxy/iODBCdrvproxy.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iodbcinst.exp \
+	$(srcdir)/mac/iODBCinst/en.lproj/InfoPlist.strings \
+	$(srcdir)/mac/iODBCinst/Info-iODBCinst.plist \
+	$(srcdir)/mac/iODBCinst/iODBCinst.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCinst/iODBCinst.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCinst/iODBCinst.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCinst/iODBCinst.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCtest/iODBCtest.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCtest/iODBCtest.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCtest/iODBCtest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCtest/iODBCtest.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/iODBCtestw/iODBCtestw.xcodeproj/project.pbxproj \
+	$(srcdir)/mac/iODBCtestw/iODBCtestw.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+	$(srcdir)/mac/iODBCtestw/iODBCtestw.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+	$(srcdir)/mac/iODBCtestw/iODBCtestw.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+	$(srcdir)/mac/link-inclibs.sh \
+	$(srcdir)/debian/changelog \
+	$(srcdir)/debian/compat \
+	$(srcdir)/debian/control \
+	$(srcdir)/debian/copyright \
+	$(srcdir)/debian/iodbc.files \
+	$(srcdir)/debian/iodbc.install \
+	$(srcdir)/debian/iodbc.lintian-overrides \
+	$(srcdir)/debian/iodbc.undocumented \
+	$(srcdir)/debian/libiodbc2-dev.examples \
+	$(srcdir)/debian/libiodbc2-dev.files \
+	$(srcdir)/debian/libiodbc2-dev.install \
+	$(srcdir)/debian/libiodbc2.docs \
+	$(srcdir)/debian/libiodbc2.examples \
+	$(srcdir)/debian/libiodbc2.files \
+	$(srcdir)/debian/libiodbc2.install \
+	$(srcdir)/debian/libiodbc2.lintian-overrides \
+	$(srcdir)/debian/libiodbc2.undocumented \
+	$(srcdir)/debian/README.Debian \
+	$(srcdir)/debian/rules \
+	$(srcdir)/debian/watch 
+
+# ----------------------------------------------------------------------
+#
+#  Maintainers only
+# 
+# ----------------------------------------------------------------------
+
+MAINTAINERCLEANFILES	= Makefile.in aclocal.m4 configure
+DISTCLEANFILES		= config.nice
+
+
+if MAINTAINER_MODE
+
+#
+#  Create Linux RPM's
+#
+RPMFLAGS=--define="_topdir `pwd`/distrib"
+
+linux-rpm:
+	$(mkinstalldirs) distrib/SOURCES distrib/SRPMS distrib/SPECS
+	$(mkinstalldirs) distrib/BUILD distrib/RPMS/i386
+	$(MAKE) dist
+	cp $(PACKAGE)-$(VERSION).tar.gz distrib/SOURCES
+	rpmbuild $(RPMFLAGS) -ba admin/libiodbc.spec
+	rpmbuild $(RPMFLAGS) --clean --rmsource admin/libiodbc.spec
+
+#
+#  Create a tar file containing the library and include files
+#
+binary-tar:
+	-mkdir @build@
+	$(MAKE) install prefix=`pwd`/@build@
+	tar cvf @[email protected] @build@
+	gzip -9vf @[email protected]
+	rm -rf @build@
+
+#
+#  Create a source snapshot package
+#
+snapshot:
+	$(MAKE) dist distdir=$(PACKAGE)-`date +"%Y%m%d"`
+
+
+#
+#  Create an official release package
+#
+release:
+	$(MAKE) distcheck
+
+#
+#  Generate ChangeLog
+#
+.PHONY: changelog
+changelog:
+	git2cl --format='%s%n%n%b%n' --strip-tab --strip-cherry-pick > ChangeLog
+
+endif

+ 415 - 0
odbc.mod/iodbc/NEWS

@@ -0,0 +1,415 @@
+Jun 07 2021, V3.52.15:
+    * Added support for macOS Big Sur (11.x) on Apple Silicon using a universal build
+    * Fixed title to show CPU architecture used
+    * Fixed length of error message buffer
+    * Fixed small portability issues
+    * Removed support for Mac OS X Snow Leopard (10.6) and older
+    * Removed deprecated iODBCcfmbridge for PPC
+
+    * Upgraded iODBC build to use recent versions of Xcode
+      - Minimum Xcode version is set to Xcode 8.0
+      - Minimum macOS deployment target is OS X Mavericks (10.9)
+      - Migrated dialogs and plist files
+      - Migrated translation support
+
+Feb 17 2021, V3.52.14:
+    * Added support for transparent conversion between UCS4, UTF-8, and UTF-16 codepages
+    * Small documentation fixes
+    * Fixed issue with return buffer
+    * Fixed compiler warnings
+    * Fixed missing check on pcbConnStrOut
+    * Fixed SQLSetEnvAttr doesn't return SQL_SUCCESS for option SQL_ATTR_APP_UNICODE_TYPE
+    * Fixed issue with switch ODBC driver to best supported unicode codepage
+    * Fixed typo in SQLBrowseConnect
+    * Fixed SQLGetConnectOption returned wrong value for SQL_CURRENT_QUALIFIER and SQL_TRANSLATE_DLL for some cases
+    * Fixed mixing calls to SQLFetchScroll with SQLFetch
+    * Fixed unicode conversion issues
+    * Fixed ansi buffers allocation
+    * Fixed issue with tracing
+    * Fixed truncate data in SQLGetPrivateProfileStringW
+
+Jul 23 2019, V3.52.13:
+    * Added extra validation for SQLAllocHandle (SQL_HANDLE_DESC, ...)
+    * Added GCC __attribute__ for checking format string
+    * Added missing define SQL_CONVERT_GUID
+    * Fixed issue using heap after free in SQLConnect_internal
+    * Fixed issue with global mutex in SQLError, SQLGetDiagRec and SQLGetDiagField
+    * Fixed SQLSetStmtAttr to cache the correct values for SQL_ATTR_ROW_ARRAY_SIZE and SQL_ATTR_ROW_BIND_TYPE
+    * Fixed format specifiers and some casts to fix trace output
+    * Fixed missing check for section in SQLGetPrivateProfileString
+    * Fixed non-void function needs to return a value
+    * Fixed issue in Mac Cocoa code
+    * Fixed iODBC apps/frameworks CFBundleGetInfoString attribute
+    * Fixes an issue where build fails on Alpine
+    * Fixed package versioning
+    * Fixed small memory leaks
+
+Jul 12 2016, V3.52.12:
+    * Added new Cocoa based dialogs for Mac OS X which will allow 64bit applications to
+      use the standard Login and Setup dialogs from the iODBCinst framework
+    * Added 64bit version of the iODBC Administrator to configure and test DSNs on drivers that are
+      only available in 64bit format
+    * Fixed User DSN support for recent versions of Microsoft Excel and Query on Mac OS X
+    * Documentation fixes
+
+May 25 2016, V3.52.11 (internal release):
+    * Added xcodebuild option for Mac OS X 10.11
+    * Added support for x86_64 to iODBC Demo
+    * Fix crash ODBCdemo - error message overwrite stack data
+    * Fix iODBCdemo issue with UID/PWD values
+    * Fixed crash in iODBC DM on push of "Test" button when 64bit ODBC driver is used.
+    * Fixed crash when create_dsnsetup fails to load the window.
+    * Fixed crash when passing an empty connect string with no window handle
+    * Fixed crash when passing an empty connect string with no window handle.
+    * Fixed iODBCadm and iODBCdrvproxy Development build errors on OS X
+    * Fixed iODBCadm and iODBCdrvproxy Development build errors on OS X.
+    * Fixed iODBCdrvproxy XIBs not compiling to NIBs on OS X.
+    * Fixed issue in SQLGetInfo
+    * Fixed issue with Xcode on Mac OS X 10.10 Xcode 7.2.1
+    * Fixed use only major.minor of Mac OS X version to configure flags
+    * Fixed crash when create_dsnsetup fails to load the window
+
+Feb 10 2015, V3.52.10:
+     * Fixed issue with ~/Library/ODBC/odbc[inst].ini on Mac OS X --
+       iODBC created ~/.odbc[inst].ini when ~/Library/ODBC/odbc[inst].ini did not exist
+	* If $HOME/.odbc[inst].ini exists, automatically import it and then replace it 
+	  with symlink to $HOME/Library/ODBC/odbc[inst].ini for backward compatibility 
+	  with third party drivers
+	* Always read from $HOME/Library/ODBC/odbc[inst].ini
+
+    * Added build support for Mac OS X 10.10
+
+    * Updated iODBC Administrator
+	- Renamed OpenLink ODBC Administrator to iODBC Administrator
+	- Install iODBC Administrator in /Applications/iODBC/
+	- Fixed About dialog
+	- Fixed UI elements
+	- Fixed FileDSN default path
+	- Fixed FileDSN save dialog 
+	- Fixed Set Trace file option
+	- Fixed Mac OS X file chooser dialogs to return long file names
+
+    * Updated iODBC Demo
+	- Fixed app names/titles to iODBC Demo Unicode and iODBC Demo Ansi
+	- Updated iODBCdemo on Mac OS X to support blue links in gridView
+	- Fixed column resize in gridView for "SPARQL DESCRIBE..." queries
+
+    * Fixed string truncation in Unicode <-> Ansi conversion on some API calls
+
+
+Apr 15 2014, V3.52.9:
+    * Added support for building on recent versions of Mac OS X
+    * Fixed warnings from autoconf/automake
+    * Fixed infinite loop in connection pool
+    * Fixed compiler warnings
+    * Fixed build dependency for make -jX
+    * Fixed check for Unicode driver
+    * Fixed issue calling SQLCancel from other thread
+    * Fixed SQLInstallDriverEx when driver is readonly
+
+
+Mar 27 2012, V3.52.8:
+    * Converted from CVS to GIT
+    * Added build support for Mac OS X 10.5, 10.6 and 10.7
+    * Converted old Mac OS X .nib format to newer .xib format
+    * Fixed issue with using buffer after free
+    * Fixed use ssize_t where appropriate
+    * Fixed issue with strlen if param can be NULL
+    * Fixed use ssize_t for length of string
+    * Fixed tracing SQLGetData using multiple chunks
+    * Fixed problem tracing on big-endian machines
+    * Fixed wrong type label
+    * Fixed compiler warnings
+
+Sep 10 2009, V3.52.7:
+    * Added iODBC Graphical Administrator for Mac OS X
+    * Added iODBC CFM Bridge
+    * Added resizable windows and dialogs for GTK+
+    * Added option in tracefile for sequence number ($S)
+    * Added additional translations between ANSI and Unicode
+    * Fixed if tracefile gets too big, continue in new tracefile
+    * Fixed unload bug due to wrong pointer deref
+    * Fixed Connection Pooling UI
+    * Fixed checking odbc_ver on connect handle
+    * Fixed packaging of runtime only libraries
+    * Fixed porting issues
+    * Fixed documentation
+
+Oct 08 2007, V3.52.6:
+    * Added support for GTK+ 2.x
+    * Fixed long mutex lock on connect
+    * Fixed problems with SQLBrowseConnect
+    * Fixed missing functions in export list
+    * Fixed core dump when checking for driver odbc version
+    * Fixed allocation error in SQLDescribeCol
+    * Fixed rpm specification for RedHat
+    * Fixed porting problems on FreeBSD, OpenBSD and OSF
+    * Use SQLFetchScroll in iodbctest
+
+Jan 05 2007, V3.52.5:
+    * Added support for FileDSN
+    * Added support for Connection Pooling
+    * Added check for tracefile size
+    * Call ODBC 2.x functions in driver if application uses ODBC 2.x only calls
+    * Fixed problem parsing driver result in SQLSetStmtAttr
+    * Fixed source code readability
+    * Fixed bug in overwriting driver name
+    * Fixed check for /Library/ODBC for Mac OS X
+    * Fixed prototypes
+    * Rewrote bootstrap script and configure summary
+    * Use localtime_r in tracing when available
+    * Fixed build issues with Mac OS X
+    * Small code cleanups and fixes
+
+Jan 26 2006, V3.52.4:
+    * Added support for Mac OS X 10.4 Universal kit (ppc, ppc64 and i386)
+    * Removed dependency between iodbc and iodbcinst shared libraries
+    * Cleanup Mac OS X build process
+    * Clarify LGPL license conditions
+    * Fixed problem with error on subsequent SQLExecute statements
+    * Fixed problem building 64bit GUI components
+    * Fixed compiler warnings
+    * Fixed problem determining which compiler to use on AIX
+    * Enabled SHLIB_PATH on HP/UX
+    * Fixed problem using # as comment in odbc.ini file
+    * Disabled --disable-odbc3 flag
+    * Small code cleanups and fixes
+
+Nov 04 2005, V3.52.3:
+    * Added support for DSN-less connections
+    * Added timestamp to ENTER/EXIT lines in trace file
+    * Added build support for AIX 5.x, HP/UX 11.23 Itanium
+    * Added build support for Mac OS X 10.3 (32bit) and 10.4 (32bit+64bit)
+    * Fixed problem with certain compilers hating lvalue casting
+    * Fixed problem with truncated messages in iodbctest
+    * Fixed problem calling setup dialog multiple times
+    * Fixed problem with ODBC_BOTH_DSN
+    * Fixed problem with tracing SQLGetInfo
+    * Fixed problem with NUL termination on setup dialog
+    * Fixed problem building on Mac OS X 10.4 64bit
+    * Fixed problem calculating buffer length after calling setup dialog
+    * Fixed problem with SQLDriverConnect (SQL_DRIVER_PROMPT) if no
+      setup dialog had been registered
+    * Fixed symbol clash between Oracle Instant client and iODBC on Mac OS X
+    * Fixed problem building iODBCadm and drvproxy on Mac OS X
+    * Fixed problem building on machines with older iODBC installation
+
+Feb 04 2005, V3.52.2:
+    * Added tracing option for root without overwriting existing files
+    * Added PORT.OpenLink script
+    * Added special iodbc-config script for Mac OS X framework build
+    * Fixed problem starting/stopping tracing
+    * Fixed SQLSetConnectAttr to return SQL_SUCCESS_WITH_INFO
+      if driver cannot handle option set before connect time
+    * Fixed SQLInfo to use pcbInfoValue if present
+    * Fixed NULL pointer problem in GTK choose driver dialog
+    * Fixed problem with C++ prototypes with older 32bit code
+    * Fixed locking problem with SQLAllocEnv/SQLAllocHandle
+    * Fixed tracefile name expansion
+    * Fixed problem running bootstrap.sh on machines without GTK
+    * Fixed problem installing code in temp directory for packaging
+    * Fixed problem calling SQLGetDiagRec on uninitialized handles
+      in iodbctest program
+    * Link iodbctest program with static iodbc libraries
+   
+Sep 29 2004, V3.52.1:
+    * Added support for new ODBC 3.52 specification for 64bit environments
+    * Added support for SQLGetEnvAttr(SQL_ATTR_WCHAR_SIZE extension
+    * Added missing Mac OS X build files
+    * Added script to symlink Mac OS X framework into /usr/local/iODBC
+      to allow traditional GNU configurable packages to use the same
+      version of iODBC
+    * Added new layer to driver loading to prevent memory leaks when
+      drivers cannot be physically unloaded
+    * Added man pages for iodbc-config, iodbctest and iodbcadm-gtk
+    * Added header file iodbcunix.h for portability
+    * Enhanced tracing for SQLGetFunctions, SQLColAttribute
+    * Fixed NULL pointer problem when connection failed
+    * Fixed initialization problem with SQLGetPrivateProfileString
+    * Fixed export Unicode and ANSI names of ODBC functions in libiodbc
+    * Fixed SQLSetScrollOption emulation
+    * Fixed tracing for SQLSetDescRec
+    * Fixed rpm build issue with RedHat 9
+    * Fixed MAC OS X install problem
+    * Fixed Mac OS X build dependency on Carbon libraries
+    * Fixed HP/UX shared library name handling
+    * Fixed handling of UTF-8 sequences
+    * Fixed compiler warnings
+    * Small code cleanups and fixes
+ 
+
+Feb 24 2004, V3.51.2:
+    * Added support for installation layouts for different distributions
+      e.g. --with-layout=RedHat
+    * Added support for Mac OS X 10.3 (panther)
+    * Added support for creating libodbc.so symlink
+    * Added more ODBC 3.x calls to iodbctest.c program
+    * Added SQLRowCount for SQL UPDATE/DELETE statements in iodbctest.c
+    * Fixed build problem with older make programs
+    * Fixed bug in state handling SQLCloseCursor 
+    * Fixed driver statement allocation problem
+    * Fixed double free in statement handle
+    * Fixed problem tracing variable length strings and binary data
+    * Use snprintf when available to guard against buffer overruns
+    * Small documentation fixes
+
+Sept 08 2003, V3.51.1:
+    * Fixed library dependency for PHP and other open source packages
+    * Fixed build problems on Mac OS X
+    * Fixed default compiler and flags for threaded builds
+    * Small bugfixes
+
+Aug 22 2003, V3.51.0:
+    * Added Unicode support
+    * Added tracing functionality
+    * Minor cleanups and bugfixes
+
+Apr 29 2002, V3.0.6:
+    * Added instructions for building MyODBC on Mac OS X
+    * Added support for building iODBC on Mac OS X as a framework
+    * Fixed creating new window handle
+    * Fixed portability issues
+    * Use the latest versions of autoconf, automake and libtool
+    * Updated all comments to reflect the new dual licensing policy
+    * Fixed bug in SQLError/SQLGetDiagRec
+    * Added support for driver specific connect options
+    * Fixed wrong argument to SQLEndTran
+    * Fixed handling statement descriptor
+    * Fixed DSN string handling
+    * Fixed mapping in SQLColumnAttributes
+    * Minor cleanups and bugfixes
+
+Jun 7 2001, V3.0.5:
+    * Added new iodbcinst code
+    * Added new drvproxy and iodbcadm GTK frontend
+    * iODBC released under LGPL or BSD license
+    * SQLMoreResults always returned SQL_NO_DATA_FOUND
+
+Jun 4 2001, V3.0.4:
+    * Reorganized source tree to use multiple subdirectories in 
+      preparation of adding the new iodbcinst code
+    * Use config.h instead of massive CFLAGS
+    * Generate libiodbc.spec with correct version number
+
+Jun 1 2001, V3.0.3:
+    * Added support for automake 1.4-p2, autoconf 2.50 and libtool 1.4
+    * Fixed problems with shl_unload on HP/UX
+    * Added support for MacOS X 1.2 (Darwin)
+    * Disallow root to start a debug session (security risk)
+    * SQLDatasources returns Driver Type instead of DSN Description
+    * Added checks for ODBC 3.x date, time and timestamp defines
+    * Fixed initialization of cip flag 
+
+Feb 1 2000, V3.0.2:
+    * Fixed deadlock problem in SQLNumResultCols
+    * Small code fix in SQLDatasources
+
+Jan 28 2000, V3.0.1:
+    * Added thread support into Driver Manager
+    * Added code to allow Threaded application to call non-threaded driver
+    * Small code fixes and cleanups
+
+Dec 16 1999, V3.0.0:
+    * Added initial support for ODBC 3.x API and the ODBC 3.x to 2.x
+      translation layer
+    * Added --disable-odbc3 flag to configure.in for building ODBC 2.x 
+      compatible driver manager
+    * Added --enable-maintainer-mode flag to configure.in
+    * Rewrote dlopen and underscore checks in configure.in
+    * Default iodbc-inidir is set to /etc
+    * Clear error stack at the start of each ODBC function
+    * Imported libtool 1.3.4
+    * Small code cleanups
+    * Created iodbc-config script for other projects to find out how
+      to link with the iodbc libraries.
+    * Fixed bug in SQLDataSources 
+    * Added initial support for MacOS X (Rhapsody)
+    * Add some ODBC 3.x API calls to the odbctest program
+    
+June 25, 1999, V2.50.3:
+    * Renamed public header files to conform to ODBC standard 
+    * System wide iodbc.ini can now be set with --with-odbc-inidir=,
+      default is set to $sysconfdir/odbc.ini to comply with GNU 
+      standards
+    * Some small bug fixes
+    * Added AutoReqProv flag to RPM .spec file
+    * Changed types for SQLHENV, SQLHDBC, SQLHSTMT
+
+April 26, 1999, V2.50.2:
+    * Small code cleanups (pvk)
+    * Wrote new handle validation checks to make the driver manager more
+      resistant to handle misuse (pvk)
+    * Rewrote all function prototypes to conform to ODBC 2.51 standard (pvk)
+    * Use the internal form of the handle instead of the external
+      representation (pvk)
+    * Removed 2 copyright sccs stamps and comments as requested by Ke Jin (pvk)
+    * Added rudementary SQLGetPrivateProfileString call (pvk)
+    * Added support for VMS (ps)
+
+January 18, 1999, V2.50:
+    * Added autoconf/automake/libtool support
+    * Licensing moved to LGPL 
+    * Added OpenLink code enhancements and bug fixes
+
+------------------------------------------------------------------------
+Original Changelog from Ke Jin
+------------------------------------------------------------------------
+July 30, 1995, v2.00.beta: 
+	0. the first release and beta version. 
+
+Sep. 11, 1995, v2.10:
+	1. Porting to AIX 3.x and 4.x, by writing dlopen(),
+	   dlsym(), dlclose() interface. 
+	2. Tested on SCO OpenServer 5.x 
+	3. Awared of that, unlike s700/s800, exported function 
+	   symbols on HP9000 s300/s400 will be prepended with 
+	   a '_' prefix by compiler(and this '_' prefix is not
+	   automatically handled by shl_findsym()). Now, it works
+	   fine on s300/s400.
+	4. Support driver ODBC call tracing.
+
+Oct. 12, 1995, v2.11:
+	5. Driver's SQLNumResultCols() will automatically be 
+	   invoked in driver manager's SQLExecute(),
+	   SQLExecDirect() and SQLParamData() after successfully 
+	   (i.e. return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO )
+	   calling of their correspondent driver functions. This 
+	   simplifies the state tracing/checking of the driver 
+	   manager a lot and allows store procedures to return 
+	   result set and also make iODBC driver manager work 
+	   properly with SELECT INTO statements which actually 
+	   don't return result sets.
+	6. Memory leaks are cleared.
+	7. Two bugs in dld.c for AIX are fixed 
+	8. A bug of setting tracing option is fixed.
+	9. The driver will not be unloaded by SQLDisconnect() 
+	   but by SQLFreeConnect() or next SQLConnect()/
+	   SQLDriverConnect()/SQLBrowsConnect() on a different 
+	   driver. This will save driver's loading time if it
+	   has been used by a previous connection(even there
+	   is no active connection on this driver).
+	10.Another three platforms are supported:
+		FreeBSD			2.x 
+		Concurrent Max/OS SVR4	1.x
+		DG/UX			5.x
+	11.autoconfig and build -- shell scripts to help modifying 
+	   Config.mk and building iodbc driver manager
+
+Nov. 12, 1995, v2.12
+	12.I realized that a driver manager doesn't aware of 
+	   difference between a C5 (i.e. hstmt) and a C6 
+	   (i.e. transaction) states. 
+	13.The link flags "-lc" has been droped from Linux ELF
+	   section of Config.mk to fix a segment fault problem.
+	   Now, it works fine on Slackware 2.3 and Red Hat 2.0
+	   (kernel version are 1.2.xx and 1.3.xx respectively).
+	14.On FreeBSD 2.x, dlsym() doesn't handle the '_' prefix 
+	   prepended to an exportting function symbol by compiler. 
+	   So, CLI_NAME_PREFIX needs to be defined as "_SQL" for 
+	   FreeBSD 2.x. 
+	15.Some files are renamed
+		dld.c	-> dlf.c
+		dld.h	-> dlf.h
+		confg.h -> config.h
+	16. Fix a bug on setting tracing options.
+

+ 489 - 0
odbc.mod/iodbc/PORT.OpenLink

@@ -0,0 +1,489 @@
+#!/bin/sh
+#
+#  PORT.OpenLink
+#
+#  Script to port iODBC to various platforms and ABIs
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+#
+#  Defaults
+#
+TOP=`pwd`
+OS=`admin/config.guess`
+PREFIX=/usr/local/iODBC
+
+CC=${CC:-cc}
+CFLAGS=${CFLAGS:-"-O"}
+LDFLAGS=${LDFLAGS:-""}
+CONFLAGS=${CONFLAGS:-"--disable-gui --enable-maintainer-mode"}
+MAKE=${MAKE:-make}
+
+BUILD=run_make
+
+export TOP CC CFLAGS LDFLAGS OS PREFIX CONFLAGS BUILD MAKE
+
+
+#
+#  Parse arguments
+#
+ARG=${1:-usage}
+case $ARG in
+    -[Cc]|configure) 
+	BUILD=run_config;;
+
+    -[Mm]|make)	   
+	BUILD=run_make;;
+
+    *)
+	echo "PORT script to build OpenLink type installation packages"
+	echo "in $PREFIX."
+	echo ""
+	echo "Usage: $0 [ -c | -m]"
+	echo ""
+	echo "  -c  run configure"
+        echo "  -m  run make [clean|install]"
+	exit 1
+	;;
+esac
+
+
+#
+#  Optional argument for make clean
+#
+shift
+MAKERULE=${*:-""}
+export MAKERULE
+
+
+#
+#  Configure the package
+#
+run_config()
+{
+    MODE=${1:-"default"}
+    export MODE
+
+    case $MODE in
+    o32)	# Irix
+	$TOP/admin/mkinstalldirs build-o32
+	cd build-o32
+	../configure --prefix=$PREFIX $CONFLAGS --bindir='${prefix}/bino32' --libdir='${prefix}/libo32'
+	cd ..
+	;;
+
+    32)
+	$TOP/admin/mkinstalldirs build-32
+	cd build-32
+	../configure --prefix=$PREFIX $CONFLAGS --bindir='${prefix}/bin32' --libdir='${prefix}/lib32'
+	cd ..
+	;;
+
+    64)
+	$TOP/admin/mkinstalldirs build-64
+	cd build-64
+	../configure --prefix=$PREFIX $CONFLAGS --bindir='${prefix}/bin64' --libdir='${prefix}/lib64'
+	cd ..
+	;;
+
+    universal)
+	$TOP/admin/mkinstalldirs build-universal
+	cd build-universal
+	../configure --prefix=$PREFIX $CONFLAGS 
+	cd ..
+	;;
+
+    cur)
+	./configure --prefix=$PREFIX $CONFLAGS
+	;;
+
+    *)
+	$TOP/admin/mkinstalldirs build
+	cd build
+	../configure --prefix=$PREFIX $CONFLAGS
+	cd ..
+	;;
+    esac
+}
+
+
+#
+#  Make the package
+#
+run_make()
+{
+    MODE=${1:-"default"}
+    export MODE
+
+    case $MODE in
+    o32)
+	cd build-o32
+	$MAKE $MAKERULE
+	cd ..
+	;;
+
+    32)
+	cd build-32
+	$MAKE $MAKERULE
+	cd ..
+	;;
+
+    64)
+	cd build-64
+	$MAKE $MAKERULE
+	cd ..
+	;;
+
+    universal)
+	cd build-universal
+	$MAKE $MAKERULE
+	cd ..
+	;;
+
+    cur)
+    	$MAKE $MAKERULE
+	;;
+
+    *)
+	cd build
+	$MAKE $MAKERULE
+	cd ..
+	;;
+    esac
+}
+
+
+#
+#  Main
+#
+case $OS in
+    powerpc-ibm-aix4*)
+	CC=cc_r7
+	CFLAGS="-O -q32"
+	LDFLAGS="-brtl"
+	OBJECT_MODE=64
+	export CC CFLAGS LDFLAGS OBJECT_MODE
+	$BUILD 32
+
+	CC=cc_r7
+	CFLAGS="-O -q64"
+	LDFLAGS="-brtl"
+	OBJECT_MODE=64
+	export CC CFLAGS LDFLAGS OBJECT_MODE
+	$BUILD 64
+	;;
+
+    hppa2.0w-hp-hpux11*)
+	CFLAGS="-O -Ae +DA1.1"
+	export CFLAGS
+	$BUILD 32
+
+	CFLAGS="-O -Ae +DA2.0W"
+	export CFLAGS
+	$BUILD 64
+	;;
+
+    sparc-sun-solaris2.*)
+	CFLAGS="-O"
+	export CFLAGS
+	$BUILD 32
+
+	CFLAGS="-O -xtarget=ultra -xarch=v9"
+	export CFLAGS
+	$BUILD 64
+	;;
+
+    i[3456]86-*-solaris2.*)
+        CFLAGS="-O -xtarget=opteron"
+        export CFLAGS
+        $BUILD 32
+
+        CFLAGS="-O -xtarget=opteron -xarch=amd64"
+        export CFLAGS
+        $BUILD 64
+        ;;
+
+    i[3456]86-pc-linux-*)
+    	CFLAGS="-O3"
+	CONFLAGS="--enable-gui --enable-maintainer-mode"
+	export CFLAGS CONFLAGS
+	$BUILD cur
+	;;
+
+    x86_64-suse-linux)
+       CFLAGS="-O3"
+       CONFLAGS="--enable-gui --enable-maintainer-mode"
+       export CFLAGS CONFLAGS
+       $BUILD
+       ;;
+
+    x86_64-*-linux-gnu)
+       CONFLAGS="--enable-gui --enable-maintainer-mode --with-pic"
+
+       CFLAGS="-O3 -m32"
+       export CFLAGS CONFLAGS
+       $BUILD 32
+
+       CFLAGS="-O3 -m64"
+       export CFLAGS CONFLAGS
+       $BUILD 64
+       ;;
+
+    aarch64-apple-darwin20*)
+       PREFIX=/usr/local/iODBC.universal
+       CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+       CFLAGS="-O -mmacosx-version-min=10.9 -arch arm64 -arch x86_64"
+       export PREFIX CONFLAGS CFLAGS
+       $BUILD universal
+       ;;
+
+
+    *-apple-darwin14*)
+       PREFIX=/usr/local/iODBC.darwin
+       CONFLAGS="--disable-shared --with-pic"
+       CFLAGS="-O -m32"
+       export CFLAGS CONFLAGS PREFIX
+       $BUILD 32
+
+       CFLAGS="-O -m64"
+       export CFLAGS
+       $BUILD 64
+
+       PREFIX=/usr/local/iODBC.universal
+       CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+       CFLAGS="-O -mmacosx-version-min=10.9 -arch i386 -arch x86_64"
+       export PREFIX CONFLAGS CFLAGS
+       $BUILD universal
+       ;;
+
+    *-apple-darwin13*)
+       PREFIX=/usr/local/iODBC.darwin
+       CONFLAGS="--disable-shared --with-pic"
+       CFLAGS="-O -m32"
+       export CFLAGS CONFLAGS PREFIX
+       $BUILD 32
+
+       CFLAGS="-O -m64"
+       export CFLAGS
+       $BUILD 64
+
+       PREFIX=/usr/local/iODBC.universal
+       CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+       CFLAGS="-O -mmacosx-version-min=10.8 -arch i386 -arch x86_64"
+       export PREFIX CONFLAGS CFLAGS
+       $BUILD universal
+       ;;
+
+    *-apple-darwin12*)
+       PREFIX=/usr/local/iODBC.darwin
+       CONFLAGS="--disable-shared --with-pic"
+       CFLAGS="-O -m32"
+       export CFLAGS CONFLAGS PREFIX
+       $BUILD 32
+
+       CFLAGS="-O -m64"
+       export CFLAGS
+       $BUILD 64
+
+       PREFIX=/usr/local/iODBC.universal
+       CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+       CFLAGS="-O -mmacosx-version-min=10.7 -arch i386 -arch x86_64"
+       export PREFIX CONFLAGS CFLAGS
+       $BUILD universal
+       ;;
+
+    i[3456]86-apple-darwin11*)
+	PREFIX=/usr/local/iODBC.darwin
+	CONFLAGS="--disable-shared --with-pic"
+	CFLAGS="-O -m32"
+	export CFLAGS CONFLAGS PREFIX
+	$BUILD 32
+
+	CFLAGS="-O -m64"
+	export CFLAGS
+	$BUILD 64
+
+	PREFIX=/usr/local/iODBC.universal
+	CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+	CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -arch i386 -arch x86_64"
+	export PREFIX CONFLAGS CFLAGS
+	$BUILD universal
+	;;
+
+
+    i[3456]86-apple-darwin10*)
+	PREFIX=/usr/local/iODBC.darwin
+	CONFLAGS="--disable-shared --with-pic"
+	CFLAGS="-O -m32"
+	export CFLAGS CONFLAGS PREFIX
+	$BUILD 32
+
+	CFLAGS="-O -m64"
+	export CFLAGS
+	$BUILD 64
+
+	PREFIX=/usr/local/iODBC.universal
+	CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+	CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -arch ppc -arch i386 -arch x86_64"
+	export PREFIX CONFLAGS CFLAGS
+	$BUILD universal
+	;;
+
+    i[3456]86-apple-darwin9*)
+	PREFIX=/usr/local/iODBC.darwin
+	CONFLAGS="--disable-shared --with-pic"
+	CFLAGS="-O -m32"
+	export CFLAGS CONFLAGS PREFIX
+	$BUILD 32
+
+	CFLAGS="-O -m64"
+	export CFLAGS
+	$BUILD 64
+
+	PREFIX=/usr/local/iODBC.universal
+	CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+	CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -arch ppc -arch ppc64 -arch i386 -arch x86_64"
+	export PREFIX CONFLAGS CFLAGS
+	$BUILD universal
+	;;
+
+    powerpc-apple-darwin8*)
+	PREFIX=/usr/local/iODBC.darwin
+	CONFLAGS="--disable-shared --with-pic"
+	CFLAGS="-O -m32"
+	export CFLAGS CONFLAGS PREFIX
+	$BUILD 32
+
+	CFLAGS="-O -m64"
+	export CFLAGS
+	$BUILD 64
+
+
+	PREFIX=/usr/local/iODBC.universal
+	CONFLAGS="--disable-shared --with-pic --disable-dependency-tracking"
+	CFLAGS="-O -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc -arch ppc64 -arch i386"
+	export PREFIX CONFLAGS CFLAGS
+	$BUILD universal
+	;;
+
+
+    powerpc-apple-darwin7*)
+	PREFIX=/usr/local/iODBC.darwin
+	CONFLAGS="--disable-shared --with-pic"
+	CFLAGS="-O -DNO_FRAMEWORKS"
+	export CFLAGS CONFLAGS PREFIX
+	$BUILD
+	;;
+
+    powerpc-apple-darwin6*)
+	PREFIX=/usr/local/iODBC.darwin
+	CONFLAGS="--disable-shared --with-pic"
+	CFLAGS="-O -DNO_FRAMEWORKS -DMACOSX102"
+	export CFLAGS CONFLAGS PREFIX
+	$BUILD
+	;;
+
+    ia64-hp-hpux11.23)
+	CFLAGS="-O -Ae +DD32"
+	export CFLAGS
+	$BUILD 32
+
+	CFLAGS="-O -Ae +DD64"
+	export CFLAGS
+	$BUILD 64
+	;;
+
+    powerpc-ibm-aix5*)
+	CC=cc_r
+	CFLAGS="-O -q32"
+	LDFLAGS="-brtl"
+	OBJECT_MODE=32
+	export CC CFLAGS LDFLAGS OBJECT_MODE
+	$BUILD 32
+
+	CC=cc_r
+	CFLAGS="-O -q64"
+	LDFLAGS="-brtl"
+	OBJECT_MODE=64
+	export CC CFLAGS LDFLAGS OBJECT_MODE
+	$BUILD 64
+	;;
+
+    *)
+	CFLAGS="-O"
+	export CFLAGS
+	$BUILD
+	;;
+esac
+
+
+# End
+exit 0

+ 400 - 0
odbc.mod/iodbc/README

@@ -0,0 +1,400 @@
+# iODBC Driver Manager
+
+Copyright (C) 1995 Ke Jin <[email protected]>. Copyright (C) 1996-2021
+OpenLink Software <[email protected]>. All Rights Reserved.
+
+## License
+
+Copyright 1996-2021 [OpenLink Software](http://www.openlinksw.com)
+
+This software is released under either the GNU Library General Public
+License (see [LICENSE.LGPL](./LICENSE.LGPL)) or the BSD License (see
+[LICENSE.BSD](./LICENSE.BSD)).
+
+**Note**: The only valid version of the GPL license as far as this
+project is concerned is the original GNU General Public License Version
+2, dated June 1991.
+
+### Contributions
+
+While not mandated by the BSD license, any patches you make to the iODBC
+project may be contributed back into the project at your discretion.
+Contributions will benefit the Open Source and Data Access community as
+a whole. Submissions may be made via the [iODBC Github
+project](https://github.com/openlink/iODBC/) or via email to
+<[email protected]>.
+
+## Introduction
+
+Welcome to the iODBC driver manager maintained by [OpenLink
+Software](http://www.openlinksw.com/).
+
+This kit will provide you with everything you need to develop
+ODBC-compliant applications under Unix without having to pay royalties
+to other parties.
+
+This kit consists of a number of parts:
+
+-   **The iODBC driver manager.** This is a complete implementation of
+    an ODBC driver manager, released under either the GNU Library
+    General Public License or the BSD License. We fully comply with
+    these licenses by giving you this product in source form (as well as
+    the binary form). You can download the latest version of the driver
+    manager from the [iODBC website](http://www.iodbc.org/).
+
+-   **A simple example application, `iodbctest.c`**, which gives you a
+    command-line interface to SQL. You can fit this to your purposes,
+    but at the very least this is useful for verification of your ODBC
+    installation.
+
+You can use either part stand-alone, if you wish.
+
+An ODBC driver is still needed to affect your connection architecture.
+You may build a driver with the iODBC components or obtain an ODBC
+driver from a commercial vendor. OpenLink Software produces
+cross-platform commercial drivers as well as maintaining the iODBC
+distribution: evaluation copies may be obtained via download from the
+[OpenLink Software website](http://www.openlinksw.com/). Any
+ODBC-compliant driver will work with the iODBC Driver Manager.
+
+You can see the [iODBC website](http://www.iodbc.org/) for pointers to
+various ODBC drivers.
+
+## Installation of run-time distribution
+
+You have probably already unpacked this distribution. The next step is
+to make sure that your applications can find all the dynamic link
+libraries. Depending on your system's implementation of dynamic link
+libraries, you have a number of options:
+
+-   Install the libraries in a directory that is searched by your linker
+    by default. Typical locations are `/usr/lib` and `/usr/local/lib`.
+
+-   Install the libraries in some other place, and make sure that the
+    environment variable your dynamic linker uses to find extra
+    locations for dynamic link libraries. Most systems use the
+    environment variable `LD_LIBRARY_PATH` to this end. Known exceptions
+    include AIX which uses `LIBPATH`, and HP/UX which uses `SHLIB_PATH`
+    for 32-bit libraries.
+
+If your system has a C compiler, you can verify the installation by
+compiling the `iodbctest` program. Otherwise, you may have ODBC
+applications installed on your system which you can use.
+
+## Configuration of run-time distribution
+
+The iODBC driver manager looks for a file `~/.odbc.ini`, where the tilde
+stands for the user's home directory. This file initially contains only
+a default section where you can select which driver library to use. Copy
+the `odbc.ini` file from the examples directory to `~/.odbc.ini` and
+make sure the right path and filename is used for your installation.
+
+A data source is a section (enclosed in square brackets), and the
+attributes for a data source are given within this section. The most
+important attribute to iODBC for each datasource is the `Driver`
+attribute. This must point to the shared library for the ODBC driver
+associated with the data source.
+
+For example, the OpenLink Enterprise Edition (Multi-Tier) ODBC drivers
+have a number of attributes which can be set for a data source. Here is
+a description:
+
+  -----------------------------------------------------------------------------------
+  `odbc.ini` keyword         ODBC connect string keyword            Description
+  -------------------------- -------------------------------------- -----------------
+  `Host`                     `HOST`                                 The hostname
+                                                                    where the
+                                                                    database resides.
+
+  `ServerType`               `SVT`                                  The type of
+                                                                    Database Agent.
+                                                                    (See `oplrqb.ini`
+                                                                    on the server.)
+
+  `ServerOptions`            `SVO`                                  Server-specific
+                                                                    extra options.
+                                                                    See Enterprise
+                                                                    Edition
+                                                                    server-side
+                                                                    documentation for
+                                                                    Agents which can
+                                                                    use this.
+
+  `Database`                 `DATABASE`                             The database to
+                                                                    use.
+
+  `Options`                  `OPTIONS`                              Connect options
+                                                                    for the database.
+
+  `UserName`                 `UID`                                  The name of the
+                                                                    database user.
+
+  `Password`                 `PWD`                                  The password of
+                                                                    the database
+                                                                    user.
+
+  `ReadOnly`                 `READONLY`                             A `Yes`/`No`
+                                                                    value in order to
+                                                                    make the
+                                                                    connection
+                                                                    read-only.
+
+  `FetchBufferSize`          `FBS`                                  The number of
+                                                                    records that are
+                                                                    transferred in a
+                                                                    single call to
+                                                                    the server.
+                                                                    Default is `5`;
+                                                                    maximum is `999`;
+                                                                    minimum is `1`.
+
+  `Protocol`                 `PROTO`                                The protocol to
+                                                                    use. Set to `TCP`
+                                                                    for Release 3.x
+                                                                    and later.
+  -----------------------------------------------------------------------------------
+
+Apart from these data source-specific settings, you may add a section
+called `[Communications]`, which you may use to tune the OpenLink
+Enterprise Edition (Multi-Tier) driver further:
+
+  -----------------------------------------------------------------------
+  `odbc.ini` keyword                          Description
+  ------------------------------------------- ---------------------------
+  `ReceiveTimeout`                            The time in seconds that
+                                              the client application will
+                                              wait for the Database Agent
+                                              to start sending results.
+                                              Default is `60`.
+
+  `BrokerTimeout`                             The time in seconds that
+                                              the client application will
+                                              wait for the Request Broker
+                                              to accept or reject a
+                                              database connection
+                                              request. Default is `30`.
+
+  `SendSize`                                  RPC send buffer size. A
+                                              value of `0` (the default)
+                                              will cause the application
+                                              to use system-dependent
+                                              defaults.
+
+  `ReceiveSize`                               RPC receive buffer size. A
+                                              value of `0` (the default)
+                                              will cause the application
+                                              to use system-dependent
+                                              defaults.
+
+  `DebugFile`                                 If set, the name of a file
+                                              to which debugging output
+                                              from the driver should be
+                                              directed.
+  -----------------------------------------------------------------------
+
+## iODBC driver manager platform availability
+
+The iODBC driver manager has been ported to following platforms:
+
+  OS                 Version        Processor
+  ------------------ -------------- ------------------------------------------------
+  BSDi BSD/OS        2.x            x86
+  DEC Unix (OSF/1)   3.x - 5.x      DEC Alpha
+  DG/UX              5.x            Aviion
+  FreeBSD            2.x - 9.x      x86
+  HP/UX              9.x - 11.x     HP9000 s700/s800
+  HP/UX              9.x            HP9000 s300/s400
+  IBM AIX            3.x - 5.x      IBM RS6000, ppc32, ppc64
+  Linux ELF          1.x, 2.x       x86, x86_64, IA_64, ppc32, ppc64, arm32, arm64
+  macOS              10.x -- 11.x   ppc32, ppc64, x86, x86_64, arm64
+  Max/OS SVR4        1.x            Concurrent Maxion 9200 MP
+  NCR SVR4           3.x            NCR 3435
+  OpenVMS            6.x            DEC Alpha
+  SCO OpenServer     5.x            x86
+  SGI Irix SVR4      5.x, 6.x       IP12 MIPS, IP22 MIPS
+  SunOS              4.1.x          Sun Sparc
+  Sun Solaris        2.x            Sun Sparc, x86, x86_64
+  UnixWare SVR4.2    1.x, 2.x       x86
+  Windows NT         4.x            x86
+
+As the iODBC driver manager uses `autoconf`/`automake`/`libtool`, it
+should be portable to most modern UNIX-like OS out of the box. However,
+if you do need to make changes to the code or the configuration files,
+we would appreciate it if you would share your changes with the rest of
+the internet community by mailing your patches to
+<[email protected]>, so we can include them for the next build.
+
+Porting the iODBC driver manager to some non-UNIX-like operating
+systems, such as the Windows family (3.x, 95, NT, 200x, etc.), IBM OS/2,
+or Mac Classic, is supported, but has not been compiled or tested
+recently. Of course, you will need to supply a `make`/`build` file and a
+short `LibMain` for creating the `iodbc.dll`.
+
+## How to build the iODBC driver manager
+
+Users of macOS should read the separate
+[README_MACOSX](./README_MACOSX.md) document for more detail of porting
+to this platform.
+
+Users of all other UNIX-like OS:
+
+1.  Run `configure` to adjust to target platform
+2.  Run `make`
+3.  Run `make install`
+
+The `configure` program will examine your system for various compiler
+flags, system options, etc. In some cases, extra flags need to be added
+for the `C` compiler to work properly; for instance, on HP systems, you
+may need:
+
+    $ CFLAGS="-Ae -O" ./configure --prefix=/usr/local ..........
+
+### File Hierarchy
+
+Note that the path of the system wide `odbc.ini` file is calculated as
+follows (based on flags to `./configure`):
+
+    no --prefix                     default is /etc/odbc.ini
+    --prefix=/usr                   /etc/odbc.ini
+    --prefix=/xxx/yyy               /xxx/yyy/etc/odbc.ini
+    --sysconfdir=/xxx/yyy           /xxx/yyy/odbc.ini
+    --with-iodbc-inidir=/xxx/yyy    /xxx/yyy/odbc.ini
+
+If the **`--with-layout=`** option is set, then the `prefix` and
+`sysconfdir` parameters will be changed accordingly. Currently, this
+parameter understands values of **`gentoo`**, **`redhat`**, **`gnu`**,
+**`debian`**, or **`opt`** (with everything going into `/opt/iodbc/`).
+If both are specified, `--prefix` argument will overrule
+`--with-layout`.
+
+### Example
+
+    $ ./configure --prefix=/usr/local --with-iodbc-inidir=/etc
+        ...
+        ...
+        ...
+    $ make
+        ...
+        ...
+        ...
+    $ su
+    # make install
+        ...
+        ...
+        ...
+
+## `odbc.ini`
+
+Driver manager and drivers use the `odbc.ini` file or connection string
+when establishing a data source connection. On Windows, `odbc.ini` is
+located in the Windows directory.
+
+On UNIX-like OS, the iODBC driver manager looks for the `odbc.ini` file
+in the following sequence:
+
+1.  check environment variable `ODBCINI`
+
+2.  check `$HOME/.odbc.ini`
+
+3.  check home in `/etc/passwd` and try `.odbc.ini` in there
+
+4.  system-wide `odbc.ini` (settable at configuration time)
+
+Item 1 is the easiest, as most drivers will also look at this variable.
+
+The format of `odbc.ini` (or `~/.odbc.ini`) is defined as:
+
+    odbc.ini            ::= data_source_list
+
+    data_source_list    ::= /* empty */
+                         | data_source '\n' data_source_list
+
+    data_source         ::= '[' data_source_name ']' '\n' data_source_desc
+
+    data_source_name    ::= 'default' | [A-Za-z]*[A-Za-z0-9_]*
+
+    data_source_desc    ::= /* empty */
+                         | attrib_desc '\n' data_source_desc
+
+    addrib_desc         ::= Attrib '=' attrib_value
+
+    Attrib              ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib
+
+    driver_def_attrib   ::= [A-Za-z]*[A-Za-z0-9_]*
+
+An example of an `odbc.ini` file:
+
+    ;
+    ;  odbc.ini
+    ;
+    [ODBC Data Sources]
+    Myodbc          = Myodbc
+    Sample          = OpenLink Generic ODBC Driver
+    Virtuoso        = Virtuoso
+
+    [ODBC]
+    TraceFile       = /tmp/odbc.trace
+    Trace           = 0        ; set to 1 to enable tracing
+
+    [Sample]
+    Driver          = /usr/local/openlink/lib/oplodbc.so.1
+    Description     = Sample OpenLink DSN
+    Host            = localhost
+    UserName        = openlink
+    Password        = xxxx
+    ServerType      = Oracle 8.1.x
+    Database        =
+    FetchBufferSize = 99
+    ReadOnly        = no
+
+    [Virtuoso]
+    Driver          = /usr/local/virtuoso/lib/virtodbc.so.1
+    Address         = localhost:1112
+    Database        = Demo
+
+    [Myodbc]
+    Driver          = /usr/lib/libmyodbc.so
+    HOST            = localhost
+
+    [Default]
+    Driver          = /usr/local/openlink/lib/oplodbc.so.1
+
+## Tracing
+
+The iODBC driver manager traces driver's ODBC call invoked by the driver
+manager. Default tracing file is `./odbc.log`. Tracing option (i.e.,
+on/off or optional tracing file name) can be set in `odbc.ini` file
+under the `[ODBC]` heading, as:
+
+    [ODBC]
+    TraceFile = <optional_trace_file>
+    Trace = ON | On | on | 1 | OFF | Off | off | 0
+
+If `<optional_trace_file>` is `stderr` or `stdout`, i.e. --
+
+    TraceFile = stderr
+
+-- or --
+
+    TraceFile = stdout
+
+-- the tracing message will go to the terminal screen (if available).
+
+## Further Information Sources
+
+-   [iODBC Website](http://www.iodbc.org/) containing binaries, sources
+    and documentation.
+
+-   [iODBC Project page on GitHub](https://github.com/openlink/iODBC/)
+    containing source archives, GIT tree, issues forum.
+
+-   [iODBC Project page on
+    Sourceforge](http://sourceforge.net/projects/iodbc) containing
+    source archives, GIT tree, mailing lists, forums, bug reports.
+
+-   [OpenLink Software Website](http://www.openlinksw.com/) containing
+    free trials and support for OpenLink's ODBC drivers.
+
+-   [Microsoft ODBC
+    Documentation](https://msdn.microsoft.com/en-us/library/ms714177)
+    containing the ODBC API Reference Guide.

+ 320 - 0
odbc.mod/iodbc/README.md

@@ -0,0 +1,320 @@
+# iODBC Driver Manager
+
+Copyright (C) 1995 Ke Jin <[email protected]>.
+Copyright (C) 1996-2021 OpenLink Software <[email protected]>.
+All Rights Reserved.
+
+## License
+Copyright 1996-2021 [OpenLink Software](http://www.openlinksw.com)
+
+This software is released under either the GNU Library General Public License
+(see [LICENSE.LGPL](./LICENSE.LGPL))
+or the BSD License
+(see [LICENSE.BSD](./LICENSE.BSD)).
+
+**Note**: The only valid version of the GPL license as far as this project is
+concerned is the original GNU General Public License Version 2, dated June 1991.
+
+### Contributions
+
+While not mandated by the BSD license, any patches you make to the iODBC project
+may be contributed back into the project at your discretion. Contributions will
+benefit the Open Source and Data Access community as a whole. Submissions may be
+made via the [iODBC Github project](https://github.com/openlink/iODBC/) or via
+email to [[email protected]](mailto:[email protected]).
+
+## Introduction
+
+Welcome to the iODBC driver manager maintained by
+[OpenLink Software](http://www.openlinksw.com/).
+
+This kit will provide you with everything you need to develop ODBC-compliant
+applications under Unix without having to pay royalties to other parties.
+
+This kit consists of a number of parts:
+
+* **The iODBC driver manager.** This is a complete implementation of an ODBC
+  driver manager, released under either the GNU Library General Public License or
+  the BSD License. We fully comply with these licenses by giving you this product
+  in source form (as well as the binary form). You can download the latest version
+  of the driver manager from the [iODBC website](http://www.iodbc.org/).
+
+* **A simple example application, `iodbctest.c`**, which gives you a command-line
+  interface to SQL. You can fit this to your purposes, but at the very least this
+  is useful for verification of your ODBC installation.
+
+You can use either part stand-alone, if you wish.
+
+An ODBC driver is still needed to affect your connection architecture. You may
+build a driver with the iODBC components or obtain an ODBC driver from a commercial
+vendor. OpenLink Software produces cross-platform commercial drivers as well as
+maintaining the iODBC distribution: evaluation copies may be obtained via download
+from the [OpenLink Software website](http://www.openlinksw.com/). Any ODBC-compliant
+driver will work with the iODBC Driver Manager.
+
+You can see the [iODBC website](http://www.iodbc.org/) for pointers to various
+ODBC drivers.
+
+## Installation of run-time distribution
+
+You have probably already unpacked this distribution. The next step is to make sure
+that your applications can find all the dynamic link libraries. Depending on your
+system's implementation of dynamic link libraries, you have a number of options:
+
+* Install the libraries in a directory that is searched by your linker by default.
+  Typical locations are `/usr/lib` and `/usr/local/lib`.
+
+* Install the libraries in some other place, and make sure that the environment
+  variable your dynamic linker uses to find extra locations for dynamic link
+  libraries. Most systems use the environment variable `LD_LIBRARY_PATH` to this
+  end. Known exceptions include AIX which uses `LIBPATH`, and HP/UX which uses
+  `SHLIB_PATH` for 32-bit libraries.
+
+If your system has a C compiler, you can verify the installation by compiling the
+`iodbctest` program.  Otherwise, you may have ODBC applications installed on your
+system which you can use.
+
+## Configuration of run-time distribution
+
+The iODBC driver manager looks for a file `~/.odbc.ini`, where the tilde stands
+for the user's home directory. This file initially contains only a default section
+where you can select which driver library to use. Copy the `odbc.ini` file from the
+examples directory to `~/.odbc.ini` and make sure the right path and filename is
+used for your installation.
+
+A data source is a section (enclosed in square brackets), and the attributes for
+a data source are given within this section.  The most important attribute to
+iODBC for each datasource is the `Driver` attribute. This must point to the shared
+library for the ODBC driver associated with the data source.
+
+For example, the OpenLink Enterprise Edition (Multi-Tier) ODBC drivers have a number
+of attributes which can be set for a data source. Here is a description:
+
+| `odbc.ini` keyword | ODBC connect string keyword | Description |
+|--------------------|-----------------------------|-----|
+| `Host`             | `HOST`                      | The hostname where the database resides. |
+| `ServerType`       | `SVT`                       | The type of Database Agent. (See `oplrqb.ini` on the server.) |
+| `ServerOptions`    | `SVO`                       | Server-specific extra options. See Enterprise Edition server-side documentation for Agents which can use this. |
+| `Database`         | `DATABASE`                  | The database to use. |
+| `Options`          | `OPTIONS`                   | Connect options for the database. |
+| `UserName`         | `UID`                       | The name of the database user. |
+| `Password`         | `PWD`                       | The password of the database user. |
+| `ReadOnly`         | `READONLY`                  | A `Yes`/`No` value in order to make the connection read-only. |
+| `FetchBufferSize`  | `FBS`                       | The number of records that are transferred in a single call to the server.  Default is `5`; maximum is `999`; minimum is `1`. |
+| `Protocol`         | `PROTO`                     | The protocol to use. Set to `TCP` for Release 3.x and later. |
+
+
+Apart from these data source-specific settings, you may add a section called
+`[Communications]`, which you may use to tune the OpenLink Enterprise Edition
+(Multi-Tier) driver further:
+
+| `odbc.ini` keyword | Description |
+|--------------------|-------------|
+| `ReceiveTimeout`   | The time in seconds that the client application will wait for the Database Agent to start sending results. Default is `60`. |
+| `BrokerTimeout`    | The time in seconds that the client application will wait for the Request Broker to accept or reject a database connection request. Default is `30`. |
+| `SendSize`         | RPC send buffer size. A value of `0` (the default) will cause the application to use system-dependent defaults. |
+| `ReceiveSize`      | RPC receive buffer size. A value of `0` (the default) will cause the application to use system-dependent defaults. |
+| `DebugFile`        | If set, the name of a file to which debugging output from the driver should be directed. |
+
+## iODBC driver manager platform availability
+
+The iODBC driver manager has been ported to following platforms:
+
+| OS               | Version       | Processor                                      |
+|------------------|---------------|----------------------------------------------- |
+| BSDi BSD/OS      | 2.x           | x86                                            |
+| DEC Unix (OSF/1) | 3.x - 5.x     | DEC Alpha                                      |
+| DG/UX            | 5.x           | Aviion                                         |
+| FreeBSD          | 2.x - 9.x     | x86                                            |
+| HP/UX            | 9.x - 11.x    | HP9000 s700/s800                               |
+| HP/UX            | 9.x           | HP9000 s300/s400                               |
+| IBM AIX          | 3.x - 5.x     | IBM RS6000, ppc32, ppc64                       |
+| Linux ELF        | 1.x, 2.x      | x86, x86_64, IA_64, ppc32, ppc64, arm32, arm64 |
+| macOS            | 10.x – 11.x   | ppc32, ppc64, x86, x86_64, arm64               |
+| Max/OS SVR4      | 1.x           | Concurrent Maxion 9200 MP                      |
+| NCR SVR4         | 3.x           | NCR 3435                                       |
+| OpenVMS          | 6.x           | DEC Alpha                                      |
+| SCO OpenServer   | 5.x           | x86                                            |
+| SGI Irix SVR4    | 5.x, 6.x      | IP12 MIPS, IP22 MIPS                           |
+| SunOS            | 4.1.x         | Sun Sparc                                      |
+| Sun Solaris      | 2.x           | Sun Sparc, x86, x86_64                         |
+| UnixWare SVR4.2  | 1.x, 2.x      | x86                                            |
+| Windows NT       | 4.x           | x86                                            |
+
+As the iODBC driver manager uses `autoconf`/`automake`/`libtool`, it should be
+portable to most modern UNIX-like OS out of the box. However, if you do need to
+make changes to the code or the configuration files, we would appreciate it if
+you would share your changes with the rest of the internet community by mailing
+your patches to [[email protected]](mailto:[email protected]), so we can
+include them for the next build.
+
+Porting the iODBC driver manager to some non-UNIX-like operating systems, such
+as the Windows family (3.x, 95, NT, 200x, etc.), IBM OS/2, or Mac Classic, is
+supported, but has not been compiled or tested recently. Of course, you will need
+to supply a `make`/`build` file and a short `LibMain` for creating the `iodbc.dll`.
+
+## How to build the iODBC driver manager
+
+Users of macOS should read the separate [README_MACOSX](./README_MACOSX.md)
+document for more detail of porting to this platform.
+
+Users of all other UNIX-like OS:
+
+1. Run `configure` to adjust to target platform
+2. Run `make`
+3. Run `make install`
+
+The `configure` program will examine your system for various compiler flags,
+system options, etc. In some cases, extra flags need to be added for the `C`
+compiler to work properly; for instance, on HP systems, you may need:
+
+    $ CFLAGS="-Ae -O" ./configure --prefix=/usr/local ..........
+
+### File Hierarchy
+
+Note that the path of the system wide `odbc.ini` file is calculated as follows
+(based on flags to `./configure`):
+
+```
+no --prefix                     default is /etc/odbc.ini
+--prefix=/usr                   /etc/odbc.ini
+--prefix=/xxx/yyy               /xxx/yyy/etc/odbc.ini
+--sysconfdir=/xxx/yyy           /xxx/yyy/odbc.ini
+--with-iodbc-inidir=/xxx/yyy    /xxx/yyy/odbc.ini
+```
+
+If the **`--with-layout=`** option is set, then the `prefix` and `sysconfdir`
+parameters will be changed accordingly. Currently, this parameter understands
+values of **`gentoo`**, **`redhat`**, **`gnu`**, **`debian`**, or **`opt`**
+(with everything going into `/opt/iodbc/`). If both are specified, `--prefix`
+argument will overrule `--with-layout`.
+
+### Example
+
+```
+$ ./configure --prefix=/usr/local --with-iodbc-inidir=/etc
+    ...
+    ...
+    ...
+$ make
+    ...
+    ...
+    ...
+$ su
+# make install
+    ...
+    ...
+    ...
+```
+
+## `odbc.ini`
+
+Driver manager and drivers use the `odbc.ini` file or connection string when
+establishing a data source connection. On Windows, `odbc.ini` is located in
+the Windows directory.
+
+On UNIX-like OS, the iODBC driver manager looks for the `odbc.ini` file in the
+following sequence:
+
+  1. check environment variable `ODBCINI`
+
+  2. check `$HOME/.odbc.ini`
+
+  3. check home in `/etc/passwd` and try `.odbc.ini` in there
+
+  4. system-wide `odbc.ini` (settable at configuration time)
+
+Item 1 is the easiest, as most drivers will also look at this variable.
+
+The format of `odbc.ini` (or `~/.odbc.ini`) is defined as:
+```
+odbc.ini            ::= data_source_list
+
+data_source_list    ::= /* empty */
+                     | data_source '\n' data_source_list
+
+data_source         ::= '[' data_source_name ']' '\n' data_source_desc
+
+data_source_name    ::= 'default' | [A-Za-z]*[A-Za-z0-9_]*
+
+data_source_desc    ::= /* empty */
+                     | attrib_desc '\n' data_source_desc
+
+addrib_desc         ::= Attrib '=' attrib_value
+
+Attrib              ::= 'Driver' | 'PID' | 'UID' | driver_def_attrib
+
+driver_def_attrib   ::= [A-Za-z]*[A-Za-z0-9_]*
+```
+
+An example of an `odbc.ini` file:
+```
+;
+;  odbc.ini
+;
+[ODBC Data Sources]
+Myodbc          = Myodbc
+Sample          = OpenLink Generic ODBC Driver
+Virtuoso        = Virtuoso
+
+[ODBC]
+TraceFile       = /tmp/odbc.trace
+Trace           = 0        ; set to 1 to enable tracing
+
+[Sample]
+Driver          = /usr/local/openlink/lib/oplodbc.so.1
+Description     = Sample OpenLink DSN
+Host            = localhost
+UserName        = openlink
+Password        = xxxx
+ServerType      = Oracle 8.1.x
+Database        =
+FetchBufferSize = 99
+ReadOnly        = no
+
+[Virtuoso]
+Driver          = /usr/local/virtuoso/lib/virtodbc.so.1
+Address         = localhost:1112
+Database        = Demo
+
+[Myodbc]
+Driver          = /usr/lib/libmyodbc.so
+HOST            = localhost
+
+[Default]
+Driver          = /usr/local/openlink/lib/oplodbc.so.1
+```
+
+## Tracing
+
+The iODBC driver manager traces driver's ODBC call invoked by the driver manager.
+Default tracing file is `./odbc.log`. Tracing option (i.e., on/off or optional
+tracing file name) can be set in `odbc.ini` file under the `[ODBC]` heading, as:
+
+```
+[ODBC]
+TraceFile = <optional_trace_file>
+Trace = ON | On | on | 1 | OFF | Off | off | 0
+```
+
+If `<optional_trace_file>` is `stderr` or `stdout`, i.e. --
+
+    TraceFile = stderr
+
+-- or --
+
+    TraceFile = stdout
+
+-- the tracing message will go to the terminal screen (if available).
+
+## Further Information Sources
+
+* [iODBC Website](http://www.iodbc.org/) containing binaries, sources and documentation.
+
+* [iODBC Project page on GitHub](https://github.com/openlink/iODBC/) containing source archives, GIT tree, issues forum.
+
+* [iODBC Project page on Sourceforge](http://sourceforge.net/projects/iodbc) containing source archives, GIT tree, mailing lists, forums, bug reports.
+
+* [OpenLink Software Website](http://www.openlinksw.com/) containing free trials and support for OpenLink's ODBC drivers.
+
+* [Microsoft ODBC Documentation](https://msdn.microsoft.com/en-us/library/ms714177) containing the ODBC API Reference Guide.

+ 104 - 0
odbc.mod/iodbc/README_GIT

@@ -0,0 +1,104 @@
+# Using the iODBC git tree
+
+Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+
+## Introduction
+
+This document describes how to check out a copy of the git tree for
+development purposes. It also lists the packages that need to be
+installed prior to generating the necessary scripts and makefiles to
+build the project.
+
+Git access is only needed by developers who want to actively track
+progress of the iODBC source code and contribute bugfixes or
+enhancements to the project. It requires basic knowledge of git itself,
+the general layout of open source and GNU projects, the use of
+`autoconf` and `automake`, etc., which are beyond the scope of this
+document.
+
+If you have any questions, please email us at <[email protected]>.
+
+## Git Archive Server Access
+
+For main development, OpenLink Software publishes the iODBC tree to
+GitHub, and we encourage everyone who is interested in tracking the
+project to make an account there.
+
+Users who mainly just want to track the code can use the following
+command to get a copy of the tree:
+
+    $ git clone git://github.com/openlink/iODBC
+
+At this point, you can create your own work branch based on any of the
+branches available, create bugfixes and commit them to your own branch,
+and then use the `git format-patch` command to generate the appropriate
+diffs to send to <[email protected]>.
+
+Developers are encouraged to fork the project using GitHub, create their
+own branches to make enhancements/bugfixes, and then send pull requests
+using the excellent GitHub interface, for the OpenLink team to examine
+and incorporate into the master tree for an upcoming release.
+
+Github has [excellent documentation](http://help.github.com/) on how to
+fork a project, send pull requests, track a project, etc.
+
+OpenLink Software will continue to use
+[sourceforge.net](https://sourceforge.net/projects/iodbc/) for the
+source tarball releases and certain binary releases, and for
+completeness will also provide read-only Git Archive access there.
+
+For more information, check the [iODBC SourceForge
+pages](https://sourceforge.net/projects/iodbc/)
+
+## Package Dependencies
+
+To generate the `configure` script and all other build files necessary,
+please make sure the following packages (and any GNU packages required
+by them) and recommended versions are installed on your system.
+
+*Note -- these are minimum versions; later versions should work just
+fine. Older versions of these packages can sometimes be used, but could
+cause build problems.*
+
+  Package    Minimum Version   Source
+  ---------- ----------------- ------------------------------------
+  autoconf   2.59              ftp://ftp.gnu.org/pub/gnu/autoconf
+  automake   1.9.6             ftp://ftp.gnu.org/pub/gnu/automake
+  libtool    1.5.22            ftp://ftp.gnu.org/pub/gnu/libtool
+  make       3.79.1            http://www.gnu.org/software/make
+  gtk+       1.2.10            ftp://ftp.gtk.org/pub/gtk/v1.2
+
+The `autogen.sh` and `configure` scripts check for the presence and
+version of some of the required components.
+
+To check the version numbers of the tools installed on your system, you
+can use the following commands:
+
+    $ autoconf --version
+    $ automake --version
+    $ libtoolize --version
+    $ make --version
+    $ gtk-config --version
+
+## Generate build files
+
+To generate the `configure` script and all related build files, use the
+following command:
+
+    $ autoreconf --install
+
+Alternatively, use the supplied script in your check-out directory:
+
+    $ ./autogen.sh
+
+If the above commands succeed without any error messages, you can use
+the following command to see all the options you can use:
+
+    $ ./configure --help
+
+Certain build targets are only enabled when the
+`--enable-maintainer-mode` flag is added to `configure`.
+
+Please read the `INSTALL` and `README` files in this directory for
+further information on how to configure the package and install it on
+your system.

+ 99 - 0
odbc.mod/iodbc/README_GIT.md

@@ -0,0 +1,99 @@
+# Using the iODBC git tree
+
+Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+
+## Introduction
+
+This document describes how to check out a copy of the git tree for development
+purposes. It also lists the packages that need to be installed prior to generating
+the necessary scripts and makefiles to build the project.
+
+Git access is only needed by developers who want to actively track progress of the
+iODBC source code and contribute bugfixes or enhancements to the project. It
+requires basic knowledge of git itself, the general layout of open source and GNU
+projects, the use of `autoconf` and `automake`, etc., which are beyond the scope
+of this document.
+
+If you have any questions, please email us at
+[[email protected]](mailto:[email protected]).
+
+## Git Archive Server Access
+
+For main development, OpenLink Software publishes the iODBC tree to GitHub, and we
+encourage everyone who is interested in tracking the project to make an account there.
+
+Users who mainly just want to track the code can use the following command to get
+a copy of the tree:
+
+    $ git clone git://github.com/openlink/iODBC
+
+At this point, you can create your own work branch based on any of the branches
+available, create bugfixes and commit them to your own branch, and then use the
+`git format-patch` command to generate the appropriate diffs to send to
+[[email protected]](mailto:[email protected]).
+
+Developers are encouraged to fork the project using GitHub, create their own branches
+to make enhancements/bugfixes, and then send pull requests using the excellent GitHub
+interface, for the OpenLink team to examine and incorporate into the master tree for
+an upcoming release.
+
+Github has [excellent documentation](http://help.github.com/) on how to fork a project,
+send pull requests, track a project, etc.
+
+OpenLink Software will continue to use [sourceforge.net](https://sourceforge.net/projects/iodbc/)
+for the source tarball releases and certain binary releases, and for completeness will also
+provide read-only Git Archive access there.
+
+For more information, check the
+[iODBC SourceForge pages](https://sourceforge.net/projects/iodbc/)
+
+## Package Dependencies
+
+To generate the `configure` script and all other build files necessary, please make
+sure the following packages (and any GNU packages required by them) and recommended
+versions are installed on your system.
+
+*Note -- these are minimum versions; later versions should work just fine. Older
+versions of these packages can sometimes be used, but could cause build problems.*
+
+| Package  | Minimum Version  | Source                             |
+| -------- | ---------------- | ---------------------------------- |
+| autoconf | 2.59             | ftp://ftp.gnu.org/pub/gnu/autoconf |
+| automake | 1.9.6            | ftp://ftp.gnu.org/pub/gnu/automake |
+| libtool  | 1.5.22           | ftp://ftp.gnu.org/pub/gnu/libtool  |
+| make     | 3.79.1           | http://www.gnu.org/software/make   |
+| gtk+     | 1.2.10           | ftp://ftp.gtk.org/pub/gtk/v1.2     |
+
+The `autogen.sh` and `configure` scripts check for the presence and version of some
+of the required components.
+
+To check the version numbers of the tools installed on your system, you can use
+the following commands:
+
+    $ autoconf --version
+    $ automake --version
+    $ libtoolize --version
+    $ make --version
+    $ gtk-config --version
+
+## Generate build files
+
+To generate the `configure` script and all related build files, use the following
+command:
+
+    $ autoreconf --install
+
+Alternatively, use the supplied script in your check-out directory:
+
+    $ ./autogen.sh
+
+If the above commands succeed without any error messages, you can use the following
+command to see all the options you can use:
+
+    $ ./configure --help
+
+Certain build targets are only enabled when the `--enable-maintainer-mode` flag is
+added to `configure`.
+
+Please read the `INSTALL` and `README` files in this directory for further information
+on how to configure the package and install it on your system.

+ 187 - 0
odbc.mod/iodbc/README_MACOSX

@@ -0,0 +1,187 @@
+# How to build iODBC for macOS (formerly known as *OS X* and *Mac OS X*)
+
+    Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+
+## Method 1: Using Project builder
+
+This build method only works for Xcode 8.0 or newer.
+
+This version of Xcode was first supported on macOS El Capitan (10.11),
+however the resulting binaries are backward-compatible with OS X
+Mavericks (10.9) and newer.
+
+OpenLink uses build environments on macOS Mojave (10.14) and macOS Big
+Sur (11.x) to produce suitable notarized installers with graphical
+components.
+
+To build iODBC components yourself, you will first need to install the
+latest Mac OS X Developer Packages, which can be found at ---
+
+    http://developer.apple.com/tools
+
+Then, execute the following commands in a terminal session, to build all
+the frameworks and demo applications:
+
+    $ cd mac 
+    $ make
+
+After building the iODBC libraries and applications, you have to install
+them on your system with the command:
+
+    $ sudo make install
+
+This installs the `iODBCinst` and `iODBC` frameworks into ---
+
+    /Library/Frameworks/iODBC.framework 
+    /Library/Frameworks/iODBCinst.framework
+
+--- and the test applications `iodbctest` and `iodbctestw` into ---
+
+    /Library/Application Support/iODBC/bin
+
+--- and the iODBC Administrator and iODBC Demo applications in ---
+
+    /Applications/iODBC
+
+### `iODBC Administrator.app`
+
+Now that you have installed the iODBC frameworks on your system, you are
+able to use ODBC applications or build your own applications using the
+iODBC API.
+
+Once you have installed an ODBC Driver, you can configure and test a new
+ODBC DSN, using either the 32-bit Cocoa UI, which can configure and test
+any ODBC driver that is built in Universal mode ---
+
+     /Applications/iODBC/iODBC Administrator.app
+
+--- or the 64-bit version, which can configure drivers that only support
+a 64-bit Cocoa UI ---
+
+     /Applications/iODBC/iODBC Administrator64.app
+
+### Test DSN connection
+
+Once you have configured a DSN, you will be able to make a connection
+using the `iodbctest` tool which is located at ---
+
+    /Library/Application Support/iODBC/bin/iodbctest
+
+## Method 2: Using `configure` and `make`
+
+The iODBC package can also be built like any other Open Source package
+not using any frameworks.
+
+This build method still works with older versions of Xcode.
+
+On OS X Yosemite (10.10) and newer, Apple removed a number of programs
+from their **`Xcode.app`** commandline installation, including
+`autoconf`, `automake`, `libtool`, and some other tools needed to build
+iODBC from a newly checked out GIT tree. We suggest using the [HomeBrew
+package manager](http://brew.sh/) to install these tools, according to
+their documentation.
+
+To build the libraries, open up a terminal session in **`Terminal.app`**
+or similar, and execute the following commands:
+
+    $ sh autogen.sh
+    $ ./configure
+    $ make
+
+To install the header files and libraries in `/usr/local`, execute the
+following command as an administrator, and provide that user's password
+when prompted:
+
+    $ sudo make install
+
+Note that, by default, this will build components that only run on the
+CPU type you are building on, so `ppc` on very old systems, `x86` on
+early CoreDuo machines, `x86_64` on recent Intel models, and `arm64` on
+current Apple Silicon models.
+
+You can also build iODBC components that support multiple CPU
+architectures --- either Universal components that support `ppc`, `x86`,
+and/or `x86_64`; or Universal2 components that support `x86_64`
+(including as emulated by Rosetta2) and `arm64`.
+
+### Mac OS X Leopard (10.5) and Mac OS X Snow Leopard (10.6)
+
+The following commands will build a release of iODBC that supports Mac
+OS X Leopard (10.5) as well as Mac OS X Snow Leopard (10.6), on `ppc`
+(including as emulated by Rosetta), `x86`, and `x86_64`:
+
+    $ CFLAGS="-O -arch ppc -arch i386 -arch x86_64"
+    $ CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### Mac OS X Lion (10.7) and OS X Mountain Lion (10.8)
+
+The following commands will build a release of iODBC that works on Mac
+OS X Lion (10.7) and OS X Mountain Lion (10.8):
+
+    $ CFLAGS="-O -arch i386 -arch x86_64"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.7"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### OS X Mavericks (10.9) through macOS Big Sur (11.x) on `x86` or `x86_64` (including Rosetta2 emulation)
+
+The following commands will build a release of iODBC that works on OS X
+Mavericks (10.9) through macOS Big Sur (11.x), supporting other
+components built for `x86` (through macOS Mojave (10.14), where Apple
+dropped support for 32-bit components) or `x86_64` (including Rosetta2
+emulation):
+
+    $ CFLAGS="-O -arch i386 -arch x86_64"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### macOS Big Sur (11.x) including Apple Silicon support
+
+The following commands will build a release of iODBC that works on macOS
+Big Sur (11.x), running on Intel (`x86_64`) or Apple Silicon (M1 a/k/a
+`arm64`):
+
+    $ CFLAGS="-O -arch arm64 -arch x86_64"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### Test DSN connection
+
+Once you have installed an ODBC driver and configured a DSN, you will be
+able to make a connection using the `iodbctest` tool which is located at
+---
+
+    /usr/local/iODBC.universal/bin/iodbctest

+ 166 - 0
odbc.mod/iodbc/README_MACOSX.md

@@ -0,0 +1,166 @@
+# How to build iODBC for macOS (formerly known as _OS X_ and _Mac OS X_)
+
+    Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+
+## Method 1: Using Project builder
+
+This build method only works for Xcode 8.0 or newer.
+
+This version of Xcode was first supported on macOS El Capitan (10.11), however the resulting binaries
+are backward-compatible with OS X Mavericks (10.9) and newer.
+
+OpenLink uses build environments on macOS Mojave (10.14) and macOS Big Sur (11.x) to produce suitable
+notarized installers with graphical components.
+
+To build iODBC components yourself, you will first need to install the latest Mac OS X Developer 
+Packages, which can be found at —
+
+    http://developer.apple.com/tools
+
+Then, execute the following commands in a terminal session, to build all the frameworks and demo applications:
+
+    $ cd mac 
+    $ make
+
+
+After building the iODBC libraries and applications, you have to install them on your system with the command:
+
+    $ sudo make install
+
+This installs the `iODBCinst` and `iODBC` frameworks into —
+
+    /Library/Frameworks/iODBC.framework 
+    /Library/Frameworks/iODBCinst.framework
+
+— and the test applications `iodbctest` and `iodbctestw` into —
+
+    /Library/Application Support/iODBC/bin
+
+— and the iODBC Administrator and iODBC Demo applications in —
+
+    /Applications/iODBC
+
+### `iODBC Administrator.app`
+
+Now that you have installed the iODBC frameworks on your system, you are able to use ODBC applications or build your own
+applications using the iODBC API.
+
+Once you have installed an ODBC Driver, you can configure and test a new ODBC DSN, using either the 32-bit Cocoa UI, which can configure
+and test any ODBC driver that is built in Universal mode —
+
+     /Applications/iODBC/iODBC Administrator.app
+
+— or the 64-bit version, which can configure drivers that only support a 64-bit Cocoa UI —
+
+     /Applications/iODBC/iODBC Administrator64.app
+
+### Test DSN connection
+
+Once you have configured a DSN, you will be able to make a connection using the `iodbctest` tool which is located at —
+
+    /Library/Application Support/iODBC/bin/iodbctest
+
+## Method 2: Using `configure` and `make`
+
+The iODBC package can also be built like any other Open Source package not using any frameworks.
+
+This build method still works with older versions of Xcode.
+
+On OS X Yosemite (10.10) and newer, Apple removed a number of programs from their **`Xcode.app`** commandline installation, including
+`autoconf`, `automake`, `libtool`, and some other tools needed to build iODBC from a newly checked out GIT tree. We suggest
+using the [HomeBrew package manager](http://brew.sh/) to install these tools, according to their documentation.
+
+To build the libraries, open up a terminal session in **`Terminal.app`** or similar, and execute the following commands:
+
+    $ sh autogen.sh
+    $ ./configure
+    $ make
+
+To install the header files and libraries in `/usr/local`, execute the following command as an administrator, 
+and provide that user's password when prompted:
+
+    $ sudo make install
+
+Note that, by default, this will build components that only run on the CPU type you are building on, so `ppc` 
+on very old systems, `x86` on early CoreDuo machines, `x86_64` on recent Intel models, and `arm64` on current 
+Apple Silicon models.
+
+You can also build iODBC components that support multiple CPU architectures — either Universal components
+that support `ppc`, `x86`, and/or `x86_64`; or Universal2 components that support `x86_64` (including as 
+emulated by Rosetta2) and `arm64`.
+
+### Mac OS X Leopard (10.5) and Mac OS X Snow Leopard (10.6)
+
+The following commands will build a release of iODBC that supports Mac OS X Leopard (10.5) as well as 
+Mac OS X Snow Leopard (10.6), on `ppc` (including as emulated by Rosetta), `x86`, and `x86_64`:
+
+    $ CFLAGS="-O -arch ppc -arch i386 -arch x86_64"
+    $ CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.5.sdk"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+
+### Mac OS X Lion (10.7) and OS X Mountain Lion (10.8)
+
+The following commands will build a release of iODBC that works on Mac OS X Lion (10.7) 
+and OS X Mountain Lion (10.8):
+
+    $ CFLAGS="-O -arch i386 -arch x86_64"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.7"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### OS X Mavericks (10.9) through macOS Big Sur (11.x) on `x86` or `x86_64` (including Rosetta2 emulation)
+
+The following commands will build a release of iODBC that works on OS X Mavericks (10.9) through macOS Big Sur (11.x), supporting other components built for `x86` (through macOS Mojave (10.14), where Apple dropped support for 32-bit components) or `x86_64` (including Rosetta2 emulation):
+
+    $ CFLAGS="-O -arch i386 -arch x86_64"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### macOS Big Sur (11.x) including Apple Silicon support
+
+The following commands will build a release of iODBC that works on macOS Big Sur (11.x), 
+running on Intel (`x86_64`) or Apple Silicon (M1 a/k/a `arm64`):
+
+    $ CFLAGS="-O -arch arm64 -arch x86_64"
+    $ CFLAGS="$CFLAGS -mmacosx-version-min=10.9"
+    $ export CFLAGS
+
+    $ sh autogen.sh
+    $ ./configure \
+        --disable-dependency-tracking \
+        --prefix=/usr/local/iODBC.universal
+
+    $ make
+    $ sudo make install
+
+### Test DSN connection
+
+Once you have installed an ODBC driver and configured a DSN, you will be able to 
+make a connection using the `iodbctest` tool which is located at —
+
+    /usr/local/iODBC.universal/bin/iodbctest

+ 109 - 0
odbc.mod/iodbc/acinclude.m4

@@ -0,0 +1,109 @@
+#
+#  acinclude.m4
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1995 Ke Jin <[email protected]>
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+AC_DEFUN([IODBC_CHECK_PTHREAD_LIB],
+[AC_MSG_CHECKING([for $2 in -l$1 $5])
+ac_save_LIBS="$LIBS"
+LIBS="-l$1 $5 $LIBS"
+
+AC_LINK_IFELSE([AC_LANG_PROGRAM(dnl
+[[
+#ifdef __cplusplus
+extern "C"
+#endif
+
+#if defined (HAVE_PTHREAD_H)
+#include <pthread.h>
+#endif
+]],
+[[$2(0)]])],
+eval "ac_cv_lib_$ac_lib_var=yes",
+eval "ac_cv_lib_$ac_lib_var=no")
+LIBS="$ac_save_LIBS"
+dnl
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+AC_MSG_RESULT(yes)
+ifelse([$3], ,
+[changequote(, )dnl
+  ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+changequote([, ])dnl
+  AC_DEFINE_UNQUOTED($ac_tr_lib)
+  LIBS="-l$1 $LIBS"
+], [$3])
+else
+  AC_MSG_RESULT(no)
+ifelse([$4], , , [$4
+])dnl
+fi
+])

+ 84 - 0
odbc.mod/iodbc/admin/Makefile.am

@@ -0,0 +1,84 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+EXTRA_DIST = \
+	$(srcdir)/gtk-2.0.m4 \
+	$(srcdir)/gtk.m4 \
+	$(srcdir)/libiodbc.pc.in \
+	$(srcdir)/libiodbc.spec.in \
+	$(srcdir)/openlink.m4
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libiodbc.pc
+
+
+noinst_SCRIPTS = libiodbc.spec

+ 196 - 0
odbc.mod/iodbc/admin/gtk-2.0.m4

@@ -0,0 +1,196 @@
+# Configure paths for GTK+
+# Owen Taylor     1997-2001
+
+dnl AM_PATH_GTK_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK+, and define GTK_CFLAGS and GTK_LIBS, if gthread is specified in MODULES, 
+dnl pass to pkg-config
+dnl
+AC_DEFUN([AM_PATH_GTK_2_0],
+[dnl 
+dnl Get the cflags and libraries from pkg-config
+dnl
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       do not try to compile and run a test GTK+ program],
+		    , enable_gtktest=yes)
+
+  pkg_config_args=gtk+-2.0
+  for module in . $4
+  do
+      case "$module" in
+         gthread) 
+             pkg_config_args="$pkg_config_args gthread-2.0"
+         ;;
+      esac
+  done
+
+  no_gtk=""
+
+  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
+  if test x$PKG_CONFIG != xno ; then
+    if pkg-config --atleast-pkgconfig-version 0.7 ; then
+      :
+    else
+      echo *** pkg-config too old; version 0.7 or better required.
+      no_gtk=yes
+      PKG_CONFIG=no
+    fi
+  else
+    no_gtk=yes
+  fi
+
+  min_gtk_version=ifelse([$1], ,2.0.0,$1)
+  AC_MSG_CHECKING(for GTK+ - version >= $min_gtk_version)
+
+  if test x$PKG_CONFIG != xno ; then
+    ## don't try to run the test against uninstalled libtool libs
+    if $PKG_CONFIG --uninstalled $pkg_config_args; then
+	  echo "Will use uninstalled version of GTK+ found in PKG_CONFIG_PATH"
+	  enable_gtktest=no
+    fi
+
+    if $PKG_CONFIG --atleast-version $min_gtk_version $pkg_config_args; then
+	  :
+    else
+	  no_gtk=yes
+    fi
+  fi
+
+  if test x"$no_gtk" = x ; then
+    GTK_CFLAGS=`$PKG_CONFIG $pkg_config_args --cflags`
+    GTK_LIBS=`$PKG_CONFIG $pkg_config_args --libs`
+    gtk_config_major_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$PKG_CONFIG --modversion gtk+-2.0 | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK+ is sufficiently new. (Also sanity
+dnl checks the results of pkg-config to some extent)
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'pkg-config --modversion gtk+-2.0' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If pkg-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
+      printf("*** to point to the correct configuration files\n");
+    } 
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+	   (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+	     gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+	       major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the PKG_CONFIG environment to point to the\n");
+        printf("*** correct copy of pkg-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes (version $gtk_config_major_version.$gtk_config_minor_version.$gtk_config_micro_version))
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$PKG_CONFIG" = "no" ; then
+       echo "*** A new enough version of pkg-config was not found."
+       echo "*** See http://pkgconfig.sourceforge.net"
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK+ test program, checking why..."
+	  ac_save_CFLAGS="$CFLAGS"
+	  ac_save_LIBS="$LIBS"
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK+ or finding the wrong"
+          echo "*** version of GTK+. If it is not finding GTK+, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK+ is incorrectly installed."])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])

+ 194 - 0
odbc.mod/iodbc/admin/gtk.m4

@@ -0,0 +1,194 @@
+# Configure paths for GTK+
+# Owen Taylor     97-11-3
+
+dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
+dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS
+dnl
+AC_DEFUN([AM_PATH_GTK],
+[dnl 
+dnl Get the cflags and libraries from the gtk-config script
+dnl
+AC_ARG_WITH(gtk-prefix,[  --with-gtk-prefix=PFX   Prefix where GTK is installed (optional)],
+            gtk_config_prefix="$withval", gtk_config_prefix="")
+AC_ARG_WITH(gtk-exec-prefix,[  --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional)],
+            gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="")
+AC_ARG_ENABLE(gtktest, [  --disable-gtktest       Do not try to compile and run a test GTK program],
+		    , enable_gtktest=yes)
+
+  for module in . $4
+  do
+      case "$module" in
+         gthread) 
+             gtk_config_args="$gtk_config_args gthread"
+         ;;
+      esac
+  done
+
+  if test x$gtk_config_exec_prefix != x ; then
+     gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config
+     fi
+  fi
+  if test x$gtk_config_prefix != x ; then
+     gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix"
+     if test x${GTK_CONFIG+set} != xset ; then
+        GTK_CONFIG=$gtk_config_prefix/bin/gtk-config
+     fi
+  fi
+
+  AC_PATH_PROG(GTK_CONFIG, gtk-config, no)
+  min_gtk_version=ifelse([$1], ,0.99.7,$1)
+  AC_MSG_CHECKING(for GTK - version >= $min_gtk_version)
+  no_gtk=""
+  if test "$GTK_CONFIG" = "no" ; then
+    no_gtk=yes
+  else
+    GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags`
+    GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs`
+    gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+    gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+    gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \
+           sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+    if test "x$enable_gtktest" = "xyes" ; then
+      ac_save_CFLAGS="$CFLAGS"
+      ac_save_LIBS="$LIBS"
+      CFLAGS="$CFLAGS $GTK_CFLAGS"
+      LIBS="$GTK_LIBS $LIBS"
+dnl
+dnl Now check if the installed GTK is sufficiently new. (Also sanity
+dnl checks the results of gtk-config to some extent
+dnl
+      rm -f conf.gtktest
+      AC_TRY_RUN([
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int 
+main ()
+{
+  int major, minor, micro;
+  char *tmp_version;
+
+  system ("touch conf.gtktest");
+
+  /* HP/UX 9 (%@#!) writes to sscanf strings */
+  tmp_version = g_strdup("$min_gtk_version");
+  if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, &micro) != 3) {
+     printf("%s, bad version string\n", "$min_gtk_version");
+     exit(1);
+   }
+
+  if ((gtk_major_version != $gtk_config_major_version) ||
+      (gtk_minor_version != $gtk_config_minor_version) ||
+      (gtk_micro_version != $gtk_config_micro_version))
+    {
+      printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.%d)\n", 
+             $gtk_config_major_version, $gtk_config_minor_version, $gtk_config_micro_version,
+             gtk_major_version, gtk_minor_version, gtk_micro_version);
+      printf ("*** was found! If gtk-config was correct, then it is best\n");
+      printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n");
+      printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
+      printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
+      printf("*** required on your system.\n");
+      printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n");
+      printf("*** to point to the correct copy of gtk-config, and remove the file config.cache\n");
+      printf("*** before re-running configure\n");
+    } 
+#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK_MICRO_VERSION)
+  else if ((gtk_major_version != GTK_MAJOR_VERSION) ||
+	   (gtk_minor_version != GTK_MINOR_VERSION) ||
+           (gtk_micro_version != GTK_MICRO_VERSION))
+    {
+      printf("*** GTK+ header files (version %d.%d.%d) do not match\n",
+	     GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+      printf("*** library (version %d.%d.%d)\n",
+	     gtk_major_version, gtk_minor_version, gtk_micro_version);
+    }
+#endif /* defined (GTK_MAJOR_VERSION) ... */
+  else
+    {
+      if ((gtk_major_version > major) ||
+        ((gtk_major_version == major) && (gtk_minor_version > minor)) ||
+        ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_micro_version >= micro)))
+      {
+        return 0;
+       }
+     else
+      {
+        printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n",
+               gtk_major_version, gtk_minor_version, gtk_micro_version);
+        printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest version of\n",
+	       major, minor, micro);
+        printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n");
+        printf("***\n");
+        printf("*** If you have already installed a sufficiently new version, this error\n");
+        printf("*** probably means that the wrong copy of the gtk-config shell script is\n");
+        printf("*** being found. The easiest way to fix this is to remove the old version\n");
+        printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n");
+        printf("*** correct copy of gtk-config. (In this case, you will have to\n");
+        printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
+        printf("*** so that the correct libraries are found at run-time))\n");
+      }
+    }
+  return 1;
+}
+],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
+       CFLAGS="$ac_save_CFLAGS"
+       LIBS="$ac_save_LIBS"
+     fi
+  fi
+  if test "x$no_gtk" = x ; then
+     AC_MSG_RESULT(yes)
+     ifelse([$2], , :, [$2])     
+  else
+     AC_MSG_RESULT(no)
+     if test "$GTK_CONFIG" = "no" ; then
+       echo "*** The gtk-config script installed by GTK could not be found"
+       echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in"
+       echo "*** your path, or set the GTK_CONFIG environment variable to the"
+       echo "*** full path to gtk-config."
+     else
+       if test -f conf.gtktest ; then
+        :
+       else
+          echo "*** Could not run GTK test program, checking why..."
+          CFLAGS="$CFLAGS $GTK_CFLAGS"
+          LIBS="$LIBS $GTK_LIBS"
+          AC_TRY_LINK([
+#include <gtk/gtk.h>
+#include <stdio.h>
+],      [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_version)); ],
+        [ echo "*** The test program compiled, but did not run. This usually means"
+          echo "*** that the run-time linker is not finding GTK or finding the wrong"
+          echo "*** version of GTK. If it is not finding GTK, you'll need to set your"
+          echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
+          echo "*** to the installed location  Also, make sure you have run ldconfig if that"
+          echo "*** is required on your system"
+	  echo "***"
+          echo "*** If you have an old version installed, it is best to remove it, although"
+          echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"
+          echo "***"
+          echo "*** If you have a RedHat 5.0 system, you should remove the GTK package that"
+          echo "*** came with the system with the command"
+          echo "***"
+          echo "***    rpm --erase --nodeps gtk gtk-devel" ],
+        [ echo "*** The test program failed to compile or link. See the file config.log for the"
+          echo "*** exact error that occured. This usually means GTK was incorrectly installed"
+          echo "*** or that you have moved GTK since it was installed. In the latter case, you"
+          echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ])
+          CFLAGS="$ac_save_CFLAGS"
+          LIBS="$ac_save_LIBS"
+       fi
+     fi
+     GTK_CFLAGS=""
+     GTK_LIBS=""
+     ifelse([$3], , :, [$3])
+  fi
+  AC_SUBST(GTK_CFLAGS)
+  AC_SUBST(GTK_LIBS)
+  rm -f conf.gtktest
+])

+ 93 - 0
odbc.mod/iodbc/admin/libiodbc.pc.in

@@ -0,0 +1,93 @@
+#
+#  libiodbc.pc
+#
+#  $Id$
+#
+#  pkg-config specification file
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+ODBCINI=@inidir@/odbc.ini
+ODBCINSTINI=@inidir@/odbcinst.ini
+odbcversion=@odbcmode@
+
+Name: iODBC
+Description: @PACKAGE_NAME@
+Version: @PACKAGE_VERSION@
+Requires:
+Libs: -L${libdir} -liodbc -liodbcinst @LIBADD_DL@
+Libs.private: -lpthread
+Cflags: -I${includedir}

+ 261 - 0
odbc.mod/iodbc/admin/libiodbc.spec.in

@@ -0,0 +1,261 @@
+#
+#  libiodbc.spec
+#
+#  $Id$
+#
+#  RPM specification file to build binary distribution set
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+# ----------------------------------------------------------------------
+# MACROS AND DEFINES
+# ----------------------------------------------------------------------
+
+#  Disable generation of debug package
+%define debug_package %{nil}
+
+#  Do we want to build the GTK based administrator?
+%define with_admin 1
+
+# on commandline: --define 'noadmin 1'
+%{?noadmin:%define with_admin 0}
+
+# ----------------------------------------------------------------------
+# BASE PACKAGE
+# ----------------------------------------------------------------------
+Name: libiodbc
+Version: @VERSION@
+Release: 1
+Summary: iODBC Driver Manager
+Group: Libraries
+License: LGPL or BSD license (see "LICENSE" file included in distribution)
+URL: http://www.iodbc.org/
+Source: http://www.iodbc.org/downloads/iODBC/libiodbc-%{PACKAGE_VERSION}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+The iODBC Driver Manager is a free implementation of the SAG CLI and
+ODBC compliant driver manager which allows developers to write ODBC
+compliant applications that can connect to various databases using
+appropriate backend drivers.
+
+The iODBC Driver Manager was originally created Ke Jin and is
+currently maintained by OpenLink Software under a LGPL or BSD license
+(see "LICENSE" file included in the distribution).
+
+%package devel
+Summary: header files and libraries for iODBC development
+Group: Development/Libraries
+Requires: libiodbc
+
+%description devel
+The iODBC Driver Manager is a free implementation of the SAG CLI and
+ODBC compliant driver manager which allows developers to write ODBC
+compliant applications that can connect to various databases using
+appropriate backend drivers.
+
+This package contains the header files and libraries needed to develop
+program that use the driver manager.
+
+The iODBC Driver Manager was originally created Ke Jin and is 
+currently maintained by OpenLink Software under a LGPL or BSD license
+(see "LICENSE" file included in the distribution).
+
+%if %{with_admin}
+%package admin
+Summary: GTK based administrator for iODBC development
+Group: Development/Libraries
+Requires: libiodbc 
+
+%description admin
+The iODBC Driver Manager is a free implementation of the SAG CLI and
+ODBC compliant driver manager which allows developers to write ODBC
+compliant applications that can connect to various databases using
+appropriate backend drivers.
+
+This package contains a GTK based administrator program for maintaining
+DSN information in odbc.ini and odbcinst.ini files.
+
+The iODBC Driver Manager was originally created Ke Jin and is
+currently maintained by OpenLink Software under a LGPL or BSD license
+(see "LICENSE" file included in the distribution).
+%endif
+
+%prep
+%setup
+%build
+
+#
+#  Configure the package
+#
+%if %{with_admin}
+%configure --enable-odbc3 --with-iodbc-inidir=/etc --enable-pthreads --disable-libodbc
+%else
+%configure --enable-odbc3 --with-iodbc-inidir=/etc --enable-pthreads --disable-libodbc --disable-gui
+%endif
+
+#
+#  Build the packages
+#
+make
+
+%install
+#
+#  Carefully clean the build tree before use
+#
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+#
+#  Make sure we can find the necessary libraries
+#
+LIBRARY_PATH=$RPM_BUILD_ROOT/%{_libdir}
+export LIBRARY_PATH
+
+#
+#  Install binaries, include files and libraries
+#
+%makeinstall
+
+#
+#  Install the sample odbc.ini and odbcinst.ini files
+#
+mkdir -p $RPM_BUILD_ROOT/etc
+#install -m644 etc/odbc.ini.sample $RPM_BUILD_ROOT/etc/odbc.ini
+#install -m644 etc/odbcinst.ini.sample $RPM_BUILD_ROOT/etc/odbcinst.ini
+
+%clean
+#
+#  Carefully clean the build tree
+#
+[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files 
+%attr(0755, root, root) %{_bindir}/iodbctest
+%attr(0755, root, root) %{_bindir}/iodbctestw
+%attr(0755, root, root) %{_libdir}/libiodbc.so.*
+%attr(0755, root, root) %{_libdir}/libiodbcinst.so.*
+%attr(0644, root, root) %{_mandir}/man1/iodbctest.1*
+%attr(0644, root, root) %{_mandir}/man1/iodbctestw.1*
+#%attr(0644, root, root) %config /etc/odbc.ini
+#%attr(0644, root, root) %config /etc/odbcinst.ini
+
+
+%files devel
+%defattr(-,root,root)
+%attr(0644, root, root) %doc AUTHORS 
+%attr(0644, root, root) %doc LICENSE
+%attr(0644, root, root) %doc LICENSE.LGPL
+%attr(0644, root, root) %doc LICENSE.BSD
+%attr(0644, root, root) %doc ChangeLog 
+%attr(0644, root, root) %doc NEWS 
+%attr(0644, root, root) %doc README
+%attr(0644, root, root) %doc README.CVS
+%attr(0644, root, root) %doc etc/odbc.ini.sample
+%attr(0644, root, root) %doc etc/odbcinst.ini.sample
+%attr(0644, root, root) %{_includedir}/iodbcext.h
+%attr(0644, root, root) %{_includedir}/iodbcinst.h
+%attr(0644, root, root) %{_includedir}/iodbcunix.h
+%attr(0644, root, root) %{_includedir}/isqlext.h
+%attr(0644, root, root) %{_includedir}/isql.h
+%attr(0644, root, root) %{_includedir}/isqltypes.h
+%attr(0644, root, root) %{_includedir}/sql.h
+%attr(0644, root, root) %{_includedir}/sqltypes.h
+%attr(0644, root, root) %{_includedir}/sqlucode.h
+%attr(0644, root, root) %{_includedir}/sqlext.h
+%attr(0644, root, root) %{_includedir}/odbcinst.h
+%attr(0755, root, root) %{_bindir}/iodbc-config
+%attr(0644, root, root) %{_libdir}/libiodbc.a
+%attr(0644, root, root) %{_libdir}/libiodbc.la
+%attr(0755, root, root) %{_libdir}/libiodbc.so
+%attr(0644, root, root) %{_libdir}/libiodbcinst.a
+%attr(0644, root, root) %{_libdir}/libiodbcinst.la
+%attr(0755, root, root) %{_libdir}/libiodbcinst.so
+%attr(0644, root, root) %{_mandir}/man1/iodbc-config.1*
+%attr(0644, root, root) %{_datadir}/libiodbc/samples/Makefile
+%attr(0644, root, root) %{_datadir}/libiodbc/samples/iodbctest.c
+%attr(0644, root, root) %{_libdir}/pkgconfig/libiodbc.pc
+
+%if %{with_admin}
+%files admin
+%attr(0755, root, root) %{_bindir}/iodbcadm-gtk
+%ghost %{_libdir}/libdrvproxy.a
+%ghost %{_libdir}/libdrvproxy.la
+%ghost %{_libdir}/libdrvproxy.so
+%attr(0755, root, root) %{_libdir}/libdrvproxy.so.*
+%ghost %{_libdir}/libiodbcadm.a
+%ghost %{_libdir}/libiodbcadm.la
+%ghost %{_libdir}/libiodbcadm.so
+%attr(0755, root, root) %{_libdir}/libiodbcadm.so.*
+%attr(0644, root, root) %{_mandir}/man1/iodbcadm-gtk.1*
+%endif

+ 150 - 0
odbc.mod/iodbc/admin/mkinstalldirs

@@ -0,0 +1,150 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+
+scriptversion=2005-02-02.21
+
+# Original author: Noah Friedman <[email protected]>
+# Created: 1993-05-16
+# Public domain.
+#
+# This file is maintained in Automake, please report
+# bugs to <[email protected]> or send patches to
+# <[email protected]>.
+
+errstatus=0
+dirmode=""
+
+usage="\
+Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
+
+Create each directory DIR (with mode MODE, if specified), including all
+leading file name components.
+
+Report bugs to <[email protected]>."
+
+# process command line arguments
+while test $# -gt 0 ; do
+  case $1 in
+    -h | --help | --h*)         # -h for help
+      echo "$usage"
+      exit $?
+      ;;
+    -m)                         # -m PERM arg
+      shift
+      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
+      dirmode=$1
+      shift
+      ;;
+    --version)
+      echo "$0 $scriptversion"
+      exit $?
+      ;;
+    --)                         # stop option processing
+      shift
+      break
+      ;;
+    -*)                         # unknown option
+      echo "$usage" 1>&2
+      exit 1
+      ;;
+    *)                          # first non-opt arg
+      break
+      ;;
+  esac
+done
+
+for file
+do
+  if test -d "$file"; then
+    shift
+  else
+    break
+  fi
+done
+
+case $# in
+  0) exit 0 ;;
+esac
+
+# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
+# mkdir -p a/c at the same time, both will detect that a is missing,
+# one will create a, then the other will try to create a and die with
+# a "File exists" error.  This is a problem when calling mkinstalldirs
+# from a parallel make.  We use --version in the probe to restrict
+# ourselves to GNU mkdir, which is thread-safe.
+case $dirmode in
+  '')
+    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+      echo "mkdir -p -- $*"
+      exec mkdir -p -- "$@"
+    else
+      # On NextStep and OpenStep, the `mkdir' command does not
+      # recognize any option.  It will interpret all options as
+      # directories to create, and then abort because `.' already
+      # exists.
+      test -d ./-p && rmdir ./-p
+      test -d ./--version && rmdir ./--version
+    fi
+    ;;
+  *)
+    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
+       test ! -d ./--version; then
+      echo "mkdir -m $dirmode -p -- $*"
+      exec mkdir -m "$dirmode" -p -- "$@"
+    else
+      # Clean up after NextStep and OpenStep mkdir.
+      for d in ./-m ./-p ./--version "./$dirmode";
+      do
+        test -d $d && rmdir $d
+      done
+    fi
+    ;;
+esac
+
+for file
+do
+  set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+  shift
+
+  pathcomp=
+  for d
+  do
+    pathcomp="$pathcomp$d"
+    case $pathcomp in
+      -*) pathcomp=./$pathcomp ;;
+    esac
+
+    if test ! -d "$pathcomp"; then
+      echo "mkdir $pathcomp"
+
+      mkdir "$pathcomp" || lasterr=$?
+
+      if test ! -d "$pathcomp"; then
+	errstatus=$lasterr
+      else
+	if test ! -z "$dirmode"; then
+	  echo "chmod $dirmode $pathcomp"
+	  lasterr=""
+	  chmod "$dirmode" "$pathcomp" || lasterr=$?
+
+	  if test ! -z "$lasterr"; then
+	    errstatus=$lasterr
+	  fi
+	fi
+      fi
+    fi
+
+    pathcomp="$pathcomp/"
+  done
+done
+
+exit $errstatus
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:

+ 38 - 0
odbc.mod/iodbc/admin/openlink.m4

@@ -0,0 +1,38 @@
+#
+#  Autoconf macros used by OpenLink
+#
+
+AC_DEFUN([OPL_CONFIG_NICE], [
+  rm -f $1
+  cat >$1 <<-CONFIG_NICE_EOF
+	#!$SHELL
+	#
+	# Created by configure for $PACKAGE_STRING
+	#
+
+CONFIG_NICE_EOF
+
+  export_names="export"
+  for var in SHELL CFLAGS CXXFLAGS CPPFLAGS LDFLAGS INCLUDES LIBS CC CXX
+  do
+    eval val=\$$var
+    if test -n "$val"; then
+      echo "$var='$val'" >> $1
+      export_names="$export_names $var"
+    fi
+  done
+
+  echo "$export_names" >> $1
+
+  echo "" >> $1
+  echo "# configure" >> $1
+
+  eval "set -- $ac_configure_args"
+  echo "[$]SHELL \"[$]0\" \\" >> $1
+  for arg
+  do
+    echo "'$arg' \\" >> $1
+  done
+  echo '"[$]@"' >> $1
+  chmod +x $1
+])dnl

+ 208 - 0
odbc.mod/iodbc/autogen.sh

@@ -0,0 +1,208 @@
+#! /bin/sh
+#
+#  autogen.sh
+#
+#  Bootstrap the iODBC project so we do not need to maintain the
+#  files generated by autoconf, automake and libtool
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+# ----------------------------------------------------------------------
+#  Globals
+# ----------------------------------------------------------------------
+DIE=0
+ELINES=3
+
+
+# ----------------------------------------------------------------------
+#  Color settings
+# ----------------------------------------------------------------------
+B=`tput bold 2>/dev/null`
+N=`tput sgr0 2>/dev/null`
+
+ERROR="${B}** ERROR **${N}"
+WARNING="${B}* WARNING *${N}"
+
+
+# ----------------------------------------------------------------------
+#  Functions
+# ----------------------------------------------------------------------
+CHECK() {
+    for PROG in $*
+    do
+	VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"`
+	if test \! -z "$VERSION"
+	then
+	    echo "Using $PROG $VERSION"
+	    USE_PROG=$PROG
+	    break
+	fi
+    done
+
+    if test -z "$VERSION"
+    then
+	echo
+	echo "${ERROR} : You must have \`${B}${PROG}${N}' installed on your system."
+	echo
+	DIE=1
+    fi
+}
+
+
+CHECK_WARN() {
+    for PROG in $*
+    do
+	VERSION=`$PROG --version 2>/dev/null | head -1 | sed -e "s/$PROG //"`
+	if test \! -z "$VERSION"
+	then
+	    echo "Using $PROG $VERSION"
+	    USE_PROG=$PROG
+	    break
+	fi
+    done
+
+    if test -z "$VERSION"
+    then
+	echo
+	echo "${WARNING} : You may need \`${B}${PROG}${N}' installed on your system."
+	echo
+    fi
+}
+
+
+RUN() {
+    PROG=$1; shift
+    ARGS=$*
+
+    echo "Running ${B}${PROG}${N} ..."
+    $PROG $ARGS 2>> autogen.log
+    if test $? -ne 0
+    then
+	echo
+	echo "${ERROR}"
+	tail -$ELINES autogen.log
+	echo
+	echo "autogen.sh script aborting (see autogen.log for details) ..."
+	exit 1
+    fi
+}
+
+
+#
+#  Check availability of build tools
+#
+echo
+echo "${B}Checking build environment${N} ..."
+
+CHECK libtoolize glibtoolize; LIBTOOLIZE=$USE_PROG
+CHECK aclocal
+CHECK autoheader
+CHECK automake
+CHECK autoconf
+CHECK_WARN gtk-config
+
+if test "$DIE" -eq 1
+then
+    echo
+    echo "Please read the ${B}README_GIT${N} file for a list of packages you need"
+    echo "to install on your system before bootstrapping this project."
+    echo
+    echo "autogen.sh script aborting ..."
+    exit 1
+fi
+
+
+#
+#  Generate the build scripts
+#
+> autogen.log
+
+echo
+echo "${B}Generating build scripts${N} ..."
+
+touch ChangeLog
+
+RUN $LIBTOOLIZE --force --copy
+RUN aclocal -I admin #--warnings=all
+RUN autoheader --warnings=all
+RUN automake --copy --add-missing --warnings=all
+RUN autoconf --warnings=all,no-obsolete
+
+echo
+echo "Please check the ${B}INSTALL${N} and ${B}README${N} files for instructions to"
+echo "configure, build and install iODBC on your system."
+echo
+echo "Certain build targets are only enabled in maintainer mode:"
+echo
+echo "    ./configure --enable-maintainer-mode ..."
+echo
+echo "autogen.sh script completed successfully."
+
+exit 0

+ 74 - 0
odbc.mod/iodbc/bin/Makefile.am

@@ -0,0 +1,74 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+bin_SCRIPTS	= iodbc-config

+ 214 - 0
odbc.mod/iodbc/bin/iodbc-config.in

@@ -0,0 +1,214 @@
+#!/bin/sh
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+exec_prefix_set=no
+data_dir=@datadir@
+
+usage()
+{
+	cat <<EOF
+iODBC Configuration Script
+@PACKAGE_STRING@
+Copyright (C) 1996-2021 OpenLink Software
+Please report all bugs to <@PACKAGE_BUGREPORT@>
+
+Usage: 
+        iodbc-config [OPTIONS] [LIBRARIES]
+
+Options:
+	[--prefix[=DIR]]
+	[--exec-prefix[=DIR]]
+	[--version]
+	[--libs]
+	[--static-libs]
+	[--libtool-libs]
+	[--cflags]
+	[--odbcversion]
+	[--odbcini]
+	[--odbcinstini]
+Libraries:
+	iodbc
+EOF
+	exit $1
+}
+
+if test $# -eq 0; then
+	usage 1 1>&2
+fi
+
+lib_iodbc=yes
+
+while test $# -gt 0; do
+  case "$1" in
+  -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+  *) optarg= ;;
+  esac
+
+  case $1 in
+    --prefix=*)
+      prefix=$optarg
+      if test $exec_prefix_set = no ; then
+        exec_prefix=$optarg
+      fi
+      ;;
+    --prefix)
+      echo_prefix=yes
+      ;;
+    --exec-prefix=*)
+      exec_prefix=$optarg
+      exec_prefix_set=yes
+      ;;
+    --exec-prefix)
+      echo_exec_prefix=yes
+      ;;
+    --version)
+      echo @VERSION@
+      exit 0
+      ;;
+    --cflags)
+      if test "@includedir@" != /usr/include ; then
+        includes="-I@includedir@"
+      fi
+      echo_cflags=yes
+      ;;
+    --libs)
+      echo_libs=yes
+      ;;
+   --static-libs)
+      echo_staticlibs=yes
+      ;;
+   --libtool-libs)
+      echo_libtoollibs=yes
+      ;;
+   --data-dir)
+      echo_data_dir=yes
+      ;;
+   --odbcversion)
+      echo @odbcmode@
+      exit 0
+      ;;
+   --odbcini)
+      echo_odbcini=yes
+      ;;
+   --odbcinstini)
+      echo_odbcinstini=yes
+      ;;
+    iodbc)
+      lib_iodbc=yes
+      ;;
+    *)
+      usage 1 1>&2
+      ;;
+  esac
+  shift
+done
+
+if test "$echo_prefix" = "yes"; then
+	echo $prefix
+fi
+if test "$echo_exec_prefix" = "yes"; then
+	echo $exec_prefix
+fi
+if test "$echo_data_dir" = "yes"; then
+	echo $data_dir
+fi
+if test "$echo_odbcini" = "yes"; then
+	echo "@inidir@/odbc.ini"
+fi
+if test "$echo_odbcinstini" = "yes"; then
+	echo "@inidir@/odbcinst.ini"
+fi
+if test "$echo_cflags" = "yes"; then
+	echo "$includes"
+fi
+if test "$echo_libs" = "yes"; then
+	libs=""
+	if test "$lib_iodbc" = "yes"; then
+		libs="$libs -liodbc -liodbcinst"
+	fi
+	echo "-L@libdir@ $libs"
+fi
+if test "$echo_staticlibs" = "yes"; then
+	libs=""
+	if test "$lib_iodbc" = "yes"; then
+		libs="@libdir@/libiodbc.a @libdir@/libiodbcinst.a -lpthread @LIBADD_DL@"
+	fi
+	echo "$libs"
+fi
+if test "$echo_libtoollibs" = "yes"; then
+	libs=""
+	if test "$lib_iodbc" = "yes"; then
+		libs="@libdir@/libiodbc.la @libdir@/libiodbcinst.la"
+	fi
+	echo "$libs"
+fi

+ 774 - 0
odbc.mod/iodbc/configure.ac

@@ -0,0 +1,774 @@
+AC_PREREQ(2.59)
+AC_REVISION($Id$)
+#
+#  configure.ac
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1995 Ke Jin <[email protected]>
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+##########################################################################
+##									##
+##  Version info							##
+##									##
+##########################################################################
+m4_define(V_iodbc_major,       [3])            # ODBC Major version
+m4_define(V_iodbc_minor,       [52])           # ODBC Minor version
+m4_define(V_iodbc_patch,       [16])           # Increase every release
+m4_define(V_iodbc_devel,       [-dev])             # -dev, -rc1 or empty for stable
+
+m4_define(V_iodbc_date,        [210705])       # YYMMDD of release
+m4_define(V_iodbc_shlib,       [30])           # Increase every change
+
+
+##########################################################################
+##									##
+##  Initialization							##
+##									##
+##########################################################################
+AC_INIT([iODBC Driver Manager],
+        V_iodbc_major.V_iodbc_minor.V_iodbc_patch[]V_iodbc_devel,
+	[[email protected]],
+	[libiodbc])
+AC_CONFIG_SRCDIR([include/isql.h])
+AC_CONFIG_AUX_DIR(admin)
+AC_CONFIG_MACRO_DIR(admin)
+AC_CONFIG_HEADERS(include/config.h)
+AM_INIT_AUTOMAKE
+AC_CANONICAL_HOST
+AM_MAINTAINER_MODE
+
+
+##########################################################################
+##									##
+##  Version information							##
+##									##
+#########################################################################
+
+#
+#  Version information for SQLGetInfo(SQL_DM_VER) call
+#
+BUILD_MAJOR="V_iodbc_patch"		# last digit of version number
+BUILD_MINOR="V_iodbc_date"		# year/month/day of release
+BUILD_VER="${BUILD_MAJOR}${BUILD_MINOR}"
+
+#
+#  Library version numbers
+#
+lib3_version=3:V_iodbc_shlib:1	# ODBC 3.x mode
+lib2_version=2:55:0		# ODBC 2.x mode (do not change)
+
+
+##########################################################################
+##									##
+##  Check whether config.cache belongs to this machine			##
+##									##
+##########################################################################
+AC_MSG_CHECKING(cached information)
+hostcheck="$host"
+AC_CACHE_VAL(ac_cv_hostcheck, [ ac_cv_hostcheck="$hostcheck" ])
+if test "$ac_cv_hostcheck" != "$hostcheck"; then
+  AC_MSG_RESULT(changed)
+
+  AC_MSG_WARN([Running on a different architecture.])
+  AC_MSG_WARN([Can't use cached values.])
+  AC_MSG_ERROR([Please remove the invalid config.cache file, then try again.])
+else
+  AC_MSG_RESULT(ok)
+fi
+
+
+##########################################################################
+##									##
+##  Save configuration for later reuse					##
+##									##
+##########################################################################
+
+OPL_CONFIG_NICE([config.nice])
+
+
+##########################################################################
+##									##
+##  Set Layout for iODBC						##
+##									##
+##########################################################################
+AC_PREFIX_DEFAULT(/usr/local)
+
+AC_MSG_CHECKING(for iODBC installation layout)
+AC_ARG_WITH(layout, [dnl
+AS_HELP_STRING([--with-layout=LAYOUT], [Choose installation layout])dnl
+],
+[ case "${withval}" in
+    yes|no)	IODBC_LAYOUT=unset ;;
+    *)		IODBC_LAYOUT=${withval} ;;
+  esac
+], [IODBC_LAYOUT=unset]) 
+
+
+#
+#  Defaults for Layout
+#
+install_libodbc=true
+
+case ${IODBC_LAYOUT} in
+  unset)					# No Layout set
+	iodbc_layout="default"
+	inidir=/etc
+	;;
+
+  [[Gg]][[Nn]][[Uu]])				# GNU
+	iodbc_layout="GNU"
+	test "x$prefix" = xNONE && prefix=/usr/local
+	inidir=${prefix}/etc/iodbc
+	;;
+
+  [[Dd]][[Ee]][[Bb]][[Ii]][[Aa]][[Nn]])		# Debian
+	iodbc_layout="Debian"
+	test "x$prefix" = xNONE && prefix=/usr
+	inidir=/etc
+	install_libodbc=false
+	;;
+
+  [[Gg]][[Ee]][[Nn]][[Tt]][[Oo]][[Oo]])		# Gentoo
+	iodbc_layout="Gentoo"
+	test "x$prefix" = xNONE && prefix=/usr
+	includedir='${prefix}/include/iodbc'
+	inidir=/etc/iodbc
+	install_libodbc=false
+	;;
+
+  [[Rr]][[Ee]][[Dd]][[Hh]][[Aa]][[Tt]])		# RedHat
+	iodbc_layout=RedHat
+	test "x$prefix" = xNONE && prefix=/usr
+	inidir=/etc
+	;;
+
+  [[Ff]][[Rr]][[Ee]][[Ee]][[Bb]][[Ss]][[Dd]])	# FreeBSD
+	iodbc_layout=FreeBSD
+	test "x$prefix" = xNONE && prefix=/usr
+	inidir=/etc
+	;;
+
+  [[Oo]][[Pp]][[Tt]])				# /opt
+	iodbc_layout=opt
+	test "x$prefix" = xNONE && prefix=/opt/iodbc
+	inidir=/etc
+	;;
+
+ [[Oo]][[Pp]][[Ee]][[Nn]][[Ll]][[Ii]][[Nn]][[Kk]])	# OpenLink
+ 	iodbc_layout=openlink
+	prefix=/usr/local/iODBC
+	inidir=/etc
+	;;
+
+  *)						# UNKNOWN
+  	AC_MSG_RESULT(unknown)
+	echo ""
+	echo "Supported layouts: Debian FreeBSD GNU OpenLink opt RedHat"
+	echo ""
+	AC_MSG_ERROR([unable to continue])
+	;;
+esac
+AC_MSG_RESULT([${iodbc_layout}])
+
+
+##########################################################################
+##									##
+##  Check for C compiler						##
+##									##
+##########################################################################
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_CC_STDC
+AC_PROG_CPP
+AC_LANG([C])
+AC_C_CONST
+
+
+##########################################################################
+##									##
+##  Check for standard programs						##
+##									##
+##########################################################################
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+LT_INIT
+
+
+##########################################################################
+##									##
+##  Check for standard header files					##
+##									##
+##########################################################################
+AC_HEADER_STDC
+AC_HEADER_TIME
+AC_CHECK_HEADERS(wchar.h)
+
+
+##########################################################################
+##									##
+##  Check for specific library functions				##
+##									##
+##########################################################################
+AC_CHECK_FUNCS(strerror setenv asprintf snprintf gettimeofday localtime_r)
+
+dnl Unicode
+AC_CHECK_FUNCS(wcslen wcscpy wcsncpy wcschr wcscat wcscmp towlower wcsncasecmp)
+
+
+##########################################################################
+##									##
+##  Check if we want to build the GUI applications and libraries	##
+##									##
+##########################################################################
+AC_ARG_ENABLE(gui, [dnl
+AS_HELP_STRING([--enable-gui], [build GUI applications (default)])
+AS_HELP_STRING([--disable-gui], [build GUI applications])dnl
+],
+[ case "${enableval}" in
+    yes) USE_GUI=true ;;
+    no)  USE_GUI=false ;;
+    *) AC_MSG_ERROR(bad value ${enableval} for --enable-gui) ;;
+  esac
+],[USE_GUI=true]) 
+
+
+##########################################################################
+##									##
+##  Check for GTK library functions					##
+##									##
+##########################################################################
+USE_GTK=false
+if test x$USE_GUI = xtrue
+then
+  no_gtk=""
+  # Check for GTK+ 2.x
+  AM_PATH_GTK_2_0(2.0.0)
+  if test x$no_gtk != x
+  then
+      # Try GTK 1.2.x instead
+      no_gtk=""
+      AM_PATH_GTK(1.2.3)
+  fi
+  if test x$no_gtk = x
+  then
+    USE_GTK=true
+  fi
+fi
+
+##########################################################################
+##									##
+##  Now make the final checks whether we can use GUI extensions		##
+##									##
+##########################################################################
+if test x$USE_GTK = xfalse
+then
+  USE_GUI=false
+fi
+
+if test x$USE_GUI = xtrue
+then
+  AC_DEFINE(GUI, 1, [Define if we detected a GUI library we can use])
+fi
+
+AM_CONDITIONAL(GUI, [test x$USE_GUI = xtrue])
+AM_CONDITIONAL(GTK, [test x$USE_GTK = xtrue])
+
+
+##########################################################################
+##									##
+##  Check for dynamic load module					##
+##									##
+##########################################################################
+
+AC_CHECK_HEADERS(dlfcn.h dl.h dld.h)
+
+save_LIBS="$LIBS"
+LIBADD_DL=""
+
+AC_CHECK_LIB(dl, dlopen,
+  [
+    AC_DEFINE(HAVE_LIBDL, 1, [Define if you have the -ldl library])
+    LIBADD_DL="-ldl"
+    LIBS="$LIBS -ldl"
+  ]
+)
+
+AC_CHECK_FUNCS(dlopen _dlopen dlsym dladdr)
+
+AC_MSG_CHECKING([whether dlsym() requires a leading underscore in symbol names])
+_LT_TRY_DLOPEN_SELF([
+    AC_MSG_RESULT(no)
+], [
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(NEED_USCORE, 1, [Define if dlsym() requires a leading underscore in symbol names. ])
+], [
+  AC_MSG_RESULT(no)
+], [])
+
+##########################################################################
+##  Check if the dl library has the Dl_info structure                   ##
+##########################################################################
+AC_MSG_CHECKING([for Dl_info])
+AC_TRY_COMPILE([
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+#include <dlfcn.h>
+  ],[
+Dl_info* info = 0;
+dladdr(0, info);
+  ],[
+    AC_DEFINE(HAVE_DL_INFO, 1, [Define to 1 if you have the Dl_info structure])
+    AC_MSG_RESULT(yes)
+  ],[
+    AC_MSG_RESULT(no)
+])
+
+##########################################################################
+##  Check for dynamic load module (hpux)				##
+##########################################################################
+AC_CHECK_FUNC(shl_load,
+  [AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if you have the shl_load function])],
+  [AC_CHECK_LIB(dld, shl_load,
+    [AC_DEFINE(HAVE_SHL_LOAD, 1, [Define if you have the shl_load function]) LIBADD_DL="-ldld"])]
+  )
+
+##########################################################################
+##  Check for dynamic load module (hpux)				##
+##########################################################################
+AC_CHECK_LIB(dld, dld_link,
+   [AC_DEFINE(HAVE_DLD, 1, [Define if you have the -ldld library])dnl
+    test "x$ac_cv_lib_dld_shl_load" = yes || LIBADD_DL="-ldld"])
+
+##########################################################################
+##  Check for dynamic load module (macos)				##
+##########################################################################
+AC_CHECK_FUNC(NSCreateObjectFileImageFromFile,
+    [AC_DEFINE(HAVE_DYLD, 1, [Define if you have the DYLD library])])
+
+AC_SUBST(LIBADD_DL)
+
+LIBS="$save_LIBS"
+
+##########################################################################
+##									##
+##  Set version information						## 
+##									##
+##########################################################################
+
+AC_MSG_CHECKING(for iODBC mode)
+AC_ARG_ENABLE(odbc3, [dnl
+AS_HELP_STRING([--enable-odbc3], [build ODBC 3.x compatible driver manager (default)])
+AS_HELP_STRING([--disable-odbc3], [build ODBC 2.x compatible driver manager])dnl
+],
+[
+    case "${enableval}" in
+      yes)	odbcmode=3 ;;
+      no)	odbcmode=2 
+      		AC_MSG_ERROR(--disable-odbc3 temporarily disabled)
+		;;
+      *)	AC_MSG_ERROR(bad value ${enableval} for --enable-odbc3) ;;
+    esac
+],
+[
+    odbcmode=3	  # set default to ODBC 3.x mode 
+])
+
+if test "x$odbcmode" = "x3"
+then
+	lib_version=$lib3_version
+	CFLAGS="$CFLAGS -DODBCVER=0x0350 -DIODBC_BUILD=$BUILD_VER" 
+	AC_MSG_RESULT(ODBC 3.x compatible mode)
+else
+	lib_version=$lib2_version
+	CFLAGS="$CFLAGS -DODBCVER=0x0250 -DIODBC_BUILD=$BUILD_VER" 
+	AC_MSG_RESULT(ODBC 2.x compatible mode)
+fi
+AC_SUBST(odbcmode)
+AC_SUBST(lib_version)
+
+
+##########################################################################
+##									##
+##  Where to find the system odbc.ini file				**
+##									##
+##########################################################################
+
+#
+#  First determine the systemwide default directory according 
+#  to GNU specifications
+#
+AC_MSG_CHECKING(system config directory)
+sysinidir=`eval echo $sysconfdir`
+case "$sysinidir" in
+NONE*) 
+       sysinidir=$ac_default_prefix/etc
+       ;;
+/usr/etc)
+       sysinidir=/etc
+       ;;
+*)
+       sysinidir=`eval echo $sysconfdir`
+       ;;
+esac
+AC_MSG_RESULT($sysinidir)
+
+#
+#  Now allow to overrule this directory with a custom setting
+#
+AC_MSG_CHECKING(for iODBC ini directory)
+AC_ARG_WITH(iodbc-inidir, [dnl
+AS_HELP_STRING([--with-iodbc-inidir=DIR], [where the system odbc.ini file should be located])
+AS_HELP_STRING([ ], [(default is /etc)])dnl
+],
+[ 
+    case "$withval" in
+    yes|no)
+        inidir=$sysinidir
+	;;
+    *)
+    	inidir=$withval
+	;;
+    esac 
+])
+AC_MSG_RESULT($inidir)
+
+AC_SUBST(inidir)
+AC_DEFINE_UNQUOTED(SYS_ODBC_INI, "$inidir/odbc.ini",
+	[Define path to systemwide odbc.ini file])
+AC_DEFINE_UNQUOTED(SYS_ODBCINST_INI, "$inidir/odbcinst.ini",
+	[Define path to systemwide odbcinst.ini file])
+
+#
+#  Now allow to override default FileDSN directory with a custom setting
+#
+filedsnpath=$inidir/ODBCDataSources
+AC_MSG_CHECKING(for FILEDSN default directory)
+AC_ARG_WITH(iodbc-filedsnpath, [dnl
+AS_HELP_STRING([--with-iodbc-filedsnpath=DIR], [default location for FILEDSN data sources])
+AS_HELP_STRING([ ], [(default is $inidir/ODBCDataSources)])dnl
+],
+[ 
+    case "$withval" in
+    yes|no)
+        filedsnpath=$inidir/ODBCDataSources
+	;;
+    *)
+    	filedsnpath=$withval
+	;;
+    esac 
+])
+AC_MSG_RESULT($filedsnpath)
+
+AC_SUBST(filedsnpath)
+AC_DEFINE_UNQUOTED(DEFAULT_FILEDSNPATH, "$filedsnpath",
+	[Default location for FILEDSN data sources])
+
+
+##########################################################################
+##									##
+##  Create libodbc.so if requested                     			##
+##									##
+##########################################################################
+
+AC_MSG_CHECKING(for libodbc.so link)
+AC_ARG_ENABLE(libodbc, [dnl
+AS_HELP_STRING([--enable-libodbc], [install extra libodbc.so library (default)])
+AS_HELP_STRING([--disable-libodbc], [do not install extra libodbc.so library ])dnl
+],
+[ case "${enableval}" in
+    yes) install_libodbc=true ;;
+    no)  install_libodbc=false ;;
+    *) AC_MSG_ERROR(bad value ${enableval} for --enable-libodbc) ;;
+  esac
+],[]) 
+AC_MSG_RESULT([$install_libodbc])
+
+AM_CONDITIONAL(INSTALL_LIBODBC, [test x$install_libodbc = xtrue])
+
+
+##########################################################################
+##									##
+##  Checkout pthread situation						##
+##									##
+##########################################################################
+
+# for backward compatibility
+AC_ARG_WITH(pthreads,[],
+[ 
+  AC_MSG_WARN([--with-pthreads flag is deprecated, use --enable-pthreads])
+],[]) 
+
+
+AC_MSG_CHECKING(for thread model)
+AC_ARG_ENABLE(pthreads, [dnl
+AS_HELP_STRING([--enable-pthreads], [build threaded libraries and applications (default)])
+AS_HELP_STRING([--disable-pthreads], [build non-threaded libraries and applications])dnl
+],
+[ case "${enableval}" in
+    yes) USE_PTHREADS=true ;;
+    no)  USE_PTHREADS=false ;;
+    *) AC_MSG_ERROR(bad value ${enableval} for --enable-pthreads) ;;
+  esac
+],[USE_PTHREADS=true]) 
+
+if test x$USE_PTHREADS = xtrue
+then
+    AC_MSG_RESULT(enabled pthread support)
+    CPPFLAGS="$CPPFLAGS -DWITH_PTHREADS -D_REENTRANT"
+    found_lib=false
+
+    AC_MSG_CHECKING(for OS dependent thread flags)
+    case $host in
+      *-aix*)	
+		#  Unless overruled by the user, we prefer this compiler
+		if test "x$CC" = "xcc"
+		then
+		    CC=cc_r7
+		fi
+		AC_MSG_RESULT([using $CC for AIX])
+		;;
+
+      *UnixWare*)
+      		CFLAGS="$CFLAGS -Kthread"
+		AC_MSG_RESULT([use -Kthread for UnixWare])
+		;;
+
+      i[3456]86-dg-dgux*)
+      		CFLAGS="$CFLAGS -D_POSIX4A_DRAFT6_SOURCE"
+		LIBS="$LIBS -lthread"
+		AC_MSG_RESULT([use -lthread for DG/UX])
+		;;
+
+      *-freebsd*)	
+		CFLAGS="$CFLAGS -pthread"
+		AC_MSG_RESULT([use -pthread for FreeBSD])
+		;;
+
+	*-hpux*)
+		LIBS="$LIBS -lpthread -lcl"
+		AC_MSG_RESULT([use -lpthread for HP/UX])
+		;;
+
+	*-osf3.*)
+		CPPFLAGS="$CPPFLAGS -DOLD_PTHREADS"
+		LIBS="$LIBS -lpthreads -lmach -lc_r"
+		AC_MSG_RESULT([use -lpthreads for OSF 3.2])
+		;;
+
+	*-osf4.*)
+	        LIBS="$LIBS -lpthread"
+		AC_MSG_RESULT([use -lpthread for OSF 4.x])
+	  	;;
+		
+      *)
+		AC_MSG_RESULT([none])
+		;;
+    esac
+
+    #
+    #  Check headers
+    #
+    AC_CHECK_HEADER([pthread.h], , [AC_MSG_ERROR([pthreads header not found])])
+
+    #
+    #  If mutex functions are in C library, we should not need to link
+    #  with -lpthread
+    #
+    AC_CHECK_FUNC(pthread_mutex_lock, [found_lib=true])
+
+    #
+    #  Check out the various libraries
+    #
+    if test x$found_lib = xfalse
+    then
+	IODBC_CHECK_PTHREAD_LIB(pthreads, pthread_mutex_lock,
+	[
+	    LIBS="$LIBS -lpthreads"
+	    found_lib=true
+	])
+    fi
+    if test x$found_lib = xfalse
+    then
+	IODBC_CHECK_PTHREAD_LIB(pthread, pthread_mutex_lock, 
+	[
+	    LIBS="$LIBS -lpthread"
+	    found_lib=true
+	])
+    fi 
+else
+    AC_MSG_RESULT(no thread support)
+fi
+
+
+########################################################################## 
+##									##
+##  OS dependent libraries						##
+##									##
+##########################################################################
+LIBADD_OS=""
+AC_MSG_CHECKING(for OS dependent libraries and link flags)
+AM_CONDITIONAL(DARWIN, false)	
+case $host in
+  *-hpux*)
+	LDFLAGS="$LDFLAGS -Wl,+s"
+	AC_MSG_RESULT([use -Wl,+s for HP/UX])
+	;;
+  *-darwin*)
+	AM_CONDITIONAL(DARWIN, true)	
+	CFLAGS="$CFLAGS -DNO_FRAMEWORKS"
+	LIBADD_OS="-Wl,-framework,Carbon"
+	AC_MSG_RESULT([$LIBADD_OS])
+	;;
+  *)
+	AC_MSG_RESULT(none)
+	;;
+esac
+AC_SUBST(LIBADD_OS)
+
+
+########################################################################## 
+##									##
+##  Generate Makefiles etc.						##
+##									##
+##########################################################################
+AC_CONFIG_FILES([
+    Makefile 
+    admin/Makefile
+    admin/libiodbc.spec
+    admin/libiodbc.pc
+    bin/Makefile
+    bin/iodbc-config
+    etc/Makefile
+    man/Makefile
+    man/iodbc-config.1
+    man/iodbctest.1
+    man/iodbctestw.1
+    man/iodbcadm-gtk.1
+    include/Makefile
+    iodbc/Makefile
+    iodbc/trace/Makefile
+    iodbcinst/Makefile
+    iodbcadm/Makefile
+    iodbcadm/gtk/Makefile
+    drvproxy/Makefile
+    drvproxy/gtk/Makefile
+    samples/Makefile
+])
+AC_CONFIG_COMMANDS([default],[
+    chmod 755 bin/iodbc-config
+])
+AC_OUTPUT
+
+
+########################################################################## 
+##									##
+##  Display configuration information					##
+##									##
+##########################################################################
+
+# ----------------------------------------------------------------------
+#  Color settings
+# ----------------------------------------------------------------------
+B=`tput bold 2>/dev/null`
+N=`tput sgr0 2>/dev/null`
+
+cat <<EOF
+
+
+${B}${PACKAGE_STRING} configuration summary${N}
+`echo "${PACKAGE_STRING} configuration summary" | sed 's/./=/g'`
+
+${B}Installation variables${N}
+  layout		${iodbc_layout}
+  prefix		${prefix}
+  exec_prefix		${exec_prefix}
+
+${B}Installation paths${N}
+  programs		${bindir}
+  include files		${includedir}
+  libraries		${libdir}
+  manual pages		${mandir}
+
+${B}Configuration files${N}
+  odbc.ini		${inidir}/odbc.ini
+  odbcinst.ini		${inidir}/odbcinst.ini
+  default FILEDSN path	${filedsnpath}
+
+${B}Extensions${N}
+  ODBC Version		${odbcmode}
+  GUI Extensions	${USE_GUI}
+  ThreadSafe		${USE_PTHREADS}
+  Install libodbc.so	${install_libodbc}
+
+EOF

+ 23 - 0
odbc.mod/iodbc/debian/README.Debian

@@ -0,0 +1,23 @@
+#
+# What about libodbc.so? (bug #171370)
+#
+
+According to the upstream authors the library can safely be installed
+as libodbc.so to use it with OpenOffice, R and other applications.
+
+It is not yet done in Debian by default as currently unixODBC maintains
+a symlink to libodbc.so and using alternatives for shared libraries is
+maybe dangerous. We are currently deciding if maybe one ODBC library
+can be dropped alltogether.
+
+last edited: 2004-03-01, [email protected]
+
+#
+# Why are .so libraries not in -dev packages? (bug #275179)
+#
+
+This is an unfortunate side effect from the (legacy) version of libtool
+used at the time when this code was written and will be fixed in an
+upcoming version.
+
+last edited: 2007-01-05, [email protected]

+ 253 - 0
odbc.mod/iodbc/debian/changelog

@@ -0,0 +1,253 @@
+libiodbc2 (3.52.12) unstable; urgency=low
+  * Added new Cocoa based UI for Mac OS X 10.5 and above so 64bit
+    applications can use 64bit dialog boxes from the iODBCinst framework
+  * Small bugfixes and cleanups
+
+ -- iODBC maintainer <[email protected]>  Tue, 12 Jul 2016 12:00:00 +0200
+
+libiodbc2 (3.52.4-3) unstable; urgency=low
+
+  * New maintainer.  Closes: #230646.
+  * debian/copyright: Updated by removing the existing patches.  This fixes
+    the FSF address, and this restores some subtle upstream license choices.
+  * debian/iodbc.lintian-overrides: Updated.
+  * debian/libiodbc2.lintian-overrides: Updated.
+  * debian/control, debian/rules: Use automake1.9.
+  * debian/control: Standards version.
+  * debian/control: Added homepage.
+
+ -- Bart Martens <[email protected]>  Sat, 22 Apr 2006 16:38:52 +0200
+
+libiodbc2 (3.52.4-2) unstable; urgency=low
+
+  * Fixed FTBFS due to bug in iodbc control file which has recently started
+    to let dpkg-genchanges fail.
+
+ -- Christian Hammers <[email protected]>  Mon,  6 Feb 2006 20:28:19 +0100
+
+libiodbc2 (3.52.4-1) unstable; urgency=low
+
+  * New upstream release.
+    Closes: #339501 
+
+ -- Christian Hammers <[email protected]>  Mon, 30 Jan 2006 21:37:30 +0100
+
+libiodbc2 (3.52.3-1) unstable; urgency=low
+
+  * New upstream release.
+    Closes: #309935, #309936, #301304
+  * Removed Debian specific patches and added --layout=debian to configure.
+
+ -- Christian Hammers <[email protected]>  Wed, 16 Nov 2005 02:56:21 +0100
+
+libiodbc2 (3.52.2-4) unstable; urgency=low
+
+  * Raised automake version from 1.6 to 1.7 on request of Eric Dorland. 
+
+ -- Christian Hammers <[email protected]>  Sun, 31 Jul 2005 23:50:25 +0200
+
+libiodbc2 (3.52.2-3) unstable; urgency=low
+
+  * Andreas Jochens reported a build problem on amd64 which uses the
+    apparently more strict gcc-4.0 and provided a patch. Thanks!
+    Closes: #294154
+
+ -- Christian Hammers <[email protected]>  Tue,  8 Feb 2005 13:04:39 +0100
+
+libiodbc2 (3.52.2-2) unstable; urgency=low
+
+  * debian/rules: Adjusted CDBS variables necessary to update libtool
+    (thanks to Robert Millan). Closes: #268306, #262295
+
+ -- Christian Hammers <[email protected]>  Mon,  7 Feb 2005 21:05:33 +0100
+
+libiodbc2 (3.52.2-1) unstable; urgency=low
+
+  * New upstream version. 
+
+ -- Christian Hammers <[email protected]>  Mon,  7 Feb 2005 19:28:33 +0100
+
+libiodbc2 (3.52.1-2) unstable; urgency=medium
+
+  * Moved all .so files from libiodbc2-dev to iodbc and libiodbc2 as some
+    applications like iodbcadm-gtk from iodbc load their shared libraries
+    in a DLL wrapper function at runtime and not via the common dynamic
+    linking way! (thanks to Alexey Nezhdanov). Closes: #275179
+
+ -- Christian Hammers <[email protected]>  Thu,  7 Oct 2004 23:02:04 +0200
+
+libiodbc2 (3.52.1-1) unstable; urgency=low
+
+  * New upstream release. 
+
+ -- Christian Hammers <[email protected]>  Sat,  2 Oct 2004 21:48:11 +0200
+
+libiodbc2 (3.51.2-5) unstable; urgency=medium
+
+  * Reworked libtool update to fix FTBFS on ARM. 
+    Sadly buildd said maybe-success and it took me a while to figure out
+    that there was something for me to do :-(
+
+ -- Christian Hammers <[email protected]>  Sat, 21 Aug 2004 15:08:48 +0200
+
+libiodbc2 (3.51.2-4) unstable; urgency=medium
+
+  * Added versioned dependencies to the .shlibs file (thanks to
+    Adrian Bunk). Closes: #265494
+  * Added shlibs.local.
+
+ -- Christian Hammers <[email protected]>  Fri, 13 Aug 2004 22:38:39 +0200
+
+libiodbc2 (3.51.2-3) unstable; urgency=low
+
+  * Converted debian/rules to cdbs.
+
+ -- Christian Hammers <[email protected]>  Mon,  2 Aug 2004 19:43:22 +0200
+
+libiodbc2 (3.51.2-2) unstable; urgency=low
+
+  * Reverted the "-ld" patch from last upload. The problem that my iodbc
+    libraries all had a TEXTREL symbol in them was simply caused do a "bug"
+    in the libc6 package that made libdl.so a symlink pointing from 
+    /usr/lib/ to ../../lib/ which does not work if /usr is on another 
+    partition than /lib!
+
+ -- Christian Hammers <[email protected]>  Thu,  4 Mar 2004 01:33:55 +0100
+
+libiodbc2 (3.51.2-1) unstable; urgency=medium
+
+  * New upstream version. 
+  * Changed Makefile so that there is no longer a TEXTREL secion in
+    libiodbc.so.2.1.9 and "prelink" is happy. The shared library is now
+    hopefully fully PIC compatible. Closes: #228859
+  * Upstream fixed this bug according to private email. Closes: #169174
+  * Changed section of libiodbc2-dev to libdevel.
+  * Updated download link in copyright file.
+
+ -- Christian Hammers <[email protected]>  Sun, 29 Feb 2004 22:39:59 +0100
+
+libiodbc2 (3.51.1-3) unstable; urgency=low
+
+  * Moved libdrvproxy from libiodbc2 to iodbc as it seems to be
+    necessary only for the GUI (thanks to Raphael Surcouf Bordet). 
+    Closes: #221087
+
+ -- Christian Hammers <[email protected]>  Sun, 16 Nov 2003 16:06:02 +0100
+
+libiodbc2 (3.51.1-2) unstable; urgency=low
+
+  * Added libdrvproxy.so library (thanks to Adrian Kubala). 
+    Closes: #220834 
+
+ -- Christian Hammers <[email protected]>  Sat, 15 Nov 2003 13:47:32 +0100
+
+libiodbc2 (3.51.1-1) unstable; urgency=low
+
+  * New upstream version. 
+    - Unicode support
+    - bugfixes
+  * Fixed small description typo (thanks to Thanasis Kinias). 
+    Closes: #197627
+
+ -- Christian Hammers <[email protected]>  Tue, 28 Oct 2003 01:15:32 +0100
+
+libiodbc2 (3.0.6-4) unstable; urgency=low
+
+  * Updated GNU autoconf files for Debian/FreeBSD (Thanks to Robert Millan).
+    Closes: #195923 
+
+ -- Christian Hammers <[email protected]>  Tue,  3 Jun 2003 14:28:22 +0200
+
+libiodbc2 (3.0.6-3.1) unstable; urgency=low
+
+  * NMU
+  * iodbc-config.1 needs to be out of libiodbc2.undocumented, and
+    libiodbc2-dev needs to Replace: libiodbc2 (<3.0.6-3).  Closes: #148226
+
+ -- LaMont Jones <[email protected]>  Thu, 30 May 2002 22:18:56 -0600
+
+libiodbc2 (3.0.6-3) unstable; urgency=low
+
+  * Moved iodbc-config from lib to -dev package. Closes: #146905 
+
+ -- Christian Hammers <[email protected]>  Mon, 20 May 2002 14:28:49 +0200
+
+libiodbc2 (3.0.6-2) unstable; urgency=medium
+
+  * Fixed build problems due to broken libtool support. Closes: #145325
+
+ -- Christian Hammers <[email protected]>  Tue,  7 May 2002 10:57:27 +0200
+
+libiodbc2 (3.0.6-1) unstable; urgency=low
+
+  * New upstream version. (minor bugfixes only) 
+  * The debian directory is now integrated into the upstream source.
+  * Added iodbc-test binary.
+
+ -- Christian Hammers <[email protected]>  Tue, 30 Apr 2002 00:28:59 +0200
+
+libiodbc2 (3.0.5b-2) unstable; urgency=medium
+
+  * Added dependency to libiodbc2. Closes: #144495 
+
+ -- Christian Hammers <[email protected]>  Thu, 25 Apr 2002 18:02:34 +0200
+
+libiodbc2 (3.0.5b-1) unstable; urgency=low
+
+  * New snapshot source from upstream author that fixes build problems. 
+  * Put the new GTK configuration binary to a seperate package called
+    'iodbc'. Closes: #140859
+
+ -- Christian Hammers <[email protected]>  Sun, 14 Apr 2002 18:07:28 +0200
+
+libiodbc2 (3.0.5-3) unstable; urgency=low
+
+  * Corrected typo in package description. 
+  * Added libgtk1.2-dev to build-depends. Closes: #140723
+
+ -- Christian Hammers <[email protected]>  Fri, 29 Mar 2002 17:12:55 +0100
+
+libiodbc2 (3.0.5-2) unstable; urgency=low
+
+  * Corrected typo in package description. 
+  * Added libgtk1.2-dev to build-depends. Closes: #140723
+
+ -- Christian Hammers <[email protected]>  Fri, 29 Mar 2002 17:12:55 +0100
+
+libiodbc2 (3.0.5-1) unstable; urgency=low
+
+  * New upstream version. Closes: #113987
+    - now supports ODBC3 
+    - added iodbc-config and iodbcadm-gtk binaries
+  * This library is supposed to be backwards compatible to the 2.x 
+    versions.
+  * iodbcadm-gtk doesn't build correctly
+
+ -- Christian Hammers <[email protected]>  Tue, 26 Mar 2002 03:39:12 +0100
+
+libiodbc2 (2.50.3-4) unstable; urgency=low
+
+  * Updated config.guess and config.sub to make compilation on
+    PARISC architecuture possible. Closes: #94763 
+
+ -- Christian Hammers <[email protected]>  Sun, 20 May 2001 17:05:05 +0200
+
+libiodbc2 (2.50.3-3) unstable; urgency=low
+
+  * Added s390 recognition in config.sub. Closes: #88556 
+    Thanks to [email protected] for the patch.
+
+ -- Christian Hammers <[email protected]>  Sat, 10 Mar 2001 17:14:00 +0100
+
+libiodbc2 (2.50.3-2) unstable; urgency=low
+
+  * Added Build-Depends.
+  * No code change.
+
+ -- Christian Hammers <[email protected]>  Sun, 18 Feb 2001 05:14:04 +0100
+
+libiodbc2 (2.50.3-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Christian Hammers <[email protected]>  Sat,  2 Oct 1999 15:44:05 +0200

+ 1 - 0
odbc.mod/iodbc/debian/compat

@@ -0,0 +1 @@
+8

+ 64 - 0
odbc.mod/iodbc/debian/control

@@ -0,0 +1,64 @@
+Source: libiodbc2
+Section: libs
+Priority: optional
+Maintainer: Debian QA Group <[email protected]>
+Build-Depends: debhelper (>= 8), autotools-dev, libtool (>= 1.5-2), automake1.11, autoconf, cdbs, m4 (>= 1.4.7), libgtk2.0-dev
+Standards-Version: 3.8.0
+Homepage: http://www.iodbc.org/
+
+Package: iodbc
+Section: misc
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends} 
+Description: GTK+ config frontend for the iODBC Driver Manager
+ The iODBC (intrinsic Open Database Connectivity) driver manager is compatible
+ with the ODBC 2.x and 3.x specification and performs all the jobs of a
+ ODBC driver manager (i.e. driver loading, parameters and function sequence
+ checking, driver's function invoking, etc). Any ODBC driver working with
+ ODBC 2.0 and 3.x driver manager will also work with iODBC driver manager
+ and vice versa.
+ .
+ Applications (using ODBC function calls) linked with iODBC driver manager
+ will be able to simultaneously access different types of data sources within
+ one process through suitable iODBC drivers.
+ .
+ This package contains the configuration binaries.
+
+Package: libiodbc2
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends} 
+Suggests: iodbc (= ${binary:Version})
+Description: iODBC Driver Manager
+ The iODBC (intrinsic Open Database Connectivity) driver manager is compatible
+ with the ODBC 2.x and 3.x specification and performs all the jobs of a
+ ODBC driver manager (i.e. driver loading, parameters and function sequence
+ checking, driver's function invoking, etc). Any ODBC driver working with
+ ODBC 2.0 and 3.x driver manager will also work with iODBC driver manager
+ and vice versa.
+ .
+ Applications (using ODBC function calls) linked with iODBC driver manager
+ will be able to simultaneously access different types of data sources within
+ one process through suitable iODBC drivers.
+ .
+ This package contains the library files. Look for the iodbc package, too!
+
+Package: libiodbc2-dev
+Section: libdevel
+Architecture: any
+Depends: libiodbc2 (= ${binary:Version}), 
+ ${misc:Depends} 
+Conflicts: libiodbc2 (<= 3.52.6-1), iodbc (<= 3.52.6-1)
+Description: iODBC Driver Manager (development files)
+ The iODBC (intrinsic Open Database Connectivity) driver manager is compatible
+ with the ODBC 2.x and 3.x specification and performs all the jobs of a
+ ODBC driver manager (i.e. driver loading, parameters and function sequence
+ checking, driver's function invoking, etc). Any ODBC driver working with
+ ODBC 2.0 and 3.x driver manager will also work with iODBC driver manager
+ and vice versa.
+ .
+ Applications (using ODBC function calls) linked with iODBC driver manager
+ will be able to simultaneously access different types of data sources within
+ one process through suitable iODBC drivers.
+ .
+ This package contains the development files.

+ 82 - 0
odbc.mod/iodbc/debian/copyright

@@ -0,0 +1,82 @@
+This package was debianized by Christian Hammers <[email protected]> on
+Sat,  2 Oct 1999 15:44:05 +0200.
+
+It was downloaded from http://www.iodbc.org/
+
+Current Upstream Author: OpenLink Software Inc. <[email protected]>
+
+You can find a copy of the common licenses in /usr/share/common-licenses/
+
+Copyright:
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1995 Ke Jin <[email protected]>
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+

+ 1 - 0
odbc.mod/iodbc/debian/iodbc.files

@@ -0,0 +1 @@
+usr/bin/iodbcadm-gtk

+ 7 - 0
odbc.mod/iodbc/debian/iodbc.install

@@ -0,0 +1,7 @@
+debian/tmp/usr/bin/iodbcadm-gtk
+debian/tmp/usr/bin/iodbctest
+debian/tmp/usr/lib/libdrvproxy.so.*
+debian/tmp/usr/lib/libiodbcadm.so.*
+debian/tmp/usr/share/man/man1/iodbcadm-gtk.1
+debian/tmp/usr/share/man/man1/iodbctest.1
+debian/tmp/usr/share/lintian/overrides/iodbc

+ 4 - 0
odbc.mod/iodbc/debian/iodbc.lintian-overrides

@@ -0,0 +1,4 @@
+iodbc: non-dev-pkg-with-shlib-symlink usr/lib/libiodbcadm.so.2.1.18 usr/lib/libiodbcadm.so
+iodbc: non-dev-pkg-with-shlib-symlink usr/lib/libdrvproxy.so.2.1.18 usr/lib/libdrvproxy.so
+iodbc: package-name-doesnt-match-sonames libiodbcadm2 libdrvproxy2
+iodbc: package-name-doesnt-match-sonames libdrvproxy2 libiodbcadm2

+ 1 - 0
odbc.mod/iodbc/debian/iodbc.undocumented

@@ -0,0 +1 @@
+iodbcadm-gtk.1

+ 1 - 0
odbc.mod/iodbc/debian/libiodbc2-dev.examples

@@ -0,0 +1 @@
+samples/iodbctest.c

+ 7 - 0
odbc.mod/iodbc/debian/libiodbc2-dev.files

@@ -0,0 +1,7 @@
+usr/include/*.h
+usr/lib/libiodbc.so
+usr/lib/libiodbc.a
+usr/lib/libiodbcinst.so
+usr/lib/libiodbcinst.a
+usr/lib/libiodbcadm-gtk.a
+usr/lib/libdrvproxy-gtk.a

+ 11 - 0
odbc.mod/iodbc/debian/libiodbc2-dev.install

@@ -0,0 +1,11 @@
+debian/tmp/usr/bin/iodbc-config
+debian/tmp/usr/include/*.h
+debian/tmp/usr/lib/libiodbc.a
+debian/tmp/usr/lib/libiodbcadm.a
+debian/tmp/usr/lib/libiodbcinst.a
+debian/tmp/usr/lib/libdrvproxy.a
+debian/tmp/usr/share/man/man1/iodbc-config.1
+debian/tmp/usr/lib/libiodbc.so
+debian/tmp/usr/lib/libiodbcinst.so
+debian/tmp/usr/lib/libdrvproxy.so
+debian/tmp/usr/lib/libiodbcadm.so

+ 5 - 0
odbc.mod/iodbc/debian/libiodbc2.docs

@@ -0,0 +1,5 @@
+debian/README.Debian
+AUTHORS
+IAFA-PACKAGE
+NEWS
+README

+ 2 - 0
odbc.mod/iodbc/debian/libiodbc2.examples

@@ -0,0 +1,2 @@
+etc/odbc.ini.sample
+etc/odbcinst.ini.sample

+ 3 - 0
odbc.mod/iodbc/debian/libiodbc2.files

@@ -0,0 +1,3 @@
+usr/bin/iodbc-config
+usr/lib/libiodbc.so.2*
+usr/lib/libiodbcinst.so.2*

+ 3 - 0
odbc.mod/iodbc/debian/libiodbc2.install

@@ -0,0 +1,3 @@
+debian/tmp/usr/lib/libiodbc.so.*
+debian/tmp/usr/lib/libiodbcinst.so.*
+debian/tmp/usr/share/lintian/overrides/libiodbc2

+ 2 - 0
odbc.mod/iodbc/debian/libiodbc2.lintian-overrides

@@ -0,0 +1,2 @@
+libiodbc2: non-dev-pkg-with-shlib-symlink usr/lib/libiodbcinst.so.2.1.18 usr/lib/libiodbcinst.so
+libiodbc2: non-dev-pkg-with-shlib-symlink usr/lib/libiodbc.so.2.1.18 usr/lib/libiodbc.so

+ 1 - 0
odbc.mod/iodbc/debian/libiodbc2.undocumented

@@ -0,0 +1 @@
+iodbc-config.1

+ 57 - 0
odbc.mod/iodbc/debian/rules

@@ -0,0 +1,57 @@
+#!/usr/bin/make -f
+
+DEB_AUTO_UPDATE_LIBTOOL=pre
+DEB_AUTO_UPDATE_ACLOCAL=1.11
+DEB_AUTO_UPDATE_AUTOMAKE=1.11
+DEB_AUTO_UPDATE_AUTOCONF=2.50
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+include /usr/share/dpkg/architecture.mk
+
+# To make sure that every package that links against libiodbc defines
+# a versioned dependency and not just a normal one.
+DEB_CONFIGURE_EXTRA_FLAGS := --with-layout=debian 
+DEB_DH_MAKESHLIBS_ARGS := -V
+DEB_SHLIBDEPS_LIBRARY_iodbc := libiodbc2
+DEB_SHLIBDEPS_INCLUDE_iodbc := debian/libiodbc2/usr/lib:debian/iodbc/usr/lib
+DEB_SHLIBDEPS_INCLUDE_libiodbc2 := debian/libiodbc2/usr/lib
+
+CRUFT := \
+	aclocal.m4 \
+	admin/ltmain.sh \
+	admin/Makefile.in \
+	bin/Makefile.in \
+	configure \
+	drvproxy/gtk/Makefile.in \
+	drvproxy/Makefile.in \
+	etc/Makefile.in \
+	include/Makefile.in \
+	iodbc/Makefile.in \
+	iodbc/trace/Makefile.in \
+	iodbcadm/gtk/Makefile.in \
+	iodbcadm/Makefile.in \
+	iodbcinst/Makefile.in \
+	Makefile.in \
+	man/Makefile.in \
+	samples/Makefile.in \
+
+update-config::
+	for f in $(CRUFT) ; do [ -e $$f.d-r-orig ] || cp -p $$f $$f.d-r-orig ; done
+
+reverse-config::
+	for f in $(CRUFT) ; do [ ! -e $$f.d-r-orig ] || mv $$f.d-r-orig $$f ; done
+
+install/iodbc ::
+	mkdir -p debian/tmp/usr/share/lintian/overrides/
+	cp debian/iodbc.lintian-overrides debian/tmp/usr/share/lintian/overrides/iodbc
+
+install/libiodbc2 ::
+	mkdir -p debian/tmp/usr/share/lintian/overrides/
+	cp debian/libiodbc2.lintian-overrides debian/tmp/usr/share/lintian/overrides/libiodbc2
+
+#clean::
+#	for f in $(CRUFT) ; do cp -p ../orig/*/$$f $$f ; done
+
+clean::
+	rm -f admin/libtool.m4 admin/ltoptions.m4 admin/ltversion.m4 admin/lt~obsolete.m4

+ 3 - 0
odbc.mod/iodbc/debian/watch

@@ -0,0 +1,3 @@
+version=3
+#http://www.iodbc.org/downloads/iODBC/libiodbc-(\d.*)\.tar\.gz
+http://sf.net/iodbc/libiodbc-(\d.*)\.tar\.gz

+ 307 - 0
odbc.mod/iodbc/drvproxy/ConfigDSN.c

@@ -0,0 +1,307 @@
+/*
+ *  ConfigDSN.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+/* ----------- Finished and tested with shadowing ----------- */
+
+#include <iodbc.h>
+#include <odbcinst.h>
+#include <iodbc_error.h>
+#include <iodbcadm.h>
+
+#include "gui.h"
+
+BOOL INSTAPI
+ConfigDSN (
+    HWND	  hwndParent,
+    WORD	  fRequest,
+    LPCSTR	  lpszDriver,
+    LPCSTR	  lpszAttributes)
+{
+  char *dsn = NULL, *connstr = NULL, *curr, *cour = NULL;
+  char dsnread[4096] = { 0 };
+  char prov[4096] = { 0 };
+  int driver_type = -1, flags = 0;
+  BOOL retcode = FALSE;
+  UWORD confMode = ODBC_USER_DSN;
+
+  /* Map the request User/System */
+  if (fRequest < ODBC_ADD_DSN || fRequest > ODBC_REMOVE_DSN)
+    {
+      SQLPostInstallerError (ODBC_ERROR_INVALID_REQUEST_TYPE, NULL);
+      goto done;
+    }
+
+  if (!lpszDriver || !STRLEN (lpszDriver))
+    {
+      SQLPostInstallerError (ODBC_ERROR_INVALID_NAME, NULL);
+      goto done;
+    }
+
+  /* Retrieve the config mode */
+  SQLGetConfigMode (&confMode);
+
+  /* Retrieve the DSN if one exist */
+  for (curr = (LPSTR) lpszAttributes; curr && *curr;
+      curr += (STRLEN (curr) + 1))
+    {
+      if (!strncmp (curr, "DSN=", STRLEN ("DSN=")))
+	{
+	  dsn = curr + STRLEN ("DSN=");
+	  break;
+	}
+    }
+
+  /* Retrieve the corresponding driver */
+#if !defined (__APPLE__)
+  if (strstr (lpszDriver, "OpenLink") || strstr (lpszDriver, "Openlink")
+      || strstr (lpszDriver, "oplodbc"))
+    {
+      driver_type = 0;
+
+      for (curr = (LPSTR) lpszAttributes, cour = prov; curr && *curr;
+	  curr += (STRLEN (curr) + 1), cour += (STRLEN (cour) + 1))
+	{
+	  if (!strncasecmp (curr, "Host=", STRLEN ("Host="))
+	      && STRLEN (curr + STRLEN ("Host=")))
+	    {
+	      STRCPY (cour, curr);
+	      flags |= 0x1;
+	      continue;
+	    }
+	  if (!strncasecmp (curr, "ServerType=", STRLEN ("ServerType="))
+	      && STRLEN (curr + STRLEN ("ServerType=")))
+	    {
+	      STRCPY (cour, curr);
+	      flags |= 0x2;
+	      continue;
+	    }
+	  STRCPY (cour, curr);
+	}
+
+      if (cour && !(flags & 1))
+	{
+	  STRCPY (cour, "Host=localhost\0");
+	  cour += (STRLEN (cour) + 1);
+	}
+
+      if (cour && !(flags & 2))
+	{
+	  STRCPY (cour, "ServerType=Proxy\0");
+	  cour += (STRLEN (cour) + 1);
+	}
+
+      if (cour)
+	*cour = 0;
+    }
+  else if ((strstr (lpszDriver, "Virtuoso")
+	  || strstr (lpszDriver, "virtodbc")))
+    driver_type = 1;
+#endif
+
+  /* For each request */
+  switch (fRequest)
+    {
+    case ODBC_ADD_DSN:
+      /* Check if the DSN with this name already exists */
+
+      SQLSetConfigMode (confMode);
+#ifdef WIN32
+      if (hwndParent && dsn
+	  && SQLGetPrivateProfileString ("ODBC 32 bit Data Sources", dsn, "",
+	      dsnread, sizeof (dsnread), NULL)
+	  && !create_confirm (hwndParent, dsn,
+	      "Are you sure you want to overwrite this DSN ?"))
+#else
+      if (hwndParent && dsn
+	  && SQLGetPrivateProfileString ("ODBC Data Sources", dsn, "",
+	      dsnread, sizeof (dsnread), NULL)
+	  && !create_confirm (hwndParent, dsn,
+	      "Are you sure you want to overwrite this DSN ?"))
+#endif
+	goto done;
+
+      /* Call the right setup function */
+      connstr =
+	  create_gensetup (hwndParent, dsn,
+	  STRLEN (prov) ? prov : lpszAttributes, TRUE);
+
+      /* Check output parameters */
+      if (!connstr)
+	{
+	  SQLPostInstallerError (ODBC_ERROR_OUT_OF_MEM, NULL);
+	  goto done;
+	}
+
+      if (connstr == (LPSTR) - 1L)
+	goto done;
+
+      /* Add the DSN to the ODBC Data Sources */
+      SQLSetConfigMode (confMode);
+      if (!SQLWriteDSNToIni (dsn = connstr + STRLEN ("DSN="), lpszDriver))
+	goto done;
+
+      /* Add each keyword and values */
+      for (curr = connstr; *curr; curr += (STRLEN (curr) + 1))
+	{
+	  if (strncmp (curr, "DSN=", STRLEN ("DSN=")))
+	    {
+	      STRCPY (dsnread, curr);
+	      cour = strchr (dsnread, '=');
+	      if (cour)
+		*cour = 0;
+	      SQLSetConfigMode (confMode);
+	      if (!SQLWritePrivateProfileString (dsn, dsnread, (cour
+			  && STRLEN (cour + 1)) ? cour + 1 : NULL, NULL))
+		goto done;
+	    }
+	}
+
+      break;
+
+    case ODBC_CONFIG_DSN:
+
+      if (!dsn || !STRLEN (dsn))
+	{
+	  SQLPostInstallerError (ODBC_ERROR_INVALID_KEYWORD_VALUE, NULL);
+	  goto done;
+	}
+
+      /* Call the right setup function */
+      connstr = create_gensetup (hwndParent, dsn,
+	  STRLEN (prov) ? prov : lpszAttributes, FALSE);
+
+      /* Check output parameters */
+      if (!connstr)
+	{
+	  SQLPostInstallerError (ODBC_ERROR_OUT_OF_MEM, NULL);
+	  goto done;
+	}
+
+      if (connstr == (LPSTR) - 1L)
+	goto done;
+
+
+      /* Remove the previous DSN */
+      SQLSetConfigMode (confMode);
+      if (!SQLRemoveDSNFromIni (dsn))
+        goto done;
+
+      /* Add the new DSN section */
+      SQLSetConfigMode (confMode);
+      if (!SQLWriteDSNToIni (dsn = connstr + STRLEN ("DSN="), lpszDriver))
+        goto done;
+
+      /* Add each keyword and values */
+      for (curr = connstr; *curr; curr += (STRLEN (curr) + 1))
+	{
+	  if (strncmp (curr, "DSN=", STRLEN ("DSN=")))
+	    {
+	      STRCPY (dsnread, curr);
+	      cour = strchr (dsnread, '=');
+	      if (cour)
+		*cour = 0;
+	      SQLSetConfigMode (confMode);
+	      if (!SQLWritePrivateProfileString (dsn, dsnread, (cour
+			  && STRLEN (cour + 1)) ? cour + 1 : NULL, NULL))
+		goto done;
+	    }
+	}
+
+      break;
+
+    case ODBC_REMOVE_DSN:
+      if (!dsn || !STRLEN (dsn))
+	{
+	  SQLPostInstallerError (ODBC_ERROR_INVALID_KEYWORD_VALUE, NULL);
+	  goto done;
+	}
+
+      /* Just remove the DSN */
+      SQLSetConfigMode (confMode);
+      if (!SQLRemoveDSNFromIni (dsn))
+	goto done;
+      break;
+    };
+
+quit:
+  retcode = TRUE;
+
+done:
+  if (connstr && connstr != (LPSTR) - 1L && connstr != lpszAttributes
+      && connstr != prov)
+    free (connstr);
+
+  return retcode;
+}

+ 205 - 0
odbc.mod/iodbc/drvproxy/ConfigDriver.c

@@ -0,0 +1,205 @@
+/*
+ *  ConfigDriver.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <iodbc.h>
+#include <odbcinst.h>
+#include <iodbc_error.h>
+#include <iodbcadm.h>
+
+#include "gui.h"
+
+BOOL INSTAPI
+ConfigDriver (
+    HWND	  hwndParent,
+    WORD	  fRequest,
+    LPCSTR	  lpszDriver,
+    LPCSTR	  lpszArgs,
+    LPSTR	  lpszMsg,
+    WORD	  cbMsgMax,
+    WORD	* pcbMsgOut)
+{
+  char *curr, *cour;
+  char driverread[4096] = { 0 };
+  BOOL retcode = FALSE;
+  UWORD confMode = ODBC_USER_DSN;
+
+  /* Map the request User/System */
+  if (fRequest < ODBC_INSTALL_DRIVER || fRequest > ODBC_CONFIG_DRIVER_MAX)
+    {
+      SQLPostInstallerError (ODBC_ERROR_INVALID_REQUEST_TYPE, NULL);
+      goto done;
+    }
+
+  if (!lpszDriver || !STRLEN (lpszDriver))
+    {
+      SQLPostInstallerError (ODBC_ERROR_INVALID_NAME, NULL);
+      goto done;
+    }
+
+  /* Retrieve the config mode */
+  SQLGetConfigMode (&confMode);
+
+  /* Treat corresponding to the request */
+  switch (fRequest)
+    {
+    case ODBC_INSTALL_DRIVER:
+      /* Check if the DRIVER with this name already exists */
+      SQLSetConfigMode (confMode);
+#ifdef WIN32
+      if (hwndParent
+	  && SQLGetPrivateProfileString ("ODBC 32 bit Drivers", lpszDriver,
+	      "", driverread, sizeof (driverread), "odbcinst.ini")
+	  && !create_confirm (hwndParent, NULL,
+	      "Are you sure you want to overwrite this driver ?"))
+#else
+#  ifdef _MACX
+      if (hwndParent
+	  && SQLGetPrivateProfileString ("ODBC Drivers", lpszDriver, "",
+	      driverread, sizeof (driverread), "odbcinst.ini")
+	  && !create_confirm (hwndParent, NULL,
+	      "Are you sure you want to overwrite this driver ?"))
+#  else
+      if (hwndParent
+	  && SQLGetPrivateProfileString ("ODBC Drivers", lpszDriver, "",
+	      driverread, sizeof (driverread), "odbcinst.ini")
+	  && !create_confirm (hwndParent, NULL,
+	      "Are you sure you want to overwrite this driver ?"))
+#  endif
+#endif
+	{
+	  SQLPostInstallerError (ODBC_ERROR_DRIVER_SPECIFIC,
+	      "Driver already installed previously.");
+	  goto done;
+	}
+
+      /* Add the Driver to the ODBC Drivers */
+      SQLSetConfigMode (confMode);
+      if (!SQLInstallDriverEx (lpszArgs, NULL, driverread,
+	      sizeof (driverread), NULL, ODBC_INSTALL_COMPLETE, NULL))
+	{
+	  SQLPostInstallerError (ODBC_ERROR_DRIVER_SPECIFIC,
+	      "Could not add the driver information.");
+	  goto done;
+	}
+
+      break;
+
+    case ODBC_CONFIG_DRIVER:
+      if (!lpszArgs || !STRLEN (lpszArgs))
+	{
+	  SQLPostInstallerError (ODBC_ERROR_DRIVER_SPECIFIC,
+	      "No enough parameters for configururation.");
+	  goto done;
+	}
+
+      /* Add each keyword and values */
+      for (curr = (LPSTR) lpszArgs; *curr; curr += (STRLEN (curr) + 1))
+	{
+	  STRCPY (driverread, curr);
+	  cour = strchr (driverread, '=');
+	  if (cour)
+	    *cour = 0;
+	  SQLSetConfigMode (confMode);
+	  if (!SQLWritePrivateProfileString (lpszDriver, driverread, (cour
+		      && STRLEN (cour + 1)) ? cour + 1 : NULL,
+		  "odbcinst.ini"))
+	    goto done;
+	}
+      break;
+
+    case ODBC_REMOVE_DRIVER:
+      /* Remove the Driver to the ODBC Drivers */
+      SQLSetConfigMode (confMode);
+      if (!SQLRemoveDriver (lpszDriver, TRUE, NULL))
+	{
+	  SQLPostInstallerError (ODBC_ERROR_DRIVER_SPECIFIC,
+	      "Could not remove driver information.");
+	  goto done;
+	}
+      break;
+
+    default:
+      SQLPostInstallerError (ODBC_ERROR_REQUEST_FAILED, NULL);
+      goto done;
+    };
+
+quit:
+  retcode = TRUE;
+
+done:
+  if (pcbMsgOut)
+    *pcbMsgOut = 0;
+  return retcode;
+}

+ 77 - 0
odbc.mod/iodbc/drvproxy/Info.c

@@ -0,0 +1,77 @@
+/*
+ *  info.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iodbc.h>
+
+char *iodbcproxy_version = VERSION;

+ 131 - 0
odbc.mod/iodbc/drvproxy/Makefile.am

@@ -0,0 +1,131 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+if GUI
+SUBDIRS			= gtk
+
+lib_LTLIBRARIES		= libdrvproxy.la
+endif
+
+if GTK
+AM_CPPFLAGS		= \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/iodbc \
+	-I$(top_srcdir)/iodbcinst \
+	-I$(top_srcdir)/iodbcadm \
+	@GTK_CFLAGS@ -D__GTK__
+else
+AM_CPPFLAGS		= \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/iodbc \
+	-I$(top_srcdir)/iodbcinst\
+	-I$(top_srcdir)/iodbcadm 
+endif
+
+libdrvproxy_la_LDFLAGS	= -version-info @lib_version@ \
+			  -export-symbols $(srcdir)/drvproxy.exp
+
+if GTK
+libdrvproxy_la_LIBADD	= \
+	$(LIBADD_DL) \
+	../iodbcadm/libiodbcadm.la \
+	../drvproxy/gtk/libdrvproxy-gtk.la \
+	../iodbcinst/libiodbc_common.la \
+	../iodbcinst/libiodbcinst.la \
+	@GTK_LIBS@
+else
+libdrvproxy_la_LIBADD	= \
+	$(LIBADD_DL) \
+	../iodbcadm/libiodbcadm.la \
+	../iodbcinst/libiodbc_common.la \
+	../iodbcinst/libiodbcinst.la
+endif
+
+libdrvproxy_la_SOURCES	= \
+	ConfigDSN.c \
+	ConfigDriver.c \
+	Info.c \
+	drvconn.c
+
+noinst_HEADERS		= gui.h
+
+EXTRA_DIST		= \
+	$(srcdir)/*.c \
+	$(srcdir)/*.h \
+	$(srcdir)/drvproxy.exp \
+	$(srcdir)/gtk/*.c \
+	$(srcdir)/gtk/*.h \
+	$(srcdir)/mac/*.c \
+	$(srcdir)/mac/*.h \
+	$(srcdir)/mac/*.m \
+	$(srcdir)/mac/*.png \
+	$(srcdir)/mac/Base.lproj/*.xib

+ 177 - 0
odbc.mod/iodbc/drvproxy/drvconn.c

@@ -0,0 +1,177 @@
+/*
+ *  drvconn.c
+ *
+ *  $Id$
+ *
+ *  The data_sources dialog for SQLDriverConnect and a login box procedures
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "gui.h"
+
+#include <iodbc.h>
+#include "herr.h"
+#include "dlproc.h"
+
+
+SQLRETURN SQL_API
+_iodbcdm_drvconn_dialbox (
+    HWND	  hwnd,
+    LPSTR	  szInOutConnStr,
+    DWORD	  cbInOutConnStr,
+    int	 	* sqlStat,
+    SQLUSMALLINT  fDriverCompletion,
+    UWORD	* config)
+{
+  RETCODE retcode = SQL_ERROR;
+  char *szDSN = NULL, *szDriver = NULL, *szUID = NULL, *szPWD = NULL, *curr;
+  TLOGIN log_t;
+
+  /* Check input parameters */
+  if (!hwnd || !szInOutConnStr || cbInOutConnStr < 1)
+    goto quit;
+
+  /* Check if the DSN is already set or DRIVER */
+  for (curr = szInOutConnStr; *curr; curr += (STRLEN (curr) + 1))
+    {
+      if (!strncasecmp (curr, "DSN=", STRLEN ("DSN=")))
+	{
+	  szDSN = curr + STRLEN ("DSN=");
+	  continue;
+	}
+      if (!strncasecmp (curr, "DRIVER=", STRLEN ("DRIVER=")))
+	{
+	  szDriver = curr + STRLEN ("DRIVER=");
+	  continue;
+	}
+      if (!strncasecmp (curr, "UID=", STRLEN ("UID=")))
+	{
+	  szUID = curr + STRLEN ("UID=");
+	  continue;
+	}
+      if (!strncasecmp (curr, "UserName=", STRLEN ("UserName=")))
+	{
+	  szUID = curr + STRLEN ("UserName=");
+	  continue;
+	}
+      if (!strncasecmp (curr, "LastUser=", STRLEN ("LastUser=")))
+	{
+	  szUID = curr + STRLEN ("LastUser=");
+	  continue;
+	}
+      if (!strncasecmp (curr, "PWD=", STRLEN ("PWD=")))
+	{
+	  szPWD = curr + STRLEN ("PWD=");
+	  continue;
+	}
+      if (!strncasecmp (curr, "Password=", STRLEN ("Password=")))
+	{
+	  szPWD = curr + STRLEN ("Password=");
+	  continue;
+	}
+    }
+
+  if (fDriverCompletion != SQL_DRIVER_NOPROMPT && (!szUID || !szPWD))
+    {
+      create_login (hwnd, szUID, szPWD, szDSN ? szDSN : "(File DSN)", &log_t);
+
+      if (log_t.user && !szUID)
+	{
+	  sprintf (curr, "UID=%s", log_t.user);
+	  curr += STRLEN (curr);
+	  *curr++ = '\0';
+	  free (log_t.user);
+	}
+
+      if (log_t.pwd && !szPWD)
+	{
+	  sprintf (curr, "PWD=%s", log_t.pwd);
+	  curr += STRLEN (curr);
+	  *curr++ = '\0';
+	  free (log_t.pwd);
+	}
+
+      /* add list-terminating '\0' */
+      *curr = '\0';
+    }
+
+  retcode = log_t.ok == TRUE ? SQL_SUCCESS : SQL_NO_DATA_FOUND;
+
+quit:
+  for (curr = szInOutConnStr; *curr; curr = szDSN + 1)
+    {
+      szDSN = curr + STRLEN (curr);
+      if (szDSN[1])
+	szDSN[0] = ';';
+    }
+
+  return retcode;
+}

+ 5 - 0
odbc.mod/iodbc/drvproxy/drvproxy.exp

@@ -0,0 +1,5 @@
+ConfigDriver
+ConfigDSN
+_iodbcdm_drvconn_dialbox
+_iodbcdm_loginbox
+iodbcproxy_version

+ 89 - 0
odbc.mod/iodbc/drvproxy/gtk/Makefile.am

@@ -0,0 +1,89 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+if GTK
+noinst_LTLIBRARIES		= libdrvproxy-gtk.la
+endif
+
+AM_CPPFLAGS			= \
+	-I$(top_srcdir)/include -I$(top_srcdir)/iodbc \
+	@GTK_CFLAGS@ -D__GTK__
+
+libdrvproxy_gtk_la_LDFLAGS	= #-static
+
+libdrvproxy_gtk_la_LIBADD	= @GTK_LIBS@
+
+libdrvproxy_gtk_la_SOURCES	= \
+	gensetup.c \
+	loginbox.c
+
+noinst_HEADERS			= gui.h

+ 680 - 0
odbc.mod/iodbc/drvproxy/gtk/gensetup.c

@@ -0,0 +1,680 @@
+/*
+ *  gensetup.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "gui.h"
+
+
+static char* STRCONN = "DSN=%s\0Description=%s\0\0";
+static int STRCONN_NB_TOKENS = 2;
+
+static char *szKeysColumnNames[] = {
+  "Keyword",
+  "Value"
+};
+
+static char *szKeysButtons[] = {
+  "_Add",
+  "_Update"
+};
+
+
+static void
+addkeywords_to_list(GtkWidget* widget, LPCSTR attrs, TGENSETUP *gensetup_t)
+{
+  char *curr, *cour;
+  char *data[2];
+
+  if (!GTK_IS_CLIST (widget))
+    return;
+  gtk_clist_clear (GTK_CLIST (widget));
+
+  for (curr = (LPSTR) attrs; *curr; curr += (STRLEN (curr) + 1))
+    {
+      if (!strncasecmp (curr, "Description=", STRLEN ("Description=")))
+	gtk_entry_set_text (GTK_ENTRY (gensetup_t->comment_entry),
+	    curr + STRLEN ("Description="));
+
+      if (!strncasecmp (curr, "DSN=", STRLEN ("DSN=")) ||
+	  !strncasecmp (curr, "Driver=", STRLEN ("Driver=")) ||
+	  !strncasecmp (curr, "Description=", STRLEN ("Description=")))
+	continue;
+
+      if ((cour = strchr (curr, '=')))
+	{
+	  *cour = '\0';
+	  data[0] = curr;
+	  data[1] = cour + 1;
+	  gtk_clist_append (GTK_CLIST (widget), data);
+	  *cour = '=';
+	}
+      else
+	{
+	  data[0] = "";
+	  gtk_clist_append (GTK_CLIST (widget), data);
+	}
+    }
+
+  if (GTK_CLIST (widget)->rows > 0)
+    gtk_clist_sort (GTK_CLIST (widget));
+}
+
+
+static void
+parse_attribute_line(TGENSETUP *gensetup_t, LPCSTR dsn, LPCSTR attrs, BOOL add)
+{
+  if (dsn)
+    {
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->dsn_entry), dsn);
+      if (add)
+	gtk_widget_set_sensitive (gensetup_t->dsn_entry, TRUE);
+      else
+	gtk_widget_set_sensitive (gensetup_t->dsn_entry, FALSE);
+    }
+
+  addkeywords_to_list (gensetup_t->key_list, attrs, gensetup_t);
+}
+
+
+static void
+gensetup_add_clicked(GtkWidget* widget, TGENSETUP *gensetup_t)
+{
+  char *szKey;
+  char *data[2];
+  int i = 0;
+
+  if (gensetup_t)
+    {
+      data[0] = (char*)gtk_entry_get_text (GTK_ENTRY (gensetup_t->key_entry));
+      if (STRLEN (data[0]))
+	{
+	  data[1] = (char*)gtk_entry_get_text (GTK_ENTRY (gensetup_t->value_entry));
+
+	  /* Try to see if the keyword already exists */
+	  for (i = 0; i < GTK_CLIST (gensetup_t->key_list)->rows; i++)
+	    {
+	      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list), i, 0,
+		  &szKey);
+	      if (STREQ (data[0], szKey))
+		goto done;
+	    }
+
+	  /* An update operation */
+	  if (i < GTK_CLIST (gensetup_t->key_list)->rows)
+	    {
+	      gtk_clist_set_text (GTK_CLIST (gensetup_t->key_list), i, 1,
+		  data[1]);
+	    }
+	  else if (STRLEN (data[1]))
+	    {
+	      gtk_clist_append (GTK_CLIST (gensetup_t->key_list), data);
+	    }
+	}
+
+      gtk_clist_sort (GTK_CLIST (gensetup_t->key_list));
+
+    done:
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->key_entry), "");
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->value_entry), "");
+    }
+}
+
+
+static void
+gensetup_update_clicked(GtkWidget* widget, TGENSETUP *gensetup_t)
+{
+  char *data[2];
+  int i;
+
+  if (gensetup_t)
+    {
+      data[0] = (char*)gtk_entry_get_text (GTK_ENTRY (gensetup_t->key_entry));
+      if (STRLEN (data[0]))
+	{
+	  data[1] = (char*)gtk_entry_get_text (GTK_ENTRY (gensetup_t->value_entry));
+
+	  if (GTK_CLIST (gensetup_t->key_list)->selection != NULL)
+	    i = GPOINTER_TO_INT (GTK_CLIST (gensetup_t->key_list)->selection->
+		data);
+	  else
+	    i = 0;
+
+	  /* An update operation */
+	  if (i < GTK_CLIST (gensetup_t->key_list)->rows)
+	    {
+	      gtk_clist_set_text (GTK_CLIST (gensetup_t->key_list), i, 0,
+		  data[0]);
+	      gtk_clist_set_text (GTK_CLIST (gensetup_t->key_list), i, 1,
+		  data[1]);
+	    }
+	}
+
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->key_entry), "");
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->value_entry), "");
+    }
+}
+
+
+static void
+gensetup_list_select(GtkWidget* widget, gint row, gint column, GdkEvent *event, TGENSETUP *gensetup_t)
+{
+  char *szKey, *szValue;
+
+  if (gensetup_t && GTK_CLIST (gensetup_t->key_list)->selection != NULL)
+    {
+      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list),
+	  GPOINTER_TO_INT (GTK_CLIST (gensetup_t->key_list)->selection->data),
+	  0, &szKey);
+      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list),
+	  GPOINTER_TO_INT (GTK_CLIST (gensetup_t->key_list)->selection->data),
+	  1, &szValue);
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->key_entry), szKey);
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->value_entry), szValue);
+      gtk_widget_set_sensitive (gensetup_t->bupdate, TRUE);
+    }
+}
+
+
+static void
+gensetup_list_unselect(GtkWidget* widget, gint row, gint column, GdkEvent *event, TGENSETUP *gensetup_t)
+{
+  if (gensetup_t)
+    {
+      gtk_widget_set_sensitive (gensetup_t->bupdate, FALSE);
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->key_entry), "");
+      gtk_entry_set_text (GTK_ENTRY (gensetup_t->value_entry), "");
+    }
+}
+
+
+static void
+gensetup_ok_clicked(GtkWidget* widget, TGENSETUP *gensetup_t)
+{
+  char *curr, *cour, *szKey, *szValue;
+  int i = 0, size = 0;
+
+  if (gensetup_t)
+    {
+      /* What is the size of the block to malloc */
+      size +=
+	  STRLEN (gtk_entry_get_text (GTK_ENTRY (gensetup_t->dsn_entry))) +
+	  STRLEN ("DSN=") + 1;
+      size +=
+	  STRLEN (gtk_entry_get_text (GTK_ENTRY (gensetup_t->
+		  comment_entry))) + STRLEN ("Description=") + 1;
+      /* Malloc it (+1 for list-terminating NUL) */
+      if ((gensetup_t->connstr = (char *) malloc (size + 1)))
+	{
+	  for (curr = STRCONN, cour = gensetup_t->connstr;
+	      i < STRCONN_NB_TOKENS; i++, curr += (STRLEN (curr) + 1))
+	    switch (i)
+	      {
+	      case 0:
+		sprintf (cour, curr,
+		    gtk_entry_get_text (GTK_ENTRY (gensetup_t->dsn_entry)));
+		cour += (STRLEN (cour) + 1);
+		break;
+	      case 1:
+		sprintf (cour, curr,
+		    gtk_entry_get_text (GTK_ENTRY (gensetup_t->
+			    comment_entry)));
+		cour += (STRLEN (cour) + 1);
+		break;
+	      };
+
+	  for (i = 0; i < GTK_CLIST (gensetup_t->key_list)->rows; i++)
+	    {
+	      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list), i, 0,
+		  &szKey);
+	      gtk_clist_get_text (GTK_CLIST (gensetup_t->key_list), i, 1,
+		  &szValue);
+
+	      cour = gensetup_t->connstr;
+	      gensetup_t->connstr =
+		  (char *) malloc (size + STRLEN (szKey) + STRLEN (szValue) +
+		  2);
+	      if (gensetup_t->connstr)
+		{
+		  memcpy (gensetup_t->connstr, cour, size);
+		  sprintf (gensetup_t->connstr + size, "%s=%s", szKey, szValue);
+		  free (cour);
+		  size += STRLEN (szKey) + STRLEN (szValue) + 2;
+		}
+	      else
+		gensetup_t->connstr = cour;
+	    }
+
+	  /* add list-terminating NUL */
+	  gensetup_t->connstr[size] = '\0';
+	}
+
+      gensetup_t->dsn_entry = gensetup_t->comment_entry = NULL;
+      gensetup_t->key_list = NULL;
+
+      gtk_signal_disconnect_by_func (GTK_OBJECT (gensetup_t->mainwnd),
+	  GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+      gtk_main_quit ();
+      gtk_widget_destroy (gensetup_t->mainwnd);
+    }
+}
+
+
+static void
+gensetup_cancel_clicked(GtkWidget* widget, TGENSETUP *gensetup_t)
+{
+  if (gensetup_t)
+    {
+      gensetup_t->connstr = (LPSTR) - 1L;
+
+      gensetup_t->dsn_entry = gensetup_t->comment_entry = NULL;
+      gensetup_t->key_list = NULL;
+
+      gtk_signal_disconnect_by_func (GTK_OBJECT (gensetup_t->mainwnd),
+	  GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+      gtk_main_quit ();
+      gtk_widget_destroy (gensetup_t->mainwnd);
+    }
+}
+
+
+static gint delete_event( GtkWidget *widget,
+	GdkEvent *event, TGENSETUP *gensetup_t)
+{
+  gensetup_cancel_clicked (widget, gensetup_t);
+
+  return FALSE;
+}
+
+
+LPSTR
+create_gensetup (HWND hwnd, LPCSTR dsn, LPCSTR attrs, BOOL add)
+{
+  GtkWidget *dgensetup;
+  GtkWidget *vbox42;
+  GtkWidget *vbox43;
+  GtkWidget *frame100;
+  GtkWidget *alignment84;
+  GtkWidget *label166;
+  GtkWidget *frame103;
+  GtkWidget *alignment87;
+  GtkWidget *table11;
+  GtkWidget *label171;
+  GtkWidget *label172;
+  GtkWidget *t_dsn;
+  GtkWidget *t_comment;
+  GtkWidget *frame101;
+  GtkWidget *alignment85;
+  GtkWidget *scrolledwindow22;
+  GtkWidget *clist1;
+  GtkWidget *label167;
+  GtkWidget *label168;
+  GtkWidget *frame102;
+  GtkWidget *alignment86;
+  GtkWidget *hbox58;
+  GtkWidget *table10;
+  GtkWidget *label169;
+  GtkWidget *t_value;
+  GtkWidget *b_update;
+  GtkWidget *b_add;
+  GtkWidget *t_keyword;
+  GtkWidget *label170;
+  GtkWidget *hbuttonbox4;
+  GtkWidget *b_cancel;
+  GtkWidget *b_ok;
+  TGENSETUP gensetup_t;
+  char buff[1024];
+
+  if (hwnd == NULL || !GTK_IS_WIDGET (hwnd))
+    return (LPSTR) attrs;
+
+  dgensetup = gtk_dialog_new ();
+  gtk_widget_set_name (dgensetup, "dgensetup");
+  gtk_widget_set_size_request (dgensetup, 356, 445);
+  sprintf (buff, "Setup of DSN %s ...", (dsn) ? dsn : "Unknown");
+  gtk_window_set_title (GTK_WINDOW (dgensetup), buff);
+  gtk_window_set_position (GTK_WINDOW (dgensetup), GTK_WIN_POS_CENTER);
+  gtk_window_set_modal (GTK_WINDOW (dgensetup), TRUE);
+  gtk_window_set_default_size (GTK_WINDOW (dgensetup), 600, 450);
+  gtk_window_set_type_hint (GTK_WINDOW (dgensetup), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+#if GTK_CHECK_VERSION(2,0,0)
+  gtk_widget_show (dgensetup);
+#endif
+
+  vbox42 = GTK_DIALOG (dgensetup)->vbox;
+  gtk_widget_set_name (vbox42, "vbox42");
+  gtk_widget_show (vbox42);
+
+  vbox43 = gtk_vbox_new (FALSE, 0);
+  gtk_widget_set_name (vbox43, "vbox43");
+  gtk_widget_show (vbox43);
+  gtk_box_pack_start (GTK_BOX (vbox42), vbox43, TRUE, TRUE, 0);
+
+  frame100 = gtk_frame_new (NULL);
+  gtk_widget_set_name (frame100, "frame100");
+  gtk_widget_show (frame100);
+  gtk_box_pack_start (GTK_BOX (vbox43), frame100, FALSE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame100), GTK_SHADOW_NONE);
+
+  alignment84 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_set_name (alignment84, "alignment84");
+  gtk_widget_show (alignment84);
+  gtk_container_add (GTK_CONTAINER (frame100), alignment84);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment84), 4, 4, 0, 0);
+
+  label166 = gtk_label_new (_("Generic ODBC driver Setup"));
+  gtk_widget_set_name (label166, "label166");
+  gtk_widget_show (label166);
+  gtk_container_add (GTK_CONTAINER (alignment84), label166);
+
+  frame103 = gtk_frame_new (NULL);
+  gtk_widget_set_name (frame103, "frame103");
+  gtk_widget_show (frame103);
+  gtk_box_pack_start (GTK_BOX (vbox43), frame103, FALSE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame103), GTK_SHADOW_NONE);
+
+  alignment87 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_set_name (alignment87, "alignment87");
+  gtk_widget_show (alignment87);
+  gtk_container_add (GTK_CONTAINER (frame103), alignment87);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment87), 6, 0, 0, 0);
+
+  table11 = gtk_table_new (2, 2, FALSE);
+  gtk_widget_set_name (table11, "table11");
+  gtk_widget_show (table11);
+  gtk_container_add (GTK_CONTAINER (alignment87), table11);
+  gtk_table_set_row_spacings (GTK_TABLE (table11), 6);
+  gtk_table_set_col_spacings (GTK_TABLE (table11), 4);
+
+  label171 = gtk_label_new (_("Data Source Name (DSN) :"));
+  gtk_widget_set_name (label171, "label171");
+  gtk_widget_show (label171);
+  gtk_table_attach (GTK_TABLE (table11), label171, 0, 1, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label171), 0, 0.5);
+
+  label172 = gtk_label_new (_("                        Comment :"));
+  gtk_widget_set_name (label172, "label172");
+  gtk_widget_show (label172);
+  gtk_table_attach (GTK_TABLE (table11), label172, 0, 1, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label172), 0, 0.5);
+
+  t_dsn = gtk_entry_new ();
+  gtk_widget_set_name (t_dsn, "t_dsn");
+  gtk_widget_show (t_dsn);
+  gtk_table_attach (GTK_TABLE (table11), t_dsn, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  t_comment = gtk_entry_new ();
+  gtk_widget_set_name (t_comment, "t_comment");
+  gtk_widget_show (t_comment);
+  gtk_table_attach (GTK_TABLE (table11), t_comment, 1, 2, 1, 2,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  frame101 = gtk_frame_new (NULL);
+  gtk_widget_set_name (frame101, "frame101");
+  gtk_widget_show (frame101);
+  gtk_box_pack_start (GTK_BOX (vbox43), frame101, TRUE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame101), GTK_SHADOW_NONE);
+
+  alignment85 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_set_name (alignment85, "alignment85");
+  gtk_widget_show (alignment85);
+  gtk_container_add (GTK_CONTAINER (frame101), alignment85);
+
+  scrolledwindow22 = gtk_scrolled_window_new (NULL, NULL);
+  gtk_widget_set_name (scrolledwindow22, "scrolledwindow22");
+  gtk_widget_show (scrolledwindow22);
+  gtk_container_add (GTK_CONTAINER (alignment85), scrolledwindow22);
+
+  clist1 = gtk_clist_new (2);
+  gtk_widget_set_name (clist1, "clist1");
+  gtk_widget_show (clist1);
+  gtk_container_add (GTK_CONTAINER (scrolledwindow22), clist1);
+  gtk_clist_set_column_width (GTK_CLIST (clist1), 0, 137);
+  gtk_clist_set_column_width (GTK_CLIST (clist1), 1, 80);
+  gtk_clist_column_titles_show (GTK_CLIST (clist1));
+
+  label167 = gtk_label_new (_("Keyword"));
+  gtk_widget_set_name (label167, "label167");
+  gtk_widget_show (label167);
+  gtk_clist_set_column_widget (GTK_CLIST (clist1), 0, label167);
+  gtk_widget_set_size_request (label167, 137, -1);
+
+  label168 = gtk_label_new (_("Value"));
+  gtk_widget_set_name (label168, "label168");
+  gtk_widget_show (label168);
+  gtk_clist_set_column_widget (GTK_CLIST (clist1), 1, label168);
+
+  frame102 = gtk_frame_new (NULL);
+  gtk_widget_set_name (frame102, "frame102");
+  gtk_widget_show (frame102);
+  gtk_box_pack_start (GTK_BOX (vbox43), frame102, FALSE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame102), GTK_SHADOW_NONE);
+
+  alignment86 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_set_name (alignment86, "alignment86");
+  gtk_widget_show (alignment86);
+  gtk_container_add (GTK_CONTAINER (frame102), alignment86);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment86), 3, 0, 0, 0);
+
+  hbox58 = gtk_hbox_new (FALSE, 0);
+  gtk_widget_set_name (hbox58, "hbox58");
+  gtk_widget_show (hbox58);
+  gtk_container_add (GTK_CONTAINER (alignment86), hbox58);
+
+  table10 = gtk_table_new (2, 3, FALSE);
+  gtk_widget_set_name (table10, "table10");
+  gtk_widget_show (table10);
+  gtk_box_pack_start (GTK_BOX (hbox58), table10, TRUE, TRUE, 0);
+
+  label169 = gtk_label_new (_("Value : "));
+  gtk_widget_set_name (label169, "label169");
+  gtk_widget_show (label169);
+  gtk_table_attach (GTK_TABLE (table10), label169, 0, 1, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  t_value = gtk_entry_new ();
+  gtk_widget_set_name (t_value, "t_value");
+  gtk_widget_show (t_value);
+  gtk_table_attach (GTK_TABLE (table10), t_value, 1, 2, 1, 2,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  b_update = gtk_button_new_with_mnemonic (_("    _Update    "));
+  gtk_widget_set_name (b_update, "b_update");
+  gtk_widget_show (b_update);
+  gtk_table_attach (GTK_TABLE (table10), b_update, 2, 3, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_container_set_border_width (GTK_CONTAINER (b_update), 6);
+
+  b_add = gtk_button_new_from_stock ("gtk-add");
+  gtk_widget_set_name (b_add, "b_add");
+  gtk_widget_show (b_add);
+  gtk_table_attach (GTK_TABLE (table10), b_add, 2, 3, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_container_set_border_width (GTK_CONTAINER (b_add), 6);
+
+  t_keyword = gtk_entry_new ();
+  gtk_widget_set_name (t_keyword, "t_keyword");
+  gtk_widget_show (t_keyword);
+  gtk_table_attach (GTK_TABLE (table10), t_keyword, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  label170 = gtk_label_new (_("Keyword : "));
+  gtk_widget_set_name (label170, "label170");
+  gtk_widget_show (label170);
+  gtk_table_attach (GTK_TABLE (table10), label170, 0, 1, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  hbuttonbox4 = GTK_DIALOG (dgensetup)->action_area;
+  gtk_widget_set_name (hbuttonbox4, "hbuttonbox4");
+  gtk_widget_show (hbuttonbox4);
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox4), GTK_BUTTONBOX_END);
+
+  b_cancel = gtk_button_new_from_stock ("gtk-cancel");
+  gtk_widget_set_name (b_cancel, "b_cancel");
+  gtk_widget_show (b_cancel);
+  gtk_dialog_add_action_widget (GTK_DIALOG (dgensetup), b_cancel, GTK_RESPONSE_CANCEL);
+  GTK_WIDGET_SET_FLAGS (b_cancel, GTK_CAN_DEFAULT);
+
+  b_ok = gtk_button_new_from_stock ("gtk-ok");
+  gtk_widget_set_name (b_ok, "b_ok");
+  gtk_widget_show (b_ok);
+  gtk_dialog_add_action_widget (GTK_DIALOG (dgensetup), b_ok, GTK_RESPONSE_OK);
+  GTK_WIDGET_SET_FLAGS (b_ok, GTK_CAN_DEFAULT);
+
+  /* Store pointers to all widgets, for use by lookup_widget(). */
+  GLADE_HOOKUP_OBJECT_NO_REF (dgensetup, dgensetup, "dgensetup");
+  GLADE_HOOKUP_OBJECT_NO_REF (dgensetup, vbox42, "vbox42");
+  GLADE_HOOKUP_OBJECT (dgensetup, vbox43, "vbox43");
+  GLADE_HOOKUP_OBJECT (dgensetup, frame100, "frame100");
+  GLADE_HOOKUP_OBJECT (dgensetup, alignment84, "alignment84");
+  GLADE_HOOKUP_OBJECT (dgensetup, label166, "label166");
+  GLADE_HOOKUP_OBJECT (dgensetup, frame103, "frame103");
+  GLADE_HOOKUP_OBJECT (dgensetup, alignment87, "alignment87");
+  GLADE_HOOKUP_OBJECT (dgensetup, table11, "table11");
+  GLADE_HOOKUP_OBJECT (dgensetup, label171, "label171");
+  GLADE_HOOKUP_OBJECT (dgensetup, label172, "label172");
+  GLADE_HOOKUP_OBJECT (dgensetup, t_dsn, "t_dsn");
+  GLADE_HOOKUP_OBJECT (dgensetup, t_comment, "t_comment");
+  GLADE_HOOKUP_OBJECT (dgensetup, frame101, "frame101");
+  GLADE_HOOKUP_OBJECT (dgensetup, alignment85, "alignment85");
+  GLADE_HOOKUP_OBJECT (dgensetup, scrolledwindow22, "scrolledwindow22");
+  GLADE_HOOKUP_OBJECT (dgensetup, clist1, "clist1");
+  GLADE_HOOKUP_OBJECT (dgensetup, label167, "label167");
+  GLADE_HOOKUP_OBJECT (dgensetup, label168, "label168");
+  GLADE_HOOKUP_OBJECT (dgensetup, frame102, "frame102");
+  GLADE_HOOKUP_OBJECT (dgensetup, alignment86, "alignment86");
+  GLADE_HOOKUP_OBJECT (dgensetup, hbox58, "hbox58");
+  GLADE_HOOKUP_OBJECT (dgensetup, table10, "table10");
+  GLADE_HOOKUP_OBJECT (dgensetup, label169, "label169");
+  GLADE_HOOKUP_OBJECT (dgensetup, t_value, "t_value");
+  GLADE_HOOKUP_OBJECT (dgensetup, b_update, "b_update");
+  GLADE_HOOKUP_OBJECT (dgensetup, b_add, "b_add");
+  GLADE_HOOKUP_OBJECT (dgensetup, t_keyword, "t_keyword");
+  GLADE_HOOKUP_OBJECT (dgensetup, label170, "label170");
+  GLADE_HOOKUP_OBJECT_NO_REF (dgensetup, hbuttonbox4, "hbuttonbox4");
+  GLADE_HOOKUP_OBJECT (dgensetup, b_cancel, "b_cancel");
+  GLADE_HOOKUP_OBJECT (dgensetup, b_ok, "b_ok");
+
+  /* Ok button events */
+  gtk_signal_connect (GTK_OBJECT (b_ok), "clicked",
+      GTK_SIGNAL_FUNC (gensetup_ok_clicked), &gensetup_t);
+  /* Cancel button events */
+  gtk_signal_connect (GTK_OBJECT (b_cancel), "clicked",
+      GTK_SIGNAL_FUNC (gensetup_cancel_clicked), &gensetup_t);
+  /* Add button events */
+  gtk_signal_connect (GTK_OBJECT (b_add), "clicked",
+      GTK_SIGNAL_FUNC (gensetup_add_clicked), &gensetup_t);
+  /* Update button events */
+  gtk_signal_connect (GTK_OBJECT (b_update), "clicked",
+      GTK_SIGNAL_FUNC (gensetup_update_clicked), &gensetup_t);
+  /* Close window button events */
+  gtk_signal_connect (GTK_OBJECT (dgensetup), "delete_event",
+      GTK_SIGNAL_FUNC (delete_event), &gensetup_t);
+  gtk_signal_connect (GTK_OBJECT (dgensetup), "destroy",
+      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+  /* List events */
+  gtk_signal_connect (GTK_OBJECT (clist1), "select_row",
+      GTK_SIGNAL_FUNC (gensetup_list_select), &gensetup_t);
+  gtk_signal_connect (GTK_OBJECT (clist1), "unselect_row",
+      GTK_SIGNAL_FUNC (gensetup_list_unselect), &gensetup_t);
+
+  gensetup_t.dsn_entry = t_dsn;
+  gensetup_t.comment_entry = t_comment;
+  gensetup_t.key_list = clist1;
+  gensetup_t.bupdate = b_update;
+  gensetup_t.key_entry = t_keyword;
+  gensetup_t.value_entry = t_value;
+  gensetup_t.mainwnd = dgensetup;
+
+  /* Parse the attributes line */
+  parse_attribute_line (&gensetup_t, dsn, attrs, add);
+
+  gtk_widget_show_all (dgensetup);
+  gtk_main ();
+
+  return gensetup_t.connstr;
+}

+ 114 - 0
odbc.mod/iodbc/drvproxy/gtk/gui.h

@@ -0,0 +1,114 @@
+/*
+ *  gui.h
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iodbc.h>
+#include <odbcinst.h>
+#include <gtk/gtk.h>
+
+#ifndef	_GTKGUI_H
+#define _GTKGUI_H
+
+#define GLADE_HOOKUP_OBJECT(component,widget,name) \
+  gtk_widget_ref(widget); \
+  gtk_object_set_data_full (GTK_OBJECT (component), name, \
+      widget, (GtkDestroyNotify) gtk_widget_unref)
+
+#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
+  gtk_object_set_data (GTK_OBJECT (component), name, widget)
+
+#define _(X)  X
+
+
+typedef struct TLOGIN
+{
+  GtkWidget *username, *password, *mainwnd;
+  char *user, *pwd;
+  BOOL ok;
+} TLOGIN;
+
+typedef struct TGENSETUP
+{
+  GtkWidget *dsn_entry, *comment_entry, *key_list, *bupdate;
+  GtkWidget *key_entry, *value_entry;
+  GtkWidget *mainwnd;
+  LPSTR connstr;
+} TGENSETUP;
+
+typedef struct TCONFIRM
+{
+  GtkWidget *mainwnd;
+  BOOL yes_no;
+} TCONFIRM;
+
+#endif

+ 282 - 0
odbc.mod/iodbc/drvproxy/gtk/loginbox.c

@@ -0,0 +1,282 @@
+/*
+ *  loginbox.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include "gui.h"
+
+
+static void
+login_ok_clicked (GtkWidget *widget, TLOGIN *log_t)
+{
+  if (log_t)
+    {
+      log_t->user = (char *) malloc (sizeof (char) *
+	  (STRLEN (gtk_entry_get_text (GTK_ENTRY (log_t->username))) + 1));
+      log_t->pwd = (char *) malloc (sizeof (char) *
+	  (STRLEN (gtk_entry_get_text (GTK_ENTRY (log_t->password))) + 1));
+
+      if (log_t->user)
+	strcpy (log_t->user,
+	    gtk_entry_get_text (GTK_ENTRY (log_t->username)));
+      if (log_t->pwd)
+	strcpy (log_t->pwd, gtk_entry_get_text (GTK_ENTRY (log_t->password)));
+
+      log_t->username = log_t->password = NULL;
+      log_t->ok = TRUE;
+
+      gtk_signal_disconnect_by_func (GTK_OBJECT (log_t->mainwnd),
+	  GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+      gtk_main_quit ();
+      gtk_widget_destroy (log_t->mainwnd);
+    }
+}
+
+
+static void
+login_cancel_clicked (GtkWidget *widget, TLOGIN *log_t)
+{
+  if (log_t)
+    {
+      log_t->user = log_t->pwd = NULL;
+      log_t->username = log_t->password = NULL;
+      log_t->ok = FALSE;
+
+      gtk_signal_disconnect_by_func (GTK_OBJECT (log_t->mainwnd),
+	  GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+      gtk_main_quit ();
+      gtk_widget_destroy (log_t->mainwnd);
+    }
+}
+
+
+static gint
+delete_event (GtkWidget *widget, GdkEvent *event, TLOGIN *log_t)
+{
+  login_cancel_clicked (widget, log_t);
+
+  return FALSE;
+}
+
+
+void
+create_login (HWND hwnd, LPCSTR username, LPCSTR password, LPCSTR dsn,
+    TLOGIN *log_t)
+{
+  GtkWidget *login;
+  GtkWidget *dialog_vbox8;
+  GtkWidget *frame99;
+  GtkWidget *alignment83;
+  GtkWidget *table9;
+  GtkWidget *label165;
+  GtkWidget *t_user;
+  GtkWidget *t_password;
+  GtkWidget *label164;
+  GtkWidget *dialog_action_area8;
+  GtkWidget *b_ok;
+  GtkWidget *b_cancel;
+  char buff[1024];
+
+  if (hwnd == (HWND) - 1L)
+    {
+      gtk_init (0, NULL);
+      hwnd = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+    }
+
+  if (hwnd == NULL || !GTK_IS_WIDGET (hwnd))
+    return;
+
+  login = gtk_dialog_new ();
+  gtk_widget_set_name (login, "login");
+  gtk_widget_set_size_request (login, 400, 150);
+  sprintf (buff, "Login for DSN %s ...", (dsn) ? dsn : "Unknown");
+  gtk_window_set_title (GTK_WINDOW (login), buff);
+  gtk_window_set_position (GTK_WINDOW (login), GTK_WIN_POS_CENTER);
+  gtk_window_set_modal (GTK_WINDOW (login), TRUE);
+  gtk_window_set_default_size (GTK_WINDOW (login), 400, 150);
+  gtk_window_set_type_hint (GTK_WINDOW (login), GDK_WINDOW_TYPE_HINT_DIALOG);
+
+#if GTK_CHECK_VERSION(2,0,0)
+  gtk_widget_show (login);
+#endif
+
+  dialog_vbox8 = GTK_DIALOG (login)->vbox;
+  gtk_widget_set_name (dialog_vbox8, "dialog_vbox8");
+  gtk_widget_show (dialog_vbox8);
+
+  frame99 = gtk_frame_new (NULL);
+  gtk_widget_set_name (frame99, "frame99");
+  gtk_widget_show (frame99);
+  gtk_box_pack_start (GTK_BOX (dialog_vbox8), frame99, TRUE, TRUE, 0);
+  gtk_frame_set_shadow_type (GTK_FRAME (frame99), GTK_SHADOW_NONE);
+
+  alignment83 = gtk_alignment_new (0.5, 0.5, 1, 1);
+  gtk_widget_set_name (alignment83, "alignment83");
+  gtk_widget_show (alignment83);
+  gtk_container_add (GTK_CONTAINER (frame99), alignment83);
+  gtk_alignment_set_padding (GTK_ALIGNMENT (alignment83), 4, 0, 6, 7);
+
+  table9 = gtk_table_new (2, 2, FALSE);
+  gtk_widget_set_name (table9, "table9");
+  gtk_widget_show (table9);
+  gtk_container_add (GTK_CONTAINER (alignment83), table9);
+  gtk_table_set_row_spacings (GTK_TABLE (table9), 10);
+  gtk_table_set_col_spacings (GTK_TABLE (table9), 6);
+
+  label165 = gtk_label_new (_("Password :"));
+  gtk_widget_set_name (label165, "label165");
+  gtk_widget_show (label165);
+  gtk_table_attach (GTK_TABLE (table9), label165, 0, 1, 1, 2,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label165), 0, 0.5);
+
+  t_user = gtk_entry_new ();
+  gtk_widget_set_name (t_user, "t_user");
+  gtk_widget_show (t_user);
+  gtk_table_attach (GTK_TABLE (table9), t_user, 1, 2, 0, 1,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+
+  if (username && STRLEN (username))
+    gtk_entry_set_text (GTK_ENTRY (t_user), username);
+
+  t_password = gtk_entry_new ();
+  gtk_widget_set_name (t_password, "t_password");
+  gtk_widget_show (t_password);
+  gtk_table_attach (GTK_TABLE (table9), t_password, 1, 2, 1, 2,
+                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_entry_set_visibility (GTK_ENTRY (t_password), FALSE);
+  if (password && STRLEN (password))
+    gtk_entry_set_text (GTK_ENTRY (t_password), password);
+
+  label164 = gtk_label_new (_("Username :"));
+  gtk_widget_set_name (label164, "label164");
+  gtk_widget_show (label164);
+  gtk_table_attach (GTK_TABLE (table9), label164, 0, 1, 0, 1,
+                    (GtkAttachOptions) (GTK_FILL),
+                    (GtkAttachOptions) (0), 0, 0);
+  gtk_misc_set_alignment (GTK_MISC (label164), 0, 0.5);
+
+  dialog_action_area8 = GTK_DIALOG (login)->action_area;
+  gtk_widget_set_name (dialog_action_area8, "dialog_action_area8");
+  gtk_widget_show (dialog_action_area8);
+  gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area8), GTK_BUTTONBOX_END);
+
+  b_cancel = gtk_button_new_from_stock ("gtk-cancel");
+  gtk_widget_set_name (b_cancel, "b_cancel");
+  gtk_widget_show (b_cancel);
+  gtk_dialog_add_action_widget (GTK_DIALOG (login), b_cancel, GTK_RESPONSE_CANCEL);
+  GTK_WIDGET_SET_FLAGS (b_cancel, GTK_CAN_DEFAULT);
+
+  b_ok = gtk_button_new_from_stock ("gtk-ok");
+  gtk_widget_set_name (b_ok, "b_ok");
+  gtk_widget_show (b_ok);
+  gtk_dialog_add_action_widget (GTK_DIALOG (login), b_ok, GTK_RESPONSE_OK);
+  GTK_WIDGET_SET_FLAGS (b_ok, GTK_CAN_DEFAULT);
+
+  /* Store pointers to all widgets, for use by lookup_widget(). */
+  GLADE_HOOKUP_OBJECT_NO_REF (login, login, "login");
+  GLADE_HOOKUP_OBJECT_NO_REF (login, dialog_vbox8, "dialog_vbox8");
+  GLADE_HOOKUP_OBJECT (login, frame99, "frame99");
+  GLADE_HOOKUP_OBJECT (login, alignment83, "alignment83");
+  GLADE_HOOKUP_OBJECT (login, table9, "table9");
+  GLADE_HOOKUP_OBJECT (login, label165, "label165");
+  GLADE_HOOKUP_OBJECT (login, t_user, "t_user");
+  GLADE_HOOKUP_OBJECT (login, t_password, "t_password");
+  GLADE_HOOKUP_OBJECT (login, label164, "label164");
+  GLADE_HOOKUP_OBJECT_NO_REF (login, dialog_action_area8, "dialog_action_area8");
+  GLADE_HOOKUP_OBJECT (login, b_ok, "b_ok");
+  GLADE_HOOKUP_OBJECT (login, b_cancel, "b_cancel");
+
+  /* Ok button events */
+  gtk_signal_connect (GTK_OBJECT (b_ok), "clicked",
+      GTK_SIGNAL_FUNC (login_ok_clicked), log_t);
+  /* Cancel button events */
+  gtk_signal_connect (GTK_OBJECT (b_cancel), "clicked",
+      GTK_SIGNAL_FUNC (login_cancel_clicked), log_t);
+  /* Close window button events */
+  gtk_signal_connect (GTK_OBJECT (login), "delete_event",
+      GTK_SIGNAL_FUNC (delete_event), log_t);
+  gtk_signal_connect (GTK_OBJECT (login), "destroy",
+      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+
+  log_t->username = t_user;
+  log_t->password = t_password;
+  log_t->user = log_t->pwd = NULL;
+  log_t->mainwnd = login;
+
+  gtk_widget_show_all (login);
+  gtk_main ();
+}

+ 106 - 0
odbc.mod/iodbc/drvproxy/gui.h

@@ -0,0 +1,106 @@
+/*
+ *  gui.h
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iodbc.h>
+#include <odbcinst.h>
+
+#if defined(__BEOS__)
+#include "be/gui.h"
+#elif defined(macintosh)
+#include "mac/gui.h"
+#elif defined(__GTK__)
+#include "gtk/gui.h"
+#elif defined(__QT__)
+#include "qt/gui.h"
+#elif defined(__APPLE__)
+#include "mac/gui.h"
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef	_GUI_H
+#define _GUI_H
+
+LPSTR create_gensetup (HWND hwnd, LPCSTR dsn, LPCSTR attrs, BOOL add);
+void create_login (HWND hwnd, LPCSTR username, LPCSTR password, LPCSTR dsn, TLOGIN *log_t);
+BOOL create_confirm (HWND hwnd, LPCSTR dsn, LPCSTR text);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif

+ 137 - 0
odbc.mod/iodbc/drvproxy/login.c

@@ -0,0 +1,137 @@
+/*
+ *  login.c
+ *
+ *  $Id$
+ *
+ *  The data_sources dialog for SQLDriverConnect and a login box procedures
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <iodbc.h>
+#include <odbcinst.h>
+#include <iodbc_error.h>
+
+#include "gui.h"
+
+
+SQLRETURN SQL_API
+_iodbcdm_loginbox (
+    HWND	  hwnd,
+    LPSTR	  szInOutConnStr,
+    DWORD	  cbInOutConnStr,
+    int	 	* sqlStat)
+{
+  RETCODE retcode = SQL_ERROR;
+  char *szUID = NULL, *szPWD = NULL, *szDSN = NULL, *curr;
+  TLOGIN log_t;
+
+  /* Check input parameters */
+  if (!hwnd || !szInOutConnStr || cbInOutConnStr < 1)
+    goto quit;
+
+  /* Check if the user and password are put */
+  for (curr = szInOutConnStr; *curr; curr += (STRLEN (curr) + 1))
+    {
+      if (!strncasecmp (curr, "DSN=", STRLEN ("DSN=")))
+	szDSN = curr + STRLEN ("DSN=");
+      if (!strncasecmp (curr, "UID=", STRLEN ("UID=")))
+	szUID = curr + STRLEN ("UID=");
+      if (!strncasecmp (curr, "PWD=", STRLEN ("PWD=")))
+	szPWD = curr + STRLEN ("PWD=");
+    }
+
+  if (!szUID || !szPWD)
+    {
+      create_login (hwnd, szUID, szPWD, szDSN, &log_t);
+
+      if (log_t.user && !szUID)
+	{
+	  sprintf (curr, "UID=%s\0", log_t.user);
+	  curr += (STRLEN (curr) + 1);
+	  free (log_t.user);
+	  *curr = 0;
+	}
+
+      if (log_t.pwd)
+	{
+	  sprintf (curr, "PWD=%s\0", log_t.pwd);
+	  curr += (STRLEN (curr) + 1);
+	  free (log_t.pwd);
+	  *curr = 0;
+	}
+
+    }
+
+  retcode = SQL_SUCCESS;
+
+quit:
+  return retcode;
+}

+ 126 - 0
odbc.mod/iodbc/drvproxy/mac/Base.lproj/IODBCProxy_LoginController.xib

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+    <dependencies>
+        <deployment version="1090" identifier="macosx"/>
+        <development version="8000" identifier="xcode"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="IODBCProxy_LoginController">
+            <connections>
+                <outlet property="fld_PWD" destination="6" id="176"/>
+                <outlet property="fld_UID" destination="5" id="175"/>
+                <outlet property="window" destination="1" id="3"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application"/>
+        <window title="Login ..." allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="1">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="268" height="147"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
+            <view key="contentView" id="2">
+                <rect key="frame" x="0.0" y="0.0" width="268" height="147"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5">
+                        <rect key="frame" x="98" y="110" width="141" height="21"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="141" id="14"/>
+                        </constraints>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="15">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <secureTextField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6">
+                        <rect key="frame" x="98" y="71" width="141" height="21"/>
+                        <secureTextFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" borderStyle="bezel" drawsBackground="YES" usesSingleLineMode="YES" id="13">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                            <allowedInputSourceLocales>
+                                <string>NSAllRomanInputSourcesLocaleIdentifier</string>
+                            </allowedInputSourceLocales>
+                        </secureTextFieldCell>
+                    </secureTextField>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="7">
+                        <rect key="frame" x="12" y="113" width="74" height="16"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="70" id="11"/>
+                        </constraints>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Username" id="12">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="8">
+                        <rect key="frame" x="12" y="74" width="74" height="16"/>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Password" id="10">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="9">
+                        <rect key="frame" x="0.0" y="49" width="267" height="5"/>
+                    </box>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="143">
+                        <rect key="frame" x="88" y="8" width="82" height="32"/>
+                        <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="144">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="call_Cancel:" target="-2" id="177"/>
+                        </connections>
+                    </button>
+                    <button autoresizesSubviews="NO" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="147">
+                        <rect key="frame" x="172" y="8" width="82" height="32"/>
+                        <buttonCell key="cell" type="push" title="Ok" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="148">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="call_OK:" target="-2" id="178"/>
+                        </connections>
+                    </button>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="8" firstAttribute="leading" secondItem="7" secondAttribute="leading" id="16"/>
+                    <constraint firstItem="8" firstAttribute="centerY" secondItem="6" secondAttribute="centerY" id="18"/>
+                    <constraint firstItem="6" firstAttribute="leading" secondItem="5" secondAttribute="leading" id="19"/>
+                    <constraint firstItem="7" firstAttribute="trailing" secondItem="8" secondAttribute="trailing" id="21"/>
+                    <constraint firstItem="5" firstAttribute="centerY" secondItem="7" secondAttribute="centerY" id="23"/>
+                    <constraint firstItem="5" firstAttribute="trailing" secondItem="6" secondAttribute="trailing" id="24"/>
+                    <constraint firstItem="7" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="14" id="124"/>
+                    <constraint firstItem="9" firstAttribute="leading" secondItem="2" secondAttribute="leading" id="125"/>
+                    <constraint firstAttribute="trailing" secondItem="9" secondAttribute="trailing" constant="1" id="126"/>
+                    <constraint firstItem="5" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="98" id="127"/>
+                    <constraint firstAttribute="bottom" secondItem="9" secondAttribute="bottom" constant="51" id="141"/>
+                    <constraint firstItem="5" firstAttribute="top" secondItem="2" secondAttribute="top" constant="16" id="142"/>
+                    <constraint firstAttribute="bottom" secondItem="143" secondAttribute="bottom" constant="15" id="145"/>
+                    <constraint firstAttribute="trailing" secondItem="147" secondAttribute="trailing" constant="20" symbolic="YES" id="149"/>
+                    <constraint firstItem="147" firstAttribute="baseline" secondItem="143" secondAttribute="baseline" id="150"/>
+                    <constraint firstItem="143" firstAttribute="width" secondItem="147" secondAttribute="width" id="151"/>
+                    <constraint firstItem="143" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="94" id="162"/>
+                    <constraint firstItem="6" firstAttribute="top" secondItem="2" secondAttribute="top" constant="55" id="174"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="4"/>
+            </connections>
+            <point key="canvasLocation" x="140" y="148"/>
+        </window>
+    </objects>
+</document>

+ 254 - 0
odbc.mod/iodbc/drvproxy/mac/Base.lproj/IODBCProxy_SetupController.xib

@@ -0,0 +1,254 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+    <dependencies>
+        <deployment version="1090" identifier="macosx"/>
+        <development version="8000" identifier="xcode"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <objects>
+        <customObject id="-2" userLabel="File's Owner" customClass="IODBCProxy_SetupController">
+            <connections>
+                <outlet property="Attrs_ArrController" destination="460" id="476"/>
+                <outlet property="btn_Add" destination="566" id="635"/>
+                <outlet property="btn_Remove" destination="844" id="886"/>
+                <outlet property="fld_Comment" destination="25" id="447"/>
+                <outlet property="fld_DSN" destination="18" id="446"/>
+                <outlet property="window" destination="1" id="3"/>
+            </connections>
+        </customObject>
+        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+        <window title="Generic ODBC Driver Setup" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="1">
+            <windowStyleMask key="styleMask" titled="YES" closable="YES"/>
+            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+            <rect key="contentRect" x="196" y="240" width="425" height="440"/>
+            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
+            <view key="contentView" id="2">
+                <rect key="frame" x="0.0" y="0.0" width="425" height="440"/>
+                <autoresizingMask key="autoresizingMask"/>
+                <subviews>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5">
+                        <rect key="frame" x="18" y="409" width="156" height="16"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="152" id="9"/>
+                        </constraints>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Data Source Name (DSN)" id="6">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="10">
+                        <rect key="frame" x="18" y="376" width="156" height="16"/>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Comment" id="12">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <textField verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="18">
+                        <rect key="frame" x="191" y="407" width="214" height="20"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="214" id="23"/>
+                        </constraints>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="19">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="25">
+                        <rect key="frame" x="191" y="373" width="214" height="21"/>
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="27">
+                            <font key="font" metaFont="system"/>
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
+                        </textFieldCell>
+                    </textField>
+                    <scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="72">
+                        <rect key="frame" x="20" y="87" width="385" height="273"/>
+                        <clipView key="contentView" id="xEb-Xi-1Dc">
+                            <rect key="frame" x="1" y="0.0" width="383" height="272"/>
+                            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                            <subviews>
+                                <tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="sequential" columnReordering="NO" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" headerView="75" id="73">
+                                    <rect key="frame" x="0.0" y="0.0" width="383" height="247"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                    <size key="intercellSpacing" width="3" height="2"/>
+                                    <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                    <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
+                                    <tableColumns>
+                                        <tableColumn identifier="key" width="116" minWidth="40" maxWidth="1000" id="77">
+                                            <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Keyword">
+                                                <font key="font" metaFont="smallSystem"/>
+                                                <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
+                                            </tableHeaderCell>
+                                            <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="80">
+                                                <font key="font" metaFont="system"/>
+                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <connections>
+                                                <binding destination="460" name="value" keyPath="arrangedObjects.key" id="470">
+                                                    <dictionary key="options">
+                                                        <integer key="NSConditionallySetsEditable" value="1"/>
+                                                        <string key="NSNullPlaceholder">...</string>
+                                                    </dictionary>
+                                                </binding>
+                                            </connections>
+                                        </tableColumn>
+                                        <tableColumn identifier="val" width="261" minWidth="40" maxWidth="1000" id="78">
+                                            <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Value">
+                                                <font key="font" metaFont="smallSystem"/>
+                                                <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
+                                            </tableHeaderCell>
+                                            <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="79">
+                                                <font key="font" metaFont="system"/>
+                                                <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
+                                                <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
+                                            </textFieldCell>
+                                            <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
+                                            <connections>
+                                                <binding destination="460" name="value" keyPath="arrangedObjects.val" id="474">
+                                                    <dictionary key="options">
+                                                        <integer key="NSConditionallySetsEditable" value="1"/>
+                                                        <string key="NSNullPlaceholder">...</string>
+                                                    </dictionary>
+                                                </binding>
+                                            </connections>
+                                        </tableColumn>
+                                    </tableColumns>
+                                </tableView>
+                            </subviews>
+                        </clipView>
+                        <scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="74">
+                            <rect key="frame" x="1" y="119" width="223" height="15"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </scroller>
+                        <scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="76">
+                            <rect key="frame" x="224" y="17" width="15" height="102"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </scroller>
+                        <tableHeaderView key="headerView" id="75">
+                            <rect key="frame" x="0.0" y="0.0" width="383" height="25"/>
+                            <autoresizingMask key="autoresizingMask"/>
+                        </tableHeaderView>
+                    </scrollView>
+                    <box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="385">
+                        <rect key="frame" x="0.0" y="48" width="425" height="5"/>
+                    </box>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="394">
+                        <rect key="frame" x="237" y="8" width="82" height="32"/>
+                        <buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="395">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+Gw
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="call_Cancel:" target="-2" id="452"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="398">
+                        <rect key="frame" x="321" y="9" width="82" height="32"/>
+                        <buttonCell key="cell" type="push" title="Ok" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="399">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system"/>
+                            <string key="keyEquivalent" base64-UTF8="YES">
+DQ
+</string>
+                        </buttonCell>
+                        <connections>
+                            <action selector="call_Ok:" target="-2" id="453"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="566">
+                        <rect key="frame" x="20" y="56" width="30" height="32"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="30" id="588"/>
+                            <constraint firstAttribute="height" constant="30" id="618"/>
+                        </constraints>
+                        <buttonCell key="cell" type="smallSquare" title="+" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="567">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system" size="25"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="add:" target="460" id="633"/>
+                        </connections>
+                    </button>
+                    <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="844">
+                        <rect key="frame" x="50" y="56" width="30" height="32"/>
+                        <constraints>
+                            <constraint firstAttribute="width" constant="30" id="845"/>
+                        </constraints>
+                        <buttonCell key="cell" type="smallSquare" title="-" bezelStyle="smallSquare" imagePosition="overlaps" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="847">
+                            <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+                            <font key="font" metaFont="system" size="25"/>
+                        </buttonCell>
+                        <connections>
+                            <action selector="remove:" target="460" id="875"/>
+                            <binding destination="460" name="enabled" keyPath="selection.key" id="MIN-C7-2Gg">
+                                <dictionary key="options">
+                                    <integer key="NSMultipleValuesPlaceholder" value="0"/>
+                                    <integer key="NSNoSelectionPlaceholder" value="0"/>
+                                    <integer key="NSNotApplicablePlaceholder" value="0"/>
+                                    <integer key="NSNullPlaceholder" value="0"/>
+                                    <string key="NSValueTransformerName">NSIsNotNil</string>
+                                </dictionary>
+                            </binding>
+                        </connections>
+                    </button>
+                </subviews>
+                <constraints>
+                    <constraint firstItem="10" firstAttribute="leading" secondItem="5" secondAttribute="leading" id="16"/>
+                    <constraint firstItem="10" firstAttribute="trailing" secondItem="5" secondAttribute="trailing" id="17"/>
+                    <constraint firstItem="18" firstAttribute="centerY" secondItem="5" secondAttribute="centerY" id="21"/>
+                    <constraint firstItem="10" firstAttribute="centerY" secondItem="25" secondAttribute="centerY" id="33"/>
+                    <constraint firstItem="25" firstAttribute="leading" secondItem="18" secondAttribute="leading" id="34"/>
+                    <constraint firstItem="25" firstAttribute="trailing" secondItem="18" secondAttribute="trailing" id="35"/>
+                    <constraint firstItem="25" firstAttribute="top" secondItem="2" secondAttribute="top" constant="46" id="70"/>
+                    <constraint firstItem="18" firstAttribute="top" secondItem="2" secondAttribute="top" constant="13" id="71"/>
+                    <constraint firstItem="72" firstAttribute="leading" secondItem="10" secondAttribute="leading" id="81"/>
+                    <constraint firstAttribute="trailing" secondItem="72" secondAttribute="trailing" constant="20" id="84"/>
+                    <constraint firstAttribute="trailing" secondItem="385" secondAttribute="trailing" id="387"/>
+                    <constraint firstItem="385" firstAttribute="leading" secondItem="2" secondAttribute="leading" id="388"/>
+                    <constraint firstItem="385" firstAttribute="centerX" secondItem="72" secondAttribute="centerX" id="392"/>
+                    <constraint firstAttribute="bottom" secondItem="394" secondAttribute="bottom" constant="15" id="396"/>
+                    <constraint firstAttribute="bottom" secondItem="398" secondAttribute="bottom" constant="16" id="415"/>
+                    <constraint firstAttribute="trailing" secondItem="398" secondAttribute="trailing" constant="28" id="426"/>
+                    <constraint firstAttribute="trailing" secondItem="394" secondAttribute="trailing" constant="112" id="442"/>
+                    <constraint firstItem="394" firstAttribute="width" secondItem="398" secondAttribute="width" id="443"/>
+                    <constraint firstItem="5" firstAttribute="top" secondItem="2" secondAttribute="top" constant="15" id="444"/>
+                    <constraint firstItem="5" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="20" id="445"/>
+                    <constraint firstItem="25" firstAttribute="trailing" secondItem="72" secondAttribute="trailing" id="634"/>
+                    <constraint firstItem="72" firstAttribute="top" secondItem="2" secondAttribute="top" constant="80" id="843"/>
+                    <constraint firstAttribute="bottom" secondItem="72" secondAttribute="bottom" constant="87" id="855"/>
+                    <constraint firstAttribute="bottom" secondItem="385" secondAttribute="bottom" constant="50" id="858"/>
+                    <constraint firstItem="566" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="20" symbolic="YES" id="867"/>
+                    <constraint firstItem="566" firstAttribute="baseline" secondItem="844" secondAttribute="baseline" id="868"/>
+                    <constraint firstItem="566" firstAttribute="top" secondItem="844" secondAttribute="top" id="869"/>
+                    <constraint firstAttribute="bottom" secondItem="566" secondAttribute="bottom" constant="57" id="870"/>
+                    <constraint firstItem="844" firstAttribute="leading" secondItem="2" secondAttribute="leading" constant="50" id="874"/>
+                </constraints>
+            </view>
+            <connections>
+                <outlet property="delegate" destination="-2" id="4"/>
+            </connections>
+            <point key="canvasLocation" x="140" y="147"/>
+        </window>
+        <arrayController preservesSelection="NO" id="460" userLabel="Attrs Array Controller">
+            <declaredKeys>
+                <string>key</string>
+                <string>val</string>
+            </declaredKeys>
+            <connections>
+                <binding destination="-2" name="contentArray" keyPath="Attrs_list" id="j94-Zc-wfO"/>
+            </connections>
+        </arrayController>
+    </objects>
+</document>

+ 99 - 0
odbc.mod/iodbc/drvproxy/mac/IODBCProxy_LoginController.h

@@ -0,0 +1,99 @@
+/*
+ *  IODBCProxy_LoginController.h
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import <gui.h>
+
+BOOL showLogin(const char* title, const char *username, const char *password, TLOGIN *log_t);
+
+@interface IODBCProxy_LoginController : NSWindowController {
+    NSTextField *fld_UID;
+    NSSecureTextField *fld_PWD;
+
+    NSString *d_title;
+    NSString *d_uid;
+    NSString *d_pwd;
+    int _dialogCode;
+}
+
+@property (assign) IBOutlet NSTextField *fld_UID;
+@property (assign) IBOutlet NSSecureTextField *fld_PWD;
+
+@property (nonatomic, retain) NSString *d_title;
+@property (nonatomic, retain) NSString *d_uid;
+@property (nonatomic, retain) NSString *d_pwd;
+
+- (IBAction)call_Cancel:(id)sender;
+- (IBAction)call_OK:(id)sender;
+@end

+ 178 - 0
odbc.mod/iodbc/drvproxy/mac/IODBCProxy_LoginController.m

@@ -0,0 +1,178 @@
+/*
+ *  IODBCProxy_LoginController.m
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "IODBCProxy_LoginController.h"
+#import "utils.h"
+
+BOOL showLogin(const char* title, const char *username, const char *password, TLOGIN *log_t)
+{
+        if (log_t) {
+            log_t->user = NULL;
+            log_t->pwd = NULL;
+            log_t->ok = 0;
+        }
+
+	@autoreleasepool {
+        NSApplication *app = [NSApplication sharedApplication];
+        
+        IODBCProxy_LoginController *dlg = [[IODBCProxy_LoginController alloc] init];
+        if (title)
+            dlg.d_title = conv_char_to_NSString(title);
+        if (username)
+            dlg.d_uid = conv_char_to_NSString(username);
+        if (password)
+            dlg.d_pwd = conv_char_to_NSString(password);
+        [dlg.window makeKeyAndOrderFront:nil];
+        
+        NSInteger rc = [app runModalForWindow:dlg.window];
+        [dlg.window orderOut:dlg.window];
+        if (log_t && rc == 1){
+            log_t->user = (char*)conv_NSString_to_char(dlg.d_uid);
+            log_t->pwd = (char*)conv_NSString_to_char(dlg.d_pwd);
+            log_t->ok = 1;
+        }
+        [dlg release];
+        return rc == 1 ? TRUE : FALSE;
+    }
+    
+}
+
+
+
+@interface IODBCProxy_LoginController ()
+
+@end
+
+@implementation IODBCProxy_LoginController
+@synthesize fld_UID;
+@synthesize fld_PWD;
+@synthesize d_title, d_uid, d_pwd;
+
+- (id)init
+{
+    return [super initWithWindowNibName:@"IODBCProxy_LoginController"];
+}
+
+- (void)dealloc
+{
+    [d_title release];
+    [d_uid release];
+    [d_pwd release];
+	[super dealloc];
+}
+
+
+- (id)initWithWindow:(NSWindow *)window
+{
+    self = [super initWithWindow:window];
+    if (self) {
+        // Initialization code here.
+    }
+    return self;
+}
+
+- (void)windowDidLoad
+{
+    [super windowDidLoad];
+    
+    _dialogCode = 0;
+    
+   [[self window] center];  // Center the window.
+    if (d_title!=nil)
+        self.window.title = d_title;
+    if (d_uid!=nil)
+        self.fld_UID.stringValue = d_uid;
+    if (d_pwd!=nil)
+        self.fld_PWD.stringValue = d_pwd;
+}
+
+- (void)windowWillClose:(NSNotification*)notification
+{
+    [NSApp stopModalWithCode:_dialogCode];
+}
+
+
+- (IBAction)call_OK:(id)sender {
+    _dialogCode = 1;
+    self.d_uid = fld_UID.stringValue;
+    self.d_pwd = fld_PWD.stringValue;
+    [self.window close];
+}
+
+- (IBAction)call_Cancel:(id)sender {
+    _dialogCode = 0;
+    [self.window close];
+}
+
+@end

+ 110 - 0
odbc.mod/iodbc/drvproxy/mac/IODBCProxy_SetupController.h

@@ -0,0 +1,110 @@
+/*
+ *  IODBCProxy_SetupController.h
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Cocoa/Cocoa.h>
+#import <gui.h>
+
+char* showSetup(char* dsn, char* attrs, BOOL addEnable);
+
+@interface IODBCProxy_SetupController : NSWindowController<NSTableViewDelegate> {
+    NSTextField *fld_DSN;
+    NSTextField *fld_Comment;
+    NSButton *btn_Add;
+    NSButton *btn_Remove;
+
+    NSString *d_dsn;
+    NSString *d_comment;
+    int _dialogCode;
+    int _curMode;
+    BOOL _addEnabled;
+    NSMutableArray *_Attrs_list;
+    NSArrayController *Attrs_ArrController;
+}
+
+@property (assign) IBOutlet NSArrayController *Attrs_ArrController;
+@property (assign) IBOutlet NSTextField *fld_DSN;
+@property (assign) IBOutlet NSTextField *fld_Comment;
+@property (assign) IBOutlet NSButton *btn_Add;
+@property (assign) IBOutlet NSButton *btn_Remove;
+
+@property (nonatomic, retain) NSString *d_dsn;
+@property (nonatomic, retain) NSString *d_comment;
+@property (assign) BOOL _addEnabled;
+@property (nonatomic, retain) NSMutableArray *Attrs_list;
+
+- (id)initWithAttrs:(const char*)attrs;
+
+- (IBAction)call_Cancel:(id)sender;
+- (IBAction)call_Ok:(id)sender;
+@end

+ 277 - 0
odbc.mod/iodbc/drvproxy/mac/IODBCProxy_SetupController.m

@@ -0,0 +1,277 @@
+/*
+ *  IODBCProxy_SetupController.m
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "IODBCProxy_SetupController.h"
+#import "utils.h"
+
+static char *STRCONN = "DSN=%s\0Description=%s\0\0";
+static int STRCONN_NB_TOKENS = 2;
+
+
+char* showSetup(char* dsn, char* attrs, BOOL addEnable)
+{
+    char *connstr = (char*) - 1L;
+	@autoreleasepool {
+        NSApplication *app = [NSApplication sharedApplication];
+        
+        IODBCProxy_SetupController *dlg = [[IODBCProxy_SetupController alloc] initWithAttrs:attrs];
+        if (dsn)
+            dlg.d_dsn = conv_char_to_NSString(dsn);
+        dlg._addEnabled = addEnable;
+        
+        NSInteger rc = [app runModalForWindow:dlg.window];
+        [dlg.window orderOut:dlg.window];
+        if (rc == 1){
+            char *cour, *curr;
+            int i = 0, size = 0;
+            char *val,*key;
+            char *dsn,*comment;
+            Size len;
+            
+            dsn = (char*)conv_NSString_to_char(dlg.d_dsn);
+            comment = (char*)conv_NSString_to_char(dlg.d_comment);
+            len = (dsn!=NULL)?strlen(dsn):0;
+            size += len + strlen("DSN=") + 1;
+            len = (comment!=NULL)?strlen(comment):0;
+            size += len + strlen("Description=") + 1;
+            
+            // Malloc it
+            if ((connstr = (char *) malloc (++size)))
+            {
+                for (curr = STRCONN, cour = connstr;
+                     i < STRCONN_NB_TOKENS; i++, curr += (strlen(curr) + 1))
+                {
+                    switch (i)
+                    {
+                        case 0:
+                            sprintf (cour, curr, dsn?dsn:"");
+                            cour += (strlen(cour) + 1);
+                            break;
+                        case 1:
+                            sprintf (cour, curr, comment?comment:"");
+                            cour += (strlen(cour) + 1);
+                            break;
+                    }
+                }
+                
+                for (i = 0; i < dlg.Attrs_list.count; i++)
+                {
+                    NSDictionary *row = [dlg.Attrs_list objectAtIndex:i];
+                    NSString *nskey = (NSString*)[row valueForKey:@"key"];
+                    int alen = 0;
+
+                    if ([nskey isEqualToString:@"..."] || nskey.length==0)
+                        continue;
+                    key = (char*)conv_NSString_to_char(nskey);
+                    alen += key ? strlen(key) : 0;
+
+                    val = (char*)conv_NSString_to_char((NSString*)[row valueForKey:@"val"]);
+                    alen += val ? strlen(val) : 0;
+
+                    cour = connstr;
+                    connstr = (char*) malloc (size + alen + 2);
+                    if (connstr)
+                    {
+                        memcpy (connstr, cour, size);
+                        sprintf (connstr + size - 1, "%s=%s", key?key:"", val?val:"");
+                        free (cour);
+                        size += alen + 2;
+                    }
+                    else
+                        connstr = cour;
+                    
+                    if (key!=NULL) free(key);
+                    if (val!=NULL) free(val);
+                }
+                
+                connstr[size - 1] = '\0';
+                
+                if (dsn!=NULL) free(dsn);
+                if (comment!=NULL) free(comment);
+            }
+        }
+        [dlg release];
+        return connstr;
+    }
+}
+
+
+
+
+#define MODE_ADD 1
+#define MODE_VIEW 0
+@interface IODBCProxy_SetupController ()
+
+@end
+
+@implementation IODBCProxy_SetupController
+@synthesize Attrs_ArrController;
+@synthesize fld_DSN;
+@synthesize fld_Comment;
+@synthesize btn_Add;
+@synthesize btn_Remove;
+@synthesize d_dsn, d_comment, _addEnabled;
+@synthesize Attrs_list=_Attrs_list;
+
+- (id)initWithAttrs:(const char*)attrs
+{
+    self = [super initWithWindowNibName:@"IODBCProxy_SetupController"];
+    if (self) {
+        self.Attrs_list = [NSMutableArray arrayWithCapacity:16];
+        [self parse_attrs:attrs];
+    }
+    return self;
+}
+
+- (void)dealloc
+{
+    [d_dsn release];
+    [d_comment release];
+    [_Attrs_list release];
+	[super dealloc];
+}
+
+- (id)initWithWindow:(NSWindow *)window
+{
+    self = [super initWithWindow:window];
+    if (self) {
+        // Initialization code here.
+    }
+    return self;
+}
+
+- (void)parse_attrs:(const char *)attrs
+{
+    char *curr, *cour;
+    
+    for (curr = (char*) attrs; *curr; curr += (strlen(curr) + 1))
+    {
+        if (!strncasecmp (curr, "Description=", strlen("Description=")))
+            self.d_comment = conv_char_to_NSString(curr + strlen("Description="));
+        
+        if (!strncasecmp (curr, "DSN=", strlen("DSN=")) ||
+            !strncasecmp (curr, "Driver=", strlen("Driver=")) ||
+            !strncasecmp (curr, "Description=", strlen("Description=")))
+            continue;
+        
+        if ((cour = strchr (curr, '=')))
+        {
+            NSString *key, *val;
+            *cour = '\0';
+            key = conv_char_to_NSString(curr);
+            *cour = '=';
+            val = conv_char_to_NSString(cour+1);
+            [_Attrs_list addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:key!=nil?key:@"", @"key",
+                                    val!=nil?val:@"", @"val", nil]];
+
+        }
+    }
+}
+
+- (void)windowDidLoad
+{
+    [super windowDidLoad];
+    
+    _dialogCode = 0;
+    _curMode = MODE_VIEW;
+    
+    [[self window] center];  // Center the window.
+    if (d_dsn!=nil){
+        self.window.title = [NSString stringWithFormat:@"Setup of %@", d_dsn];
+        self.fld_DSN.stringValue = d_dsn;
+    }
+    if (d_comment!=nil)
+        self.fld_Comment.stringValue = d_comment;
+}
+
+
+- (void)windowWillClose:(NSNotification*)notification
+{
+    [NSApp stopModalWithCode:_dialogCode];
+}
+
+
+- (IBAction)call_Ok:(id)sender {
+    _dialogCode = 1;
+    self.d_dsn = fld_DSN.stringValue;
+    self.d_comment = fld_Comment.stringValue;
+    [self.window close];
+}
+
+- (IBAction)call_Cancel:(id)sender {
+    _dialogCode = 0;
+    [self.window close];
+}
+
+@end

+ 92 - 0
odbc.mod/iodbc/drvproxy/mac/confirm.c

@@ -0,0 +1,92 @@
+/*
+ *  confirm.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gui.h>
+
+extern BOOL showConfirm(const void *title, const void *message, char waMode);
+
+BOOL create_confirm (HWND hwnd,
+    LPCSTR dsn,
+    LPCSTR text)
+{
+  return showConfirm((SQLPOINTER)dsn, (SQLPOINTER)text, 'A');
+}
+
+BOOL create_confirmw (HWND hwnd,
+    LPCWSTR dsn,
+    LPCWSTR text)
+{
+  return showConfirm((SQLPOINTER)dsn, (SQLPOINTER)text, 'W');
+}
+

BIN
odbc.mod/iodbc/drvproxy/mac/confirm.png


+ 83 - 0
odbc.mod/iodbc/drvproxy/mac/gensetup.c

@@ -0,0 +1,83 @@
+/*
+ *  gensetup.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gui.h>
+
+extern char* showSetup(char* dsn, char* attrs, BOOL addEnable);
+
+LPSTR create_gensetup (HWND hwnd, LPCSTR dsn,
+                       LPCSTR attrs, BOOL add)
+{
+    return showSetup((char*)dsn, (char*)attrs, add);
+}

+ 87 - 0
odbc.mod/iodbc/drvproxy/mac/gui.h

@@ -0,0 +1,87 @@
+/*
+ *  gui.h
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdlib.h>
+
+#ifndef	_MACXGUI_H
+#define	_MACXGUI_H
+
+typedef struct TLOGIN
+{
+  char *user, *pwd;
+  int ok;
+}
+TLOGIN;
+
+#endif

+ 88 - 0
odbc.mod/iodbc/drvproxy/mac/loginbox.c

@@ -0,0 +1,88 @@
+/*
+ *  loginbox.c
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <gui.h>
+
+extern BOOL showLogin(const char* title, const char *username, const char *password, TLOGIN *log_t);
+
+void
+create_login (HWND hwnd,
+              LPCSTR username,
+              LPCSTR password,
+              LPCSTR dsn,
+              TLOGIN * log_t)
+{
+    BOOL rc = showLogin(dsn, username, password, log_t);
+    log_t->ok = rc;
+}

+ 88 - 0
odbc.mod/iodbc/drvproxy/mac/utils.h

@@ -0,0 +1,88 @@
+/*
+ *  utils.h
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <Foundation/Foundation.h>
+#import <Cocoa/Cocoa.h>
+#include <stdio.h>
+#include <wchar.h>
+
+
+NSString* conv_wchar_to_NSString(const wchar_t* str);
+wchar_t* conv_NSString_to_wchar(NSString* str);
+char* conv_NSString_to_char(NSString* str);
+NSString* conv_char_to_NSString(const char* str);
+NSString* conv_to_NSString(const void * str, char waMode);
+
+
+

+ 241 - 0
odbc.mod/iodbc/drvproxy/mac/utils.m

@@ -0,0 +1,241 @@
+/*
+ *  utils.m
+ *
+ *  $Id$
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "utils.h"
+
+#define OPL_W2A(XW, XA, SIZE)      wcstombs((char *) XA, (wchar_t *) XW, SIZE)
+#define OPL_A2W(XA, XW, SIZE)      mbstowcs((wchar_t *) XW, (char *) XA, SIZE)
+
+
+static char *str_W2A (const wchar_t *inStr)
+{
+    char *outStr = NULL;
+    size_t len;
+    
+    if (inStr == NULL)
+        return NULL;
+    
+    len = wcslen (inStr);
+    
+    if ((outStr = (char *) malloc (len*4 + 1)) != NULL)  /* for multi-byte encodings */
+    {
+        if (len > 0)
+            OPL_W2A (inStr, outStr, len);
+        outStr[len] = '\0';
+    }
+    return outStr;
+}
+
+
+static wchar_t* str_A2W (const char *inStr)
+{
+    wchar_t *outStr = NULL;
+    size_t len;
+    
+    if (inStr == NULL)
+        return NULL;
+    
+    len = strlen (inStr);
+    
+    if ((outStr = (wchar_t*) calloc (len + 1, sizeof (wchar_t))) != NULL)
+    {
+        if (len > 0)
+            OPL_A2W (inStr, outStr, len);
+        outStr[len] = L'\0';
+    }
+    return outStr;
+}
+
+
+NSString* conv_wchar_to_NSString(const wchar_t* str)
+{
+    if (!str)
+        return nil;
+
+    int num = 1;
+    if(*(char *)&num == 1)
+        return [[[NSString alloc] initWithBytes:str length:wcslen(str)*sizeof(wchar_t) encoding:NSUTF32LittleEndianStringEncoding] autorelease];
+    else
+        return [[[NSString alloc] initWithBytes:str length:wcslen(str)*sizeof(wchar_t) encoding:NSUTF32BigEndianStringEncoding] autorelease];
+}
+
+#if OLD_1
+NSString* conv_wchar_to_NSString(const wchar_t* str)
+{
+    if (!str)
+        return nil;
+
+    CFMutableStringRef prov = CFStringCreateMutable(NULL, 0);
+    CFIndex i;
+    UniChar c;
+    
+    if(prov)
+    {
+        for(i = 0 ; str[i] != L'\0' ; i++)
+        {
+            c = (UniChar)str[i];
+            CFStringAppendCharacters(prov, &c, 1);
+        }
+    }
+    return (NSString*)prov;
+}
+#endif
+
+
+
+wchar_t* conv_NSString_to_wchar(NSString* str)
+{
+    if (str == nil)
+        return NULL;
+
+    int len = str.length;
+    wchar_t *prov = malloc(sizeof(wchar_t) * (len+1));
+    CFIndex i;
+    
+    if(prov)
+    {
+        for(i = 0 ; i<len ; i++)
+            prov[i] = CFStringGetCharacterAtIndex((CFStringRef)str, i);
+        prov[i] = L'\0';
+    }
+    return prov;
+}
+
+char* conv_NSString_to_char(NSString* str)
+{
+    if (str == nil)
+        return NULL;
+    
+    wchar_t *prov = conv_NSString_to_wchar (str);
+    char *buffer = NULL;
+    
+    if (prov)
+    {
+        buffer = str_W2A(prov);
+        free(prov);
+    }
+    return buffer;
+}
+
+
+NSString* conv_char_to_NSString(const char* str)
+{
+    if (!str)
+        return nil;
+    NSString *ret = nil;
+    wchar_t *buffer = str_A2W(str);
+    if (buffer)
+    {
+        ret = conv_wchar_to_NSString(buffer);
+        free(buffer);
+    }
+    return ret;
+}
+
+NSString* conv_to_NSString(const void * str, char waMode)
+{
+    if (str) {
+        if (waMode == 'A')
+            return conv_char_to_NSString((const char*)str);
+        else
+            return conv_wchar_to_NSString((const wchar_t*)str);
+    }
+    else
+        return nil;
+}
+
+
+BOOL showConfirm(const void *title, const void *message, char waMode)
+{
+    @autoreleasepool {
+        NSAlert *alert = [[[NSAlert alloc] init] autorelease];
+        [alert addButtonWithTitle:@"Yes"]; /* first button */
+        [alert addButtonWithTitle:@"No"];
+        [alert setMessageText:(title?conv_to_NSString(title, waMode):@"")];
+        [alert setInformativeText:(message?conv_to_NSString(message, waMode):@"")];
+        [alert setAlertStyle:NSInformationalAlertStyle];
+        BOOL rc = ([alert runModal] == NSAlertFirstButtonReturn);
+/**
+        if ([alert runModal] == NSAlertFirstButtonReturn) {
+            // OK clicked, delete the record
+        }
+**/
+        return rc;
+        
+    }
+    
+}
+
+
+

+ 75 - 0
odbc.mod/iodbc/etc/Makefile.am

@@ -0,0 +1,75 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+EXTRA_DIST = \
+	$(srcdir)/odbc.ini.sample \
+	$(srcdir)/odbcinst.ini.sample

+ 22 - 0
odbc.mod/iodbc/etc/odbc.ini.sample

@@ -0,0 +1,22 @@
+;
+;  odbc.ini
+;
+[ODBC Data Sources]
+OpenLink = OpenLink (MT)
+
+[OpenLink]
+Driver          = /home/openlink/lib/oplodbc.so.1
+Description     = Sample OpenLink MT DSN
+Host            = localhost
+ServerType      = Oracle 8
+FetchBufferSize = 99
+UserName        = 
+Password        = 
+Database        = 
+ServerOptions   = 
+ConnectOptions  = 
+Options         = 
+ReadOnly        = no
+
+[Default]
+Driver = /home/openlink/lib/oplodbc.so.1

+ 6 - 0
odbc.mod/iodbc/etc/odbcinst.ini.sample

@@ -0,0 +1,6 @@
+[ODBC Drivers]
+OpenLink (MT) = Installed
+
+[OpenLink (MT)]
+Driver = /home/openlink/lib/oplodbc.so.1
+Setup  = /home/openlink/lib/oplodbc.so.1

+ 89 - 0
odbc.mod/iodbc/include/Makefile.am

@@ -0,0 +1,89 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+include_HEADERS         = \
+	isql.h \
+	isqlext.h \
+	isqltypes.h \
+	sql.h \
+	sqlext.h \
+	sqlucode.h \
+	sqltypes.h \
+	odbcinst.h \
+	iodbcunix.h \
+	iodbcinst.h \
+	iodbcext.h
+
+noinst_HEADERS	= \
+	iodbc.h \
+	macos_config.h

+ 250 - 0
odbc.mod/iodbc/include/iodbc.h

@@ -0,0 +1,250 @@
+/*
+ *
+ *  iodbc.h
+ *
+ *  $Id$
+ *
+ *  Configuration
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_IODBC_H
+#define _IODBC_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#elif defined (__APPLE__)
+#include "macos_config.h"
+#endif
+
+#ifndef VERSION
+#define VERSION		"3.52.15"
+#define MAJ_VERSION	"3"
+#define MIN_VERSION	"52"
+#endif
+
+#ifndef IODBC_BUILD
+#define IODBC_BUILD 15210705	/* 0001.0928 */
+#endif
+
+#if	!defined(WINDOWS) && !defined(WIN32_SYSTEM)
+#define _UNIX_
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+#define MEM_ALLOC(size)	(malloc((size_t)(size)))
+#define MEM_FREE(ptr)	{if(ptr) free(ptr);}
+
+#define STRCPY(t, s)	(strcpy((char*)(t), (char*)(s)))
+#define STRNCPY(t,s,n)	(strncpy((char*)(t), (char*)(s), (size_t)(n)))
+#define STRCAT(t, s)	(strcat((char*)(t), (char*)(s)))
+#define STRNCAT(t,s,n)	(strncat((char*)(t), (char*)(s), (size_t)(n)))
+#define STREQ(a, b)	(strcmp((char*)(a), (char*)(b)) == 0)
+#define STRNEQ(a, b, n)		(strncmp((char*)(a), (char*)(b), (size_t)(n)) == 0)
+#define STRLEN(str)	((str)? strlen((char*)(str)):0)
+#define STRDUP(t)		(strdup((char*)(t)))
+#define STRCASEEQ(a, b)		(strcasecmp((char*)(a), (char*)(b)) == 0)
+#define STRNCASEEQ(a, b, n)	(strncasecmp((char*)(a), (char*)(b), (size_t)(n)) == 0)
+
+#define WCSCPY(t, s)		(wcscpy((wchar_t*)(t), (wchar_t*)(s)))
+#define WCSNCPY(t,s,n)		(wcsncpy((wchar_t*)(t), (wchar_t*)(s), (size_t)(n)))
+#define WCSCAT(t, s)		(wcscat((wchar_t*)(t), (wchar_t*)(s)))
+#define WCSNCAT(t,s,n)		(wcsncat((wchar_t*)(t), (wchar_t*)(s), (size_t)(n)))
+#define WCSEQ(a, b)		(wcscmp((wchar_t*)(a), (wchar_t*)(b)) == 0)
+#define WCSNEQ(a, b, n)		(wcsncmp((wchar_t*)(a), (wchar_t*)(b), (size_t)(n)) == 0)
+#define WCSLEN(str)		((str)? wcslen((wchar_t*)(str)):0)
+#define WCSDUP(t)		(wcsdup((wchar_t*)(t)))
+#define WCSCASEEQ(a, b)		(wcscasecmp((wchar_t*)(a), (wchar_t*)(b)) == 0)
+#define WCSNCASEEQ(a, b, n)	(wcsncasecmp((wchar_t*)(a), (wchar_t*)(b), (size_t)(n)) == 0)
+
+
+#define EXPORT
+#define CALLBACK
+#define FAR
+
+#ifndef WIN32
+#define UNALIGNED
+#endif
+
+/*
+ *  If not defined, use this as the system default odbc.ini file
+ */
+#if !defined(SYS_ODBC_INI) || (defined(__APPLE__) && !defined(ODBC_INI_APP))
+# if defined(__BEOS__)
+# 	define SYS_ODBC_INI "/boot/beos/etc/odbc.ini"
+# elif defined(_MAC)
+# 	ifdef __POWERPC__
+# 		define SYS_ODBC_INI "Boot:System Folder:Preferences:ODBC Preferences PPC"
+# 	else
+# 		define SYS_ODBC_INI "Boot:System Folder:Preferences:ODBC Preferences"
+# 	endif
+# elif defined(__APPLE__)
+# 	define SYS_ODBC_INI "/etc/odbc.ini"
+# 	define ODBC_INI_APP "/Library/ODBC/odbc.ini"
+# else
+# 	define SYS_ODBC_INI "/etc/odbc.ini"
+# endif
+#endif
+
+#if !defined(SYS_ODBCINST_INI) || (defined(__APPLE__) && !defined(ODBCINST_INI_APP))
+#  if defined(__BEOS__)
+#    define SYS_ODBCINST_INI	"/boot/beos/etc/odbcinst.ini"
+#  elif defined(macintosh)
+#  elif defined(__APPLE__)
+#    define SYS_ODBCINST_INI	"/etc/odbcinst.ini"
+#    define ODBCINST_INI_APP	"/Library/ODBC/odbcinst.ini"
+#  else
+#    define SYS_ODBCINST_INI	"/etc/odbcinst.ini"
+#  endif
+#endif
+
+#endif /* _UNIX_ */
+
+#if	defined(WINDOWS) || defined(WIN32_SYSTEM)
+#include <windows.h>
+#include <windowsx.h>
+
+#ifdef	_MSVC_
+#define MEM_ALLOC(size)	(fmalloc((size_t)(size)))
+#define MEM_FREE(ptr)	((ptr)? ffree((PTR)(ptr)):0)
+#define STRCPY(t, s)	(fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#define STRNCPY(t,s,n)	(fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#define STRLEN(str)	((str)? fstrlen((char FAR*)(str)):0)
+#define STREQ(a, b)	(fstrcmp((char FAR*)(a), (char FAR*)(b) == 0))
+#define STRCAT(t, s)	(strcat((char*)(t), (char*)(s)))
+#define STRNCAT(t,s,n)	(strncat((char*)(t), (char*)(s), (size_t)(n)))
+#define STRNCMP(t,s,n)	(strncmp((char*)(t), (char*)(s), (size_t)(n)))
+#endif
+
+#ifdef	_BORLAND_
+#define MEM_ALLOC(size)	(farmalloc((unsigned long)(size)))
+#define MEM_FREE(ptr)	((ptr)? farfree((void far*)(ptr)):0)
+#define STRCPY(t, s)	(_fstrcpy((char FAR*)(t), (char FAR*)(s)))
+#define STRNCPY(t,s,n)	(_fstrncpy((char FAR*)(t), (char FAR*)(s), (size_t)(n)))
+#define STRLEN(str)     ((str)? _fstrlen((char FAR*)(str)):0)
+#define STREQ(a, b)     (_fstrcmp((char FAR*)(a), (char FAR*)(b) == 0))
+#define STRCAT(t, s)	(strcat((char*)(t), (char*)(s)))
+#define STRNCAT(t,s,n)	(strncat((char*)(t), (char*)(s), (size_t)(n)))
+#define STRNCMP(t,s,n)	(strncmp((char*)(t), (char*)(s), (size_t)(n)))
+#endif
+
+#endif /* WINDOWS */
+
+#ifdef VMS
+/*
+ *  VMS also defines _UNIX_ above. This is OK for iODBC since all used UNIX
+ *  interfaces are supported.
+ *  The DEC C RTL actually supports dlopen(), etc, but I have made my own
+ *  implementation that supports:
+ *     - Proper error messages from dlopen()
+ *     - The ability to place the driver in other directories than SYS$SHARE:
+ *     - Neither implementation can do dlopen(NULL,), but my implementation
+ *       will not crash in this case.
+ *  To use old DEC C dlopen() implementation, remove the following define.
+ */
+#define DLDAPI_VMS_IODBC	/* Use enhanced dlopen() */
+#endif
+
+#define SYSERR		(-1)
+
+#ifndef	NULL
+#define NULL		((void *)0UL)
+#endif
+
+/*
+ *  Map generic pointer to internal pointer 
+ */
+#define STMT(stmt, var) \
+	STMT_t *stmt = (STMT_t *)var
+
+#define CONN(con, var) \
+	DBC_t *con = (DBC_t *)var
+
+#define GENV(genv, var) \
+	GENV_t *genv = (GENV_t *)var
+
+#define ENVR(env, var) \
+	ENV_t *env = (ENV_t *)var
+
+#define DESC(desc, var) \
+	DESC_t *desc = (DESC_t *)var
+
+#define NEW_VAR(type, var) \
+	type *var = (type *)MEM_ALLOC(sizeof(type))
+
+
+/* these are deprecated defines from the odbc headers */
+#define SQL_CONNECT_OPT_DRVR_START      1000
+
+#endif /* _IODBC_H */

+ 400 - 0
odbc.mod/iodbc/include/iodbcext.h

@@ -0,0 +1,400 @@
+/*
+ *  iodbcext.h
+ *
+ *  $Id$
+ *
+ *  iODBC extensions and changes to the SAG specifications
+ *  for third party drivers
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef _IODBCEXT_H
+#define _IODBCEXT_H
+
+
+/*
+ * OpenLink API Extensions
+ */
+#define SQL_GETLASTROWID		1048L
+#define SQL_GETLASTSERIAL		1049L
+#define SQL_CONCUR_VAL_EXTENT		1050L
+#define SQL_APPLICATION_NAME		1051L /* connect option */
+#define SQL_PARSE_FWD_ONLY_REQ		1052L
+#define SQL_DESC_KEY			1053L
+#define SQL_APPEND_KEYS			1054L
+#define SQL_DESC_EXPR			1055L
+#define SQL_ATTR_WCHAR_SIZE		1056L
+
+#define SQL_COLUMN_ROWVER 		SQL_DESC_ROWVER
+#define SQL_COLUMN_KEY 			SQL_DESC_KEY
+#define SQL_COLUMN_EXPR			SQL_DESC_EXPR
+#define SQL_ATTR_PARSE_FWD_ONLY_REQ  	SQL_PARSE_FWD_ONLY_REQ
+#define SQL_ATTR_APPEND_KEYS            SQL_APPEND_KEYS
+
+
+/*
+ *  Microsoft extensions for SQLServer
+ */
+
+/*
+ *  SQLSetConnectOption/SQLSetStmtOption driver specific defines.
+ *  Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server 
+ *  driver usage.
+ */
+#define SQL_ATTR_ENLIST_IN_DTC		1207
+#define SQL_ATTR_ENLIST_IN_XA		1208
+#define SQL_ATTR_CONNECTION_DEAD	1209	/* GetConnectAttr only */
+#define SQL_COPT_SS_BASE		1200
+#define SQL_COPT_SS_REMOTE_PWD		(SQL_COPT_SS_BASE+1) /* dbrpwset SQLSetConnectOption only */
+#define SQL_COPT_SS_USE_PROC_FOR_PREP	(SQL_COPT_SS_BASE+2) /* Use create proc for SQLPrepare */
+#define SQL_COPT_SS_INTEGRATED_SECURITY	(SQL_COPT_SS_BASE+3) /* Force integrated security on login */
+#define SQL_COPT_SS_PRESERVE_CURSORS	(SQL_COPT_SS_BASE+4) /* Preserve server cursors after SQLTransact */
+#define SQL_COPT_SS_USER_DATA		(SQL_COPT_SS_BASE+5) /* dbgetuserdata/dbsetuserdata */
+#define SQL_COPT_SS_ANSI_OEM		(SQL_COPT_SS_BASE+6) /* dbsetopt/DBANSItoOEM/DBOEMtoANSI */
+#define SQL_COPT_SS_ENLIST_IN_DTC	SQL_ATTR_ENLIST_IN_DTC /* Enlist in a DTC transaction */
+#define SQL_COPT_SS_ENLIST_IN_XA	SQL_ATTR_ENLIST_IN_XA /* Enlist in a XA transaction */
+#define SQL_COPT_SS_CONNECTION_DEAD	SQL_ATTR_CONNECTION_DEAD /* dbdead SQLGetConnectOption only */
+#define SQL_COPT_SS_FALLBACK_CONNECT	(SQL_COPT_SS_BASE+10) /* Enables FallBack connections */
+#define SQL_COPT_SS_PERF_DATA		(SQL_COPT_SS_BASE+11) /* Used to access SQL Server ODBC driver performance data */
+#define SQL_COPT_SS_PERF_DATA_LOG	(SQL_COPT_SS_BASE+12) /* Used to set the logfile name for the Performance data */
+#define SQL_COPT_SS_PERF_QUERY_INTERVAL (SQL_COPT_SS_BASE+13) /* Used to set the query logging threshold in milliseconds. */
+#define SQL_COPT_SS_PERF_QUERY_LOG	(SQL_COPT_SS_BASE+14) /* Used to set the logfile name for saving queries. */
+#define SQL_COPT_SS_PERF_QUERY		(SQL_COPT_SS_BASE+15) /* Used to start and stop query logging. */
+#define SQL_COPT_SS_PERF_DATA_LOG_NOW	(SQL_COPT_SS_BASE+16) /* Used to make a statistics log entry to disk. */
+#define SQL_COPT_SS_QUOTED_IDENT	(SQL_COPT_SS_BASE+17) /* Enable/Disable Quoted Identifiers */
+#define SQL_COPT_SS_ANSI_NPW		(SQL_COPT_SS_BASE+18) /* Enable/Disable ANSI NULL, Padding and Warnings */
+#define SQL_COPT_SS_BCP			(SQL_COPT_SS_BASE+19) /* Allow BCP usage on connection */
+
+#define SQL_COPT_SS_MAX_USED		SQL_COPT_SS_BCP
+
+#define SQL_SOPT_SS_BASE		1225
+#define SQL_SOPT_SS_TEXTPTR_LOGGING	(SQL_SOPT_SS_BASE+0) /* Text pointer logging */
+#define SQL_SOPT_SS_CURRENT_COMMAND	(SQL_SOPT_SS_BASE+1) /* dbcurcmd SQLGetStmtOption only */
+#define SQL_SOPT_SS_HIDDEN_COLUMNS	(SQL_SOPT_SS_BASE+2) /* Expose FOR BROWSE hidden columns */
+#define SQL_SOPT_SS_NOBROWSETABLE	(SQL_SOPT_SS_BASE+3) /* Set NOBROWSETABLE option */
+#define SQL_SOPT_SS_REGIONALIZE		(SQL_SOPT_SS_BASE+4) /* Regionalize output character conversions */
+#define SQL_SOPT_SS_MAX_USED		SQL_SOPT_SS_REGIONALIZE
+
+
+/* Defines for use with SQL_COPT_SS_USE_PROC_FOR_PREP */
+#define SQL_UP_OFF		0L	/*Procedures won't be used for prepare*/
+#define SQL_UP_ON		1L	/*Procedures will be used for prepare*/
+#define SQL_UP_ON_DROP	2L		/*Temp procedures will be explicitly dropped*/
+#define SQL_UP_DEFAULT	SQL_UP_ON
+
+/* Defines for use with SQL_COPT_SS_INTEGRATED_SECURITY - Pre-Connect Option only */
+#define SQL_IS_OFF		0L	/* Integrated security isn't used */
+#define SQL_IS_ON		1L	/* Integrated security is used */
+#define SQL_IS_DEFAULT	SQL_IS_OFF
+
+/*	Defines for use with SQL_COPT_SS_PRESERVE_CURSORS */
+#define SQL_PC_OFF		0L	/* Cursors are closed on SQLTransact */
+#define SQL_PC_ON		1L	/* Cursors remain open on SQLTransact */
+#define SQL_PC_DEFAULT	SQL_PC_OFF
+
+/* Defines for use with SQL_COPT_SS_USER_DATA */
+#define SQL_UD_NOTSET	NULL		/* No user data pointer set */
+
+/* Defines for use with SQL_COPT_SS_ANSI_OEM */
+#define SQL_AO_OFF		0L	/* ANSI/OEM translation is not performed */
+#define SQL_AO_ON		1L	/* ANSI/OEM translation is performed */
+#define SQL_AO_DEFAULT	SQL_AO_OFF	/* Default unless DSN OEM/ANSI checkbox is checked */
+
+/* Defines for use with SQL_COPT_SS_FALLBACK_CONNECT */
+#define SQL_FB_OFF		0L	/* FallBack connections are disabled */
+#define SQL_FB_ON		1L	/* FallBack connections are enabled */
+#define SQL_FB_DEFAULT	SQL_FB_OFF
+
+/* Defines for use with SQL_COPT_SS_BCP */
+#define SQL_BCP_OFF		0L	/* BCP is not allowed on connection */
+#define SQL_BCP_ON		1L	/* BCP is allowed on connection */
+#define SQL_BCP_DEFAULT	SQL_BCP_OFF
+
+/* Defines for use with SQL_COPT_SS_QUOTED_IDENT - Pre-Connect Option only */
+#define SQL_QI_OFF		0L	/* Quoted identifiers are not supported */
+#define SQL_QI_ON		1L	/* Quoted identifiers are supported */
+#define SQL_QI_DEFAULT	SQL_QI_ON
+
+/* Defines for use with SQL_COPT_SS_ANSI_NPW - Pre-Connect Option only */
+#define SQL_AD_OFF		0L	/* ANSI NULLs, Padding and Warnings are not supported */
+#define SQL_AD_ON		1L	/* ANSI NULLs, Padding and Warnings are supported */
+#define SQL_AD_DEFAULT	SQL_AD_ON
+
+
+/* Defines for use with SQL_SOPT_SS_TEXTPTR_LOGGING */
+#define SQL_TL_OFF		0L	/* No logging on text pointer ops */
+#define SQL_TL_ON		1L	/* Logging occurs on text pointer ops */
+#define SQL_TL_DEFAULT	SQL_TL_ON
+
+/* Defines for use with SQL_SOPT_SS_HIDDEN_COLUMNS */
+#define SQL_HC_OFF		0L	/* FOR BROWSE columns are hidden */
+#define SQL_HC_ON		1L	/* FOR BROWSE columns are exposed */
+#define SQL_HC_DEFAULT	SQL_HC_OFF
+
+/* Defines for use with SQL_SOPT_SS_NOBROWSETABLE */
+#define SQL_NB_OFF		0L	/* NO_BROWSETABLE is off */
+#define SQL_NB_ON		1L	/* NO_BROWSETABLE is on */
+#define SQL_NB_DEFAULT	SQL_NB_OFF
+
+/* Defines for use with SQL_SOPT_SS_REGIONALIZE */
+#define SQL_RE_OFF		0L	/* No regionalization occurs on output character conversions */
+#define SQL_RE_ON		1L	/* Regionalization occurs on output character conversions */
+#define SQL_RE_DEFAULT	SQL_RE_OFF
+
+
+#define SQL_ATTR_APP_WCHAR_TYPE		      1061
+
+#define SQL_ATTR_APP_UNICODE_TYPE             1064
+#define SQL_ATTR_DRIVER_UNICODE_TYPE          1065
+
+#define SQL_DM_CP_UTF16			1
+#define SQL_DM_CP_UTF8			2
+#define SQL_DM_CP_UCS4			3
+
+#if defined(SIZEOF_WCHAR)
+# if (SIZEOF_WCHAR == 2)
+#  define SQL_DM_CP_DEF  SQL_DM_CP_UTF16
+# else
+#  define SQL_DM_CP_DEF  SQL_DM_CP_UCS4
+# endif
+#else
+# define SQL_DM_CP_DEF  SQL_DM_CP_UCS4
+#endif
+
+/* DataDirect options for Connection/Env Attributes. */
+#define SQL_DD_CP_ANSI				0 
+#define SQL_DD_CP_UCS2				SQL_DM_CP_UTF16
+#define SQL_DD_CP_UTF8				SQL_DM_CP_UTF8
+#define SQL_DD_CP_UTF16				SQL_DD_CP_UCS2
+
+
+/*
+ * IBM extensions for DB2
+ */
+
+/* Options for SQLGetStmtOption/SQLSetStmtOption extensions */
+#define  SQL_CURSOR_HOLD              1250
+#define  SQL_ATTR_CURSOR_HOLD         1250
+#define  SQL_NODESCRIBE_OUTPUT        1251
+#define  SQL_ATTR_NODESCRIBE_OUTPUT   1251
+#define  SQL_NODESCRIBE_INPUT         1264
+#define  SQL_ATTR_NODESCRIBE_INPUT    1264
+#define  SQL_NODESCRIBE               SQL_NODESCRIBE_OUTPUT
+#define  SQL_ATTR_NODESCRIBE          SQL_NODESCRIBE_OUTPUT
+#define  SQL_CLOSE_BEHAVIOR           1257
+#define  SQL_ATTR_CLOSE_BEHAVIOR      1257
+#define  SQL_ATTR_CLOSEOPEN           1265
+#define  SQL_ATTR_CURRENT_PACKAGE_SET 1276
+#define  SQL_ATTR_DEFERRED_PREPARE    1277
+#define  SQL_ATTR_EARLYCLOSE          1268
+#define  SQL_ATTR_PROCESSCTL          1278
+
+/* SQL_CLOSE_BEHAVIOR values.                  */
+#define SQL_CC_NO_RELEASE             0
+#define SQL_CC_RELEASE                1
+#define SQL_CC_DEFAULT                SQL_CC_NO_RELEASE
+
+/* SQL_ATTR_DEFERRED_PREPARE values  */
+#define SQL_DEFERRED_PREPARE_ON       1
+#define SQL_DEFERRED_PREPARE_OFF      0
+#define SQL_DEFERRED_PREPARE_DEFAULT  SQL_DEFERRED_PREPARE_ON
+
+/* SQL_ATTR_EARLYCLOSE values  */
+#define SQL_EARLYCLOSE_ON             1
+#define SQL_EARLYCLOSE_OFF            0
+#define SQL_EARLYCLOSE_DEFAULT        SQL_EARLYCLOSE_ON
+
+/* SQL_ATTR_PROCESSCTL masks  */
+#define SQL_PROCESSCTL_NOTHREAD       0x00000001L
+#define SQL_PROCESSCTL_NOFORK         0x00000002L
+
+/* Options for SQL_CURSOR_HOLD */
+#define SQL_CURSOR_HOLD_ON        1
+#define SQL_CURSOR_HOLD_OFF       0
+#define SQL_CURSOR_HOLD_DEFAULT   SQL_CURSOR_HOLD_ON
+
+/* Options for SQL_NODESCRIBE_INPUT/SQL_NODESCRIBE_OUTPUT */
+#define SQL_NODESCRIBE_ON          1
+#define SQL_NODESCRIBE_OFF         0
+#define SQL_NODESCRIBE_DEFAULT     SQL_NODESCRIBE_OFF
+
+/* Options for SQLGetConnectOption/SQLSetConnectOption extensions */
+#define SQL_WCHARTYPE                1252
+#define SQL_LONGDATA_COMPAT          1253
+#define SQL_CURRENT_SCHEMA           1254
+#define SQL_DB2EXPLAIN               1258
+#define SQL_DB2ESTIMATE              1259
+#define SQL_PARAMOPT_ATOMIC          1260
+#define SQL_STMTTXN_ISOLATION        1261
+#define SQL_MAXCONN                  1262
+#define SQL_ATTR_WCHARTYPE          SQL_WCHARTYPE
+#define SQL_ATTR_LONGDATA_COMPAT    SQL_LONGDATA_COMPAT
+#define SQL_ATTR_CURRENT_SCHEMA     SQL_CURRENT_SCHEMA
+#define SQL_ATTR_DB2EXPLAIN         SQL_DB2EXPLAIN
+#define SQL_ATTR_DB2ESTIMATE        SQL_DB2ESTIMATE
+#define SQL_ATTR_PARAMOPT_ATOMIC    SQL_PARAMOPT_ATOMIC
+#define SQL_ATTR_STMTTXN_ISOLATION  SQL_STMTTXN_ISOLATION
+#define SQL_ATTR_MAXCONN            SQL_MAXCONN
+
+/* Options for SQLSetConnectOption, SQLSetEnvAttr */
+#define SQL_CONNECTTYPE              1255
+#define SQL_SYNC_POINT               1256
+#define SQL_MINMEMORY_USAGE          1263
+#define SQL_CONN_CONTEXT             1269
+#define SQL_ATTR_INHERIT_NULL_CONNECT    1270
+#define SQL_ATTR_FORCE_CONVERSION_ON_CLIENT 1275
+#define SQL_ATTR_CONNECTTYPE         SQL_CONNECTTYPE
+#define SQL_ATTR_SYNC_POINT          SQL_SYNC_POINT
+#define SQL_ATTR_MINMEMORY_USAGE     SQL_MINMEMORY_USAGE
+#define SQL_ATTR_CONN_CONTEXT        SQL_CONN_CONTEXT
+
+/* Options for SQL_LONGDATA_COMPAT */
+#define SQL_LD_COMPAT_YES            1
+#define SQL_LD_COMPAT_NO             0
+#define SQL_LD_COMPAT_DEFAULT        SQL_LD_COMPAT_NO
+
+/*  Options for SQL_PARAMOPT_ATOMIC */
+#define SQL_ATOMIC_YES               1
+#define SQL_ATOMIC_NO                0
+#define SQL_ATOMIC_DEFAULT           SQL_ATOMIC_YES
+
+/* Options for SQL_CONNECT_TYPE */
+#define SQL_CONCURRENT_TRANS         1
+#define SQL_COORDINATED_TRANS        2
+#define SQL_CONNECTTYPE_DEFAULT      SQL_CONCURRENT_TRANS
+
+/* Options for SQL_SYNCPOINT */
+#define SQL_ONEPHASE                 1
+#define SQL_TWOPHASE                 2
+#define SQL_SYNCPOINT_DEFAULT        SQL_ONEPHASE
+
+/* Options for SQL_DB2ESTIMATE */
+#define SQL_DB2ESTIMATE_ON           1
+#define SQL_DB2ESTIMATE_OFF          0
+#define SQL_DB2ESTIMATE_DEFAULT      SQL_DB2ESTIMATE_OFF
+
+/* Options for SQL_DB2EXPLAIN */
+#define SQL_DB2EXPLAIN_OFF              0x00000000L
+#define SQL_DB2EXPLAIN_SNAPSHOT_ON      0x00000001L
+#define SQL_DB2EXPLAIN_MODE_ON          0x00000002L
+#define SQL_DB2EXPLAIN_SNAPSHOT_MODE_ON SQL_DB2EXPLAIN_SNAPSHOT_ON+SQL_DB2EXPLAIN_MODE_ON
+#define SQL_DB2EXPLAIN_ON               SQL_DB2EXPLAIN_SNAPSHOT_ON
+#define SQL_DB2EXPLAIN_DEFAULT          SQL_DB2EXPLAIN_OFF
+
+/* Options for SQL_WCHARTYPE
+ * Note that you can only specify SQL_WCHARTYPE_CONVERT if you have an
+ * external compile flag SQL_WCHART_CONVERT defined
+ */
+#ifdef SQL_WCHART_CONVERT
+#define SQL_WCHARTYPE_CONVERT        1
+#endif
+#define SQL_WCHARTYPE_NOCONVERT      0
+#define SQL_WCHARTYPE_DEFAULT        SQL_WCHARTYPE_NOCONVERT
+
+
+/******************* Virtuoso ODBC Extensions *******************/
+
+/*
+ *  ODBC extensions for SQLGetDescField
+ */
+#define SQL_DESC_COL_DV_TYPE		1057L
+#define SQL_DESC_COL_DT_DT_TYPE		1058L
+#define SQL_DESC_COL_LITERAL_ATTR	1059L
+#define SQL_DESC_COL_BOX_FLAGS		1060L
+#define SQL_DESC_COL_LITERAL_LANG	1061L
+#define SQL_DESC_COL_LITERAL_TYPE	1062L
+
+
+/*
+ *  Virtuoso - ODBC SQL_DESC_COL_DV_TYPE
+ */
+#define VIRTUOSO_DV_DATE		129
+#define VIRTUOSO_DV_DATETIME		211
+#define VIRTUOSO_DV_DOUBLE_FLOAT	191
+#define VIRTUOSO_DV_IRI_ID		243
+#define VIRTUOSO_DV_LONG_INT		189
+#define VIRTUOSO_DV_NUMERIC		219
+#define VIRTUOSO_DV_RDF			246
+#define VIRTUOSO_DV_SINGLE_FLOAT	190
+#define VIRTUOSO_DV_STRING		182
+#define VIRTUOSO_DV_TIME		210
+#define VIRTUOSO_DV_TIMESTAMP		128
+#define VIRTUOSO_DV_TIMESTAMP_OBJ	208
+
+
+/*
+ *  Virtuoso - ODBC SQL_DESC_COL_DT_DT_TYPE
+ */
+#define VIRTUOSO_DT_TYPE_DATETIME	1
+#define VIRTUOSO_DT_TYPE_DATE		2
+#define VIRTUOSO_DT_TYPE_TIME		3
+
+#endif /* _IODBCEXT_H */

+ 83 - 0
odbc.mod/iodbc/include/iodbcinst.h

@@ -0,0 +1,83 @@
+/*
+ *  iodbcinst.h
+ *
+ *  $Id$
+ *
+ *  iODBC Installer defines
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* 
+ *  This file is deprecated in favor of odbcinst.h and will be removed 
+ *  sometime in the future. Please recode your applications to use 
+ *  the standard names sql.h, sqlext.h, sqltypes.h and odbcinst.h.
+ */
+
+#include <odbcinst.h>

+ 160 - 0
odbc.mod/iodbc/include/iodbcunix.h

@@ -0,0 +1,160 @@
+/*
+ *  iodbcunix.h
+ *
+ *  $Id$
+ *
+ *  ODBC defines for Unix
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _IODBCUNIX_H
+#define _IODBCUNIX_H
+
+/*
+ *  Standard header files
+ */
+#include <stdlib.h>
+#include <unistd.h>
+
+#if defined(__WCHAR_TYPE__)
+#include <wchar.h>
+#endif
+
+
+/*
+ *  Windows-style declarations
+ */
+#define NEAR
+#define FAR
+#define EXPORT
+#define PASCAL
+#define VOID			void
+#define CALLBACK
+#define _cdecl
+#define __stdcall
+
+
+/*
+ *  Boolean support
+ */
+#ifndef TRUE
+#define TRUE			1
+#endif
+#ifndef FALSE
+#define FALSE			0
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ *  Windows-style typedefs
+ */
+#if defined (OBSOLETE_WINDOWS_TYPES)
+typedef unsigned char		BYTE;
+#endif
+typedef unsigned short		WORD;
+typedef unsigned int		DWORD;
+typedef char *			LPSTR;
+typedef const char *		LPCSTR;
+typedef wchar_t *		LPWSTR;
+typedef const wchar_t *		LPCWSTR;
+typedef DWORD *			LPDWORD;
+
+#if !defined(BOOL) && !defined(_OBJC_OBJC_H_)
+typedef int			BOOL;
+#endif
+
+
+/*
+ *  Determine sizeof(long) in case it is not determined by configure/config.h
+ */
+#ifndef SIZEOF_LONG
+#if defined (_LP64)	|| \
+    defined (__LP64__)	|| \
+    defined (__64BIT__)	|| \
+    defined (__alpha)	|| \
+    defined (__sparcv9)	|| \
+    defined (__arch64__)
+#define SIZEOF_LONG	8		/* 64 bit operating systems */
+#else
+#define SIZEOF_LONG	4		/* 32 bit operating systems */
+#endif
+#endif /* SIZEOF_LONG */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _IODBCUNIX_H */

+ 84 - 0
odbc.mod/iodbc/include/isql.h

@@ -0,0 +1,84 @@
+/*
+ *  isql.h
+ *
+ *  $Id$
+ *
+ *  iODBC defines
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* 
+ *  This file is deprecated in favor of sql.h and will be removed 
+ *  sometime in the future. Please recode your applications to use 
+ *  the standard names sql.h, sqlext.h and sqltypes.h.
+ */
+
+#include <sql.h>

+ 84 - 0
odbc.mod/iodbc/include/isqlext.h

@@ -0,0 +1,84 @@
+/*
+ *  isqlext.h
+ *
+ *  $Id$
+ *
+ *  iODBC defines (ext)
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* 
+ *  This file is deprecated in favor of sqlext.h and will be removed 
+ *  sometime in the future. Please recode your applications to use 
+ *  the standard names sql.h, sqlext.h and sqltypes.h.
+ */
+
+#include <sqlext.h>

+ 84 - 0
odbc.mod/iodbc/include/isqltypes.h

@@ -0,0 +1,84 @@
+/*
+ *  isqltypes.h
+ *
+ *  $Id$
+ *
+ *  iODBC typedefs
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/* 
+ *  This file is deprecated in favor of sqltypes.h and will be removed 
+ *  sometime in the future. Please recode your applications to use 
+ *  the standard names sql.h, sqlext.h and sqltypes.h.
+ */
+
+#include <sqltypes.h>

+ 114 - 0
odbc.mod/iodbc/include/macos_config.h

@@ -0,0 +1,114 @@
+/*
+ *  macos_config.h
+ *
+ *  Extract from config.h for macOS xcodebuild
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _MACOS_CONFIG_H
+#define _MACOS_CONFIG_H
+
+#define HAVE_ASPRINTF 1
+#define HAVE_DLADDR 1
+#define HAVE_DLFCN_H 1
+#define HAVE_DL_INFO 1
+#define HAVE_DLOPEN 1
+#define HAVE_DLSYM 1
+#define HAVE_GETTIMEOFDAY 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIBDL 1
+#define HAVE_LOCALTIME_R 1
+#define HAVE_MEMORY_H 1
+#define HAVE_SETENV 1
+#define HAVE_SNPRINTF 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRERROR 1
+#define HAVE_STRING_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_TOWLOWER 1
+#define HAVE_UNISTD_H 1
+#define HAVE_WCHAR_H 1
+#define HAVE_WCSCAT 1
+#define HAVE_WCSCHR 1
+#define HAVE_WCSCMP 1
+#define HAVE_WCSCPY 1
+#define HAVE_WCSLEN 1
+#define HAVE_WCSNCASECMP 1
+#define HAVE_WCSNCPY 1
+#define STDC_HEADERS 1
+#define TIME_WITH_SYS_TIME 1
+
+#undef HAVE_DYLD
+#undef DLDAPI_MACX
+#endif

+ 639 - 0
odbc.mod/iodbc/include/odbcinst.h

@@ -0,0 +1,639 @@
+/*
+ *  odbcinst.h
+ *
+ *  $Id$
+ *
+ *  iODBC Installer defines
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _ODBCINST_H
+#define _ODBCINST_H
+
+/*
+ *  Set default specification to ODBC 3.51
+ */
+#ifndef ODBCVER
+#define ODBCVER 0x0351
+#endif
+
+#ifndef _SQL_H
+#include <sql.h>
+#endif
+
+#ifndef _SQLEXT_H
+#include <sqlext.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef EXPORT
+#define EXPORT
+#endif
+
+#ifndef SYS_ODBCINST_INI
+#  if defined(__BEOS__)
+#    define SYS_ODBCINST_INI	"/boot/beos/etc/odbcinst.ini"
+#  endif
+#  if defined(macintosh)
+#    ifdef __POWERPC__
+#      define SYS_ODBCINST_INI "Boot:System Folder:Preferences:ODBC Installer Preferences PPC"
+#    else
+#      define SYS_ODBCINST_INI "Boot:System Folder:Preferences:ODBC Installer Preferences"
+#    endif
+#  else
+#    define SYS_ODBCINST_INI	"/etc/odbcinst.ini"
+#  endif
+#endif
+
+#ifndef SYS_ODBC_INI
+#  if defined(__BEOS__)
+#    define SYS_ODBC_INI	"/boot/beos/etc/odbc.ini"
+#  endif
+#  if defined(macintosh)
+#    ifdef __POWERPC__
+#      define SYS_ODBC_INI "Boot:System Folder:Preferences:ODBC Preferences PPC"
+#    else
+#      define SYS_ODBC_INI "Boot:System Folder:Preferences:ODBC Preferences"
+#    endif
+#  else
+#    define SYS_ODBC_INI	"/etc/odbc.ini"
+#  endif
+#endif
+
+#ifndef DEFAULT_FILEDSNPATH
+#  if defined(__BEOS__)
+#    define DEFAULT_FILEDSNPATH	"/boot/beos/etc/ODBCDataSources"
+#  elif defined(macintosh)
+#    ifdef __POWERPC__
+#      define DEFAULT_FILEDSNPATH "Boot:System Folder:Preferences:ODBC Preferences PPC:ODBCDataSources"
+#    else
+#      define DEFAULT_FILEDSNPATH "Boot:System Folder:Preferences:ODBC Preferences:ODBCDataSources"
+#    endif
+#  elif defined (__APPLE__)
+#    define DEFAULT_FILEDSNPATH	"/Library/ODBC/ODBCDataSources"
+#  else
+#    define DEFAULT_FILEDSNPATH	"/etc/ODBCDataSources"
+#  endif
+#endif
+
+#define USERDSN_ONLY  0
+#define SYSTEMDSN_ONLY  1
+
+#ifdef WIN32
+#define INSTAPI __stdcall
+#else
+#define INSTAPI 
+#endif
+
+/*
+ *  SQLConfigDataSource 
+ */
+#define ODBC_ADD_DSN			1
+#define ODBC_CONFIG_DSN			2
+#define ODBC_REMOVE_DSN			3
+
+#if (ODBCVER >= 0x0250)
+#define ODBC_ADD_SYS_DSN 		4			
+#define ODBC_CONFIG_SYS_DSN		5	
+#define ODBC_REMOVE_SYS_DSN		6	
+#if (ODBCVER >= 0x0300)
+#define	 ODBC_REMOVE_DEFAULT_DSN	7
+#endif  /* ODBCVER >= 0x0300 */
+
+/* install request flags */
+#define	ODBC_INSTALL_INQUIRY		1		
+#define ODBC_INSTALL_COMPLETE		2
+
+/* config driver flags */
+#define ODBC_INSTALL_DRIVER			1
+#define ODBC_REMOVE_DRIVER			2
+#define ODBC_CONFIG_DRIVER			3
+#define ODBC_CONFIG_DRIVER_MAX	100
+#endif
+
+/* SQLGetConfigMode and SQLSetConfigMode flags */
+#if (ODBCVER >= 0x0300)
+#define ODBC_BOTH_DSN		0
+#define ODBC_USER_DSN		1
+#define ODBC_SYSTEM_DSN		2
+#endif  /* ODBCVER >= 0x0300 */
+
+/* SQLInstallerError code */
+#if (ODBCVER >= 0x0300)
+#define ODBC_ERROR_GENERAL_ERR                   1
+#define ODBC_ERROR_INVALID_BUFF_LEN              2
+#define ODBC_ERROR_INVALID_HWND                  3
+#define ODBC_ERROR_INVALID_STR                   4
+#define ODBC_ERROR_INVALID_REQUEST_TYPE          5
+#define ODBC_ERROR_COMPONENT_NOT_FOUND           6
+#define ODBC_ERROR_INVALID_NAME                  7
+#define ODBC_ERROR_INVALID_KEYWORD_VALUE         8
+#define ODBC_ERROR_INVALID_DSN                   9
+#define ODBC_ERROR_INVALID_INF                  10
+#define ODBC_ERROR_REQUEST_FAILED               11
+#define ODBC_ERROR_INVALID_PATH                 12
+#define ODBC_ERROR_LOAD_LIB_FAILED              13
+#define ODBC_ERROR_INVALID_PARAM_SEQUENCE       14
+#define ODBC_ERROR_INVALID_LOG_FILE             15
+#define ODBC_ERROR_USER_CANCELED                16
+#define ODBC_ERROR_USAGE_UPDATE_FAILED          17
+#define ODBC_ERROR_CREATE_DSN_FAILED            18
+#define ODBC_ERROR_WRITING_SYSINFO_FAILED       19
+#define ODBC_ERROR_REMOVE_DSN_FAILED            20
+#define ODBC_ERROR_OUT_OF_MEM                   21
+#define ODBC_ERROR_OUTPUT_STRING_TRUNCATED      22
+#define ODBC_ERROR_DRIVER_SPECIFIC		23
+#endif /* ODBCVER >= 0x0300 */
+
+/*
+ *  Function Prototypes
+ */
+
+BOOL INSTAPI 
+SQLGetConfigMode (
+    UWORD* pwConfigMode);
+
+BOOL INSTAPI
+SQLInstallDriverEx (
+    LPCSTR lpszDriver,
+    LPCSTR lpszPathIn,
+    LPSTR lpszPathOut,
+    WORD cbPathOutMax,
+    WORD* pcbPathOut,
+    WORD fRequest,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI
+SQLInstallDriverExW (
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszPathIn,
+    LPWSTR lpszPathOut,
+    WORD cbPathOutMax,
+    WORD* pcbPathOut,
+    WORD fRequest,
+    LPDWORD lpdwUsageCount);
+
+RETCODE INSTAPI
+SQLInstallerError (
+    WORD iError,
+    DWORD* pfErrorCode,
+    LPSTR lpszErrorMsg,
+    WORD cbErrorMsgMax,
+    WORD* pcbErrorMsg);
+
+RETCODE INSTAPI
+SQLInstallerErrorW (
+    WORD iError,
+    DWORD* pfErrorCode,
+    LPWSTR lpszErrorMsg,
+    WORD cbErrorMsgMax,
+    WORD* pcbErrorMsg);
+
+RETCODE INSTAPI
+SQLPostInstallerError (
+    DWORD fErrorCode,
+    LPSTR szErrorMsg);
+
+RETCODE INSTAPI
+SQLPostInstallerErrorW (
+    DWORD fErrorCode,
+    LPWSTR szErrorMsg);
+
+BOOL INSTAPI
+SQLInstallTranslatorEx (
+    LPCSTR lpszTranslator,
+    LPCSTR lpszPathIn,
+    LPSTR lpszPathOut,
+    WORD cbPathOutMax,
+    WORD* pcbPathOut,
+    WORD fRequest,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI
+SQLInstallTranslatorExW (
+    LPCWSTR lpszTranslator,
+    LPCWSTR lpszPathIn,
+    LPWSTR lpszPathOut,
+    WORD cbPathOutMax,
+    WORD* pcbPathOut,
+    WORD fRequest,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI
+SQLReadFileDSN (
+    LPCSTR lpszFileName,
+    LPCSTR lpszAppName,
+    LPCSTR lpszKeyName,
+    LPSTR lpszString,
+    WORD cbString,
+    WORD* pcbString);
+
+BOOL INSTAPI
+SQLReadFileDSNW (
+    LPCWSTR lpszFileName,
+    LPCWSTR lpszAppName,
+    LPCWSTR lpszKeyName,
+    LPWSTR lpszString,
+    WORD cbString,
+    WORD* pcbString);
+
+BOOL INSTAPI
+SQLWriteFileDSN (
+    LPCSTR lpszFileName,
+    LPCSTR lpszAppName,
+    LPCSTR lpszKeyName,
+    LPSTR lpszString);
+
+BOOL INSTAPI
+SQLWriteFileDSNW (
+    LPCWSTR lpszFileName,
+    LPCWSTR lpszAppName,
+    LPCWSTR lpszKeyName,
+    LPWSTR lpszString);
+
+BOOL INSTAPI
+SQLSetConfigMode (
+    UWORD wConfigMode);
+
+BOOL INSTAPI SQLInstallODBC (
+    HWND hwndParent,
+    LPCSTR lpszInfFile,
+    LPCSTR lpszSrcPath,
+    LPCSTR lpszDrivers);
+
+BOOL INSTAPI SQLInstallODBCW (
+    HWND hwndParent,
+    LPCWSTR lpszInfFile,
+    LPCWSTR lpszSrcPath,
+    LPCWSTR lpszDrivers);
+
+BOOL INSTAPI SQLManageDataSources (HWND hwndParent);
+
+BOOL INSTAPI SQLCreateDataSource (
+    HWND hwndParent,
+    LPCSTR lpszDSN);
+
+BOOL INSTAPI SQLCreateDataSourceW (
+    HWND hwndParent,
+    LPCWSTR lpszDSN);
+
+BOOL INSTAPI SQLGetTranslator (
+    HWND hwnd,
+    LPSTR lpszName,
+    WORD cbNameMax,
+    WORD * pcbNameOut,
+    LPSTR lpszPath,
+    WORD cbPathMax,
+    WORD * pcbPathOut,
+    DWORD * pvOption);
+
+BOOL INSTAPI SQLGetTranslatorW (
+    HWND hwnd,
+    LPWSTR lpszName,
+    WORD cbNameMax,
+    WORD * pcbNameOut,
+    LPWSTR lpszPath,
+    WORD cbPathMax,
+    WORD * pcbPathOut,
+    DWORD * pvOption);
+
+/*  Low level APIs
+ *  NOTE: The high-level APIs should always be used. These APIs
+ *        have been left for compatibility.
+ */
+BOOL INSTAPI SQLInstallDriver (
+    LPCSTR lpszInfFile,
+    LPCSTR lpszDriver,
+    LPSTR lpszPath,
+    WORD cbPathMax,
+    WORD * pcbPathOut);
+
+BOOL INSTAPI SQLInstallDriverW (
+    LPCWSTR lpszInfFile,
+    LPCWSTR lpszDriver,
+    LPWSTR lpszPath,
+    WORD cbPathMax,
+    WORD * pcbPathOut);
+
+BOOL INSTAPI SQLInstallDriverManager (
+    LPSTR lpszPath,
+    WORD cbPathMax,
+    WORD * pcbPathOut);
+
+BOOL INSTAPI SQLInstallDriverManagerW (
+    LPWSTR lpszPath,
+    WORD cbPathMax,
+    WORD * pcbPathOut);
+
+BOOL INSTAPI SQLGetInstalledDrivers (
+    LPSTR lpszBuf,
+    WORD cbBufMax,
+    WORD * pcbBufOut);
+
+BOOL INSTAPI SQLGetInstalledDriversW (
+    LPWSTR lpszBuf,
+    WORD cbBufMax,
+    WORD * pcbBufOut);
+
+BOOL INSTAPI SQLGetAvailableDrivers (
+    LPCSTR lpszInfFile,
+    LPSTR lpszBuf,
+    WORD cbBufMax,
+    WORD * pcbBufOut);
+
+BOOL INSTAPI SQLGetAvailableDriversW (
+    LPCWSTR lpszInfFile,
+    LPWSTR lpszBuf,
+    WORD cbBufMax,
+    WORD * pcbBufOut);
+
+BOOL INSTAPI SQLConfigDataSource (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCSTR lpszDriver,
+    LPCSTR lpszAttributes);
+
+BOOL INSTAPI SQLConfigDataSourceW (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszAttributes);
+
+BOOL INSTAPI SQLRemoveDefaultDataSource (void);
+
+BOOL INSTAPI SQLWriteDSNToIni (
+    LPCSTR lpszDSN,
+    LPCSTR lpszDriver);
+
+BOOL INSTAPI SQLWriteDSNToIniW (
+    LPCWSTR lpszDSN,
+    LPCWSTR lpszDriver);
+
+BOOL INSTAPI SQLRemoveDSNFromIni (LPCSTR lpszDSN);
+
+BOOL INSTAPI SQLRemoveDSNFromIniW (LPCWSTR lpszDSN);
+
+BOOL INSTAPI SQLValidDSN (LPCSTR lpszDSN);
+
+BOOL INSTAPI SQLValidDSNW (LPCWSTR lpszDSN);
+
+BOOL INSTAPI SQLWritePrivateProfileString (
+    LPCSTR lpszSection,
+    LPCSTR lpszEntry,
+    LPCSTR lpszString,
+    LPCSTR lpszFilename);
+
+BOOL INSTAPI SQLWritePrivateProfileStringW (
+    LPCWSTR lpszSection,
+    LPCWSTR lpszEntry,
+    LPCWSTR lpszString,
+    LPCWSTR lpszFilename);
+
+int INSTAPI SQLGetPrivateProfileString (
+    LPCSTR lpszSection,
+    LPCSTR lpszEntry,
+    LPCSTR lpszDefault,
+    LPSTR lpszRetBuffer,
+    int cbRetBuffer,
+    LPCSTR lpszFilename);
+
+int INSTAPI SQLGetPrivateProfileStringW (
+    LPCWSTR lpszSection,
+    LPCWSTR lpszEntry,
+    LPCWSTR lpszDefault,
+    LPWSTR lpszRetBuffer,
+    int cbRetBuffer,
+    LPCWSTR lpszFilename);
+
+BOOL INSTAPI SQLRemoveDriverManager (LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLInstallTranslator (
+    LPCSTR lpszInfFile,
+    LPCSTR lpszTranslator,
+    LPCSTR lpszPathIn,
+    LPSTR lpszPathOut,
+    WORD cbPathOutMax,
+    WORD * pcbPathOut,
+    WORD fRequest,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLInstallTranslatorW (
+    LPCWSTR lpszInfFile,
+    LPCWSTR lpszTranslator,
+    LPCWSTR lpszPathIn,
+    LPWSTR lpszPathOut,
+    WORD cbPathOutMax,
+    WORD * pcbPathOut,
+    WORD fRequest,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLRemoveTranslator (
+    LPCSTR lpszTranslator,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLRemoveTranslatorW (
+    LPCWSTR lpszTranslator,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLRemoveDriver (
+    LPCSTR lpszDriver,
+    BOOL fRemoveDSN,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLRemoveDriverW (
+    LPCWSTR lpszDriver,
+    BOOL fRemoveDSN,
+    LPDWORD lpdwUsageCount);
+
+BOOL INSTAPI SQLConfigDriver (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCSTR lpszDriver,
+    LPCSTR lpszArgs,
+    LPSTR lpszMsg,
+    WORD cbMsgMax,
+    WORD * pcbMsgOut);
+
+BOOL INSTAPI SQLConfigDriverW (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszArgs,
+    LPWSTR lpszMsg,
+    WORD cbMsgMax,
+    WORD * pcbMsgOut);
+
+/* Driver specific Setup APIs called by installer */
+
+typedef BOOL INSTAPI (*pConfigDSNFunc) (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCSTR lpszDriver,
+    LPCSTR lpszAttributes);
+
+typedef BOOL INSTAPI (*pConfigDSNWFunc) (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszAttributes);
+
+typedef BOOL INSTAPI (*pConfigDriverFunc) (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCSTR lpszDriver,
+    LPCSTR lpszArgs,
+    LPSTR lpszMsg,
+    WORD cbMsgMax,
+    WORD * pcbMsgOut);
+
+typedef BOOL INSTAPI (*pConfigDriverWFunc) (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszArgs,
+    LPWSTR lpszMsg,
+    WORD cbMsgMax,
+    WORD * pcbMsgOut);
+
+typedef BOOL INSTAPI (*pConfigTranslatorFunc) (
+    HWND hwndParent,
+    DWORD *pvOption);
+
+BOOL INSTAPI ConfigDSN (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCSTR lpszDriver,
+    LPCSTR lpszAttributes);
+
+BOOL INSTAPI ConfigDSNW (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszAttributes);
+
+BOOL INSTAPI ConfigTranslator (HWND hwndParent,
+    DWORD * pvOption);
+
+BOOL INSTAPI ConfigDriver (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCSTR lpszDriver,
+    LPCSTR lpszArgs,
+    LPSTR lpszMsg,
+    WORD cbMsgMax,
+    WORD * pcbMsgOut);
+
+BOOL INSTAPI ConfigDriverW (
+    HWND hwndParent,
+    WORD fRequest,
+    LPCWSTR lpszDriver,
+    LPCWSTR lpszArgs,
+    LPWSTR lpszMsg,
+    WORD cbMsgMax,
+    WORD * pcbMsgOut);
+
+#ifndef	SQL_NOUNICODEMAP
+#ifdef 	UNICODE
+
+#define  SQLInstallODBC               SQLInstallODBCW
+#define  SQLCreateDataSource          SQLCreateDataSourceW
+#define  SQLGetTranslator             SQLGetTranslatorW
+#define  SQLInstallDriver             SQLInstallDriverW
+#define  SQLInstallDriverManager      SQLInstallDriverManagerW
+#define  SQLGetInstalledDrivers       SQLGetInstalledDriversW
+#define  SQLGetAvailableDrivers       SQLGetAvailableDriversW
+#define  SQLConfigDataSource          SQLConfigDataSourceW
+#define  SQLWriteDSNToIni             SQLWriteDSNToIniW
+#define  SQLRemoveDSNFromIni          SQLRemoveDSNFromIniW
+#define  SQLValidDSN                  SQLValidDSNW
+#define  SQLWritePrivateProfileString SQLWritePrivateProfileStringW
+#define	 SQLGetPrivateProfileString   SQLGetPrivateProfileStringW
+#define  SQLInstallTranslator         SQLInstallTranslatorW
+#define  SQLRemoveTranslator          SQLRemoveTranslatorW
+#define  SQLRemoveDriver              SQLRemoveDriverW
+#define  SQLConfigDriver              SQLConfigDriverW
+#define	 SQLInstallerError            SQLInstallerErrorW
+#define	 SQLPostInstallerError        SQLPostInstallerErrorW
+#define  SQLReadFileDSN               SQLReadFileDSNW
+#define  SQLWriteFileDSN              SQLWriteFileDSNW
+#define  SQLInstallDriverEx           SQLInstallDriverExW
+#define  SQLInstallTranslatorEx       SQLInstallTranslatorExW
+
+#endif /* UNICODE */
+#endif /* SQL_NOUNICODEMAP */
+
+#ifdef __cplusplus
+} 
+#endif
+
+#endif /* _ODBCINST_H */

+ 1187 - 0
odbc.mod/iodbc/include/sql.h

@@ -0,0 +1,1187 @@
+/*
+ *  sql.h
+ *
+ *  $Id$
+ *
+ *  ODBC defines
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SQL_H
+#define _SQL_H
+
+/*
+ *  Set default specification to ODBC 3.51
+ */
+#ifndef ODBCVER
+#define ODBCVER		0x0351
+#endif
+
+#ifndef _SQLTYPES_H
+#include <sqltypes.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ *  Useful Constants
+ */
+#define SQL_MAX_MESSAGE_LENGTH			512
+
+
+/*
+ *  Handle types
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_HANDLE_ENV				1
+#define SQL_HANDLE_DBC				2
+#define SQL_HANDLE_STMT				3
+#define SQL_HANDLE_DESC				4
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Function return codes
+ */
+#define SQL_SUCCESS				0
+#define SQL_SUCCESS_WITH_INFO			1
+#define SQL_STILL_EXECUTING			2
+#define SQL_ERROR				(-1)
+#define SQL_INVALID_HANDLE			(-2)
+#define SQL_NEED_DATA				99
+#if (ODBCVER >= 0x0300)
+#define SQL_NO_DATA				100
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO
+ */
+#define SQL_SUCCEEDED(rc)			(((rc) & (~1)) == 0)
+
+
+/*
+ *  Special length values
+ */
+#define SQL_NULL_DATA				(-1)
+#define SQL_DATA_AT_EXEC			(-2)
+
+
+/*
+ *  Flags for null-terminated strings
+ */
+#define SQL_NTS					(-3)
+#define SQL_NTSL				(-3L)
+
+
+/*
+ *  Standard SQL datatypes, using ANSI type numbering
+ */
+#define SQL_UNKNOWN_TYPE			0
+#define SQL_CHAR				1
+#define SQL_NUMERIC				2
+#define SQL_DECIMAL				3
+#define SQL_INTEGER				4
+#define SQL_SMALLINT				5
+#define SQL_FLOAT				6
+#define SQL_REAL				7
+#define SQL_DOUBLE				8
+#if (ODBCVER >= 0x0300)
+#define SQL_DATETIME				9
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_VARCHAR				12
+
+
+/*
+ *  SQLGetTypeInfo request for all data types
+ */
+#define SQL_ALL_TYPES				0
+
+
+/*
+ *  Statement attribute values for date/time data types
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_TYPE_DATE				91
+#define SQL_TYPE_TIME				92
+#define SQL_TYPE_TIMESTAMP			93
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Date/Time length constants
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DATE_LEN				10
+#define SQL_TIME_LEN				8	/* add P+1 if prec >0 */
+#define SQL_TIMESTAMP_LEN			19	/* add P+1 if prec >0 */
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  NULL status constants
+ */
+#define SQL_NO_NULLS				0
+#define SQL_NULLABLE				1
+#define SQL_NULLABLE_UNKNOWN			2
+
+
+/*
+ *  NULL Handles
+ */
+#define SQL_NULL_HENV				0
+#define SQL_NULL_HDBC				0
+#define SQL_NULL_HSTMT				0
+#if (ODBCVER >= 0x0300)
+#define SQL_NULL_HDESC				0
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  NULL handle for parent argument to SQLAllocHandle when allocating
+ *  a SQLHENV
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_NULL_HANDLE				0L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  CLI option values
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_FALSE				0
+#define SQL_TRUE				1
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData()
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DEFAULT				99
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLDataSources/SQLFetchScroll - FetchOrientation
+ */
+#define SQL_FETCH_NEXT				1
+#define SQL_FETCH_FIRST				2
+
+
+/*
+ *  SQLFetchScroll - FetchOrientation
+ */
+#define SQL_FETCH_LAST				3
+#define SQL_FETCH_PRIOR				4
+#define SQL_FETCH_ABSOLUTE			5
+#define SQL_FETCH_RELATIVE			6
+
+
+/*
+ *  SQLFreeStmt
+ */
+#define SQL_CLOSE				0
+#define SQL_DROP				1
+#define SQL_UNBIND				2
+#define SQL_RESET_PARAMS			3
+
+
+/*
+ *  SQLGetConnectAttr - connection attributes
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ATTR_AUTO_IPD			10001
+#define SQL_ATTR_METADATA_ID			10014
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *   SQLGetData() code indicating that the application row descriptor
+ *   specifies the data type
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ARD_TYPE				(-99)
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetDescField - 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
+#define SQL_DESC_OCTET_LENGTH_PTR		1004
+#define SQL_DESC_PRECISION			1005
+#define SQL_DESC_SCALE				1006
+#define SQL_DESC_DATETIME_INTERVAL_CODE		1007
+#define SQL_DESC_NULLABLE			1008
+#define SQL_DESC_INDICATOR_PTR			1009
+#define SQL_DESC_DATA_PTR			1010
+#define SQL_DESC_NAME				1011
+#define SQL_DESC_UNNAMED			1012
+#define SQL_DESC_OCTET_LENGTH			1013
+#define SQL_DESC_ALLOC_TYPE			1099
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetDescField - SQL_DESC_ALLOC_TYPE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DESC_ALLOC_AUTO			1
+#define SQL_DESC_ALLOC_USER			2
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetDescField - SQL_DESC_DATETIME_INTERVAL_CODE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CODE_DATE				1
+#define SQL_CODE_TIME				2
+#define SQL_CODE_TIMESTAMP			3
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetDescField - SQL_DESC_UNNAMED
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_NAMED				0
+#define SQL_UNNAMED				1
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetDiagField - 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
+#define SQL_DIAG_SQLSTATE			4
+#define SQL_DIAG_NATIVE				5
+#define SQL_DIAG_MESSAGE_TEXT			6
+#define SQL_DIAG_DYNAMIC_FUNCTION		7
+#define SQL_DIAG_CLASS_ORIGIN			8
+#define SQL_DIAG_SUBCLASS_ORIGIN		9
+#define SQL_DIAG_CONNECTION_NAME		10
+#define SQL_DIAG_SERVER_NAME			11
+#define SQL_DIAG_DYNAMIC_FUNCTION_CODE		12
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetDiagField - SQL_DIAG_DYNAMIC_FUNCTION_CODE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DIAG_ALTER_DOMAIN			3
+#define SQL_DIAG_ALTER_TABLE			4
+#define SQL_DIAG_CALL				7
+#define SQL_DIAG_CREATE_ASSERTION		6
+#define SQL_DIAG_CREATE_CHARACTER_SET		8
+#define SQL_DIAG_CREATE_COLLATION		10
+#define SQL_DIAG_CREATE_DOMAIN			23
+#define SQL_DIAG_CREATE_INDEX			(-1)
+#define SQL_DIAG_CREATE_SCHEMA			64
+#define SQL_DIAG_CREATE_TABLE			77
+#define SQL_DIAG_CREATE_TRANSLATION		79
+#define SQL_DIAG_CREATE_VIEW			84
+#define SQL_DIAG_DELETE_WHERE			19
+#define	SQL_DIAG_DROP_ASSERTION			24
+#define	SQL_DIAG_DROP_CHARACTER_SET		25
+#define	SQL_DIAG_DROP_COLLATION			26
+#define	SQL_DIAG_DROP_DOMAIN			27
+#define SQL_DIAG_DROP_INDEX			(-2)
+#define SQL_DIAG_DROP_SCHEMA			31
+#define SQL_DIAG_DROP_TABLE			32
+#define SQL_DIAG_DROP_TRANSLATION		33
+#define SQL_DIAG_DROP_VIEW			36
+#define SQL_DIAG_DYNAMIC_DELETE_CURSOR		38
+#define SQL_DIAG_DYNAMIC_UPDATE_CURSOR		81
+#define SQL_DIAG_GRANT				48
+#define SQL_DIAG_INSERT				50
+#define SQL_DIAG_REVOKE				59
+#define SQL_DIAG_SELECT_CURSOR			85
+#define SQL_DIAG_UNKNOWN_STATEMENT		0
+#define SQL_DIAG_UPDATE_WHERE			82
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetEnvAttr - environment attribute
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ATTR_OUTPUT_NTS			10001
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetFunctions
+ */
+#define SQL_API_SQLALLOCCONNECT			1
+#define SQL_API_SQLALLOCENV			2
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLALLOCHANDLE			1001
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLALLOCSTMT			3
+#define SQL_API_SQLBINDCOL			4
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLBINDPARAM			1002
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLCANCEL			5
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLCLOSECURSOR			1003
+#define SQL_API_SQLCOLATTRIBUTE			6
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLCOLUMNS			40
+#define SQL_API_SQLCONNECT			7
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLCOPYDESC			1004
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLDATASOURCES			57
+#define SQL_API_SQLDESCRIBECOL			8
+#define SQL_API_SQLDISCONNECT			9
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLENDTRAN			1005
+#endif	/* ODBCVER >= 0x0300 */
+#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	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLFREECONNECT			14
+#define SQL_API_SQLFREEENV			15
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLFREEHANDLE			1006
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLFREESTMT			16
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLGETCONNECTATTR		1007
+#endif	/* ODBCVER >= 0x0300 */
+#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	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLGETFUNCTIONS			44
+#define SQL_API_SQLGETINFO			45
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLGETSTMTATTR			1014
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLGETSTMTOPTION		46
+#define SQL_API_SQLGETTYPEINFO			47
+#define SQL_API_SQLNUMRESULTCOLS		18
+#define SQL_API_SQLPARAMDATA			48
+#define SQL_API_SQLPREPARE			19
+#define SQL_API_SQLPUTDATA			49
+#define SQL_API_SQLROWCOUNT			20
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLSETCONNECTATTR		1016
+#endif	/* ODBCVER >= 0x0300 */
+#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	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLSETPARAM			22
+#if (ODBCVER >= 0x0300)
+#define SQL_API_SQLSETSTMTATTR			1020
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_API_SQLSETSTMTOPTION		51
+#define SQL_API_SQLSPECIALCOLUMNS		52
+#define SQL_API_SQLSTATISTICS			53
+#define SQL_API_SQLTABLES			54
+#define SQL_API_SQLTRANSACT			23
+
+
+/*
+ *  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	/* ODBCVER >= 0x0300 */
+#define SQL_DATA_SOURCE_NAME			2
+#define SQL_FETCH_DIRECTION			8
+#define SQL_SERVER_NAME				13
+#define SQL_SEARCH_PATTERN_ESCAPE		14
+#define SQL_DBMS_NAME				17
+#define SQL_DBMS_VER				18
+#define SQL_ACCESSIBLE_TABLES			19
+#define SQL_ACCESSIBLE_PROCEDURES		20
+#define SQL_CURSOR_COMMIT_BEHAVIOR		23
+#define SQL_DATA_SOURCE_READ_ONLY		25
+#define SQL_DEFAULT_TXN_ISOLATION		26
+#define SQL_IDENTIFIER_CASE			28
+#define SQL_IDENTIFIER_QUOTE_CHAR		29
+#define SQL_MAX_COLUMN_NAME_LEN			30
+#define SQL_MAXIMUM_COLUMN_NAME_LENGTH		SQL_MAX_COLUMN_NAME_LEN
+#define SQL_MAX_CURSOR_NAME_LEN			31
+#define SQL_MAXIMUM_CURSOR_NAME_LENGTH		SQL_MAX_CURSOR_NAME_LEN
+#define SQL_MAX_SCHEMA_NAME_LEN			32
+#define SQL_MAXIMUM_SCHEMA_NAME_LENGTH		SQL_MAX_SCHEMA_NAME_LEN
+#define SQL_MAX_CATALOG_NAME_LEN		34
+#define SQL_MAXIMUM_CATALOG_NAME_LENGTH		SQL_MAX_CATALOG_NAME_LEN
+#define SQL_MAX_TABLE_NAME_LEN			35
+#define SQL_SCROLL_CONCURRENCY			43
+#define SQL_TXN_CAPABLE				46
+#define SQL_TRANSACTION_CAPABLE			SQL_TXN_CAPABLE
+#define SQL_USER_NAME				47
+#define SQL_TXN_ISOLATION_OPTION		72
+#define SQL_TRANSACTION_ISOLATION_OPTION	SQL_TXN_ISOLATION_OPTION
+#define SQL_INTEGRITY				73
+#define SQL_GETDATA_EXTENSIONS			81
+#define SQL_NULL_COLLATION			85
+#define SQL_ALTER_TABLE				86
+#define SQL_ORDER_BY_COLUMNS_IN_SELECT		90
+#define SQL_SPECIAL_CHARACTERS			94
+#define SQL_MAX_COLUMNS_IN_GROUP_BY		97
+#define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY		SQL_MAX_COLUMNS_IN_GROUP_BY
+#define SQL_MAX_COLUMNS_IN_INDEX		98
+#define SQL_MAXIMUM_COLUMNS_IN_INDEX		SQL_MAX_COLUMNS_IN_INDEX
+#define SQL_MAX_COLUMNS_IN_ORDER_BY		99
+#define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY		SQL_MAX_COLUMNS_IN_ORDER_BY
+#define SQL_MAX_COLUMNS_IN_SELECT		100
+#define SQL_MAXIMUM_COLUMNS_IN_SELECT		SQL_MAX_COLUMNS_IN_SELECT
+#define SQL_MAX_COLUMNS_IN_TABLE		101
+#define SQL_MAX_INDEX_SIZE			102
+#define SQL_MAXIMUM_INDEX_SIZE			SQL_MAX_INDEX_SIZE
+#define SQL_MAX_ROW_SIZE			104
+#define SQL_MAXIMUM_ROW_SIZE			SQL_MAX_ROW_SIZE
+#define SQL_MAX_STATEMENT_LEN			105
+#define SQL_MAXIMUM_STATEMENT_LENGTH		SQL_MAX_STATEMENT_LEN
+#define SQL_MAX_TABLES_IN_SELECT		106
+#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
+#define SQL_CATALOG_NAME			10003
+#define SQL_COLLATION_SEQ			10004
+#define SQL_MAX_IDENTIFIER_LEN			10005
+#define SQL_MAXIMUM_IDENTIFIER_LENGTH		SQL_MAX_IDENTIFIER_LEN
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_ALTER_TABLE
+ */
+#if (ODBCVER >= 0x0200)
+#define SQL_AT_ADD_COLUMN			0x00000001L
+#define SQL_AT_DROP_COLUMN			0x00000002L
+#endif	/* ODBCVER >= 0x0300 */
+
+#if (ODBCVER >= 0x0300)
+#define SQL_AT_ADD_CONSTRAINT			0x00000008L
+/*
+ * The following bitmasks are ODBC extensions and defined in sqlext.h:
+ *
+ * #define SQL_AT_COLUMN_SINGLE				0x00000020L
+ * #define SQL_AT_ADD_COLUMN_DEFAULT			0x00000040L
+ * #define SQL_AT_ADD_COLUMN_COLLATION			0x00000080L
+ * #define SQL_AT_SET_COLUMN_DEFAULT			0x00000100L
+ * #define SQL_AT_DROP_COLUMN_DEFAULT			0x00000200L
+ * #define SQL_AT_DROP_COLUMN_CASCADE			0x00000400L
+ * #define SQL_AT_DROP_COLUMN_RESTRICT			0x00000800L
+ * #define SQL_AT_ADD_TABLE_CONSTRAINT			0x00001000L
+ * #define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE		0x00002000L
+ * #define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT	0x00004000L
+ * #define SQL_AT_CONSTRAINT_NAME_DEFINITION		0x00008000L
+ * #define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED		0x00010000L
+ * #define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE	0x00020000L
+ * #define SQL_AT_CONSTRAINT_DEFERRABLE			0x00040000L
+ * #define SQL_AT_CONSTRAINT_NON_DEFERRABLE		0x00080000L
+ */
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_ASYNC_MODE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_AM_NONE				0
+#define SQL_AM_CONNECTION			1
+#define SQL_AM_STATEMENT			2
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CURSOR_COMMIT_BEHAVIOR
+ */
+#define SQL_CB_DELETE				0
+#define SQL_CB_CLOSE				1
+#define SQL_CB_PRESERVE				2
+
+
+/*
+ *  SQLGetInfo - SQL_FETCH_DIRECTION
+ */
+#define SQL_FD_FETCH_NEXT			0x00000001L
+#define SQL_FD_FETCH_FIRST			0x00000002L
+#define SQL_FD_FETCH_LAST			0x00000004L
+#define SQL_FD_FETCH_PRIOR			0x00000008L
+#define SQL_FD_FETCH_ABSOLUTE			0x00000010L
+#define SQL_FD_FETCH_RELATIVE			0x00000020L
+
+
+/*
+ *  SQLGetInfo - SQL_GETDATA_EXTENSIONS
+ */
+#define SQL_GD_ANY_COLUMN			0x00000001L
+#define SQL_GD_ANY_ORDER			0x00000002L
+
+
+/*
+ *  SQLGetInfo - SQL_IDENTIFIER_CASE
+ */
+#define SQL_IC_UPPER				1
+#define SQL_IC_LOWER				2
+#define SQL_IC_SENSITIVE			3
+#define SQL_IC_MIXED				4
+
+
+/*
+ *  SQLGetInfo - SQL_NULL_COLLATION
+ */
+#define SQL_NC_HIGH				0
+#define SQL_NC_LOW				1
+
+
+/*
+ *  SQLGetInfo - SQL_OJ_CAPABILITIES
+ */
+#if (ODBCVER >= 0x0201)
+#define SQL_OJ_LEFT				0x00000001L
+#define SQL_OJ_RIGHT				0x00000002L
+#define SQL_OJ_FULL				0x00000004L
+#define SQL_OJ_NESTED				0x00000008L
+#define SQL_OJ_NOT_ORDERED			0x00000010L
+#define SQL_OJ_INNER				0x00000020L
+#define SQL_OJ_ALL_COMPARISON_OPS		0x00000040L
+#endif
+
+
+/*
+ *  SQLGetInfo - SQL_SCROLL_CONCURRENCY
+ */
+#define SQL_SCCO_READ_ONLY			0x00000001L
+#define SQL_SCCO_LOCK				0x00000002L
+#define SQL_SCCO_OPT_ROWVER			0x00000004L
+#define SQL_SCCO_OPT_VALUES			0x00000008L
+
+
+/*
+ *  SQLGetInfo - SQL_TXN_CAPABLE
+ */
+#define SQL_TC_NONE				0
+#define SQL_TC_DML				1
+#define SQL_TC_ALL				2
+#define SQL_TC_DDL_COMMIT			3
+#define SQL_TC_DDL_IGNORE			4
+
+
+/*
+ *  SQLGetInfo - SQL_TXN_ISOLATION_OPTION
+ */
+#define SQL_TXN_READ_UNCOMMITTED		0x00000001L
+#define SQL_TRANSACTION_READ_UNCOMMITTED	SQL_TXN_READ_UNCOMMITTED
+#define SQL_TXN_READ_COMMITTED			0x00000002L
+#define SQL_TRANSACTION_READ_COMMITTED		SQL_TXN_READ_COMMITTED
+#define SQL_TXN_REPEATABLE_READ			0x00000004L
+#define SQL_TRANSACTION_REPEATABLE_READ		SQL_TXN_REPEATABLE_READ
+#define SQL_TXN_SERIALIZABLE			0x00000008L
+#define SQL_TRANSACTION_SERIALIZABLE		SQL_TXN_SERIALIZABLE
+
+
+/*
+ *  SQLGetStmtAttr - 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	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetStmtAttr - SQL_ATTR_CURSOR_SCROLLABLE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_NONSCROLLABLE			0
+#define SQL_SCROLLABLE				1
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetStmtAttr - SQL_ATTR_CURSOR_SENSITIVITY
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_UNSPECIFIED				0
+#define SQL_INSENSITIVE				1
+#define SQL_SENSITIVE				2
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetTypeInfo - SEARCHABLE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_PRED_NONE				0
+#define SQL_PRED_CHAR				1
+#define SQL_PRED_BASIC				2
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLSpecialColumns - Column scopes
+ */
+#define SQL_SCOPE_CURROW			0
+#define SQL_SCOPE_TRANSACTION			1
+#define SQL_SCOPE_SESSION			2
+
+
+/*
+ *  SQLSpecialColumns - PSEUDO_COLUMN
+ */
+#define SQL_PC_UNKNOWN				0
+#if (ODBCVER >= 0x0300)
+#define SQL_PC_NON_PSEUDO			1
+#endif	/* ODBCVER >= 0x0300 */
+#define SQL_PC_PSEUDO				2
+
+
+/*
+ *  SQLSpecialColumns - IdentifierType
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ROW_IDENTIFIER			1
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLStatistics - fUnique
+ */
+#define SQL_INDEX_UNIQUE			0
+#define SQL_INDEX_ALL				1
+
+
+/*
+ *  SQLStatistics - TYPE
+ */
+#define SQL_INDEX_CLUSTERED			1
+#define SQL_INDEX_HASHED			2
+#define SQL_INDEX_OTHER				3
+
+
+/*
+ *  SQLTransact/SQLEndTran
+ */
+#define SQL_COMMIT				0
+#define SQL_ROLLBACK				1
+
+
+/*
+ *  Function Prototypes
+ */
+SQLRETURN SQL_API SQLAllocConnect (
+    SQLHENV		  EnvironmentHandle,
+    SQLHDBC		* ConnectionHandle);
+
+SQLRETURN SQL_API SQLAllocEnv (
+    SQLHENV		* EnvironmentHandle);
+
+#if (ODBCVER >= 0x0300)
+SQLRETURN SQL_API SQLAllocHandle (
+    SQLSMALLINT		  HandleType,
+    SQLHANDLE		  InputHandle,
+    SQLHANDLE		* OutputHandle);
+#endif	/* ODBCVER >= 0x0300 */
+
+SQLRETURN SQL_API SQLAllocStmt (
+    SQLHDBC		  ConnectionHandle,
+    SQLHSTMT		* StatementHandle);
+
+SQLRETURN SQL_API SQLBindCol (
+    SQLHSTMT		  StatementHandle,
+    SQLUSMALLINT	  ColumnNumber,
+    SQLSMALLINT		  TargetType,
+    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);
+
+/*
+ *  Using SQLLEN * instead of SQLPOINTER for NumericAttribute,
+ *  makes the prototype the same as SQLColAttributes (deprecated)
+ *  and clearer for 64bit ports
+ */
+SQLRETURN SQL_API SQLColAttribute (
+    SQLHSTMT		  StatementHandle,
+    SQLUSMALLINT	  ColumnNumber,
+    SQLUSMALLINT	  FieldIdentifier,
+    SQLPOINTER		  CharacterAttribute,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* StringLength,
+    SQLLEN		* NumericAttribute);
+#endif
+
+SQLRETURN SQL_API SQLColumns (
+    SQLHSTMT		  StatementHandle,
+    SQLCHAR		* CatalogName,
+    SQLSMALLINT		  NameLength1,
+    SQLCHAR		* SchemaName,
+    SQLSMALLINT		  NameLength2,
+    SQLCHAR		* TableName,
+    SQLSMALLINT		  NameLength3,
+    SQLCHAR		* ColumnName,
+    SQLSMALLINT		  NameLength4);
+
+SQLRETURN SQL_API SQLConnect (
+    SQLHDBC		  ConnectionHandle,
+    SQLCHAR		* ServerName,
+    SQLSMALLINT		  NameLength1,
+    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,
+    SQLSMALLINT		  BufferLength1,
+    SQLSMALLINT		* NameLength1,
+    SQLCHAR		* Description,
+    SQLSMALLINT		  BufferLength2,
+    SQLSMALLINT		* NameLength2);
+
+SQLRETURN SQL_API SQLDescribeCol (
+    SQLHSTMT		  StatementHandle,
+    SQLUSMALLINT	  ColumnNumber,
+    SQLCHAR		* ColumnName,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* NameLength,
+    SQLSMALLINT		* DataType,
+    SQLULEN		* ColumnSize,
+    SQLSMALLINT		* DecimalDigits,
+    SQLSMALLINT		* Nullable);
+
+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,
+    SQLCHAR		* Sqlstate,
+    SQLINTEGER		* NativeError,
+    SQLCHAR		* MessageText,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* TextLength);
+
+SQLRETURN SQL_API SQLExecDirect (
+    SQLHSTMT		  StatementHandle,
+    SQLCHAR		* StatementText,
+    SQLINTEGER		  TextLength);
+
+SQLRETURN SQL_API SQLExecute (
+    SQLHSTMT		  StatementHandle);
+
+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);
+
+SQLRETURN SQL_API SQLGetCursorName (
+    SQLHSTMT		  StatementHandle,
+    SQLCHAR		* CursorName,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* NameLength);
+
+SQLRETURN SQL_API SQLGetData (
+    SQLHSTMT		  StatementHandle,
+    SQLUSMALLINT	  ColumnNumber,
+    SQLSMALLINT		  TargetType,
+    SQLPOINTER		  TargetValue,
+    SQLLEN		  BufferLength,
+    SQLLEN		* StrLen_or_Ind);
+
+#if (ODBCVER >= 0x0300)
+SQLRETURN SQL_API SQLGetDescField (
+    SQLHDESC		  DescriptorHandle,
+    SQLSMALLINT		  RecNumber,
+    SQLSMALLINT		  FieldIdentifier,
+    SQLPOINTER		  Value,
+    SQLINTEGER		  BufferLength,
+    SQLINTEGER		* StringLength);
+
+SQLRETURN SQL_API SQLGetDescRec (
+    SQLHDESC		  DescriptorHandle,
+    SQLSMALLINT		  RecNumber,
+    SQLCHAR		* Name,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* StringLength,
+    SQLSMALLINT		* Type,
+    SQLSMALLINT		* SubType,
+    SQLLEN		* Length,
+    SQLSMALLINT		* Precision,
+    SQLSMALLINT		* Scale,
+    SQLSMALLINT		* Nullable);
+
+SQLRETURN SQL_API SQLGetDiagField (
+    SQLSMALLINT		  HandleType,
+    SQLHANDLE		  Handle,
+    SQLSMALLINT		  RecNumber,
+    SQLSMALLINT		  DiagIdentifier,
+    SQLPOINTER		  DiagInfo,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* StringLength);
+
+SQLRETURN SQL_API SQLGetDiagRec (
+    SQLSMALLINT		  HandleType,
+    SQLHANDLE		  Handle,
+    SQLSMALLINT		  RecNumber,
+    SQLCHAR		* Sqlstate,
+    SQLINTEGER		* NativeError,
+    SQLCHAR		* MessageText,
+    SQLSMALLINT		  BufferLength,
+    SQLSMALLINT		* TextLength);
+
+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);
+
+SQLRETURN SQL_API SQLGetInfo (
+    SQLHDBC		  ConnectionHandle,
+    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);
+
+SQLRETURN SQL_API SQLGetTypeInfo (
+    SQLHSTMT		  StatementHandle,
+    SQLSMALLINT		  DataType);
+
+SQLRETURN SQL_API SQLNumResultCols (
+    SQLHSTMT		  StatementHandle,
+    SQLSMALLINT		* ColumnCount);
+
+SQLRETURN SQL_API SQLParamData (
+    SQLHSTMT		  StatementHandle,
+    SQLPOINTER		* Value);
+
+SQLRETURN SQL_API SQLPrepare (
+    SQLHSTMT		  StatementHandle,
+    SQLCHAR		* StatementText,
+    SQLINTEGER		  TextLength);
+
+SQLRETURN SQL_API SQLPutData (
+    SQLHSTMT		  StatementHandle,
+    SQLPOINTER		  Data,
+    SQLLEN		  StrLen_or_Ind);
+
+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);
+
+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);
+
+SQLRETURN SQL_API SQLSetDescRec (
+    SQLHDESC		  DescriptorHandle,
+    SQLSMALLINT		  RecNumber,
+    SQLSMALLINT		  Type,
+    SQLSMALLINT		  SubType,
+    SQLLEN		  Length,
+    SQLSMALLINT		  Precision,
+    SQLSMALLINT		  Scale,
+    SQLPOINTER		  Data,
+    SQLLEN		* StringLength,
+    SQLLEN		* Indicator);
+
+SQLRETURN SQL_API SQLSetEnvAttr (
+    SQLHENV		  EnvironmentHandle,
+    SQLINTEGER		  Attribute,
+    SQLPOINTER		  Value,
+    SQLINTEGER		  StringLength);
+#endif /* ODBCVER >= 0x0300 */
+
+
+#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);
+
+SQLRETURN SQL_API SQLSpecialColumns (
+    SQLHSTMT		  StatementHandle,
+    SQLUSMALLINT	  IdentifierType,
+    SQLCHAR		* CatalogName,
+    SQLSMALLINT		  NameLength1,
+    SQLCHAR		* SchemaName,
+    SQLSMALLINT		  NameLength2,
+    SQLCHAR		* TableName,
+    SQLSMALLINT		  NameLength3,
+    SQLUSMALLINT	  Scope,
+    SQLUSMALLINT	  Nullable);
+
+SQLRETURN SQL_API SQLStatistics (
+    SQLHSTMT		  StatementHandle,
+    SQLCHAR		* CatalogName,
+    SQLSMALLINT		  NameLength1,
+    SQLCHAR		* SchemaName,
+    SQLSMALLINT		  NameLength2,
+    SQLCHAR		* TableName,
+    SQLSMALLINT		  NameLength3,
+    SQLUSMALLINT	  Unique,
+    SQLUSMALLINT	  Reserved);
+
+SQLRETURN SQL_API SQLTables (
+    SQLHSTMT		  StatementHandle,
+    SQLCHAR		* CatalogName,
+    SQLSMALLINT		  NameLength1,
+    SQLCHAR		* SchemaName,
+    SQLSMALLINT		  NameLength2,
+    SQLCHAR		* TableName,
+    SQLSMALLINT		  NameLength3,
+    SQLCHAR		* TableType,
+    SQLSMALLINT		  NameLength4);
+
+SQLRETURN SQL_API SQLTransact (
+    SQLHENV		  EnvironmentHandle,
+    SQLHDBC		  ConnectionHandle,
+    SQLUSMALLINT	  CompletionType);
+
+
+/*
+ *  Depreciated ODBC 1.0 function - Use SQLBindParameter
+ */
+SQLRETURN SQL_API SQLSetParam (
+    SQLHSTMT		  StatementHandle,
+    SQLUSMALLINT	  ParameterNumber,
+    SQLSMALLINT		  ValueType,
+    SQLSMALLINT		  ParameterType,
+    SQLULEN		  LengthPrecision,
+    SQLSMALLINT		  ParameterScale,
+    SQLPOINTER		  ParameterValue,
+    SQLLEN		* StrLen_or_Ind);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	 /* _SQL_H */

+ 2573 - 0
odbc.mod/iodbc/include/sqlext.h

@@ -0,0 +1,2573 @@
+/*
+ *  sqlext.h
+ *
+ *  $Id$
+ *
+ *  ODBC defines (ext)
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_SQLEXT_H
+#define _SQLEXT_H
+
+#ifndef _SQL_H
+#include <sql.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ *  Useful Constants
+ */
+#define SQL_SPEC_MAJOR    			3
+#define SQL_SPEC_MINOR	  			52
+#define SQL_SPEC_STRING  			"03.52"
+
+#define SQL_SQLSTATE_SIZE			5
+#define SQL_MAX_DSN_LENGTH			32
+#define SQL_MAX_OPTION_STRING_LENGTH   		256
+
+
+/*
+ *  Handle types
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_HANDLE_SENV				5
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Function return codes
+ */
+#if (ODBCVER < 0x0300)
+#define SQL_NO_DATA_FOUND			100
+#else
+#define SQL_NO_DATA_FOUND			SQL_NO_DATA
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ *  Special length values for attributes
+ */
+#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 */
+
+
+/*
+ *  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)
+#define SQL_BINARY				(-2)
+#define SQL_VARBINARY				(-3)
+#define SQL_LONGVARBINARY			(-4)
+#define SQL_BIGINT				(-5)
+#define SQL_TINYINT				(-6)
+#define SQL_BIT					(-7)
+#if (ODBCVER >= 0x0350)
+#define SQL_GUID				(-11)
+#endif	/* ODBCVER >= 0x0350 */
+
+
+/*
+ *  SQL Interval datatypes
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CODE_YEAR				1
+#define SQL_CODE_MONTH				2
+#define SQL_CODE_DAY				3
+#define SQL_CODE_HOUR				4
+#define SQL_CODE_MINUTE				5
+#define SQL_CODE_SECOND				6
+#define SQL_CODE_YEAR_TO_MONTH			7
+#define SQL_CODE_DAY_TO_HOUR			8
+#define SQL_CODE_DAY_TO_MINUTE			9
+#define SQL_CODE_DAY_TO_SECOND			10
+#define SQL_CODE_HOUR_TO_MINUTE			11
+#define SQL_CODE_HOUR_TO_SECOND			12
+#define SQL_CODE_MINUTE_TO_SECOND		13
+
+#define SQL_INTERVAL_YEAR			(100 + SQL_CODE_YEAR)
+#define SQL_INTERVAL_MONTH			(100 + SQL_CODE_MONTH)
+#define SQL_INTERVAL_DAY			(100 + SQL_CODE_DAY)
+#define SQL_INTERVAL_HOUR			(100 + SQL_CODE_HOUR)
+#define SQL_INTERVAL_MINUTE			(100 + SQL_CODE_MINUTE)
+#define SQL_INTERVAL_SECOND               	(100 + SQL_CODE_SECOND)
+#define SQL_INTERVAL_YEAR_TO_MONTH		(100 + SQL_CODE_YEAR_TO_MONTH)
+#define SQL_INTERVAL_DAY_TO_HOUR		(100 + SQL_CODE_DAY_TO_HOUR)
+#define SQL_INTERVAL_DAY_TO_MINUTE		(100 + SQL_CODE_DAY_TO_MINUTE)
+#define SQL_INTERVAL_DAY_TO_SECOND		(100 + SQL_CODE_DAY_TO_SECOND)
+#define SQL_INTERVAL_HOUR_TO_MINUTE		(100 + SQL_CODE_HOUR_TO_MINUTE)
+#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 */
+
+
+/*
+ *   SQL unicode data types
+ */
+#if (ODBCVER <= 0x0300)
+/* These definitions are historical and obsolete */
+#define SQL_UNICODE				(-95)
+#define SQL_UNICODE_VARCHAR			(-96)
+#define SQL_UNICODE_LONGVARCHAR			(-97)
+#define SQL_UNICODE_CHAR			SQL_UNICODE
+#else
+#define SQL_UNICODE				SQL_WCHAR
+#define SQL_UNICODE_VARCHAR			SQL_WVARCHAR
+#define SQL_UNICODE_LONGVARCHAR			SQL_WLONGVARCHAR
+#define SQL_UNICODE_CHAR			SQL_WCHAR
+#endif	/* ODBCVER >= 0x0300 */
+
+
+#if (ODBCVER < 0x0300)
+#define SQL_TYPE_DRIVER_START			SQL_INTERVAL_YEAR
+#define SQL_TYPE_DRIVER_END			SQL_UNICODE_LONGVARCHAR
+#endif	/* ODBCVER < 0x0300 */
+
+
+#define SQL_SIGNED_OFFSET			(-20)
+#define SQL_UNSIGNED_OFFSET			(-22)
+
+
+/*
+ *  C datatype to SQL datatype mapping
+ */
+#define SQL_C_CHAR   				SQL_CHAR
+#define SQL_C_LONG   				SQL_INTEGER
+#define SQL_C_SHORT  				SQL_SMALLINT
+#define SQL_C_FLOAT  				SQL_REAL
+#define SQL_C_DOUBLE 				SQL_DOUBLE
+#if (ODBCVER >= 0x0300)
+#define SQL_C_NUMERIC				SQL_NUMERIC
+#endif	 /* ODBCVER >= 0x0300 */
+#define SQL_C_DEFAULT				99
+
+
+#define SQL_C_DATE				SQL_DATE
+#define SQL_C_TIME				SQL_TIME
+#define SQL_C_TIMESTAMP				SQL_TIMESTAMP
+#define SQL_C_BINARY				SQL_BINARY
+#define SQL_C_BIT				SQL_BIT
+#define SQL_C_TINYINT				SQL_TINYINT
+#define SQL_C_SLONG				(SQL_C_LONG+SQL_SIGNED_OFFSET)
+#define SQL_C_SSHORT				(SQL_C_SHORT+SQL_SIGNED_OFFSET)
+#define SQL_C_STINYINT				(SQL_TINYINT+SQL_SIGNED_OFFSET)
+#define SQL_C_ULONG				(SQL_C_LONG+SQL_UNSIGNED_OFFSET)
+#define SQL_C_USHORT				(SQL_C_SHORT+SQL_UNSIGNED_OFFSET)
+#define SQL_C_UTINYINT				(SQL_TINYINT+SQL_UNSIGNED_OFFSET)
+
+#if defined(_WIN64)
+#define SQL_C_BOOKMARK				SQL_C_UBIGINT
+#else
+#define SQL_C_BOOKMARK				SQL_C_ULONG
+#endif
+
+#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
+#define SQL_C_INTERVAL_YEAR			SQL_INTERVAL_YEAR
+#define SQL_C_INTERVAL_MONTH			SQL_INTERVAL_MONTH
+#define SQL_C_INTERVAL_DAY			SQL_INTERVAL_DAY
+#define SQL_C_INTERVAL_HOUR			SQL_INTERVAL_HOUR
+#define SQL_C_INTERVAL_MINUTE			SQL_INTERVAL_MINUTE
+#define SQL_C_INTERVAL_SECOND			SQL_INTERVAL_SECOND
+#define SQL_C_INTERVAL_YEAR_TO_MONTH		SQL_INTERVAL_YEAR_TO_MONTH
+#define SQL_C_INTERVAL_DAY_TO_HOUR		SQL_INTERVAL_DAY_TO_HOUR
+#define SQL_C_INTERVAL_DAY_TO_MINUTE		SQL_INTERVAL_DAY_TO_MINUTE
+#define SQL_C_INTERVAL_DAY_TO_SECOND		SQL_INTERVAL_DAY_TO_SECOND
+#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
+#define SQL_C_SBIGINT				(SQL_BIGINT+SQL_SIGNED_OFFSET)
+#define SQL_C_UBIGINT				(SQL_BIGINT+SQL_UNSIGNED_OFFSET)
+#define SQL_C_VARBOOKMARK			SQL_C_BINARY
+#endif	 /* ODBCVER >= 0x0300 */
+
+#if (ODBCVER >= 0x0350)
+#define SQL_C_GUID				SQL_GUID
+#endif
+
+#define SQL_TYPE_NULL				0
+
+#if (ODBCVER < 0x0300)
+#define SQL_TYPE_MIN				SQL_BIT
+#define SQL_TYPE_MAX				SQL_VARCHAR
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ * ----------------------------------------------------------------------
+ *  Level 1 Functions
+ * ----------------------------------------------------------------------
+ */
+
+/*
+ *  SQLBindParameter
+ */
+#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)
+
+
+/*
+ *  binary length for driver specific attributes
+ */
+#define SQL_LEN_BINARY_ATTR_OFFSET		 (-100)
+#define SQL_LEN_BINARY_ATTR(length)	 (-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
+
+
+/*
+ *  SQLColAttributes - ODBC 2.x defines
+ */
+#define SQL_COLUMN_COUNT			0
+#define SQL_COLUMN_NAME				1
+#define SQL_COLUMN_TYPE				2
+#define SQL_COLUMN_LENGTH			3
+#define SQL_COLUMN_PRECISION			4
+#define SQL_COLUMN_SCALE			5
+#define SQL_COLUMN_DISPLAY_SIZE			6
+#define SQL_COLUMN_NULLABLE			7
+#define SQL_COLUMN_UNSIGNED			8
+#define SQL_COLUMN_MONEY			9
+#define SQL_COLUMN_UPDATABLE			10
+#define SQL_COLUMN_AUTO_INCREMENT		11
+#define SQL_COLUMN_CASE_SENSITIVE		12
+#define SQL_COLUMN_SEARCHABLE			13
+#define SQL_COLUMN_TYPE_NAME			14
+#define SQL_COLUMN_TABLE_NAME			15
+#define SQL_COLUMN_OWNER_NAME			16
+#define SQL_COLUMN_QUALIFIER_NAME		17
+#define SQL_COLUMN_LABEL			18
+#define SQL_COLATT_OPT_MAX			SQL_COLUMN_LABEL
+#if (ODBCVER < 0x0300)
+#define SQL_COLUMN_DRIVER_START			1000
+#endif	/* ODBCVER < 0x0300 */
+
+#define SQL_COLATT_OPT_MIN			SQL_COLUMN_COUNT
+
+
+/*
+ *  SQLColAttributes - SQL_COLUMN_UPDATABLE
+ */
+#define SQL_ATTR_READONLY			0
+#define SQL_ATTR_WRITE				1
+#define SQL_ATTR_READWRITE_UNKNOWN		2
+
+
+/*
+ *  SQLColAttributes - SQL_COLUMN_SEARCHABLE
+ */
+#define SQL_UNSEARCHABLE			0
+#define SQL_LIKE_ONLY				1
+#define SQL_ALL_EXCEPT_LIKE			2
+#define SQL_SEARCHABLE				3
+#define SQL_PRED_SEARCHABLE			SQL_SEARCHABLE
+
+
+/*
+ *  SQLDataSources - additional fetch directions
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_FETCH_FIRST_USER			31
+#define SQL_FETCH_FIRST_SYSTEM			32
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLDriverConnect
+ */
+#define SQL_DRIVER_NOPROMPT			0
+#define SQL_DRIVER_COMPLETE			1
+#define SQL_DRIVER_PROMPT			2
+#define SQL_DRIVER_COMPLETE_REQUIRED		3
+
+
+/*
+ *  SQLGetConnectAttr - ODBC 2.x attributes
+ */
+#define SQL_ACCESS_MODE				101
+#define SQL_AUTOCOMMIT				102
+#define SQL_LOGIN_TIMEOUT			103
+#define SQL_OPT_TRACE				104
+#define SQL_OPT_TRACEFILE			105
+#define SQL_TRANSLATE_DLL			106
+#define SQL_TRANSLATE_OPTION			107
+#define SQL_TXN_ISOLATION			108
+#define SQL_CURRENT_QUALIFIER			109
+#define SQL_ODBC_CURSORS			110
+#define SQL_QUIET_MODE				111
+#define SQL_PACKET_SIZE				112
+
+
+/*
+ *  SQLGetConnectAttr - ODBC 3.0 attributes
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ATTR_ACCESS_MODE			SQL_ACCESS_MODE
+#define SQL_ATTR_AUTOCOMMIT			SQL_AUTOCOMMIT
+#define SQL_ATTR_CONNECTION_TIMEOUT		113
+#define SQL_ATTR_CURRENT_CATALOG		SQL_CURRENT_QUALIFIER
+#define SQL_ATTR_DISCONNECT_BEHAVIOR		114
+#define SQL_ATTR_ENLIST_IN_DTC			1207
+#define SQL_ATTR_ENLIST_IN_XA			1208
+#define SQL_ATTR_LOGIN_TIMEOUT			SQL_LOGIN_TIMEOUT
+#define SQL_ATTR_ODBC_CURSORS			SQL_ODBC_CURSORS
+#define SQL_ATTR_PACKET_SIZE			SQL_PACKET_SIZE
+#define SQL_ATTR_QUIET_MODE			SQL_QUIET_MODE
+#define SQL_ATTR_TRACE				SQL_OPT_TRACE
+#define SQL_ATTR_TRACEFILE			SQL_OPT_TRACEFILE
+#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 */
+
+
+/*
+ *  These options have no meaning for a 3.0 driver
+ */
+#if (ODBCVER < 0x0300)
+#define SQL_CONN_OPT_MIN			SQL_ACCESS_MODE
+#define SQL_CONN_OPT_MAX			SQL_PACKET_SIZE
+#define SQL_CONNECT_OPT_DRVR_START		1000
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ *  SQLGetConnectAttr - SQL_ACCESS_MODE
+ */
+#define SQL_MODE_READ_WRITE			0UL
+#define SQL_MODE_READ_ONLY			1UL
+#define SQL_MODE_DEFAULT			SQL_MODE_READ_WRITE
+
+
+/*
+ *  SQLGetConnectAttr - SQL_AUTOCOMMIT
+ */
+#define SQL_AUTOCOMMIT_OFF			0UL
+#define SQL_AUTOCOMMIT_ON			1UL
+#define SQL_AUTOCOMMIT_DEFAULT			SQL_AUTOCOMMIT_ON
+
+
+/*
+ *  SQLGetConnectAttr - SQL_LOGIN_TIMEOUT
+ */
+#define SQL_LOGIN_TIMEOUT_DEFAULT		15UL
+
+
+/*
+ *  SQLGetConnectAttr - SQL_ODBC_CURSORS
+ */
+#define SQL_CUR_USE_IF_NEEDED			0UL
+#define SQL_CUR_USE_ODBC			1UL
+#define SQL_CUR_USE_DRIVER			2UL
+#define SQL_CUR_DEFAULT				SQL_CUR_USE_DRIVER
+
+
+/*
+ *  SQLGetConnectAttr - SQL_OPT_TRACE
+ */
+#define SQL_OPT_TRACE_OFF			0UL
+#define SQL_OPT_TRACE_ON			1UL
+#define SQL_OPT_TRACE_DEFAULT			SQL_OPT_TRACE_OFF
+#if defined (WIN32)
+#define SQL_OPT_TRACE_FILE_DEFAULT		"\\SQL.LOG"
+#define SQL_OPT_TRACE_FILE_DEFAULTW		L"\\SQL.LOG"
+#else
+#define SQL_OPT_TRACE_FILE_DEFAULT		"/tmp/odbc.log"
+#define SQL_OPT_TRACE_FILE_DEFAULTW		L"/tmp/odbc.log"
+#endif
+
+
+/*
+ *  SQLGetConnectAttr - SQL_ATTR_ANSI_APP
+ */
+#if (ODBCVER >= 0x0351)
+#define SQL_AA_TRUE				1L /* ANSI app */
+#define SQL_AA_FALSE				0L /* Unicode app */
+#endif
+
+
+/*
+ *  SQLGetConnectAttr - SQL_ATTR_CONNECTION_DEAD
+ */
+#define SQL_CD_TRUE				1L /* closed/dead */
+#define SQL_CD_FALSE				0L /* open/available */
+
+
+/*
+ *  SQLGetConnectAttr - SQL_ATTR_DISCONNECT_BEHAVIOR
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DB_RETURN_TO_POOL			0UL
+#define SQL_DB_DISCONNECT			1UL
+#define SQL_DB_DEFAULT				SQL_DB_RETURN_TO_POOL
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetConnectAttr - SQL_ATTR_ENLIST_IN_DTC
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DTC_DONE				0L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *   SQLGetConnectAttr - Unicode drivers
+ */
+#if (ODBCVER >= 0x0351)
+#define SQL_ATTR_ANSI_APP			115
+#endif
+
+
+/*
+ *  SQLGetData
+ */
+#define SQL_NO_TOTAL				(-4)
+
+
+/*
+ *  SQLGetDescField - 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
+#define SQL_DESC_BASE_COLUMN_NAME		22
+#define SQL_DESC_BASE_TABLE_NAME		23
+#define SQL_DESC_BIND_OFFSET_PTR		24
+#define SQL_DESC_BIND_TYPE			25
+#define SQL_DESC_CASE_SENSITIVE			SQL_COLUMN_CASE_SENSITIVE
+#define SQL_DESC_CATALOG_NAME			SQL_COLUMN_QUALIFIER_NAME
+#define SQL_DESC_CONCISE_TYPE			SQL_COLUMN_TYPE
+#define SQL_DESC_DATETIME_INTERVAL_PRECISION	26
+#define SQL_DESC_DISPLAY_SIZE			SQL_COLUMN_DISPLAY_SIZE
+#define SQL_DESC_FIXED_PREC_SCALE		SQL_COLUMN_MONEY
+#define SQL_DESC_LABEL				SQL_COLUMN_LABEL
+#define SQL_DESC_LITERAL_PREFIX			27
+#define SQL_DESC_LITERAL_SUFFIX			28
+#define SQL_DESC_LOCAL_TYPE_NAME		29
+#define SQL_DESC_MAXIMUM_SCALE			30
+#define SQL_DESC_MINIMUM_SCALE			31
+#define SQL_DESC_NUM_PREC_RADIX			32
+#define SQL_DESC_PARAMETER_TYPE			33
+#define SQL_DESC_ROWS_PROCESSED_PTR		34
+#if (ODBCVER >= 0x0350)
+#define SQL_DESC_ROWVER				35
+#endif	/* ODBCVER >= 0x0350 */
+#define SQL_DESC_SCHEMA_NAME			SQL_COLUMN_OWNER_NAME
+#define SQL_DESC_SEARCHABLE			SQL_COLUMN_SEARCHABLE
+#define SQL_DESC_TYPE_NAME			SQL_COLUMN_TYPE_NAME
+#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 */
+
+
+/*
+ *  SQLGetDiagField - 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 */
+
+
+/*
+ *  SQLGetDiagField  - 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
+
+
+#if (ODBCVER >= 0x0300)
+/*
+ *  SQLGetEnvAttr - Attributes
+ */
+#define SQL_ATTR_ODBC_VERSION			200
+#define SQL_ATTR_CONNECTION_POOLING		201
+#define SQL_ATTR_CP_MATCH			202
+
+
+/*
+ * SQLGetEnvAttr - SQL_ATTR_ODBC_VERSION
+ */
+#define SQL_OV_ODBC2				2UL
+#define SQL_OV_ODBC3				3UL
+
+
+/*
+ *  SQLGetEnvAttr - SQL_ATTR_CONNECTION_POOLING
+ */
+#define SQL_CP_OFF				0UL
+#define SQL_CP_ONE_PER_DRIVER			1UL
+#define SQL_CP_ONE_PER_HENV			2UL
+#define SQL_CP_DEFAULT				SQL_CP_OFF
+
+
+/*
+ * SQLGetEnvAttr - SQL_ATTR_CP_MATCH
+ */
+#define SQL_CP_STRICT_MATCH			0UL
+#define SQL_CP_RELAXED_MATCH			1UL
+#define SQL_CP_MATCH_DEFAULT			SQL_CP_STRICT_MATCH
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetFunctions - extensions to the X/Open specification
+ */
+#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
+#define SQL_API_SQLCOLUMNPRIVILEGES		56
+#define SQL_API_SQLDESCRIBEPARAM		58
+#define SQL_API_SQLDRIVERCONNECT		41
+#define SQL_API_SQLDRIVERS			71
+#define SQL_API_SQLEXTENDEDFETCH		59
+#define SQL_API_SQLFOREIGNKEYS			60
+#define SQL_API_SQLMORERESULTS			61
+#define SQL_API_SQLNATIVESQL			62
+#define SQL_API_SQLNUMPARAMS			63
+#define SQL_API_SQLPARAMOPTIONS			64
+#define SQL_API_SQLPRIMARYKEYS			65
+#define SQL_API_SQLPROCEDURECOLUMNS		66
+#define SQL_API_SQLPROCEDURES			67
+#define SQL_API_SQLSETPOS			68
+#define SQL_API_SQLSETSCROLLOPTIONS		69
+#define SQL_API_SQLTABLEPRIVILEGES		70
+
+
+/*
+ *  These are not useful anymore as the X/Open specification defines
+ *  functions in the 10000 range
+ */
+#if (ODBCVER < 0x0300)
+#define SQL_EXT_API_LAST			SQL_API_SQLBINDPARAMETER
+#define SQL_NUM_FUNCTIONS			23
+#define SQL_EXT_API_START			40
+#define SQL_NUM_EXTENSIONS		(SQL_EXT_API_LAST-SQL_EXT_API_START+1)
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ *  SQLGetFunctions - ODBC version 2.x and earlier
+ */
+#define SQL_API_ALL_FUNCTIONS			0
+
+
+/*
+ *  Loading by ordinal is not supported for 3.0 and above drivers
+ */
+#define SQL_API_LOADBYORDINAL			199
+
+
+/*
+ *  SQLGetFunctions - SQL_API_ODBC3_ALL_FUNCTIONS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_API_ODBC3_ALL_FUNCTIONS		999
+#define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE	250
+
+#define SQL_FUNC_EXISTS(pfExists, uwAPI) \
+    ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) & (1 << ((uwAPI) & 0x000F))) \
+    ? SQL_TRUE : SQL_FALSE)
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - ODBC 2.x extensions to the X/Open standard
+ */
+#define SQL_INFO_FIRST				0
+#define SQL_ACTIVE_CONNECTIONS			0 /* MAX_DRIVER_CONNECTIONS */
+#define SQL_ACTIVE_STATEMENTS			1 /* MAX_CONCURRENT_ACTIVITIES */
+#define SQL_DRIVER_HDBC				3
+#define SQL_DRIVER_HENV				4
+#define SQL_DRIVER_HSTMT			5
+#define SQL_DRIVER_NAME				6
+#define SQL_DRIVER_VER				7
+#define SQL_ODBC_API_CONFORMANCE		9
+#define SQL_ODBC_VER				10
+#define SQL_ROW_UPDATES				11
+#define SQL_ODBC_SAG_CLI_CONFORMANCE		12
+#define SQL_ODBC_SQL_CONFORMANCE		15
+#define SQL_PROCEDURES				21
+#define SQL_CONCAT_NULL_BEHAVIOR		22
+#define SQL_CURSOR_ROLLBACK_BEHAVIOR		24
+#define SQL_EXPRESSIONS_IN_ORDERBY		27
+#define SQL_MAX_OWNER_NAME_LEN			32 /* MAX_SCHEMA_NAME_LEN */
+#define SQL_MAX_PROCEDURE_NAME_LEN		33
+#define SQL_MAX_QUALIFIER_NAME_LEN		34 /* MAX_CATALOG_NAME_LEN */
+#define SQL_MULT_RESULT_SETS			36
+#define SQL_MULTIPLE_ACTIVE_TXN			37
+#define SQL_OUTER_JOINS				38
+#define SQL_OWNER_TERM				39
+#define SQL_PROCEDURE_TERM			40
+#define SQL_QUALIFIER_NAME_SEPARATOR		41
+#define SQL_QUALIFIER_TERM			42
+#define SQL_SCROLL_OPTIONS			44
+#define SQL_TABLE_TERM				45
+#define SQL_CONVERT_FUNCTIONS			48
+#define SQL_NUMERIC_FUNCTIONS			49
+#define SQL_STRING_FUNCTIONS			50
+#define SQL_SYSTEM_FUNCTIONS			51
+#define SQL_TIMEDATE_FUNCTIONS			52
+#define SQL_CONVERT_BIGINT			53
+#define SQL_CONVERT_BINARY			54
+#define SQL_CONVERT_BIT				55
+#define SQL_CONVERT_CHAR			56
+#define SQL_CONVERT_DATE			57
+#define SQL_CONVERT_DECIMAL			58
+#define SQL_CONVERT_DOUBLE			59
+#define SQL_CONVERT_FLOAT			60
+#define SQL_CONVERT_INTEGER			61
+#define SQL_CONVERT_LONGVARCHAR			62
+#define SQL_CONVERT_NUMERIC			63
+#define SQL_CONVERT_REAL			64
+#define SQL_CONVERT_SMALLINT			65
+#define SQL_CONVERT_TIME			66
+#define SQL_CONVERT_TIMESTAMP			67
+#define SQL_CONVERT_TINYINT			68
+#define SQL_CONVERT_VARBINARY			69
+#define SQL_CONVERT_VARCHAR			70
+#define SQL_CONVERT_LONGVARBINARY		71
+#define SQL_ODBC_SQL_OPT_IEF			73 /* SQL_INTEGRITY */
+#define SQL_CORRELATION_NAME			74
+#define SQL_NON_NULLABLE_COLUMNS		75
+#define SQL_DRIVER_HLIB				76
+#define SQL_DRIVER_ODBC_VER			77
+#define SQL_LOCK_TYPES				78
+#define SQL_POS_OPERATIONS			79
+#define SQL_POSITIONED_STATEMENTS		80
+#define SQL_BOOKMARK_PERSISTENCE		82
+#define SQL_STATIC_SENSITIVITY			83
+#define SQL_FILE_USAGE				84
+#define SQL_COLUMN_ALIAS			87
+#define SQL_GROUP_BY				88
+#define SQL_KEYWORDS				89
+#define SQL_OWNER_USAGE				91
+#define SQL_QUALIFIER_USAGE			92
+#define SQL_QUOTED_IDENTIFIER_CASE		93
+#define SQL_SUBQUERIES				95
+#define SQL_UNION				96
+#define SQL_MAX_ROW_SIZE_INCLUDES_LONG		103
+#define SQL_MAX_CHAR_LITERAL_LEN		108
+#define SQL_TIMEDATE_ADD_INTERVALS		109
+#define SQL_TIMEDATE_DIFF_INTERVALS		110
+#define SQL_NEED_LONG_DATA_LEN			111
+#define SQL_MAX_BINARY_LITERAL_LEN		112
+#define SQL_LIKE_ESCAPE_CLAUSE			113
+#define SQL_QUALIFIER_LOCATION			114
+
+#if (ODBCVER >= 0x0201 && ODBCVER < 0x0300)
+#define SQL_OJ_CAPABILITIES         65003  /* Temp value until ODBC 3.0 */
+#endif	/* ODBCVER >= 0x0201 && ODBCVER < 0x0300 */
+
+
+/*
+ *  These values are not useful anymore as X/Open defines values in the
+ *  10000 range
+ */
+#if (ODBCVER < 0x0300)
+#define SQL_INFO_LAST				SQL_QUALIFIER_LOCATION
+#define SQL_INFO_DRIVER_START			1000
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ *  SQLGetInfo - ODBC 3.x extensions to the X/Open standard
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ACTIVE_ENVIRONMENTS			116
+#define SQL_ALTER_DOMAIN			117
+
+#define SQL_SQL_CONFORMANCE			118
+#define SQL_DATETIME_LITERALS			119
+
+#define SQL_ASYNC_MODE				10021	/* new X/Open spec */
+#define SQL_BATCH_ROW_COUNT			120
+#define SQL_BATCH_SUPPORT			121
+#define SQL_CATALOG_LOCATION			SQL_QUALIFIER_LOCATION
+#define SQL_CATALOG_NAME_SEPARATOR		SQL_QUALIFIER_NAME_SEPARATOR
+#define SQL_CATALOG_TERM			SQL_QUALIFIER_TERM
+#define SQL_CATALOG_USAGE			SQL_QUALIFIER_USAGE
+#define SQL_CONVERT_WCHAR			122
+#define SQL_CONVERT_INTERVAL_DAY_TIME		123
+#define SQL_CONVERT_INTERVAL_YEAR_MONTH		124
+#define SQL_CONVERT_WLONGVARCHAR		125
+#define SQL_CONVERT_WVARCHAR			126
+#define SQL_CREATE_ASSERTION			127
+#define SQL_CREATE_CHARACTER_SET		128
+#define SQL_CREATE_COLLATION			129
+#define SQL_CREATE_DOMAIN			130
+#define SQL_CREATE_SCHEMA			131
+#define SQL_CREATE_TABLE			132
+#define SQL_CREATE_TRANSLATION			133
+#define SQL_CREATE_VIEW				134
+#define SQL_DRIVER_HDESC			135
+#define SQL_DROP_ASSERTION			136
+#define SQL_DROP_CHARACTER_SET			137
+#define SQL_DROP_COLLATION			138
+#define SQL_DROP_DOMAIN				139
+#define SQL_DROP_SCHEMA				140
+#define SQL_DROP_TABLE				141
+#define SQL_DROP_TRANSLATION			142
+#define SQL_DROP_VIEW				143
+#define SQL_DYNAMIC_CURSOR_ATTRIBUTES1		144
+#define SQL_DYNAMIC_CURSOR_ATTRIBUTES2		145
+#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1	146
+#define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2	147
+#define SQL_INDEX_KEYWORDS			148
+#define SQL_INFO_SCHEMA_VIEWS			149
+#define SQL_KEYSET_CURSOR_ATTRIBUTES1		150
+#define SQL_KEYSET_CURSOR_ATTRIBUTES2		151
+#define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS	10022	/* new X/Open spec */
+#define SQL_ODBC_INTERFACE_CONFORMANCE		152
+#define SQL_PARAM_ARRAY_ROW_COUNTS		153
+#define SQL_PARAM_ARRAY_SELECTS			154
+#define SQL_SCHEMA_TERM				SQL_OWNER_TERM
+#define SQL_SCHEMA_USAGE			SQL_OWNER_USAGE
+#define SQL_SQL92_DATETIME_FUNCTIONS		155
+#define SQL_SQL92_FOREIGN_KEY_DELETE_RULE	156
+#define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE	157
+#define SQL_SQL92_GRANT				158
+#define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS	159
+#define SQL_SQL92_PREDICATES			160
+#define SQL_SQL92_RELATIONAL_JOIN_OPERATORS	161
+#define SQL_SQL92_REVOKE			162
+#define SQL_SQL92_ROW_VALUE_CONSTRUCTOR		163
+#define SQL_SQL92_STRING_FUNCTIONS		164
+#define SQL_SQL92_VALUE_EXPRESSIONS		165
+#define SQL_STANDARD_CLI_CONFORMANCE		166
+#define SQL_STATIC_CURSOR_ATTRIBUTES1		167
+#define SQL_STATIC_CURSOR_ATTRIBUTES2		168
+
+#define SQL_AGGREGATE_FUNCTIONS			169
+#define SQL_DDL_INDEX				170
+#define SQL_DM_VER				171
+#define SQL_INSERT_STATEMENT			172
+#define SQL_CONVERT_GUID			173
+#define SQL_UNION_STATEMENT			SQL_UNION
+
+#endif	/* ODBCVER >= 0x0300 */
+
+#define SQL_DTC_TRANSITION_COST			1750
+
+
+/*
+ *  SQLGetInfo - SQL_AGGREGATE_FUNCTIONS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_AF_AVG				0x00000001L
+#define SQL_AF_COUNT				0x00000002L
+#define SQL_AF_MAX				0x00000004L
+#define SQL_AF_MIN				0x00000008L
+#define SQL_AF_SUM				0x00000010L
+#define SQL_AF_DISTINCT				0x00000020L
+#define SQL_AF_ALL				0x00000040L
+#endif	/* ODBCVER >= 0x0300 */
+
+/*
+ *  SQLGetInfo - SQL_ALTER_DOMAIN
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_AD_CONSTRAINT_NAME_DEFINITION	0x00000001L
+#define SQL_AD_ADD_DOMAIN_CONSTRAINT		0x00000002L
+#define SQL_AD_DROP_DOMAIN_CONSTRAINT		0x00000004L
+#define SQL_AD_ADD_DOMAIN_DEFAULT		0x00000008L
+#define SQL_AD_DROP_DOMAIN_DEFAULT		0x00000010L
+#define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED	0x00000020L
+#define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE	0x00000040L
+#define SQL_AD_ADD_CONSTRAINT_DEFERRABLE	0x00000080L
+#define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE	0x00000100L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_ALTER_TABLE
+ */
+#if (ODBCVER >= 0x0300)
+/*
+	* The following 5 bitmasks are defined in sql.h
+ *
+ * #define SQL_AT_ADD_COLUMN			0x00000001L
+ * #define SQL_AT_DROP_COLUMN			0x00000002L
+ * #define SQL_AT_ADD_CONSTRAINT		0x00000008L
+ */
+#define SQL_AT_ADD_COLUMN_SINGLE		0x00000020L
+#define SQL_AT_ADD_COLUMN_DEFAULT		0x00000040L
+#define SQL_AT_ADD_COLUMN_COLLATION		0x00000080L
+#define SQL_AT_SET_COLUMN_DEFAULT		0x00000100L
+#define SQL_AT_DROP_COLUMN_DEFAULT		0x00000200L
+#define SQL_AT_DROP_COLUMN_CASCADE		0x00000400L
+#define SQL_AT_DROP_COLUMN_RESTRICT		0x00000800L
+#define SQL_AT_ADD_TABLE_CONSTRAINT		0x00001000L
+#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE	0x00002000L
+#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT	0x00004000L
+#define SQL_AT_CONSTRAINT_NAME_DEFINITION	0x00008000L
+#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED	0x00010000L
+#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE	0x00020000L
+#define SQL_AT_CONSTRAINT_DEFERRABLE		0x00040000L
+#define SQL_AT_CONSTRAINT_NON_DEFERRABLE	0x00080000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_ASYNC_MODE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_AM_NONE				0
+#define SQL_AM_CONNECTION			1
+#define SQL_AM_STATEMENT			2
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_BATCH_ROW_COUNT
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_BRC_PROCEDURES			0x0000001
+#define SQL_BRC_EXPLICIT			0x0000002
+#define SQL_BRC_ROLLED_UP			0x0000004
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_BATCH_SUPPORT
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_BS_SELECT_EXPLICIT			0x00000001L
+#define SQL_BS_ROW_COUNT_EXPLICIT		0x00000002L
+#define SQL_BS_SELECT_PROC			0x00000004L
+#define SQL_BS_ROW_COUNT_PROC			0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_BOOKMARK_PERSISTENCE
+ */
+#define SQL_BP_CLOSE				0x00000001L
+#define SQL_BP_DELETE				0x00000002L
+#define SQL_BP_DROP				0x00000004L
+#define SQL_BP_TRANSACTION			0x00000008L
+#define SQL_BP_UPDATE				0x00000010L
+#define SQL_BP_OTHER_HSTMT			0x00000020L
+#define SQL_BP_SCROLL				0x00000040L
+
+
+/*
+ *  SQLGetInfo - SQL_CATALOG_LOCATION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CL_START				SQL_QL_START
+#define SQL_CL_END				SQL_QL_END
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CATALOG_USAGE
+ */
+#if (ODBCVER >= 0x0300)
+#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 */
+
+
+/*
+ *  SQLGetInfo - SQL_CONCAT_NULL_BEHAVIOR
+ */
+#define SQL_CB_NULL				0x0000
+#define SQL_CB_NON_NULL				0x0001
+
+
+/*
+ *  SQLGetInfo - SQL_CONVERT_* bitmask values
+ */
+#define SQL_CVT_CHAR				0x00000001L
+#define SQL_CVT_NUMERIC				0x00000002L
+#define SQL_CVT_DECIMAL				0x00000004L
+#define SQL_CVT_INTEGER				0x00000008L
+#define SQL_CVT_SMALLINT			0x00000010L
+#define SQL_CVT_FLOAT				0x00000020L
+#define SQL_CVT_REAL				0x00000040L
+#define SQL_CVT_DOUBLE				0x00000080L
+#define SQL_CVT_VARCHAR				0x00000100L
+#define SQL_CVT_LONGVARCHAR			0x00000200L
+#define SQL_CVT_BINARY				0x00000400L
+#define SQL_CVT_VARBINARY			0x00000800L
+#define SQL_CVT_BIT				0x00001000L
+#define SQL_CVT_TINYINT				0x00002000L
+#define SQL_CVT_BIGINT				0x00004000L
+#define SQL_CVT_DATE				0x00008000L
+#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
+#define SQL_CVT_WLONGVARCHAR			0x00400000L
+#define SQL_CVT_WVARCHAR			0x00800000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CONVERT_FUNCTIONS
+ */
+#define SQL_FN_CVT_CONVERT			0x00000001L
+#if (ODBCVER >= 0x0300)
+#define SQL_FN_CVT_CAST				0x00000002L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CORRELATION_NAME
+ */
+#define SQL_CN_NONE				0x0000
+#define SQL_CN_DIFFERENT			0x0001
+#define SQL_CN_ANY				0x0002
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_ASSERTION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA_CREATE_ASSERTION			0x00000001L
+#define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED	0x00000010L
+#define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE	0x00000020L
+#define SQL_CA_CONSTRAINT_DEFERRABLE		0x00000040L
+#define SQL_CA_CONSTRAINT_NON_DEFERRABLE	0x00000080L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_CHARACTER_SET
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CCS_CREATE_CHARACTER_SET		0x00000001L
+#define SQL_CCS_COLLATE_CLAUSE			0x00000002L
+#define SQL_CCS_LIMITED_COLLATION		0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_COLLATION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CCOL_CREATE_COLLATION		0x00000001L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_DOMAIN
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CDO_CREATE_DOMAIN			0x00000001L
+#define SQL_CDO_DEFAULT				0x00000002L
+#define SQL_CDO_CONSTRAINT			0x00000004L
+#define SQL_CDO_COLLATION			0x00000008L
+#define SQL_CDO_CONSTRAINT_NAME_DEFINITION	0x00000010L
+#define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED	0x00000020L
+#define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE	0x00000040L
+#define SQL_CDO_CONSTRAINT_DEFERRABLE		0x00000080L
+#define SQL_CDO_CONSTRAINT_NON_DEFERRABLE	0x00000100L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_SCHEMA
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CS_CREATE_SCHEMA			0x00000001L
+#define SQL_CS_AUTHORIZATION			0x00000002L
+#define SQL_CS_DEFAULT_CHARACTER_SET		0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_TABLE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CT_CREATE_TABLE			0x00000001L
+#define SQL_CT_COMMIT_PRESERVE			0x00000002L
+#define SQL_CT_COMMIT_DELETE			0x00000004L
+#define SQL_CT_GLOBAL_TEMPORARY			0x00000008L
+#define SQL_CT_LOCAL_TEMPORARY			0x00000010L
+#define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED	0x00000020L
+#define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE	0x00000040L
+#define SQL_CT_CONSTRAINT_DEFERRABLE		0x00000080L
+#define SQL_CT_CONSTRAINT_NON_DEFERRABLE	0x00000100L
+#define SQL_CT_COLUMN_CONSTRAINT		0x00000200L
+#define SQL_CT_COLUMN_DEFAULT			0x00000400L
+#define SQL_CT_COLUMN_COLLATION			0x00000800L
+#define SQL_CT_TABLE_CONSTRAINT			0x00001000L
+#define SQL_CT_CONSTRAINT_NAME_DEFINITION	0x00002000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_TRANSLATION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CTR_CREATE_TRANSLATION		0x00000001L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_CREATE_VIEW
+ */
+#define SQL_CV_CREATE_VIEW			0x00000001L
+#define SQL_CV_CHECK_OPTION			0x00000002L
+#define SQL_CV_CASCADED				0x00000004L
+#define SQL_CV_LOCAL				0x00000008L
+
+
+/*
+ *  SQLGetInfo - SQL_DATETIME_LITERALS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DL_SQL92_DATE			0x00000001L
+#define SQL_DL_SQL92_TIME			0x00000002L
+#define SQL_DL_SQL92_TIMESTAMP			0x00000004L
+#define SQL_DL_SQL92_INTERVAL_YEAR		0x00000008L
+#define SQL_DL_SQL92_INTERVAL_MONTH		0x00000010L
+#define SQL_DL_SQL92_INTERVAL_DAY		0x00000020L
+#define SQL_DL_SQL92_INTERVAL_HOUR		0x00000040L
+#define SQL_DL_SQL92_INTERVAL_MINUTE		0x00000080L
+#define SQL_DL_SQL92_INTERVAL_SECOND		0x00000100L
+#define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH	0x00000200L
+#define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR	0x00000400L
+#define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE	0x00000800L
+#define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND	0x00001000L
+#define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE	0x00002000L
+#define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND	0x00004000L
+#define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND	0x00008000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DDL_INDEX
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DI_CREATE_INDEX			0x00000001L
+#define SQL_DI_DROP_INDEX			0x00000002L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_ASSERTION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DA_DROP_ASSERTION			0x00000001L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_CHARACTER_SET
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DCS_DROP_CHARACTER_SET		0x00000001L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_COLLATION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DC_DROP_COLLATION			0x00000001L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_DOMAIN
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DD_DROP_DOMAIN			0x00000001L
+#define SQL_DD_RESTRICT				0x00000002L
+#define SQL_DD_CASCADE				0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_SCHEMA
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DS_DROP_SCHEMA			0x00000001L
+#define SQL_DS_RESTRICT				0x00000002L
+#define SQL_DS_CASCADE				0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_TABLE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DT_DROP_TABLE			0x00000001L
+#define SQL_DT_RESTRICT				0x00000002L
+#define SQL_DT_CASCADE				0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_TRANSLATION
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DTR_DROP_TRANSLATION		0x00000001L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DROP_VIEW
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_DV_DROP_VIEW			0x00000001L
+#define SQL_DV_RESTRICT				0x00000002L
+#define SQL_DV_CASCADE				0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_DTC_TRANSITION_COST
+ */
+#define SQL_DTC_ENLIST_EXPENSIVE		0x00000001L
+#define SQL_DTC_UNENLIST_EXPENSIVE		0x00000002L
+
+
+/*
+ *  SQLGetInfo - SQL_DYNAMIC_CURSOR_ATTRIBUTES1
+ *  SQLGetInfo - SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1
+ *  SQLGetInfo - SQL_KEYSET_CURSOR_ATTRIBUTES1
+ *  SQLGetInfo - SQL_STATIC_CURSOR_ATTRIBUTES1
+ */
+/*
+ *  SQLFetchScroll - FetchOrientation
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA1_NEXT				0x00000001L
+#define SQL_CA1_ABSOLUTE			0x00000002L
+#define SQL_CA1_RELATIVE			0x00000004L
+#define SQL_CA1_BOOKMARK			0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLSetPos - LockType
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA1_LOCK_NO_CHANGE			0x00000040L
+#define SQL_CA1_LOCK_EXCLUSIVE			0x00000080L
+#define SQL_CA1_LOCK_UNLOCK			0x00000100L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLSetPos Operations
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA1_POS_POSITION			0x00000200L
+#define SQL_CA1_POS_UPDATE			0x00000400L
+#define SQL_CA1_POS_DELETE			0x00000800L
+#define SQL_CA1_POS_REFRESH			0x00001000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  positioned updates and deletes
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA1_POSITIONED_UPDATE		0x00002000L
+#define SQL_CA1_POSITIONED_DELETE		0x00004000L
+#define SQL_CA1_SELECT_FOR_UPDATE		0x00008000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLBulkOperations operations
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA1_BULK_ADD			0x00010000L
+#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 */
+
+
+/*
+ *  SQLGetInfo - SQL_DYNAMIC_CURSOR_ATTRIBUTES2
+ *  SQLGetInfo - SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2
+ *  SQLGetInfo - SQL_KEYSET_CURSOR_ATTRIBUTES2
+ *  SQLGetInfo - SQL_STATIC_CURSOR_ATTRIBUTES2
+ */
+/*
+ *  SQL_ATTR_SCROLL_CONCURRENCY
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA2_READ_ONLY_CONCURRENCY		0x00000001L
+#define SQL_CA2_LOCK_CONCURRENCY		0x00000002L
+#define SQL_CA2_OPT_ROWVER_CONCURRENCY		0x00000004L
+#define SQL_CA2_OPT_VALUES_CONCURRENCY		0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  sensitivity of the cursor to its own inserts, deletes, and updates
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA2_SENSITIVITY_ADDITIONS		0x00000010L
+#define SQL_CA2_SENSITIVITY_DELETIONS		0x00000020L
+#define SQL_CA2_SENSITIVITY_UPDATES		0x00000040L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQL_ATTR_MAX_ROWS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA2_MAX_ROWS_SELECT			0x00000080L
+#define SQL_CA2_MAX_ROWS_INSERT			0x00000100L
+#define SQL_CA2_MAX_ROWS_DELETE			0x00000200L
+#define SQL_CA2_MAX_ROWS_UPDATE			0x00000400L
+#define SQL_CA2_MAX_ROWS_CATALOG		0x00000800L
+#define SQL_CA2_MAX_ROWS_AFFECTS_ALL		(SQL_CA2_MAX_ROWS_SELECT | \
+						 SQL_CA2_MAX_ROWS_INSERT | \
+						 SQL_CA2_MAX_ROWS_DELETE | \
+						 SQL_CA2_MAX_ROWS_UPDATE | \
+						 SQL_CA2_MAX_ROWS_CATALOG)
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQL_DIAG_CURSOR_ROW_COUNT
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA2_CRC_EXACT			0x00001000L
+#define SQL_CA2_CRC_APPROXIMATE			0x00002000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  the kinds of positioned statements that can be simulated
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_CA2_SIMULATE_NON_UNIQUE		0x00004000L
+#define SQL_CA2_SIMULATE_TRY_UNIQUE		0x00008000L
+#define SQL_CA2_SIMULATE_UNIQUE			0x00010000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_FETCH_DIRECTION
+ */
+#if (ODBCVER < 0x0300)
+#define SQL_FD_FETCH_RESUME			0x00000040L
+#endif	/* ODBCVER < 0x0300 */
+#define SQL_FD_FETCH_BOOKMARK			0x00000080L
+
+
+/*
+ *  SQLGetInfo - SQL_FILE_USAGE
+ */
+#define SQL_FILE_NOT_SUPPORTED			0x0000
+#define SQL_FILE_TABLE				0x0001
+#define SQL_FILE_QUALIFIER			0x0002
+#define SQL_FILE_CATALOG			SQL_FILE_QUALIFIER
+
+
+/*
+ *  SQLGetInfo - SQL_GETDATA_EXTENSIONS
+ */
+#define SQL_GD_BLOCK				0x00000004L
+#define SQL_GD_BOUND				0x00000008L
+
+
+/*
+ *  SQLGetInfo - SQL_GROUP_BY
+ */
+#define SQL_GB_NOT_SUPPORTED			0x0000
+#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 */
+
+
+/*
+ *  SQLGetInfo - SQL_INDEX_KEYWORDS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_IK_NONE				0x00000000L
+#define SQL_IK_ASC				0x00000001L
+#define SQL_IK_DESC				0x00000002L
+#define SQL_IK_ALL				(SQL_IK_ASC | SQL_IK_DESC)
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_INFO_SCHEMA_VIEWS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ISV_ASSERTIONS			0x00000001L
+#define SQL_ISV_CHARACTER_SETS			0x00000002L
+#define SQL_ISV_CHECK_CONSTRAINTS		0x00000004L
+#define SQL_ISV_COLLATIONS			0x00000008L
+#define SQL_ISV_COLUMN_DOMAIN_USAGE		0x00000010L
+#define SQL_ISV_COLUMN_PRIVILEGES		0x00000020L
+#define SQL_ISV_COLUMNS				0x00000040L
+#define SQL_ISV_CONSTRAINT_COLUMN_USAGE		0x00000080L
+#define SQL_ISV_CONSTRAINT_TABLE_USAGE		0x00000100L
+#define SQL_ISV_DOMAIN_CONSTRAINTS		0x00000200L
+#define SQL_ISV_DOMAINS				0x00000400L
+#define SQL_ISV_KEY_COLUMN_USAGE		0x00000800L
+#define SQL_ISV_REFERENTIAL_CONSTRAINTS		0x00001000L
+#define SQL_ISV_SCHEMATA			0x00002000L
+#define SQL_ISV_SQL_LANGUAGES			0x00004000L
+#define SQL_ISV_TABLE_CONSTRAINTS		0x00008000L
+#define SQL_ISV_TABLE_PRIVILEGES		0x00010000L
+#define SQL_ISV_TABLES				0x00020000L
+#define SQL_ISV_TRANSLATIONS			0x00040000L
+#define SQL_ISV_USAGE_PRIVILEGES		0x00080000L
+#define SQL_ISV_VIEW_COLUMN_USAGE		0x00100000L
+#define SQL_ISV_VIEW_TABLE_USAGE		0x00200000L
+#define SQL_ISV_VIEWS				0x00400000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_INSERT_STATEMENT
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_IS_INSERT_LITERALS			0x00000001L
+#define SQL_IS_INSERT_SEARCHED			0x00000002L
+#define SQL_IS_SELECT_INTO			0x00000004L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_LOCK_TYPES
+ */
+#define SQL_LCK_NO_CHANGE			0x00000001L
+#define SQL_LCK_EXCLUSIVE			0x00000002L
+#define SQL_LCK_UNLOCK				0x00000004L
+
+
+/*
+ *  SQLGetInfo - SQL_POS_OPERATIONS
+ */
+#define SQL_POS_POSITION			0x00000001L
+#define SQL_POS_REFRESH				0x00000002L
+#define SQL_POS_UPDATE				0x00000004L
+#define SQL_POS_DELETE				0x00000008L
+#define SQL_POS_ADD				0x00000010L
+
+
+/*
+ *  SQLGetInfo - SQL_NON_NULLABLE_COLUMNS
+ */
+#define SQL_NNC_NULL				0x0000
+#define SQL_NNC_NON_NULL			0x0001
+
+
+/*
+ *  SQLGetInfo - SQL_NULL_COLLATION
+ */
+#define SQL_NC_START				0x0002
+#define SQL_NC_END				0x0004
+
+
+/*
+ *  SQLGetInfo - SQL_NUMERIC_FUNCTIONS
+ */
+#define SQL_FN_NUM_ABS				0x00000001L
+#define SQL_FN_NUM_ACOS				0x00000002L
+#define SQL_FN_NUM_ASIN				0x00000004L
+#define SQL_FN_NUM_ATAN				0x00000008L
+#define SQL_FN_NUM_ATAN2			0x00000010L
+#define SQL_FN_NUM_CEILING			0x00000020L
+#define SQL_FN_NUM_COS				0x00000040L
+#define SQL_FN_NUM_COT				0x00000080L
+#define SQL_FN_NUM_EXP				0x00000100L
+#define SQL_FN_NUM_FLOOR			0x00000200L
+#define SQL_FN_NUM_LOG				0x00000400L
+#define SQL_FN_NUM_MOD				0x00000800L
+#define SQL_FN_NUM_SIGN				0x00001000L
+#define SQL_FN_NUM_SIN				0x00002000L
+#define SQL_FN_NUM_SQRT				0x00004000L
+#define SQL_FN_NUM_TAN				0x00008000L
+#define SQL_FN_NUM_PI				0x00010000L
+#define SQL_FN_NUM_RAND				0x00020000L
+#define SQL_FN_NUM_DEGREES			0x00040000L
+#define SQL_FN_NUM_LOG10			0x00080000L
+#define SQL_FN_NUM_POWER			0x00100000L
+#define SQL_FN_NUM_RADIANS			0x00200000L
+#define SQL_FN_NUM_ROUND			0x00400000L
+#define SQL_FN_NUM_TRUNCATE			0x00800000L
+
+
+/*
+ *  SQLGetInfo - SQL_ODBC_API_CONFORMANCE
+ */
+#define SQL_OAC_NONE				0x0000
+#define SQL_OAC_LEVEL1				0x0001
+#define SQL_OAC_LEVEL2				0x0002
+
+
+/*
+ *  SQLGetInfo - SQL_ODBC_INTERFACE_CONFORMANCE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_OIC_CORE				1UL
+#define SQL_OIC_LEVEL1				2UL
+#define SQL_OIC_LEVEL2				3UL
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_ODBC_SAG_CLI_CONFORMANCE
+ */
+#define SQL_OSCC_NOT_COMPLIANT			0x0000
+#define SQL_OSCC_COMPLIANT			0x0001
+
+
+/*
+ *  SQLGetInfo - SQL_ODBC_SQL_CONFORMANCE
+ */
+#define SQL_OSC_MINIMUM				0x0000
+#define SQL_OSC_CORE				0x0001
+#define SQL_OSC_EXTENDED			0x0002
+
+
+/*
+ *  SQLGetInfo - SQL_OWNER_USAGE
+ */
+#define SQL_OU_DML_STATEMENTS			0x00000001L
+#define SQL_OU_PROCEDURE_INVOCATION		0x00000002L
+#define SQL_OU_TABLE_DEFINITION			0x00000004L
+#define SQL_OU_INDEX_DEFINITION			0x00000008L
+#define SQL_OU_PRIVILEGE_DEFINITION		0x00000010L
+
+
+/*
+ *  SQLGetInfo - SQL_PARAM_ARRAY_ROW_COUNTS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_PARC_BATCH				1
+#define SQL_PARC_NO_BATCH			2
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_PARAM_ARRAY_SELECTS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_PAS_BATCH				1
+#define SQL_PAS_NO_BATCH			2
+#define SQL_PAS_NO_SELECT			3
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_POSITIONED_STATEMENTS
+ */
+#define SQL_PS_POSITIONED_DELETE		0x00000001L
+#define SQL_PS_POSITIONED_UPDATE		0x00000002L
+#define SQL_PS_SELECT_FOR_UPDATE		0x00000004L
+
+
+/*
+ *  SQLGetInfo - SQL_QUALIFIER_LOCATION
+ */
+#define SQL_QL_START				0x0001
+#define SQL_QL_END				0x0002
+
+
+/*
+ *  SQLGetInfo - SQL_QUALIFIER_USAGE
+ */
+#define SQL_QU_DML_STATEMENTS			0x00000001L
+#define SQL_QU_PROCEDURE_INVOCATION		0x00000002L
+#define SQL_QU_TABLE_DEFINITION			0x00000004L
+#define SQL_QU_INDEX_DEFINITION			0x00000008L
+#define SQL_QU_PRIVILEGE_DEFINITION		0x00000010L
+
+
+/*
+ *  SQLGetInfo - SQL_SCHEMA_USAGE
+ */
+#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 */
+
+
+/*
+ *  SQLGetInfo - SQL_SCROLL_OPTIONS
+ */
+#define SQL_SO_FORWARD_ONLY			0x00000001L
+#define SQL_SO_KEYSET_DRIVEN			0x00000002L
+#define SQL_SO_DYNAMIC				0x00000004L
+#define SQL_SO_MIXED				0x00000008L
+#define SQL_SO_STATIC				0x00000010L
+
+
+/*
+ *  SQLGetInfo - SQL_SQL_CONFORMANCE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SC_SQL92_ENTRY			0x00000001L
+#define SQL_SC_FIPS127_2_TRANSITIONAL		0x00000002L
+#define SQL_SC_SQL92_INTERMEDIATE		0x00000004L
+#define SQL_SC_SQL92_FULL			0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - 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 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_FOREIGN_KEY_DELETE_RULE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SFKD_CASCADE			0x00000001L
+#define SQL_SFKD_NO_ACTION			0x00000002L
+#define SQL_SFKD_SET_DEFAULT			0x00000004L
+#define SQL_SFKD_SET_NULL			0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_FOREIGN_KEY_UPDATE_RULE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SFKU_CASCADE			0x00000001L
+#define SQL_SFKU_NO_ACTION			0x00000002L
+#define SQL_SFKU_SET_DEFAULT			0x00000004L
+#define SQL_SFKU_SET_NULL			0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_GRANT
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SG_USAGE_ON_DOMAIN			0x00000001L
+#define SQL_SG_USAGE_ON_CHARACTER_SET		0x00000002L
+#define SQL_SG_USAGE_ON_COLLATION		0x00000004L
+#define SQL_SG_USAGE_ON_TRANSLATION		0x00000008L
+#define SQL_SG_WITH_GRANT_OPTION		0x00000010L
+#define SQL_SG_DELETE_TABLE			0x00000020L
+#define SQL_SG_INSERT_TABLE			0x00000040L
+#define SQL_SG_INSERT_COLUMN			0x00000080L
+#define SQL_SG_REFERENCES_TABLE			0x00000100L
+#define SQL_SG_REFERENCES_COLUMN		0x00000200L
+#define SQL_SG_SELECT_TABLE			0x00000400L
+#define SQL_SG_UPDATE_TABLE			0x00000800L
+#define SQL_SG_UPDATE_COLUMN			0x00001000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - 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 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_PREDICATES
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SP_EXISTS				0x00000001L
+#define SQL_SP_ISNOTNULL			0x00000002L
+#define SQL_SP_ISNULL				0x00000004L
+#define SQL_SP_MATCH_FULL			0x00000008L
+#define SQL_SP_MATCH_PARTIAL			0x00000010L
+#define SQL_SP_MATCH_UNIQUE_FULL		0x00000020L
+#define SQL_SP_MATCH_UNIQUE_PARTIAL		0x00000040L
+#define SQL_SP_OVERLAPS				0x00000080L
+#define SQL_SP_UNIQUE				0x00000100L
+#define SQL_SP_LIKE				0x00000200L
+#define SQL_SP_IN				0x00000400L
+#define SQL_SP_BETWEEN				0x00000800L
+#define SQL_SP_COMPARISON			0x00001000L
+#define SQL_SP_QUANTIFIED_COMPARISON		0x00002000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_RELATIONAL_JOIN_OPERATORS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SRJO_CORRESPONDING_CLAUSE		0x00000001L
+#define SQL_SRJO_CROSS_JOIN			0x00000002L
+#define SQL_SRJO_EXCEPT_JOIN			0x00000004L
+#define SQL_SRJO_FULL_OUTER_JOIN		0x00000008L
+#define SQL_SRJO_INNER_JOIN			0x00000010L
+#define SQL_SRJO_INTERSECT_JOIN			0x00000020L
+#define SQL_SRJO_LEFT_OUTER_JOIN		0x00000040L
+#define SQL_SRJO_NATURAL_JOIN			0x00000080L
+#define SQL_SRJO_RIGHT_OUTER_JOIN		0x00000100L
+#define SQL_SRJO_UNION_JOIN			0x00000200L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_REVOKE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SR_USAGE_ON_DOMAIN			0x00000001L
+#define SQL_SR_USAGE_ON_CHARACTER_SET		0x00000002L
+#define SQL_SR_USAGE_ON_COLLATION		0x00000004L
+#define SQL_SR_USAGE_ON_TRANSLATION		0x00000008L
+#define SQL_SR_GRANT_OPTION_FOR			0x00000010L
+#define SQL_SR_CASCADE				0x00000020L
+#define SQL_SR_RESTRICT				0x00000040L
+#define SQL_SR_DELETE_TABLE			0x00000080L
+#define SQL_SR_INSERT_TABLE			0x00000100L
+#define SQL_SR_INSERT_COLUMN			0x00000200L
+#define SQL_SR_REFERENCES_TABLE			0x00000400L
+#define SQL_SR_REFERENCES_COLUMN		0x00000800L
+#define SQL_SR_SELECT_TABLE			0x00001000L
+#define SQL_SR_UPDATE_TABLE			0x00002000L
+#define SQL_SR_UPDATE_COLUMN			0x00004000L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_ROW_VALUE_CONSTRUCTOR
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SRVC_VALUE_EXPRESSION		0x00000001L
+#define SQL_SRVC_NULL				0x00000002L
+#define SQL_SRVC_DEFAULT			0x00000004L
+#define SQL_SRVC_ROW_SUBQUERY			0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_STRING_FUNCTIONS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SSF_CONVERT				0x00000001L
+#define SQL_SSF_LOWER				0x00000002L
+#define SQL_SSF_UPPER				0x00000004L
+#define SQL_SSF_SUBSTRING			0x00000008L
+#define SQL_SSF_TRANSLATE			0x00000010L
+#define SQL_SSF_TRIM_BOTH			0x00000020L
+#define SQL_SSF_TRIM_LEADING			0x00000040L
+#define SQL_SSF_TRIM_TRAILING			0x00000080L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_SQL92_VALUE_EXPRESSIONS
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SVE_CASE				0x00000001L
+#define SQL_SVE_CAST				0x00000002L
+#define SQL_SVE_COALESCE			0x00000004L
+#define SQL_SVE_NULLIF				0x00000008L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_STANDARD_CLI_CONFORMANCE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_SCC_XOPEN_CLI_VERSION1		0x00000001L
+#define SQL_SCC_ISO92_CLI			0x00000002L
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_STATIC_SENSITIVITY
+ */
+#define SQL_SS_ADDITIONS			0x00000001L
+#define SQL_SS_DELETIONS			0x00000002L
+#define SQL_SS_UPDATES				0x00000004L
+
+
+/*
+ *  SQLGetInfo - SQL_SUBQUERIES
+ */
+#define SQL_SQ_COMPARISON			0x00000001L
+#define SQL_SQ_EXISTS				0x00000002L
+#define SQL_SQ_IN				0x00000004L
+#define SQL_SQ_QUANTIFIED			0x00000008L
+#define SQL_SQ_CORRELATED_SUBQUERIES		0x00000010L
+
+
+/*
+ *  SQLGetInfo - SQL_SYSTEM_FUNCTIONS
+ */
+#define SQL_FN_SYS_USERNAME			0x00000001L
+#define SQL_FN_SYS_DBNAME			0x00000002L
+#define SQL_FN_SYS_IFNULL			0x00000004L
+
+
+/*
+ *  SQLGetInfo - SQL_STRING_FUNCTIONS
+ */
+#define SQL_FN_STR_CONCAT			0x00000001L
+#define SQL_FN_STR_INSERT			0x00000002L
+#define SQL_FN_STR_LEFT				0x00000004L
+#define SQL_FN_STR_LTRIM			0x00000008L
+#define SQL_FN_STR_LENGTH			0x00000010L
+#define SQL_FN_STR_LOCATE			0x00000020L
+#define SQL_FN_STR_LCASE			0x00000040L
+#define SQL_FN_STR_REPEAT			0x00000080L
+#define SQL_FN_STR_REPLACE			0x00000100L
+#define SQL_FN_STR_RIGHT			0x00000200L
+#define SQL_FN_STR_RTRIM			0x00000400L
+#define SQL_FN_STR_SUBSTRING			0x00000800L
+#define SQL_FN_STR_UCASE			0x00001000L
+#define SQL_FN_STR_ASCII			0x00002000L
+#define SQL_FN_STR_CHAR				0x00004000L
+#define SQL_FN_STR_DIFFERENCE			0x00008000L
+#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 */
+
+
+/*
+ *  SQLGetInfo - SQL_TIMEDATE_ADD_INTERVALS
+ *  SQLGetInfo - SQL_TIMEDATE_DIFF_INTERVALS
+ */
+#define SQL_FN_TSI_FRAC_SECOND			0x00000001L
+#define SQL_FN_TSI_SECOND			0x00000002L
+#define SQL_FN_TSI_MINUTE			0x00000004L
+#define SQL_FN_TSI_HOUR				0x00000008L
+#define SQL_FN_TSI_DAY				0x00000010L
+#define SQL_FN_TSI_WEEK				0x00000020L
+#define SQL_FN_TSI_MONTH			0x00000040L
+#define SQL_FN_TSI_QUARTER			0x00000080L
+#define SQL_FN_TSI_YEAR				0x00000100L
+
+
+/*
+ *  SQLGetInfo - SQL_TIMEDATE_FUNCTIONS
+ */
+#define SQL_FN_TD_NOW				0x00000001L
+#define SQL_FN_TD_CURDATE			0x00000002L
+#define SQL_FN_TD_DAYOFMONTH			0x00000004L
+#define SQL_FN_TD_DAYOFWEEK			0x00000008L
+#define SQL_FN_TD_DAYOFYEAR			0x00000010L
+#define SQL_FN_TD_MONTH				0x00000020L
+#define SQL_FN_TD_QUARTER			0x00000040L
+#define SQL_FN_TD_WEEK				0x00000080L
+#define SQL_FN_TD_YEAR				0x00000100L
+#define SQL_FN_TD_CURTIME			0x00000200L
+#define SQL_FN_TD_HOUR				0x00000400L
+#define SQL_FN_TD_MINUTE			0x00000800L
+#define SQL_FN_TD_SECOND			0x00001000L
+#define SQL_FN_TD_TIMESTAMPADD			0x00002000L
+#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 */
+
+
+/*
+ *  SQLGetInfo - SQL_TXN_ISOLATION_OPTION
+ */
+#if (ODBCVER < 0x0300)
+#define SQL_TXN_VERSIONING			0x00000010L
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ *  SQLGetInfo - SQL_UNION
+ */
+#define SQL_U_UNION				0x00000001L
+#define SQL_U_UNION_ALL				0x00000002L
+
+
+/*
+ *  SQLGetInfo - SQL_UNION_STATEMENT
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_US_UNION				SQL_U_UNION
+#define SQL_US_UNION_ALL			SQL_U_UNION_ALL
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetStmtAttr - ODBC 2.x attributes
+ */
+#define SQL_QUERY_TIMEOUT			0
+#define SQL_MAX_ROWS				1
+#define SQL_NOSCAN				2
+#define SQL_MAX_LENGTH				3
+#define SQL_ASYNC_ENABLE			4
+#define SQL_BIND_TYPE				5
+#define SQL_CURSOR_TYPE				6
+#define SQL_CONCURRENCY				7
+#define SQL_KEYSET_SIZE				8
+#define SQL_ROWSET_SIZE				9
+#define SQL_SIMULATE_CURSOR			10
+#define SQL_RETRIEVE_DATA			11
+#define SQL_USE_BOOKMARKS			12
+#define SQL_GET_BOOKMARK			13
+#define SQL_ROW_NUMBER				14
+
+
+/*
+ *  SQLGetStmtAttr - ODBC 3.x attributes
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ATTR_ASYNC_ENABLE			4
+#define SQL_ATTR_CONCURRENCY			SQL_CONCURRENCY
+#define SQL_ATTR_CURSOR_TYPE			SQL_CURSOR_TYPE
+#define SQL_ATTR_ENABLE_AUTO_IPD		15
+#define SQL_ATTR_FETCH_BOOKMARK_PTR		16
+#define SQL_ATTR_KEYSET_SIZE			SQL_KEYSET_SIZE
+#define SQL_ATTR_MAX_LENGTH			SQL_MAX_LENGTH
+#define SQL_ATTR_MAX_ROWS			SQL_MAX_ROWS
+#define SQL_ATTR_NOSCAN				SQL_NOSCAN
+#define SQL_ATTR_PARAM_BIND_OFFSET_PTR		17
+#define SQL_ATTR_PARAM_BIND_TYPE		18
+#define SQL_ATTR_PARAM_OPERATION_PTR		19
+#define SQL_ATTR_PARAM_STATUS_PTR		20
+#define SQL_ATTR_PARAMS_PROCESSED_PTR		21
+#define SQL_ATTR_PARAMSET_SIZE			22
+#define SQL_ATTR_QUERY_TIMEOUT			SQL_QUERY_TIMEOUT
+#define SQL_ATTR_RETRIEVE_DATA			SQL_RETRIEVE_DATA
+#define SQL_ATTR_ROW_BIND_OFFSET_PTR		23
+#define SQL_ATTR_ROW_BIND_TYPE			SQL_BIND_TYPE
+#define SQL_ATTR_ROW_NUMBER			SQL_ROW_NUMBER	/*GetStmtAttr*/
+#define SQL_ATTR_ROW_OPERATION_PTR		24
+#define SQL_ATTR_ROW_STATUS_PTR			25
+#define SQL_ATTR_ROWS_FETCHED_PTR		26
+#define SQL_ATTR_ROW_ARRAY_SIZE			27
+#define SQL_ATTR_SIMULATE_CURSOR		SQL_SIMULATE_CURSOR
+#define SQL_ATTR_USE_BOOKMARKS			SQL_USE_BOOKMARKS
+#endif	/* ODBCVER >= 0x0300 */
+
+#if (ODBCVER < 0x0300)
+#define SQL_STMT_OPT_MAX			SQL_ROW_NUMBER
+#define SQL_STMT_OPT_MIN			SQL_QUERY_TIMEOUT
+#endif	/* ODBCVER < 0x0300 */
+
+
+/*
+ *  SQLGetStmtAttr - SQL_ATTR_ASYNC_ENABLE
+ */
+#define SQL_ASYNC_ENABLE_OFF			0UL
+#define SQL_ASYNC_ENABLE_ON			1UL
+#define SQL_ASYNC_ENABLE_DEFAULT		SQL_ASYNC_ENABLE_OFF
+
+
+/*
+ *  SQLGetStmtAttr -  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 */
+
+
+/*
+ *  SQLGetStmtAttr - SQL_BIND_TYPE
+ */
+#define SQL_BIND_BY_COLUMN			0UL
+#define SQL_BIND_TYPE_DEFAULT			SQL_BIND_BY_COLUMN
+
+
+/*
+ *  SQLGetStmtAttr - SQL_CONCURRENCY
+ */
+#define SQL_CONCUR_READ_ONLY			1
+#define SQL_CONCUR_LOCK				2
+#define SQL_CONCUR_ROWVER			3
+#define SQL_CONCUR_VALUES			4
+#define SQL_CONCUR_DEFAULT			SQL_CONCUR_READ_ONLY
+
+
+/*
+ *  SQLGetStmtAttr - SQL_CURSOR_TYPE
+ */
+#define SQL_CURSOR_FORWARD_ONLY			0UL
+#define SQL_CURSOR_KEYSET_DRIVEN		1UL
+#define SQL_CURSOR_DYNAMIC			2UL
+#define SQL_CURSOR_STATIC			3UL
+#define SQL_CURSOR_TYPE_DEFAULT			SQL_CURSOR_FORWARD_ONLY
+
+
+/*
+ *  SQLGetStmtAttr - SQL_KEYSET_SIZE
+ */
+#define SQL_KEYSET_SIZE_DEFAULT			0UL
+
+
+/*
+ *  SQLGetStmtAttr - SQL_MAX_LENGTH
+ */
+#define SQL_MAX_LENGTH_DEFAULT			0UL
+
+
+/*
+ *  SQLGetStmtAttr - SQL_MAX_ROWS
+ */
+#define SQL_MAX_ROWS_DEFAULT			0UL
+
+
+/*
+ *  SQLGetStmtAttr - SQL_NOSCAN
+ */
+#define SQL_NOSCAN_OFF				0UL	/* 1.0 FALSE */
+#define SQL_NOSCAN_ON				1UL	/* 1.0 TRUE */
+#define SQL_NOSCAN_DEFAULT			SQL_NOSCAN_OFF
+
+
+/*
+ *  SQLGetStmtAttr - SQL_QUERY_TIMEOUT
+ */
+#define SQL_QUERY_TIMEOUT_DEFAULT		0UL
+
+
+/*
+ *  SQLGetStmtAttr - SQL_RETRIEVE_DATA
+ */
+#define SQL_RD_OFF				0UL
+#define SQL_RD_ON				1UL
+#define SQL_RD_DEFAULT				SQL_RD_ON
+
+
+/*
+ *  SQLGetStmtAttr - SQL_ROWSET_SIZE
+ */
+#define SQL_ROWSET_SIZE_DEFAULT			1UL
+
+
+/*
+ *  SQLGetStmtAttr - SQL_SIMULATE_CURSOR
+ */
+#define SQL_SC_NON_UNIQUE			0UL
+#define SQL_SC_TRY_UNIQUE			1UL
+#define SQL_SC_UNIQUE				2UL
+
+
+/*
+ *  SQLGetStmtAttr - SQL_USE_BOOKMARKS
+ */
+#define SQL_UB_OFF				0UL
+#define SQL_UB_ON				1UL
+#define SQL_UB_DEFAULT				SQL_UB_OFF
+#if (ODBCVER >= 0x0300)
+#define SQL_UB_FIXED				SQL_UB_ON
+#define SQL_UB_VARIABLE				2UL
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLGetTypeInfo - SEARCHABLE
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_COL_PRED_CHAR			SQL_LIKE_ONLY
+#define SQL_COL_PRED_BASIC			SQL_ALL_EXCEPT_LIKE
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLSetPos
+ */
+#define SQL_ENTIRE_ROWSET			0
+
+
+/*
+ *  SQLSetPos - Operation
+ */
+#define SQL_POSITION				0
+#define SQL_REFRESH				1
+#define SQL_UPDATE				2
+#define SQL_DELETE				3
+
+
+/*
+ *  SQLBulkOperations - Operation
+ */
+#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 */
+
+
+/*
+ *  SQLSetPos - LockType
+ */
+#define SQL_LOCK_NO_CHANGE			0
+#define SQL_LOCK_EXCLUSIVE			1
+#define SQL_LOCK_UNLOCK				2
+#define SQL_SETPOS_MAX_LOCK_VALUE		SQL_LOCK_UNLOCK
+
+
+/*
+ *  SQLSetPos macros
+ */
+#define SQL_POSITION_TO(hstmt,irow)	\
+    SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
+#define SQL_LOCK_RECORD(hstmt,irow,fLock) \
+    SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
+#define SQL_REFRESH_RECORD(hstmt,irow,fLock) \
+    SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
+#define SQL_UPDATE_RECORD(hstmt,irow) \
+    SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
+#define SQL_DELETE_RECORD(hstmt,irow) \
+    SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
+#define SQL_ADD_RECORD(hstmt,irow) \
+    SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
+
+
+/*
+ *  SQLSpecialColumns - Column types and scopes
+ */
+#define SQL_BEST_ROWID				1
+#define SQL_ROWVER				2
+
+
+/*
+ *  All the ODBC keywords
+ */
+#define SQL_ODBC_KEYWORDS \
+"ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"\
+"ASC,ASSERTION,AT,AUTHORIZATION,AVG,"\
+"BEGIN,BETWEEN,BIT,BIT_LENGTH,BOTH,BY,CASCADE,CASCADED,CASE,CAST,CATALOG,"\
+"CHAR,CHAR_LENGTH,CHARACTER,CHARACTER_LENGTH,CHECK,CLOSE,COALESCE,"\
+"COLLATE,COLLATION,COLUMN,COMMIT,CONNECT,CONNECTION,CONSTRAINT,"\
+"CONSTRAINTS,CONTINUE,CONVERT,CORRESPONDING,COUNT,CREATE,CROSS,CURRENT,"\
+"CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,CURSOR,"\
+"DATE,DAY,DEALLOCATE,DEC,DECIMAL,DECLARE,DEFAULT,DEFERRABLE,"\
+"DEFERRED,DELETE,DESC,DESCRIBE,DESCRIPTOR,DIAGNOSTICS,DISCONNECT,"\
+"DISTINCT,DOMAIN,DOUBLE,DROP,"\
+"ELSE,END,END-EXEC,ESCAPE,EXCEPT,EXCEPTION,EXEC,EXECUTE,"\
+"EXISTS,EXTERNAL,EXTRACT,"\
+"FALSE,FETCH,FIRST,FLOAT,FOR,FOREIGN,FORTRAN,FOUND,FROM,FULL,"\
+"GET,GLOBAL,GO,GOTO,GRANT,GROUP,HAVING,HOUR,"\
+"IDENTITY,IMMEDIATE,IN,INCLUDE,INDEX,INDICATOR,INITIALLY,INNER,"\
+"INPUT,INSENSITIVE,INSERT,INT,INTEGER,INTERSECT,INTERVAL,INTO,IS,ISOLATION,"\
+"JOIN,KEY,LANGUAGE,LAST,LEADING,LEFT,LEVEL,LIKE,LOCAL,LOWER,"\
+"MATCH,MAX,MIN,MINUTE,MODULE,MONTH,"\
+"NAMES,NATIONAL,NATURAL,NCHAR,NEXT,NO,NONE,NOT,NULL,NULLIF,NUMERIC,"\
+"OCTET_LENGTH,OF,ON,ONLY,OPEN,OPTION,OR,ORDER,OUTER,OUTPUT,OVERLAPS,"\
+"PAD,PARTIAL,PASCAL,PLI,POSITION,PRECISION,PREPARE,PRESERVE,"\
+"PRIMARY,PRIOR,PRIVILEGES,PROCEDURE,PUBLIC,"\
+"READ,REAL,REFERENCES,RELATIVE,RESTRICT,REVOKE,RIGHT,ROLLBACK,ROWS"\
+"SCHEMA,SCROLL,SECOND,SECTION,SELECT,SESSION,SESSION_USER,SET,SIZE,"\
+"SMALLINT,SOME,SPACE,SQL,SQLCA,SQLCODE,SQLERROR,SQLSTATE,SQLWARNING,"\
+"SUBSTRING,SUM,SYSTEM_USER,"\
+"TABLE,TEMPORARY,THEN,TIME,TIMESTAMP,TIMEZONE_HOUR,TIMEZONE_MINUTE,"\
+"TO,TRAILING,TRANSACTION,TRANSLATE,TRANSLATION,TRIM,TRUE,"\
+"UNION,UNIQUE,UNKNOWN,UPDATE,UPPER,USAGE,USER,USING,"\
+"VALUE,VALUES,VARCHAR,VARYING,VIEW,WHEN,WHENEVER,WHERE,WITH,WORK,WRITE,"\
+"YEAR,ZONE"
+
+
+/*
+ * ----------------------------------------------------------------------
+ *  Level 2 Functions
+ * ----------------------------------------------------------------------
+ */
+
+/*
+ *  SQLExtendedFetch - fFetchType
+ */
+#define SQL_FETCH_BOOKMARK			8
+
+
+/*
+ *  SQLExtendedFetch - rgfRowStatus
+ */
+#define SQL_ROW_SUCCESS				0
+#define SQL_ROW_DELETED				1
+#define SQL_ROW_UPDATED				2
+#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
+
+
+/*
+ * 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
+#define SQL_PARAM_UNUSED			7
+#define SQL_PARAM_DIAG_UNAVAILABLE		1
+
+#define SQL_PARAM_PROCEED			0
+#define SQL_PARAM_IGNORE			1
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLForeignKeys - UPDATE_RULE/DELETE_RULE
+ */
+#define SQL_CASCADE				0
+#define SQL_RESTRICT				1
+#define SQL_SET_NULL				2
+
+#if (ODBCVER >= 0x0250)
+#define SQL_NO_ACTION				3
+#define SQL_SET_DEFAULT			 	4
+#endif	/* ODBCVER >= 0x0250 */
+
+
+/*
+ *  SQLForeignKeys - DEFERABILITY
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_INITIALLY_DEFERRED			5
+#define SQL_INITIALLY_IMMEDIATE			6
+#define SQL_NOT_DEFERRABLE			7
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  SQLBindParameter - fParamType
+ *  SQLProcedureColumns - COLUMN_TYPE
+ */
+#define SQL_PARAM_TYPE_UNKNOWN			0
+#define SQL_PARAM_INPUT				1
+#define SQL_PARAM_INPUT_OUTPUT			2
+#define SQL_RESULT_COL				3
+#define SQL_PARAM_OUTPUT			4
+#define SQL_RETURN_VALUE			5
+
+
+/*
+ *   SQLProcedures - PROCEDURE_TYPE
+ */
+#define SQL_PT_UNKNOWN				0
+#define SQL_PT_PROCEDURE			1
+#define SQL_PT_FUNCTION				2
+
+
+/*
+ *  SQLSetParam to SQLBindParameter conversion
+ */
+#define SQL_PARAM_TYPE_DEFAULT			SQL_PARAM_INPUT_OUTPUT
+#define SQL_SETPARAM_VALUE_MAX			(-1L)
+
+
+/*
+ *  SQLStatistics - fAccuracy
+ */
+#define SQL_QUICK				0
+#define SQL_ENSURE				1
+
+
+/*
+ *  SQLStatistics - TYPE
+ */
+#define SQL_TABLE_STAT				0
+
+
+/*
+ *  SQLTables
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_ALL_CATALOGS			"%"
+#define SQL_ALL_SCHEMAS				"%"
+#define SQL_ALL_TABLE_TYPES			"%"
+#endif	/* ODBCVER >= 0x0300 */
+
+/*
+ *  SQLSpecialColumns - PSEUDO_COLUMN
+ */
+#define SQL_PC_NOT_PSEUDO			1
+
+
+/*
+ *  Deprecated defines from prior versions of ODBC
+ */
+#define SQL_DATABASE_NAME			16
+#define SQL_FD_FETCH_PREV			SQL_FD_FETCH_PRIOR
+#define SQL_FETCH_PREV				SQL_FETCH_PRIOR
+#define SQL_CONCUR_TIMESTAMP			SQL_CONCUR_ROWVER
+#define SQL_SCCO_OPT_TIMESTAMP			SQL_SCCO_OPT_ROWVER
+#define SQL_CC_DELETE				SQL_CB_DELETE
+#define SQL_CR_DELETE				SQL_CB_DELETE
+#define SQL_CC_CLOSE				SQL_CB_CLOSE
+#define SQL_CR_CLOSE				SQL_CB_CLOSE
+#define SQL_CC_PRESERVE				SQL_CB_PRESERVE
+#define SQL_CR_PRESERVE				SQL_CB_PRESERVE
+#if (ODBCVER < 0x0200)
+#define SQL_FETCH_RESUME			7
+#endif
+#define SQL_SCROLL_FORWARD_ONLY			0L
+#define SQL_SCROLL_KEYSET_DRIVEN		(-1L)
+#define SQL_SCROLL_DYNAMIC			(-2L)
+#define SQL_SCROLL_STATIC			(-3L)
+
+
+/*
+ *  Level 1 function prototypes
+ */
+SQLRETURN SQL_API SQLDriverConnect (
+    SQLHDBC		  hdbc,
+    SQLHWND		  hwnd,
+    SQLCHAR		* szConnStrIn,
+    SQLSMALLINT		  cbConnStrIn,
+    SQLCHAR		* szConnStrOut,
+    SQLSMALLINT		  cbConnStrOutMax,
+    SQLSMALLINT		* pcbConnStrOut,
+    SQLUSMALLINT 	  fDriverCompletion);
+
+/*
+ *  Level 2 function prototypes
+ */
+
+SQLRETURN SQL_API SQLBrowseConnect (
+    SQLHDBC		  hdbc,
+    SQLCHAR		* szConnStrIn,
+    SQLSMALLINT		  cbConnStrIn,
+    SQLCHAR		* szConnStrOut,
+    SQLSMALLINT		  cbConnStrOutMax,
+    SQLSMALLINT		* pcbConnStrOut);
+
+#if (ODBCVER >= 0x0300)
+SQLRETURN SQL_API SQLBulkOperations (
+    SQLHSTMT		  StatementHandle,
+    SQLSMALLINT		  Operation);
+#endif /* ODBCVER >= 0x0300 */
+
+SQLRETURN SQL_API SQLColAttributes (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  icol,
+    SQLUSMALLINT	  fDescType,
+    SQLPOINTER		  rgbDesc,
+    SQLSMALLINT		  cbDescMax,
+    SQLSMALLINT		* pcbDesc,
+    SQLLEN		* pfDesc);
+
+SQLRETURN SQL_API SQLColumnPrivileges (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLDescribeParam (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  ipar,
+    SQLSMALLINT		* pfSqlType,
+    SQLULEN		* pcbParamDef,
+    SQLSMALLINT		* pibScale,
+    SQLSMALLINT		* pfNullable);
+
+SQLRETURN SQL_API SQLExtendedFetch (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  fFetchType,
+    SQLLEN		  irow,
+    SQLULEN		* pcrow,
+    SQLUSMALLINT	* rgfRowStatus);
+
+SQLRETURN SQL_API SQLForeignKeys (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szPkCatalogName,
+    SQLSMALLINT		  cbPkCatalogName,
+    SQLCHAR		* szPkSchemaName,
+    SQLSMALLINT		  cbPkSchemaName,
+    SQLCHAR		* szPkTableName,
+    SQLSMALLINT		  cbPkTableName,
+    SQLCHAR		* szFkCatalogName,
+    SQLSMALLINT		  cbFkCatalogName,
+    SQLCHAR		* szFkSchemaName,
+    SQLSMALLINT		  cbFkSchemaName,
+    SQLCHAR		* szFkTableName,
+    SQLSMALLINT		  cbFkTableName);
+
+SQLRETURN SQL_API SQLMoreResults (
+    SQLHSTMT		  hstmt);
+
+SQLRETURN SQL_API SQLNativeSql (
+    SQLHDBC		  hdbc,
+    SQLCHAR		* szSqlStrIn,
+    SQLINTEGER		  cbSqlStrIn,
+    SQLCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStrMax,
+    SQLINTEGER		* pcbSqlStr);
+
+SQLRETURN SQL_API SQLNumParams (
+    SQLHSTMT		hstmt,
+    SQLSMALLINT		* pcpar);
+
+SQLRETURN SQL_API SQLParamOptions (
+    SQLHSTMT		  hstmt,
+    SQLULEN		  crow,
+    SQLULEN		* pirow);
+
+SQLRETURN SQL_API SQLPrimaryKeys (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName);
+
+SQLRETURN SQL_API SQLProcedureColumns (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szProcName,
+    SQLSMALLINT		  cbProcName,
+    SQLCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLProcedures (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szProcName,
+    SQLSMALLINT		  cbProcName);
+
+SQLRETURN SQL_API SQLSetPos (
+    SQLHSTMT		  hstmt,
+    SQLSETPOSIROW	  irow,
+    SQLUSMALLINT	  fOption,
+    SQLUSMALLINT	  fLock);
+
+SQLRETURN SQL_API SQLTablePrivileges (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName);
+
+SQLRETURN SQL_API SQLDrivers (
+    SQLHENV		  henv,
+    SQLUSMALLINT	  fDirection,
+    SQLCHAR		* szDriverDesc,
+    SQLSMALLINT		  cbDriverDescMax,
+    SQLSMALLINT		* pcbDriverDesc,
+    SQLCHAR		* szDriverAttributes,
+    SQLSMALLINT		  cbDrvrAttrMax,
+    SQLSMALLINT		* pcbDrvrAttr);
+
+SQLRETURN SQL_API SQLBindParameter (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  ipar,
+    SQLSMALLINT		  fParamType,
+    SQLSMALLINT		  fCType,
+    SQLSMALLINT		  fSqlType,
+    SQLULEN		  cbColDef,
+    SQLSMALLINT		  ibScale,
+    SQLPOINTER		  rgbValue,
+    SQLLEN		  cbValueMax,
+    SQLLEN		* pcbValue);
+
+/*
+ *  Depreciated - use SQLSetStmtOptions
+ */
+SQLRETURN SQL_API SQLSetScrollOptions (		/* Use SQLSetStmtOptions */
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  fConcurrency,
+    SQLLEN		  crowKeyset,
+    SQLUSMALLINT	  crowRowset);
+
+
+/*
+ *  SQLAllocHandleStd - make SQLAllocHandle compatible with X/Open standard
+ *
+ *  NOTE: An application should not call SQLAllocHandleStd directly
+ */
+#ifdef ODBC_STD
+#define SQLAllocHandle			SQLAllocHandleStd
+#define SQLAllocEnv(phenv) \
+    SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv)
+
+#if (ODBCVER >= 0x0300)
+SQLRETURN SQL_API SQLAllocHandleStd (
+    SQLSMALLINT		  fHandleType,
+    SQLHANDLE		  hInput,
+    SQLHANDLE		* phOutput);
+#endif
+
+
+/* Internal type subcodes */
+#define SQL_YEAR			SQL_CODE_YEAR
+#define SQL_MONTH			SQL_CODE_MONTH
+#define SQL_DAY				SQL_CODE_DAY
+#define SQL_HOUR			SQL_CODE_HOUR
+#define SQL_MINUTE			SQL_CODE_MINUTE
+#define SQL_SECOND			SQL_CODE_SECOND
+#define SQL_YEAR_TO_MONTH		SQL_CODE_YEAR_TO_MONTH
+#define SQL_DAY_TO_HOUR			SQL_CODE_DAY_TO_HOUR
+#define SQL_DAY_TO_MINUTE		SQL_CODE_DAY_TO_MINUTE
+#define SQL_DAY_TO_SECOND		SQL_CODE_DAY_TO_SECOND
+#define SQL_HOUR_TO_MINUTE		SQL_CODE_HOUR_TO_MINUTE
+#define SQL_HOUR_TO_SECOND		SQL_CODE_HOUR_TO_SECOND
+#define SQL_MINUTE_TO_SECOND		SQL_CODE_MINUTE_TO_SECOND
+#endif	/* ODBC_STD */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#include <sqlucode.h>
+
+#endif	/* _SQLEXT_H */

+ 429 - 0
odbc.mod/iodbc/include/sqltypes.h

@@ -0,0 +1,429 @@
+/*
+ *  sqltypes.h
+ *
+ *  $Id$
+ *
+ *  ODBC typedefs
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SQLTYPES_H
+#define _SQLTYPES_H
+
+/*
+ *  Set default specification to  ODBC 3.51
+ */
+#ifndef ODBCVER
+#define ODBCVER		0x0351
+#endif
+
+/*
+ *  Include Windows style defines and typedefs on Unix
+ */
+#ifndef _IODBCUNIX_H
+#include <iodbcunix.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ *  Environment specific definitions
+ */
+#ifndef EXPORT
+#define EXPORT
+#endif
+
+#ifdef WIN32
+#define SQL_API	__stdcall
+#else
+#define SQL_API
+#endif
+
+
+/*
+ *  API declaration data types
+ */
+typedef unsigned char		SQLCHAR;
+typedef signed short		SQLSMALLINT;
+typedef unsigned short		SQLUSMALLINT;
+#if (SIZEOF_LONG == 8)
+typedef signed int		SQLINTEGER;
+typedef unsigned int		SQLUINTEGER;
+#else
+typedef signed long		SQLINTEGER;
+typedef unsigned long		SQLUINTEGER;
+#endif
+typedef void *              	SQLPOINTER;
+
+#if (ODBCVER >= 0x0300)
+typedef signed char		SQLSCHAR;
+typedef unsigned char		SQLDATE;
+typedef unsigned char		SQLDECIMAL;
+typedef unsigned char		SQLNUMERIC;
+typedef double			SQLDOUBLE;
+typedef double			SQLFLOAT;
+typedef float			SQLREAL;
+typedef unsigned char		SQLTIME;
+typedef unsigned char		SQLTIMESTAMP;
+typedef unsigned char		SQLVARCHAR;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  New Win64 datatypes
+ */
+#ifdef _WIN64
+typedef INT64			SQLLEN;
+typedef UINT64			SQLULEN;
+typedef UINT64			SQLSETPOSIROW;
+#elif defined(STRICT_ODBC_TYPES)
+typedef long			SQLLEN;
+typedef unsigned long		SQLULEN;
+typedef unsigned short		SQLSETPOSIROW;
+#else
+#define SQLLEN			long
+#define SQLULEN 		unsigned long
+#define SQLSETPOSIROW		unsigned short
+#endif
+
+
+/*
+ *  Backward compatibility with older platform sdks
+ */
+typedef SQLULEN 		SQLROWCOUNT;
+typedef SQLULEN 		SQLROWSETSIZE;
+typedef SQLULEN 		SQLTRANSID;
+typedef SQLLEN			SQLROWOFFSET;
+
+
+/*
+ *  Generic pointer types
+ */
+typedef void *              	PTR;
+typedef void *			SQLHANDLE;
+
+
+/*
+ *  Handles
+ */
+typedef void *			HENV;
+typedef void *			HDBC;
+typedef void *			HSTMT;
+
+typedef SQLHANDLE		SQLHENV;
+typedef SQLHANDLE		SQLHDBC;
+typedef SQLHANDLE		SQLHSTMT;
+#if (ODBCVER >= 0x0300)
+typedef SQLHANDLE		SQLHDESC;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Window Handle
+ */
+#if defined(WIN32) || defined (_WIN64) || defined(OS2)
+typedef HWND			SQLHWND;
+#elif defined(macintosh)
+#include <Dialogs.h>
+typedef WindowPtr 		HWND;
+typedef HWND 			SQLHWND;
+#else
+typedef SQLPOINTER 		HWND;
+typedef SQLPOINTER 		SQLHWND;
+#endif
+
+
+/*
+ *  SQL portable types for C
+ */
+typedef unsigned char		UCHAR;
+typedef signed char		SCHAR;
+typedef short int		SWORD;
+typedef unsigned short int	UWORD;
+typedef long int		SDWORD;
+typedef unsigned long int	UDWORD;
+
+typedef signed short		SSHORT;
+typedef unsigned short		USHORT;
+typedef signed long		SLONG;
+typedef unsigned long		ULONG;
+typedef float			SFLOAT;
+typedef double			SDOUBLE;
+typedef double			LDOUBLE;
+
+
+/*
+ *  Return type for functions
+ */
+typedef signed short		RETCODE;
+typedef SQLSMALLINT		SQLRETURN;
+
+
+/*
+ *  SQL portable types for C - DATA, TIME, TIMESTAMP, and BOOKMARK
+ */
+typedef SQLULEN			BOOKMARK;
+
+
+typedef struct tagDATE_STRUCT
+  {
+    SQLSMALLINT year;
+    SQLUSMALLINT month;
+    SQLUSMALLINT day;
+  }
+DATE_STRUCT;
+
+#if (ODBCVER >= 0x0300)
+typedef DATE_STRUCT		SQL_DATE_STRUCT;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+typedef struct tagTIME_STRUCT
+  {
+    SQLUSMALLINT hour;
+    SQLUSMALLINT minute;
+    SQLUSMALLINT second;
+  }
+TIME_STRUCT;
+
+#if (ODBCVER >= 0x0300)
+typedef TIME_STRUCT		SQL_TIME_STRUCT;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+typedef struct tagTIMESTAMP_STRUCT
+  {
+    SQLSMALLINT year;
+    SQLUSMALLINT month;
+    SQLUSMALLINT day;
+    SQLUSMALLINT hour;
+    SQLUSMALLINT minute;
+    SQLUSMALLINT second;
+    SQLUINTEGER fraction;
+  }
+TIMESTAMP_STRUCT;
+
+#if (ODBCVER >= 0x0300)
+typedef TIMESTAMP_STRUCT	SQL_TIMESTAMP_STRUCT;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Enumeration for DATETIME_INTERVAL_SUBCODE values for interval data types
+ *
+ *  These values are from SQL-92
+ */
+#if (ODBCVER >= 0x0300)
+typedef enum
+  {
+    SQL_IS_YEAR			= 1,
+    SQL_IS_MONTH		= 2,
+    SQL_IS_DAY			= 3,
+    SQL_IS_HOUR			= 4,
+    SQL_IS_MINUTE		= 5,
+    SQL_IS_SECOND		= 6,
+    SQL_IS_YEAR_TO_MONTH	= 7,
+    SQL_IS_DAY_TO_HOUR		= 8,
+    SQL_IS_DAY_TO_MINUTE	= 9,
+    SQL_IS_DAY_TO_SECOND	= 10,
+    SQL_IS_HOUR_TO_MINUTE	= 11,
+    SQL_IS_HOUR_TO_SECOND	= 12,
+    SQL_IS_MINUTE_TO_SECOND	= 13
+  }
+SQLINTERVAL;
+
+
+typedef struct tagSQL_YEAR_MONTH
+  {
+    SQLUINTEGER year;
+    SQLUINTEGER month;
+  }
+SQL_YEAR_MONTH_STRUCT;
+
+
+typedef struct tagSQL_DAY_SECOND
+  {
+    SQLUINTEGER day;
+    SQLUINTEGER hour;
+    SQLUINTEGER minute;
+    SQLUINTEGER second;
+    SQLUINTEGER fraction;
+  }
+SQL_DAY_SECOND_STRUCT;
+
+
+typedef struct tagSQL_INTERVAL_STRUCT
+  {
+    SQLINTERVAL interval_type;
+    SQLSMALLINT interval_sign;
+    union
+      {
+	SQL_YEAR_MONTH_STRUCT year_month;
+	SQL_DAY_SECOND_STRUCT day_second;
+      }
+    intval;
+  }
+SQL_INTERVAL_STRUCT;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  The ODBC C types for SQL_C_SBIGINT and SQL_C_UBIGINT
+ */
+#if (ODBCVER >= 0x0300)
+
+#if defined(_MSC_VER) && (_MSC_VER >= 900)
+#  define ODBCINT64 		__int64
+#endif
+
+#ifndef ODBCINT64
+# if (SIZEOF_LONG == 8)
+#   define ODBCINT64		long
+# else
+#   define ODBCINT64		long long
+# endif
+#endif /* ODBCINT64 */
+
+#if defined (ODBCINT64)
+typedef signed   ODBCINT64	SQLBIGINT;
+typedef unsigned ODBCINT64	SQLUBIGINT;
+#endif	/* ODBCINT64 */
+
+#endif	/* ODBCVER >= 0x0300 */
+
+
+/*
+ *  The internal representation of the numeric data type
+ */
+#if (ODBCVER >= 0x0300)
+#define SQL_MAX_NUMERIC_LEN	16
+typedef struct tagSQL_NUMERIC_STRUCT
+  {
+    SQLCHAR	precision;
+    SQLSCHAR	scale;
+    SQLCHAR	sign;		/* 0 for negative, 1 for positive */
+    SQLCHAR	val[SQL_MAX_NUMERIC_LEN];
+  }
+SQL_NUMERIC_STRUCT;
+#endif	/* ODBCVER >= 0x0300 */
+
+
+#if (ODBCVER >= 0x0350)
+#ifdef GUID_DEFINED
+typedef GUID 			SQLGUID;
+#else
+typedef struct tagSQLGUID
+  {
+    unsigned int	Data1;
+    unsigned short	Data2;
+    unsigned short	Data3;
+    unsigned char	Data4[8];	/* BYTE */
+  }
+SQLGUID;
+#endif	/* GUID_DEFINED */
+#endif	/* ODBCVER >= 0x0350 */
+
+
+#if defined(WIN32)
+typedef unsigned short SQLWCHAR;
+#else
+#  include <stdlib.h>
+
+#  if defined(__cplusplus)		|| \
+      defined(_WCHAR_T)			|| \
+      defined(_WCHAR_T_DEFINED)		|| \
+      defined(_WCHAR_T_DEFINED_)	|| \
+      defined(_WCHAR_T_DECLARED)	|| \
+      defined(_BSD_WCHAR_T_DEFINED_)	|| \
+      defined(_BSD_WCHAR_T_)		|| \
+      defined(_BSD_CT_RUNE_T_)      || \
+      defined(__DEFINED_wchar_t)
+typedef wchar_t SQLWCHAR;
+#  else
+#    error Please make sure your system supports the wchar_t type
+#  endif
+#endif /* WIN32 */
+
+
+#ifdef UNICODE
+typedef SQLWCHAR        	SQLTCHAR;
+#else
+typedef SQLCHAR         	SQLTCHAR;
+#endif  /* UNICODE */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _SQLTYPES_H */

+ 818 - 0
odbc.mod/iodbc/include/sqlucode.h

@@ -0,0 +1,818 @@
+/*
+ *  sqlucode.h
+ *
+ *  $Id$
+ *
+ *  ODBC Unicode defines
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SQLUCODE_H
+#define _SQLUCODE_H
+
+#ifndef _SQLEXT_H
+#include <sqlext.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ *  SQL datatypes - Unicode
+ */
+#define SQL_WCHAR				(-8)
+#define SQL_WVARCHAR				(-9)
+#define SQL_WLONGVARCHAR			(-10)
+#define SQL_C_WCHAR				SQL_WCHAR
+
+#ifdef UNICODE
+#define SQL_C_TCHAR				SQL_C_WCHAR
+#else
+#define SQL_C_TCHAR				SQL_C_CHAR
+#endif
+
+
+/* SQLTablesW */
+#if (ODBCVER >= 0x0300)
+#define SQL_ALL_CATALOGSW			L"%"
+#define SQL_ALL_SCHEMASW			L"%"
+#define SQL_ALL_TABLE_TYPESW			L"%"
+#endif /* ODBCVER >= 0x0300 */
+
+
+/*
+ *  Size of SQLSTATE - Unicode
+ */
+#define SQL_SQLSTATE_SIZEW			10
+
+
+/*
+ *  Function Prototypes - Unicode
+ */
+SQLRETURN SQL_API SQLColAttributeW (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  iCol,
+    SQLUSMALLINT	  iField,
+    SQLPOINTER		  pCharAttr,
+    SQLSMALLINT		  cbCharAttrMax,
+    SQLSMALLINT		* pcbCharAttr,
+    SQLLEN		* pNumAttr);
+
+SQLRETURN SQL_API SQLColAttributesW (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  icol,
+    SQLUSMALLINT	  fDescType,
+    SQLPOINTER		  rgbDesc,
+    SQLSMALLINT		  cbDescMax,
+    SQLSMALLINT		* pcbDesc,
+    SQLLEN		* pfDesc);
+
+SQLRETURN SQL_API SQLConnectW (
+    SQLHDBC		  hdbc,
+    SQLWCHAR		* szDSN,
+    SQLSMALLINT		  cbDSN,
+    SQLWCHAR		* szUID,
+    SQLSMALLINT		  cbUID,
+    SQLWCHAR		* szAuthStr,
+    SQLSMALLINT		  cbAuthStr);
+
+SQLRETURN SQL_API SQLDescribeColW (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  icol,
+    SQLWCHAR		* szColName,
+    SQLSMALLINT		  cbColNameMax,
+    SQLSMALLINT		* pcbColName,
+    SQLSMALLINT		* pfSqlType,
+    SQLULEN		* pcbColDef,
+    SQLSMALLINT		* pibScale,
+    SQLSMALLINT		* pfNullable);
+
+SQLRETURN SQL_API SQLErrorW (
+    SQLHENV		  henv,
+    SQLHDBC		  hdbc,
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szSqlState,
+    SQLINTEGER		* pfNativeError,
+    SQLWCHAR		* szErrorMsg,
+    SQLSMALLINT		  cbErrorMsgMax,
+    SQLSMALLINT		* pcbErrorMsg);
+
+SQLRETURN SQL_API SQLExecDirectW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStr);
+
+SQLRETURN SQL_API SQLGetConnectAttrW (
+    SQLHDBC		  hdbc,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax,
+    SQLINTEGER		* pcbValue);
+
+SQLRETURN SQL_API SQLGetCursorNameW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCursor,
+    SQLSMALLINT		  cbCursorMax,
+    SQLSMALLINT		* pcbCursor);
+
+#if (ODBCVER >= 0x0300)
+SQLRETURN SQL_API SQLSetDescFieldW (
+    SQLHDESC		  DescriptorHandle,
+    SQLSMALLINT		  RecNumber,
+    SQLSMALLINT		  FieldIdentifier,
+    SQLPOINTER		  Value,
+    SQLINTEGER		  BufferLength);
+
+SQLRETURN SQL_API SQLGetDescFieldW (
+    SQLHDESC		  hdesc,
+    SQLSMALLINT		  iRecord,
+    SQLSMALLINT		  iField,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax,
+    SQLINTEGER		* pcbValue);
+
+SQLRETURN SQL_API SQLGetDescRecW (
+    SQLHDESC		  hdesc,
+    SQLSMALLINT		  iRecord,
+    SQLWCHAR		* szName,
+    SQLSMALLINT		  cbNameMax,
+    SQLSMALLINT		* pcbName,
+    SQLSMALLINT		* pfType,
+    SQLSMALLINT		* pfSubType,
+    SQLLEN		* pLength,
+    SQLSMALLINT		* pPrecision,
+    SQLSMALLINT		* pScale,
+    SQLSMALLINT		* pNullable);
+
+SQLRETURN SQL_API SQLGetDiagFieldW (
+    SQLSMALLINT		  fHandleType,
+    SQLHANDLE		  handle,
+    SQLSMALLINT		  iRecord,
+    SQLSMALLINT		  fDiagField,
+    SQLPOINTER		  rgbDiagInfo,
+    SQLSMALLINT		  cbDiagInfoMax,
+    SQLSMALLINT		* pcbDiagInfo);
+
+SQLRETURN SQL_API SQLGetDiagRecW (
+    SQLSMALLINT		  fHandleType,
+    SQLHANDLE		  handle,
+    SQLSMALLINT		  iRecord,
+    SQLWCHAR		* szSqlState,
+    SQLINTEGER		* pfNativeError,
+    SQLWCHAR		* szErrorMsg,
+    SQLSMALLINT		  cbErrorMsgMax,
+    SQLSMALLINT		* pcbErrorMsg);
+#endif
+
+SQLRETURN SQL_API SQLPrepareW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStr);
+
+SQLRETURN SQL_API SQLSetConnectAttrW (
+    SQLHDBC		  hdbc,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValue);
+
+SQLRETURN SQL_API SQLSetCursorNameW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCursor,
+    SQLSMALLINT		  cbCursor);
+
+SQLRETURN SQL_API SQLColumnsW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLWCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLGetConnectOptionW (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fOption,
+    SQLPOINTER		  pvParam);
+
+SQLRETURN SQL_API SQLGetInfoW (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fInfoType,
+    SQLPOINTER		  rgbInfoValue,
+    SQLSMALLINT		  cbInfoValueMax,
+    SQLSMALLINT		* pcbInfoValue);
+
+SQLRETURN SQL_API SQLGetTypeInfoW (
+    SQLHSTMT		  StatementHandle,
+    SQLSMALLINT		  DataType);
+
+SQLRETURN SQL_API SQLSetConnectOptionW (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fOption,
+    SQLULEN		  vParam);
+
+SQLRETURN SQL_API SQLSpecialColumnsW (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  fColType,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLUSMALLINT	  fScope,
+    SQLUSMALLINT	  fNullable);
+
+SQLRETURN SQL_API SQLStatisticsW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLUSMALLINT	  fUnique,
+    SQLUSMALLINT	  fAccuracy);
+
+SQLRETURN SQL_API SQLTablesW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLWCHAR		* szTableType,
+    SQLSMALLINT		  cbTableType);
+
+SQLRETURN SQL_API SQLDataSourcesW (
+    SQLHENV		  henv,
+    SQLUSMALLINT	  fDirection,
+    SQLWCHAR		* szDSN,
+    SQLSMALLINT		  cbDSNMax,
+    SQLSMALLINT		* pcbDSN,
+    SQLWCHAR		* szDescription,
+    SQLSMALLINT		  cbDescriptionMax,
+    SQLSMALLINT		* pcbDescription);
+
+SQLRETURN SQL_API SQLDriverConnectW (
+    SQLHDBC		  hdbc,
+    SQLHWND		  hwnd,
+    SQLWCHAR		* szConnStrIn,
+    SQLSMALLINT		  cbConnStrIn,
+    SQLWCHAR		* szConnStrOut,
+    SQLSMALLINT		  cbConnStrOutMax,
+    SQLSMALLINT		* pcbConnStrOut,
+    SQLUSMALLINT	  fDriverCompletion);
+
+SQLRETURN SQL_API SQLBrowseConnectW (
+    SQLHDBC		  hdbc,
+    SQLWCHAR		* szConnStrIn,
+    SQLSMALLINT		  cbConnStrIn,
+    SQLWCHAR		* szConnStrOut,
+    SQLSMALLINT		  cbConnStrOutMax,
+    SQLSMALLINT		* pcbConnStrOut);
+
+SQLRETURN SQL_API SQLColumnPrivilegesW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLWCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLGetStmtAttrW (
+    SQLHSTMT		  hstmt,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax,
+    SQLINTEGER		* pcbValue);
+
+SQLRETURN SQL_API SQLSetStmtAttrW (
+    SQLHSTMT		  hstmt,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax);
+
+SQLRETURN SQL_API SQLForeignKeysW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szPkCatalogName,
+    SQLSMALLINT		  cbPkCatalogName,
+    SQLWCHAR		* szPkSchemaName,
+    SQLSMALLINT		  cbPkSchemaName,
+    SQLWCHAR		* szPkTableName,
+    SQLSMALLINT		  cbPkTableName,
+    SQLWCHAR		* szFkCatalogName,
+    SQLSMALLINT		  cbFkCatalogName,
+    SQLWCHAR		* szFkSchemaName,
+    SQLSMALLINT		  cbFkSchemaName,
+    SQLWCHAR		* szFkTableName,
+    SQLSMALLINT		  cbFkTableName);
+
+SQLRETURN SQL_API SQLNativeSqlW (
+    SQLHDBC		  hdbc,
+    SQLWCHAR		* szSqlStrIn,
+    SQLINTEGER		  cbSqlStrIn,
+    SQLWCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStrMax,
+    SQLINTEGER		* pcbSqlStr);
+
+SQLRETURN SQL_API SQLPrimaryKeysW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName);
+
+SQLRETURN SQL_API SQLProcedureColumnsW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szProcName,
+    SQLSMALLINT		  cbProcName,
+    SQLWCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLProceduresW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szProcName,
+    SQLSMALLINT		  cbProcName);
+
+SQLRETURN SQL_API SQLTablePrivilegesW (
+    SQLHSTMT		  hstmt,
+    SQLWCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLWCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLWCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName);
+
+SQLRETURN SQL_API SQLDriversW (
+    SQLHENV		  henv,
+    SQLUSMALLINT	  fDirection,
+    SQLWCHAR		* szDriverDesc,
+    SQLSMALLINT		  cbDriverDescMax,
+    SQLSMALLINT		* pcbDriverDesc,
+    SQLWCHAR		* szDriverAttributes,
+    SQLSMALLINT		  cbDrvrAttrMax,
+    SQLSMALLINT		* pcbDrvrAttr);
+
+
+/*
+ *  Function prototypes - ANSI
+ */
+
+SQLRETURN SQL_API SQLColAttributeA (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  iCol,
+    SQLUSMALLINT	  iField,
+    SQLPOINTER		  pCharAttr,
+    SQLSMALLINT		  cbCharAttrMax,
+    SQLSMALLINT		* pcbCharAttr,
+    SQLLEN		* pNumAttr);
+
+SQLRETURN SQL_API SQLColAttributesA (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  icol,
+    SQLUSMALLINT	  fDescType,
+    SQLPOINTER		  rgbDesc,
+    SQLSMALLINT		  cbDescMax,
+    SQLSMALLINT		* pcbDesc,
+    SQLLEN		* pfDesc);
+
+SQLRETURN SQL_API SQLConnectA (
+    SQLHDBC		  hdbc,
+    SQLCHAR		* szDSN,
+    SQLSMALLINT		  cbDSN,
+    SQLCHAR		* szUID,
+    SQLSMALLINT		  cbUID,
+    SQLCHAR		* szAuthStr,
+    SQLSMALLINT		  cbAuthStr);
+
+SQLRETURN SQL_API SQLDescribeColA (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  icol,
+    SQLCHAR		* szColName,
+    SQLSMALLINT		  cbColNameMax,
+    SQLSMALLINT		* pcbColName,
+    SQLSMALLINT		* pfSqlType,
+    SQLULEN		* pcbColDef,
+    SQLSMALLINT		* pibScale,
+    SQLSMALLINT		* pfNullable);
+
+SQLRETURN SQL_API SQLErrorA (
+    SQLHENV		  henv,
+    SQLHDBC		  hdbc,
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szSqlState,
+    SQLINTEGER		* pfNativeError,
+    SQLCHAR		* szErrorMsg,
+    SQLSMALLINT		  cbErrorMsgMax,
+    SQLSMALLINT		* pcbErrorMsg);
+
+SQLRETURN SQL_API SQLExecDirectA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStr);
+
+SQLRETURN SQL_API SQLGetConnectAttrA (
+    SQLHDBC		  hdbc,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax,
+    SQLINTEGER		* pcbValue);
+
+SQLRETURN SQL_API SQLGetCursorNameA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCursor,
+    SQLSMALLINT		  cbCursorMax,
+    SQLSMALLINT		* pcbCursor);
+
+#if (ODBCVER >= 0x0300)
+SQLRETURN SQL_API SQLSetDescFieldA (
+    SQLHDESC		  DescriptorHandle,
+    SQLSMALLINT		  RecNumber,
+    SQLSMALLINT		  FieldIdentifier,
+    SQLPOINTER		  Value,
+    SQLINTEGER		  BufferLength);
+
+SQLRETURN SQL_API SQLGetDescFieldA (
+    SQLHDESC		  hdesc,
+    SQLSMALLINT		  iRecord,
+    SQLSMALLINT		  iField,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax,
+    SQLINTEGER		* pcbValue);
+
+SQLRETURN SQL_API SQLGetDescRecA (
+    SQLHDESC		  hdesc,
+    SQLSMALLINT		  iRecord,
+    SQLCHAR		* szName,
+    SQLSMALLINT		  cbNameMax,
+    SQLSMALLINT		* pcbName,
+    SQLSMALLINT		* pfType,
+    SQLSMALLINT		* pfSubType,
+    SQLLEN		* pLength,
+    SQLSMALLINT		* pPrecision,
+    SQLSMALLINT		* pScale,
+    SQLSMALLINT		* pNullable);
+
+SQLRETURN SQL_API SQLGetDiagFieldA (
+    SQLSMALLINT		  fHandleType,
+    SQLHANDLE		  handle,
+    SQLSMALLINT		  iRecord,
+    SQLSMALLINT		  fDiagField,
+    SQLPOINTER		  rgbDiagInfo,
+    SQLSMALLINT		  cbDiagInfoMax,
+    SQLSMALLINT		* pcbDiagInfo);
+
+SQLRETURN SQL_API SQLGetDiagRecA (
+    SQLSMALLINT		  fHandleType,
+    SQLHANDLE		  handle,
+    SQLSMALLINT		  iRecord,
+    SQLCHAR		* szSqlState,
+    SQLINTEGER		* pfNativeError,
+    SQLCHAR		* szErrorMsg,
+    SQLSMALLINT		  cbErrorMsgMax,
+    SQLSMALLINT		* pcbErrorMsg);
+#endif
+
+SQLRETURN SQL_API SQLPrepareA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStr);
+
+SQLRETURN SQL_API SQLSetConnectAttrA (
+    SQLHDBC		  hdbc,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValue);
+
+SQLRETURN SQL_API SQLSetCursorNameA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCursor,
+    SQLSMALLINT		  cbCursor);
+
+SQLRETURN SQL_API SQLColumnsA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLGetConnectOptionA (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fOption,
+    SQLPOINTER		  pvParam);
+
+SQLRETURN SQL_API SQLGetInfoA (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fInfoType,
+    SQLPOINTER		  rgbInfoValue,
+    SQLSMALLINT		  cbInfoValueMax,
+    SQLSMALLINT		* pcbInfoValue);
+
+SQLRETURN SQL_API SQLGetTypeInfoA (
+    SQLHSTMT		  StatementHandle,
+    SQLSMALLINT		  DataType);
+
+SQLRETURN SQL_API SQLSetConnectOptionA (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fOption,
+    SQLULEN		  vParam);
+
+SQLRETURN SQL_API SQLSpecialColumnsA (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  fColType,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLUSMALLINT	  fScope,
+    SQLUSMALLINT	  fNullable);
+
+SQLRETURN SQL_API SQLStatisticsA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLUSMALLINT	  fUnique,
+    SQLUSMALLINT	  fAccuracy);
+
+SQLRETURN SQL_API SQLTablesA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLCHAR		* szTableType,
+    SQLSMALLINT		  cbTableType);
+
+SQLRETURN SQL_API SQLDataSourcesA (
+    SQLHENV		  henv,
+    SQLUSMALLINT	  fDirection,
+    SQLCHAR		* szDSN,
+    SQLSMALLINT		  cbDSNMax,
+    SQLSMALLINT		* pcbDSN,
+    SQLCHAR		* szDescription,
+    SQLSMALLINT		  cbDescriptionMax,
+    SQLSMALLINT		* pcbDescription);
+
+SQLRETURN SQL_API SQLDriverConnectA (
+    SQLHDBC		  hdbc,
+    SQLHWND		  hwnd,
+    SQLCHAR		* szConnStrIn,
+    SQLSMALLINT		  cbConnStrIn,
+    SQLCHAR		* szConnStrOut,
+    SQLSMALLINT		  cbConnStrOutMax,
+    SQLSMALLINT		* pcbConnStrOut,
+    SQLUSMALLINT	  fDriverCompletion);
+
+SQLRETURN SQL_API SQLBrowseConnectA (
+    SQLHDBC		  hdbc,
+    SQLCHAR		* szConnStrIn,
+    SQLSMALLINT		  cbConnStrIn,
+    SQLCHAR		* szConnStrOut,
+    SQLSMALLINT		  cbConnStrOutMax,
+    SQLSMALLINT		* pcbConnStrOut);
+
+SQLRETURN SQL_API SQLColumnPrivilegesA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName,
+    SQLCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLGetStmtAttrA (
+    SQLHSTMT		  hstmt,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax,
+    SQLINTEGER		* pcbValue);
+
+SQLRETURN SQL_API SQLSetStmtAttrA (
+    SQLHSTMT		  hstmt,
+    SQLINTEGER		  fAttribute,
+    SQLPOINTER		  rgbValue,
+    SQLINTEGER		  cbValueMax);
+
+SQLRETURN SQL_API SQLForeignKeysA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szPkCatalogName,
+    SQLSMALLINT		  cbPkCatalogName,
+    SQLCHAR		* szPkSchemaName,
+    SQLSMALLINT		  cbPkSchemaName,
+    SQLCHAR		* szPkTableName,
+    SQLSMALLINT		  cbPkTableName,
+    SQLCHAR		* szFkCatalogName,
+    SQLSMALLINT		  cbFkCatalogName,
+    SQLCHAR		* szFkSchemaName,
+    SQLSMALLINT		  cbFkSchemaName,
+    SQLCHAR		* szFkTableName,
+    SQLSMALLINT		  cbFkTableName);
+
+SQLRETURN SQL_API SQLNativeSqlA (
+    SQLHDBC		  hdbc,
+    SQLCHAR		* szSqlStrIn,
+    SQLINTEGER		  cbSqlStrIn,
+    SQLCHAR		* szSqlStr,
+    SQLINTEGER		  cbSqlStrMax,
+    SQLINTEGER		* pcbSqlStr);
+
+SQLRETURN SQL_API SQLPrimaryKeysA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName);
+
+SQLRETURN SQL_API SQLProcedureColumnsA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szProcName,
+    SQLSMALLINT		  cbProcName,
+    SQLCHAR		* szColumnName,
+    SQLSMALLINT		  cbColumnName);
+
+SQLRETURN SQL_API SQLProceduresA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szProcName,
+    SQLSMALLINT		  cbProcName);
+
+SQLRETURN SQL_API SQLTablePrivilegesA (
+    SQLHSTMT		  hstmt,
+    SQLCHAR		* szCatalogName,
+    SQLSMALLINT		  cbCatalogName,
+    SQLCHAR		* szSchemaName,
+    SQLSMALLINT		  cbSchemaName,
+    SQLCHAR		* szTableName,
+    SQLSMALLINT		  cbTableName);
+
+SQLRETURN SQL_API SQLDriversA (
+    SQLHENV		  henv,
+    SQLUSMALLINT	  fDirection,
+    SQLCHAR		* szDriverDesc,
+    SQLSMALLINT		  cbDriverDescMax,
+    SQLSMALLINT		* pcbDriverDesc,
+    SQLCHAR		* szDriverAttributes,
+    SQLSMALLINT		  cbDrvrAttrMax,
+    SQLSMALLINT		* pcbDrvrAttr);
+
+
+/*
+ *  Mapping macros for Unicode
+ */
+#ifndef SQL_NOUNICODEMAP 	/* define this to disable the mapping */
+#ifdef  UNICODE
+
+#define SQLColAttribute		SQLColAttributeW
+#define SQLColAttributes	SQLColAttributesW
+#define SQLConnect		SQLConnectW
+#define SQLDescribeCol		SQLDescribeColW
+#define SQLError		SQLErrorW
+#define SQLExecDirect		SQLExecDirectW
+#define SQLGetConnectAttr	SQLGetConnectAttrW
+#define SQLGetCursorName	SQLGetCursorNameW
+#define SQLGetDescField		SQLGetDescFieldW
+#define SQLGetDescRec		SQLGetDescRecW
+#define SQLGetDiagField		SQLGetDiagFieldW
+#define SQLGetDiagRec		SQLGetDiagRecW
+#define SQLPrepare		SQLPrepareW
+#define SQLSetConnectAttr	SQLSetConnectAttrW
+#define SQLSetCursorName	SQLSetCursorNameW
+#define SQLSetDescField		SQLSetDescFieldW
+#define SQLSetStmtAttr		SQLSetStmtAttrW
+#define SQLGetStmtAttr		SQLGetStmtAttrW
+#define SQLColumns		SQLColumnsW
+#define SQLGetConnectOption	SQLGetConnectOptionW
+#define SQLGetInfo		SQLGetInfoW
+#define SQLGetTypeInfo		SQLGetTypeInfoW
+#define SQLSetConnectOption	SQLSetConnectOptionW
+#define SQLSpecialColumns	SQLSpecialColumnsW
+#define SQLStatistics		SQLStatisticsW
+#define SQLTables		SQLTablesW
+#define SQLDataSources		SQLDataSourcesW
+#define SQLDriverConnect	SQLDriverConnectW
+#define SQLBrowseConnect	SQLBrowseConnectW
+#define SQLColumnPrivileges	SQLColumnPrivilegesW
+#define SQLForeignKeys		SQLForeignKeysW
+#define SQLNativeSql		SQLNativeSqlW
+#define SQLPrimaryKeys		SQLPrimaryKeysW
+#define SQLProcedureColumns	SQLProcedureColumnsW
+#define SQLProcedures		SQLProceduresW
+#define SQLTablePrivileges	SQLTablePrivilegesW
+#define SQLDrivers		SQLDriversW
+
+#endif /* UNICODE */
+#endif /* SQL_NOUNICODEMAP */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SQLUCODE_H */

+ 115 - 0
odbc.mod/iodbc/iodbc/Makefile.am

@@ -0,0 +1,115 @@
+#
+#  Makefile.am
+#
+#  The iODBC driver manager.
+#
+#  Copyright (C) 1995 Ke Jin <[email protected]>
+#  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+#  All Rights Reserved.
+#
+#  This software is released under the terms of either of the following
+#  licenses:
+#
+#      - GNU Library General Public License (see LICENSE.LGPL)
+#      - The BSD License (see LICENSE.BSD).
+#
+#  Note that the only valid version of the LGPL license as far as this
+#  project is concerned is the original GNU Library General Public License
+#  Version 2, dated June 1991.
+#
+#  While not mandated by the BSD license, any patches you make to the
+#  iODBC source code may be contributed back into the iODBC project
+#  at your discretion. Contributions will benefit the Open Source and
+#  Data Access community as a whole. Submissions may be made at:
+#
+#      http://www.iodbc.org
+#
+#
+#  GNU Library Generic Public License Version 2
+#  ============================================
+#  This library is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU Library General Public
+#  License as published by the Free Software Foundation; only
+#  Version 2 of the License dated June 1991.
+#
+#  This library is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  Library General Public License for more details.
+#
+#  You should have received a copy of the GNU Library General Public
+#  License along with this library; if not, write to the Free
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+#
+#  The BSD License
+#  ===============
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in
+#     the documentation and/or other materials provided with the
+#     distribution.
+#  3. Neither the name of OpenLink Software Inc. nor the names of its
+#     contributors may be used to endorse or promote products derived
+#     from this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+#  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+#  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+#  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+#  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+#  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+#  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+
+SUBDIRS			= trace .
+
+AM_CPPFLAGS		= -I$(top_srcdir)/include -I$(top_srcdir)/iodbcinst
+
+lib_LTLIBRARIES		= libiodbc.la
+
+libiodbc_la_LDFLAGS	= -version-info @lib_version@ \
+	                  -export-symbols $(srcdir)/iodbc.exp
+libiodbc_la_LIBADD	= trace/libiodbctrace.la \
+			  ../iodbcinst/libiodbc_common.la \
+			  $(LIBADD_DL) $(LIBADD_OS)
+libiodbc_la_SOURCES	= catalog.c connect.c dlproc.c execute.c \
+			  fetch.c hdbc.c henv.c herr.c hstmt.c info.c \
+			  misc.c prepare.c result.c odbc3.c
+
+noinst_HEADERS		= dlproc.h hdbc.h henv.h herr.h iodbc_misc.h \
+			  hstmt.h itrace.h henv.ci herr.ci hdesc.h ithread.h
+			  
+
+if DARWIN
+libiodbc.la: $(libiodbc_la_OBJECTS) $(libiodbc_la_DEPENDENCIES)
+	$(LINK) -rpath $(libdir) $(libiodbc_la_LDFLAGS) $(libiodbc_la_OBJECTS) $(libiodbc_la_LIBADD) $(LIBS)
+	-$(STRIP) -s $(top_srcdir)/mac/iodbc.exp -u .libs/*.dylib
+endif
+
+EXTRA_DIST		= \
+	$(srcdir)/iodbc.def \
+	$(srcdir)/iodbc.exp \
+	$(srcdir)/main.c \
+	$(srcdir)/vmscompile.com \
+	$(srcdir)/install_libodbc.sh
+
+
+#
+#  Add symbolic link for libodbc.so as some apps need this
+#
+install-exec-hook:
+if INSTALL_LIBODBC
+	$(SHELL) $(srcdir)/install_libodbc.sh $(DESTDIR)$(libdir)
+endif
+

+ 281 - 0
odbc.mod/iodbc/iodbc/bmx_misc.c

@@ -0,0 +1,281 @@
+/*
+ *  misc.c
+ *
+ *  $Id$
+ *
+ *  Miscellaneous functions
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iodbc.h>
+
+#include <sql.h>
+#include <sqlext.h>
+#include <odbcinst.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include "unicode.h"
+
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#include "herr.h"
+#include "misc.h"
+#include "iodbc_misc.h"
+
+#ifdef _MAC
+#include <getfpn.h>
+#endif /* _MAC */
+
+
+/*
+ *  Parse a configuration from string (internal)
+ */
+int
+_iodbcdm_cfg_parse_str_Internal (PCONFIG pconfig, char *str)
+{
+  char *s;
+  int count;
+
+  /* init image */
+  _iodbcdm_cfg_freeimage (pconfig);
+  if (str == NULL)
+    {
+      /* NULL string is ok */
+      return 0;
+    }
+  s = pconfig->image = strdup (str);
+
+  /* Add [ODBC] section */
+  if (_iodbcdm_cfg_storeentry (pconfig, "ODBC", NULL, NULL, NULL, 0) == -1)
+    return -1;
+
+  for (count = 0; *s; count++)
+    {
+      char *keywd = NULL, *value;
+      char *cp, *n;
+
+      /* 
+       *  Extract KEY=VALUE upto first ';'
+       */
+      for (cp = s; *cp && *cp != ';'; cp++)
+	{
+	  if (*cp == '{')
+	    {
+	      for (cp++; *cp && *cp != '}'; cp++)
+		;
+	    }
+	}
+
+      /*
+       *  Store start of next token if available in n and terminate string
+       */
+      if (*cp)
+	{
+	  *cp = 0;
+	  n = cp + 1;
+	}
+      else
+	n = cp;
+
+      /*
+       *  Find '=' in string
+       */
+      for (cp = s; *cp && *cp != '='; cp++)
+	;
+
+      if (*cp)
+	{
+	  *cp++ = 0;
+          keywd = s;
+          value = cp;
+	}
+      else if (count == 0)
+	{
+	  /*
+	   *  Handle missing DSN=... from the beginning of the string, e.g.:
+	   *  'dsn_ora7;UID=scott;PWD=tiger'
+	   */
+          keywd = "DSN";
+	  value = s;
+	}
+
+      if (keywd != NULL)
+        {
+          /* store entry */
+          if (_iodbcdm_cfg_storeentry (pconfig, NULL,
+		  keywd, value, NULL, 0) == -1)
+            return -1;
+	}
+
+      /*
+       *  Continue with next token
+       */
+      s = n;
+    }
+
+  /* we're done */
+  pconfig->flags |= CFG_VALID;
+  pconfig->dirty = 1;
+  return 0;
+}
+
+
+/*
+ *  Initialize a configuration from string
+ */
+int
+_iodbcdm_cfg_init_str (PCONFIG *ppconf, void *str, int size, int wide,
+	DM_CONV *conv)
+{
+  PCONFIG pconfig;
+
+  *ppconf = NULL;
+
+  /* init config */
+  if ((pconfig = (PCONFIG) calloc (1, sizeof (TCONFIG))) == NULL)
+    return -1;
+
+  /* parse */
+  if (_iodbcdm_cfg_parse_str (pconfig, str, size, wide, conv) == -1)
+    {
+      _iodbcdm_cfg_done (pconfig);
+      return -1;
+    }
+
+  /* we're done */
+  *ppconf = pconfig;
+  return 0;
+}
+
+
+/*
+ *  Parse a configuration from string
+ */
+int
+_iodbcdm_cfg_parse_str (PCONFIG pconfig, void *str, int size, int wide,
+	DM_CONV *conv)
+{
+  int ret;
+  char *_str;
+
+  _str = wide ? (char *) DM_WtoU8 (conv, str, size) : str;
+
+  ret = _iodbcdm_cfg_parse_str_Internal (pconfig, _str);
+
+  if (wide)
+    MEM_FREE (_str);
+
+  return ret;
+}
+
+
+#define CATBUF(buf, str, buf_sz)					\
+  do {									\
+    if (_iodbcdm_strlcat (buf, str, buf_sz) >= buf_sz)			\
+      return -1;							\
+  } while (0)
+
+int
+_iodbcdm_cfg_to_string (PCONFIG pconfig, char *section,
+			char *buf, size_t buf_sz)
+{
+  BOOL atsection;
+
+  if (_iodbcdm_cfg_rewind (pconfig) == -1)
+    return -1;
+
+  atsection = FALSE;
+  buf[0] = '\0';
+  while (_iodbcdm_cfg_nextentry (pconfig) == 0)
+    {
+      if (atsection)
+        {
+          if (_iodbcdm_cfg_section (pconfig))
+            break;
+          else if (_iodbcdm_cfg_define (pconfig))
+            {
+              if (buf[0] != '\0')
+                CATBUF (buf, ";", buf_sz);
+              CATBUF (buf, pconfig->id, buf_sz);
+              CATBUF (buf, "=", buf_sz);
+              CATBUF (buf, pconfig->value, buf_sz);
+            }
+        }
+      else if (_iodbcdm_cfg_section (pconfig) &&
+	       !strcasecmp (pconfig->section, section))
+        atsection = TRUE;
+    }
+  return 0;
+}

+ 2520 - 0
odbc.mod/iodbc/iodbc/catalog.c

@@ -0,0 +1,2520 @@
+/*
+ *  catalog.c
+ *
+ *  $Id$
+ *
+ *  Catalog functions
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <iodbc.h>
+
+#include <sql.h>
+#include <sqlext.h>
+#include <sqlucode.h>
+
+#include "unicode.h"
+
+#include "herr.h"
+#include "henv.h"
+#include "hdbc.h"
+#include "hstmt.h"
+
+#include "dlproc.h"
+#include "itrace.h"
+
+/*
+ *  Check state for executing catalog functions
+ */
+static SQLRETURN
+_iodbcdm_cata_state_ok (
+    STMT_t * pstmt,
+    int fidx)
+{
+  sqlstcode_t sqlstat = en_00000;
+
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      switch (pstmt->state)
+	{
+	case en_stmt_needdata:
+	case en_stmt_mustput:
+	case en_stmt_canput:
+	  sqlstat = en_S1010;
+	  break;
+
+	case en_stmt_fetched:
+	case en_stmt_xfetched:
+	  sqlstat = en_24000;
+	  break;
+
+	default:
+	  break;
+	}
+    }
+  else if (pstmt->asyn_on != fidx)
+    {
+      sqlstat = en_S1010;
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  return SQL_SUCCESS;
+}
+
+
+/*
+ *  State transition for catalog function
+ */
+static SQLRETURN
+_iodbcdm_cata_state_tr (
+    STMT_t * pstmt,
+    int fidx,
+    SQLRETURN result)
+{
+
+  if (pstmt->asyn_on == fidx)
+    {
+      switch (result)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_ERROR:
+	  pstmt->asyn_on = en_NullProc;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	default:
+	  return result;
+	}
+    }
+
+  if (pstmt->state <= en_stmt_executed)
+    {
+      switch (result)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	  pstmt->state = en_stmt_cursoropen;
+	  break;
+
+	case SQL_ERROR:
+	  pstmt->state = en_stmt_allocated;
+	  pstmt->prep_state = 0;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	  pstmt->asyn_on = fidx;
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+  return result;
+}
+
+
+SQLRETURN SQL_API
+SQLGetTypeInfo_Internal (
+    SQLHSTMT hstmt,
+    SQLSMALLINT fSqlType,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+
+  waMode = waMode;	/*NOTUSED*/
+
+  for (;;)
+    {
+#if (ODBCVER < 0x0300)
+      if (fSqlType > SQL_TYPE_MAX)
+	{
+	  sqlstat = en_S1004;
+	  break;
+	}
+
+      /* Note: SQL_TYPE_DRIVER_START is a negative number So, we use ">" */
+      if (fSqlType < SQL_TYPE_MIN && fSqlType > SQL_TYPE_DRIVER_START)
+	{
+	  sqlstat = en_S1004;
+	  break;
+	}
+#endif	/* ODBCVER < 0x0300 */
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_GetTypeInfo);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_GetTypeInfo, (
+           pstmt->dhstmt,
+           fSqlType));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_GetTypeInfo, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLGetTypeInfo (SQLHSTMT hstmt,
+    SQLSMALLINT fSqlType)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLGetTypeInfo (TRACE_ENTER, hstmt, fSqlType));
+
+  retcode = SQLGetTypeInfo_Internal (hstmt, fSqlType, 'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLGetTypeInfo (TRACE_LEAVE, hstmt, fSqlType));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLGetTypeInfoA (SQLHSTMT hstmt,
+    SQLSMALLINT fSqlType)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLGetTypeInfo (TRACE_ENTER, hstmt, fSqlType));
+
+  retcode = SQLGetTypeInfo_Internal (hstmt, fSqlType, 'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLGetTypeInfo (TRACE_LEAVE, hstmt, fSqlType));
+}
+
+
+SQLRETURN SQL_API
+SQLGetTypeInfoW (SQLHSTMT hstmt,
+    SQLSMALLINT fSqlType)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLGetTypeInfoW (TRACE_ENTER, hstmt, fSqlType));
+
+  retcode = SQLGetTypeInfo_Internal (hstmt, fSqlType, 'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLGetTypeInfoW (TRACE_LEAVE, hstmt, fSqlType));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLSpecialColumns_Internal (
+    SQLHSTMT hstmt,
+    SQLUSMALLINT fColType,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fScope,
+    SQLUSMALLINT fNullable,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      if (fColType != SQL_BEST_ROWID && fColType != SQL_ROWVER)
+	{
+	  sqlstat = en_S1097;
+	  break;
+	}
+
+      if (fScope != SQL_SCOPE_CURROW
+	  && fScope != SQL_SCOPE_TRANSACTION
+	  && fScope != SQL_SCOPE_SESSION)
+	{
+	  sqlstat = en_S1098;
+	  break;
+	}
+
+      if (fNullable != SQL_NO_NULLS && fNullable != SQL_NULLABLE)
+	{
+	  sqlstat = en_S1099;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_SpecialColumns);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var (pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_SpecialColumns, (
+           pstmt->dhstmt,
+           fColType,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName,
+           fScope,
+           fNullable));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_SpecialColumns, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLSpecialColumns (SQLHSTMT hstmt,
+    SQLUSMALLINT fColType,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fScope,
+    SQLUSMALLINT fNullable)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLSpecialColumns (TRACE_ENTER,
+	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable));
+
+  retcode =  SQLSpecialColumns_Internal(
+  	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLSpecialColumns (TRACE_LEAVE,
+	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLSpecialColumnsA (SQLHSTMT hstmt,
+    SQLUSMALLINT fColType,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fScope,
+    SQLUSMALLINT fNullable)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLSpecialColumns (TRACE_ENTER,
+	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable));
+
+  retcode =  SQLSpecialColumns_Internal(
+  	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLSpecialColumns (TRACE_LEAVE,
+	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable));
+}
+
+
+SQLRETURN SQL_API
+SQLSpecialColumnsW (SQLHSTMT hstmt,
+    SQLUSMALLINT fColType,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fScope,
+    SQLUSMALLINT fNullable)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLSpecialColumnsW (TRACE_ENTER,
+	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable));
+
+  retcode =  SQLSpecialColumns_Internal(
+  	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLSpecialColumnsW (TRACE_LEAVE,
+	hstmt,
+	fColType,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fScope,
+	fNullable));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLStatistics_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fUnique,
+    SQLUSMALLINT fAccuracy,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      if (fUnique != SQL_INDEX_UNIQUE && fUnique != SQL_INDEX_ALL)
+	{
+	  sqlstat = en_S1100;
+	  break;
+	}
+
+      if (fAccuracy != SQL_ENSURE && fAccuracy != SQL_QUICK)
+	{
+	  sqlstat = en_S1101;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_Statistics);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var (pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_Statistics, (
+           pstmt->dhstmt,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName,
+           fUnique,
+           fAccuracy));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_Statistics, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLStatistics (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fUnique,
+    SQLUSMALLINT fAccuracy)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLStatistics (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy));
+
+  retcode = SQLStatistics_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLStatistics (TRACE_LEAVE,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLStatisticsA (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fUnique,
+    SQLUSMALLINT fAccuracy)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLStatistics (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy));
+
+  retcode = SQLStatistics_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLStatistics (TRACE_LEAVE,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy));
+}
+
+
+SQLRETURN SQL_API
+SQLStatisticsW (SQLHSTMT hstmt,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLUSMALLINT fUnique,
+    SQLUSMALLINT fAccuracy)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLStatisticsW (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy));
+
+  retcode = SQLStatistics_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLStatisticsW (TRACE_LEAVE,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	fUnique,
+	fAccuracy));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLTables_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLPOINTER szTableType,
+    SQLSMALLINT cbTableType,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  void * _TableType = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS)
+	  || (cbTableType < 0 && cbTableType != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_Tables);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var (pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+          _TableType = _iodbcdm_conv_var (pstmt, 3, szTableType, cbTableType, conv_direct);
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          szTableType = _TableType;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+          cbTableType = (cbTableType > 0) ? SQL_NTS : cbTableType;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_Tables, (
+           pstmt->dhstmt,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName,
+           szTableType,
+           cbTableType));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_Tables, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLTables (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR * szTableType,
+    SQLSMALLINT cbTableType)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLTables (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType));
+
+  retcode =  SQLTables_Internal(
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLTables (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLTablesA (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR * szTableType,
+    SQLSMALLINT cbTableType)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLTables (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType));
+
+  retcode = SQLTables_Internal (
+  	hstmt,
+  	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLTables (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType));
+}
+
+
+SQLRETURN SQL_API
+SQLTablesW (SQLHSTMT hstmt,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLWCHAR * szTableType,
+    SQLSMALLINT cbTableType)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLTablesW (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType));
+
+  retcode = SQLTables_Internal (
+  	hstmt,
+  	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLTablesW (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szTableType, cbTableType));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLColumnPrivileges_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLPOINTER szColumnName,
+    SQLSMALLINT cbColumnName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  void * _ColumnName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS)
+	  || (cbColumnName < 0 && cbColumnName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_ColumnPrivileges);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var (pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+          _ColumnName = _iodbcdm_conv_var (pstmt, 3, szColumnName, cbColumnName, conv_direct);
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          szColumnName = _ColumnName;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+          cbColumnName = (cbColumnName > 0) ? SQL_NTS : cbColumnName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_ColumnPrivileges, (
+           pstmt->dhstmt,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName,
+           szColumnName,
+           cbColumnName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_ColumnPrivileges, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLColumnPrivileges (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLColumnPrivileges (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLColumnPrivileges_Internal(hstmt,
+      szTableQualifier, cbTableQualifier,
+      szTableOwner, cbTableOwner,
+      szTableName, cbTableName,
+      szColumnName, cbColumnName,
+      'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLColumnPrivileges (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLColumnPrivilegesA (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLColumnPrivileges (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLColumnPrivileges_Internal(hstmt,
+      szTableQualifier, cbTableQualifier,
+      szTableOwner, cbTableOwner,
+      szTableName, cbTableName,
+      szColumnName, cbColumnName,
+      'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLColumnPrivileges (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+}
+
+
+SQLRETURN SQL_API
+SQLColumnPrivilegesW (SQLHSTMT hstmt,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLWCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLColumnPrivilegesW (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLColumnPrivileges_Internal (hstmt,
+      szTableQualifier, cbTableQualifier,
+      szTableOwner, cbTableOwner,
+      szTableName, cbTableName,
+      szColumnName, cbColumnName,
+      'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLColumnPrivilegesW (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLColumns_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLPOINTER szColumnName,
+    SQLSMALLINT cbColumnName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  void * _ColumnName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS)
+	  || (cbColumnName < 0 && cbColumnName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_Columns);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var (pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+          _ColumnName = _iodbcdm_conv_var (pstmt, 3, szColumnName, cbColumnName, conv_direct);
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          szColumnName = _ColumnName;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+          cbColumnName = (cbColumnName > 0) ? SQL_NTS : cbColumnName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_Columns, (
+           pstmt->dhstmt,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName,
+           szColumnName,
+           cbColumnName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_Columns, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLColumns (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLColumns (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLColumns_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLColumns (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLColumnsA (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLColumns (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLColumns_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLColumns (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+}
+
+
+SQLRETURN SQL_API
+SQLColumnsW (SQLHSTMT hstmt,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName,
+    SQLWCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLColumnsW (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLColumns_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLColumnsW (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	szColumnName, cbColumnName));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLForeignKeys_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szPkTableQualifier,
+    SQLSMALLINT cbPkTableQualifier,
+    SQLPOINTER szPkTableOwner,
+    SQLSMALLINT cbPkTableOwner,
+    SQLPOINTER szPkTableName,
+    SQLSMALLINT cbPkTableName,
+    SQLPOINTER szFkTableQualifier,
+    SQLSMALLINT cbFkTableQualifier,
+    SQLPOINTER szFkTableOwner,
+    SQLSMALLINT cbFkTableOwner,
+    SQLPOINTER szFkTableName,
+    SQLSMALLINT cbFkTableName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _PkTableQualifier = NULL;
+  void * _PkTableOwner = NULL;
+  void * _PkTableName = NULL;
+  void * _FkTableQualifier = NULL;
+  void * _FkTableOwner = NULL;
+  void * _FkTableName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbPkTableQualifier < 0 && cbPkTableQualifier != SQL_NTS)
+	  || (cbPkTableOwner < 0 && cbPkTableOwner != SQL_NTS)
+	  || (cbPkTableName < 0 && cbPkTableName != SQL_NTS)
+	  || (cbFkTableQualifier < 0 && cbFkTableQualifier != SQL_NTS)
+	  || (cbFkTableOwner < 0 && cbFkTableOwner != SQL_NTS)
+	  || (cbFkTableName < 0 && cbFkTableName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_ForeignKeys);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _PkTableQualifier = _iodbcdm_conv_var (pstmt, 0, szPkTableQualifier, cbPkTableQualifier, conv_direct);
+          _PkTableOwner = _iodbcdm_conv_var (pstmt, 1, szPkTableOwner, cbPkTableOwner, conv_direct);
+          _PkTableName = _iodbcdm_conv_var (pstmt, 2, szPkTableName, cbPkTableName, conv_direct);
+          _FkTableQualifier = _iodbcdm_conv_var (pstmt, 3, szFkTableQualifier, cbFkTableQualifier, conv_direct);
+          _FkTableOwner = _iodbcdm_conv_var (pstmt, 4, szFkTableOwner, cbFkTableOwner, conv_direct);
+          _FkTableName = _iodbcdm_conv_var (pstmt, 5, szFkTableName, cbFkTableName, conv_direct);
+          szPkTableQualifier = _PkTableQualifier;
+          szPkTableOwner = _PkTableOwner;
+          szPkTableName = _PkTableName;
+          szFkTableQualifier = _FkTableQualifier;
+          szFkTableOwner = _FkTableOwner;
+          szFkTableName = _FkTableName;
+          cbPkTableQualifier = (cbPkTableQualifier > 0) ? SQL_NTS : cbPkTableQualifier;
+          cbPkTableOwner = (cbPkTableOwner > 0) ? SQL_NTS : cbPkTableOwner;
+          cbPkTableName = (cbPkTableName > 0) ? SQL_NTS : cbPkTableName;
+          cbFkTableQualifier = (cbFkTableQualifier > 0) ? SQL_NTS : cbFkTableQualifier;
+          cbFkTableOwner = (cbFkTableOwner > 0) ? SQL_NTS : cbFkTableOwner;
+          cbFkTableName = (cbFkTableName > 0) ? SQL_NTS : cbFkTableName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_ForeignKeys, (
+           pstmt->dhstmt,
+           szPkTableQualifier,
+           cbPkTableQualifier,
+           szPkTableOwner,
+           cbPkTableOwner,
+           szPkTableName,
+           cbPkTableName,
+           szFkTableQualifier,
+           cbFkTableQualifier,
+           szFkTableOwner,
+           cbFkTableOwner,
+           szFkTableName,
+           cbFkTableName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_ForeignKeys, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLForeignKeys (SQLHSTMT hstmt,
+    SQLCHAR * szPkTableQualifier,
+    SQLSMALLINT cbPkTableQualifier,
+    SQLCHAR * szPkTableOwner,
+    SQLSMALLINT cbPkTableOwner,
+    SQLCHAR * szPkTableName,
+    SQLSMALLINT cbPkTableName,
+    SQLCHAR * szFkTableQualifier,
+    SQLSMALLINT cbFkTableQualifier,
+    SQLCHAR * szFkTableOwner,
+    SQLSMALLINT cbFkTableOwner,
+    SQLCHAR * szFkTableName,
+    SQLSMALLINT cbFkTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLForeignKeys (TRACE_ENTER,
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName));
+
+  retcode = SQLForeignKeys_Internal(
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLForeignKeys (TRACE_LEAVE,
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLForeignKeysA (SQLHSTMT hstmt,
+    SQLCHAR * szPkTableQualifier,
+    SQLSMALLINT cbPkTableQualifier,
+    SQLCHAR * szPkTableOwner,
+    SQLSMALLINT cbPkTableOwner,
+    SQLCHAR * szPkTableName,
+    SQLSMALLINT cbPkTableName,
+    SQLCHAR * szFkTableQualifier,
+    SQLSMALLINT cbFkTableQualifier,
+    SQLCHAR * szFkTableOwner,
+    SQLSMALLINT cbFkTableOwner,
+    SQLCHAR * szFkTableName,
+    SQLSMALLINT cbFkTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLForeignKeys (TRACE_ENTER,
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName));
+
+  retcode = SQLForeignKeys_Internal(
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLForeignKeys (TRACE_LEAVE,
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName));
+}
+
+
+SQLRETURN SQL_API
+SQLForeignKeysW (SQLHSTMT hstmt,
+    SQLWCHAR * szPkTableQualifier,
+    SQLSMALLINT cbPkTableQualifier,
+    SQLWCHAR * szPkTableOwner,
+    SQLSMALLINT cbPkTableOwner,
+    SQLWCHAR * szPkTableName,
+    SQLSMALLINT cbPkTableName,
+    SQLWCHAR * szFkTableQualifier,
+    SQLSMALLINT cbFkTableQualifier,
+    SQLWCHAR * szFkTableOwner,
+    SQLSMALLINT cbFkTableOwner,
+    SQLWCHAR * szFkTableName,
+    SQLSMALLINT cbFkTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLForeignKeysW (TRACE_ENTER,
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName));
+
+  retcode = SQLForeignKeys_Internal(
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLForeignKeysW (TRACE_LEAVE,
+  	hstmt,
+  	szPkTableQualifier, cbPkTableQualifier,
+	szPkTableOwner, cbPkTableOwner,
+	szPkTableName, cbPkTableName,
+	szFkTableQualifier, cbFkTableQualifier,
+	szFkTableOwner, cbFkTableOwner,
+	szFkTableName, cbFkTableName));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLPrimaryKeys_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_PrimaryKeys);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var(pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_PrimaryKeys, (
+           pstmt->dhstmt,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_PrimaryKeys, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLPrimaryKeys (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLPrimaryKeys (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName));
+
+  retcode = SQLPrimaryKeys_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLPrimaryKeys (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLPrimaryKeysA (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLPrimaryKeys (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName));
+
+  retcode = SQLPrimaryKeys_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLPrimaryKeys (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName));
+}
+
+
+SQLRETURN SQL_API
+SQLPrimaryKeysW (SQLHSTMT hstmt,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLPrimaryKeysW (TRACE_ENTER,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName));
+
+  retcode = SQLPrimaryKeys_Internal (
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLPrimaryKeysW (TRACE_LEAVE,
+	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName, cbTableName));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLProcedureColumns_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLPOINTER szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLPOINTER szProcName,
+    SQLSMALLINT cbProcName,
+    SQLPOINTER szColumnName,
+    SQLSMALLINT cbColumnName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _ProcQualifier = NULL;
+  void * _ProcOwner = NULL;
+  void * _ProcName = NULL;
+  void * _ColumnName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbProcQualifier < 0 && cbProcQualifier != SQL_NTS)
+	  || (cbProcOwner < 0 && cbProcOwner != SQL_NTS)
+	  || (cbProcName < 0 && cbProcName != SQL_NTS)
+	  || (cbColumnName < 0 && cbColumnName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_ProcedureColumns);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _ProcQualifier = _iodbcdm_conv_var (pstmt, 0, szProcQualifier, cbProcQualifier, conv_direct);
+          _ProcOwner = _iodbcdm_conv_var (pstmt, 1, szProcOwner, cbProcOwner, conv_direct);
+          _ProcName = _iodbcdm_conv_var (pstmt, 2, szProcName, cbProcName, conv_direct);
+          _ColumnName = _iodbcdm_conv_var (pstmt, 3, szColumnName, cbColumnName, conv_direct);
+          szProcQualifier = _ProcQualifier;
+          szProcOwner = _ProcOwner;
+          szProcName = _ProcName;
+          szColumnName = _ColumnName;
+          cbProcQualifier = (cbProcQualifier > 0) ? SQL_NTS : cbProcQualifier;
+          cbProcOwner = (cbProcOwner > 0) ? SQL_NTS : cbProcOwner;
+          cbProcName = (cbProcName > 0) ? SQL_NTS : cbProcName;
+          cbColumnName = (cbColumnName > 0) ? SQL_NTS : cbColumnName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_ProcedureColumns, (
+           pstmt->dhstmt,
+           szProcQualifier,
+           cbProcQualifier,
+           szProcOwner,
+           cbProcOwner,
+           szProcName,
+           cbProcName,
+           szColumnName,
+           cbColumnName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_ProcedureColumns, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLProcedureColumns (SQLHSTMT hstmt,
+    SQLCHAR * szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLCHAR * szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLCHAR * szProcName,
+    SQLSMALLINT cbProcName,
+    SQLCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLProcedureColumns (TRACE_ENTER,
+    	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLProcedureColumns_Internal (
+  	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLProcedureColumns (TRACE_LEAVE,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLProcedureColumnsA (SQLHSTMT hstmt,
+    SQLCHAR * szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLCHAR * szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLCHAR * szProcName,
+    SQLSMALLINT cbProcName,
+    SQLCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLProcedureColumns (TRACE_ENTER,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLProcedureColumns_Internal (
+  	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLProcedureColumns (TRACE_LEAVE,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName));
+}
+
+
+SQLRETURN SQL_API
+SQLProcedureColumnsW (SQLHSTMT hstmt,
+    SQLWCHAR * szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLWCHAR * szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLWCHAR * szProcName,
+    SQLSMALLINT cbProcName,
+    SQLWCHAR * szColumnName,
+    SQLSMALLINT cbColumnName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLProcedureColumnsW (TRACE_ENTER,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName));
+
+  retcode = SQLProcedureColumns_Internal (
+  	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLProcedureColumnsW (TRACE_LEAVE,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	szColumnName, cbColumnName));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLProcedures_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLPOINTER szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLPOINTER szProcName,
+    SQLSMALLINT cbProcName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _ProcQualifier = NULL;
+  void * _ProcOwner = NULL;
+  void * _ProcName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbProcQualifier < 0 && cbProcQualifier != SQL_NTS)
+	  || (cbProcOwner < 0 && cbProcOwner != SQL_NTS)
+	  || (cbProcName < 0 && cbProcName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_Procedures);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _ProcQualifier = _iodbcdm_conv_var (pstmt, 0, szProcQualifier, cbProcQualifier, conv_direct);
+          _ProcOwner = _iodbcdm_conv_var (pstmt, 1, szProcOwner, cbProcOwner, conv_direct);
+          _ProcName = _iodbcdm_conv_var (pstmt, 2, szProcName, cbProcName, conv_direct);
+          szProcQualifier = _ProcQualifier;
+          szProcOwner = _ProcOwner;
+          szProcName = _ProcName;
+          cbProcQualifier = (cbProcQualifier > 0) ? SQL_NTS : cbProcQualifier;
+          cbProcOwner = (cbProcOwner > 0) ? SQL_NTS : cbProcOwner;
+          cbProcName = (cbProcName > 0) ? SQL_NTS : cbProcName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_Procedures, (
+           pstmt->dhstmt,
+           szProcQualifier,
+           cbProcQualifier,
+           szProcOwner,
+           cbProcOwner,
+           szProcName,
+           cbProcName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_Procedures, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLProcedures (SQLHSTMT hstmt,
+    SQLCHAR * szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLCHAR * szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLCHAR * szProcName,
+    SQLSMALLINT cbProcName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLProcedures (TRACE_ENTER,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName));
+
+  retcode = SQLProcedures_Internal (
+  	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLProcedures (TRACE_LEAVE,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLProceduresA (SQLHSTMT hstmt,
+    SQLCHAR * szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLCHAR * szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLCHAR * szProcName,
+    SQLSMALLINT cbProcName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLProcedures (TRACE_ENTER,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName));
+
+  retcode = SQLProcedures_Internal (
+  	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLProcedures (TRACE_LEAVE,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName));
+}
+
+
+SQLRETURN SQL_API
+SQLProceduresW (SQLHSTMT hstmt,
+    SQLWCHAR * szProcQualifier,
+    SQLSMALLINT cbProcQualifier,
+    SQLWCHAR * szProcOwner,
+    SQLSMALLINT cbProcOwner,
+    SQLWCHAR * szProcName,
+    SQLSMALLINT cbProcName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLProceduresW (TRACE_ENTER,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName));
+
+  retcode = SQLProcedures_Internal (
+  	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLProceduresW (TRACE_LEAVE,
+	hstmt,
+	szProcQualifier, cbProcQualifier,
+	szProcOwner, cbProcOwner,
+	szProcName, cbProcName));
+}
+#endif
+
+
+SQLRETURN SQL_API
+SQLTablePrivileges_Internal (
+    SQLHSTMT hstmt,
+    SQLPOINTER szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLPOINTER szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLPOINTER szTableName,
+    SQLSMALLINT cbTableName,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _TableQualifier = NULL;
+  void * _TableOwner = NULL;
+  void * _TableName = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  for (;;)
+    {
+      if ((cbTableQualifier < 0 && cbTableQualifier != SQL_NTS)
+	  || (cbTableOwner < 0 && cbTableOwner != SQL_NTS)
+	  || (cbTableName < 0 && cbTableName != SQL_NTS))
+	{
+	  sqlstat = en_S1090;
+	  break;
+	}
+
+      retcode = _iodbcdm_cata_state_ok (pstmt, en_TablePrivileges);
+
+      if (retcode != SQL_SUCCESS)
+	{
+	  return SQL_ERROR;
+	}
+
+      if (penv->unicode_driver && waMode != 'W')
+        conv_direct = CD_A2W;
+      else if (!penv->unicode_driver && waMode == 'W')
+        conv_direct = CD_W2A;
+      else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+        conv_direct = CD_W2W;
+
+      if (conv_direct != CD_NONE)
+        {
+          _TableQualifier = _iodbcdm_conv_var (pstmt, 0, szTableQualifier, cbTableQualifier, conv_direct);
+          _TableOwner = _iodbcdm_conv_var (pstmt, 1, szTableOwner, cbTableOwner, conv_direct);
+          _TableName = _iodbcdm_conv_var (pstmt, 2, szTableName, cbTableName, conv_direct);
+          szTableQualifier = _TableQualifier;
+          szTableOwner = _TableOwner;
+          szTableName = _TableName;
+          cbTableQualifier = (cbTableQualifier > 0) ? SQL_NTS : cbTableQualifier;
+          cbTableOwner = (cbTableOwner > 0) ? SQL_NTS : cbTableOwner;
+          cbTableName = (cbTableName > 0) ? SQL_NTS : cbTableName;
+        }
+
+      CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+        en_TablePrivileges, (
+           pstmt->dhstmt,
+           szTableQualifier,
+           cbTableQualifier,
+           szTableOwner,
+           cbTableOwner,
+           szTableName,
+           cbTableName));
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	  break;
+	}
+
+      sqlstat = en_00000;
+
+      if (1)			/* turn off solaris warning message */
+	break;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  retcode = _iodbcdm_cata_state_tr (pstmt, en_TablePrivileges, retcode);
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLTablePrivileges (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLTablePrivileges (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName));
+
+  retcode = SQLTablePrivileges_Internal(
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLTablePrivileges (TRACE_LEAVE,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLTablePrivilegesA (SQLHSTMT hstmt,
+    SQLCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLCHAR * szTableName,
+    SQLSMALLINT cbTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLTablePrivileges (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName));
+
+  retcode = SQLTablePrivileges_Internal(
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName,
+	'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLTablePrivileges (TRACE_LEAVE,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName));
+}
+
+
+SQLRETURN SQL_API
+SQLTablePrivilegesW (SQLHSTMT hstmt,
+    SQLWCHAR * szTableQualifier,
+    SQLSMALLINT cbTableQualifier,
+    SQLWCHAR * szTableOwner,
+    SQLSMALLINT cbTableOwner,
+    SQLWCHAR * szTableName,
+    SQLSMALLINT cbTableName)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLTablePrivilegesW (TRACE_ENTER,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName));
+
+  retcode = SQLTablePrivileges_Internal(
+  	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName,
+	'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLTablePrivilegesW (TRACE_LEAVE,
+    	hstmt,
+	szTableQualifier, cbTableQualifier,
+	szTableOwner, cbTableOwner,
+	szTableName,cbTableName));
+}
+#endif

+ 4036 - 0
odbc.mod/iodbc/iodbc/connect.c

@@ -0,0 +1,4036 @@
+/*
+ *  connect.c
+ *
+ *  $Id$
+ *
+ *  Connect (load) driver
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iodbc.h>
+
+#include <assert.h>
+#include <sql.h>
+#include <sqlext.h>
+#include <sqlucode.h>
+#include <iodbcext.h>
+#include <odbcinst.h>
+
+#include "dlproc.h"
+
+#include "unicode.h"
+#include "herr.h"
+#include "henv.h"
+#include "hdbc.h"
+#include "hstmt.h"
+
+#include "itrace.h"
+
+#include "unicode.h"
+
+#if defined (__APPLE__) && !defined (NO_FRAMEWORKS)
+#include <Carbon/Carbon.h>
+#endif
+
+#include "misc.h"
+#include "iodbc_misc.h"
+
+/*
+ *  Identification strings
+ */
+static char sccsid[] = "@(#)iODBC driver manager " VERSION "\n";
+char *iodbc_version = VERSION;
+
+
+/*
+ *  Prototypes
+ */
+extern SQLRETURN _iodbcdm_driverunload (HDBC hdbc, int ver);
+extern SQLRETURN SQL_API _iodbcdm_SetConnectOption (SQLHDBC hdbc,
+    SQLUSMALLINT fOption, SQLULEN vParam, SQLCHAR waMode);
+
+
+#if 0
+#define CHECK_DRVCONN_DIALBOX(path) \
+  { \
+    if ((handle = DLL_OPEN(path)) != NULL) \
+      { \
+        if (DLL_PROC(handle, "_iodbcdm_drvconn_dialboxw") != NULL) \
+          { \
+            DLL_CLOSE(handle); \
+            retVal = TRUE; \
+            goto quit; \
+          } \
+        else \
+          { \
+            if (DLL_PROC(handle, "_iodbcdm_drvconn_dialbox") != NULL) \
+              { \
+                DLL_CLOSE(handle); \
+                retVal = TRUE; \
+                goto quit; \
+              } \
+          } \
+        DLL_CLOSE(handle); \
+      } \
+  }
+
+
+
+static BOOL
+_iodbcdm_CheckDriverLoginDlg (
+    LPSTR drv,
+    LPSTR dsn
+)
+{
+  char tokenstr[4096];
+  char drvbuf[4096] = { L'\0'};
+  HDLL handle;
+  BOOL retVal = FALSE;
+
+  /* Check if the driver is provided */
+  if (drv == NULL)
+    {
+      SQLSetConfigMode (ODBC_BOTH_DSN);
+      SQLGetPrivateProfileString ("ODBC Data Sources",
+        dsn && dsn[0] != '\0' ? dsn : "Default",
+        "", tokenstr, sizeof (tokenstr), NULL);
+      drv = tokenstr;
+    }
+
+  /* Call the iodbcdm_drvconn_dialbox */
+
+  SQLSetConfigMode (ODBC_USER_DSN);
+  if (!access (drv, X_OK))
+    { CHECK_DRVCONN_DIALBOX (drv); }
+  if (SQLGetPrivateProfileString (drv, "Driver", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+  if (SQLGetPrivateProfileString (drv, "Setup", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+  if (SQLGetPrivateProfileString ("Default", "Driver", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+  if (SQLGetPrivateProfileString ("Default", "Setup", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+
+
+  SQLSetConfigMode (ODBC_SYSTEM_DSN);
+  if (!access (drv, X_OK))
+    { CHECK_DRVCONN_DIALBOX (drv); }
+  if (SQLGetPrivateProfileString (drv, "Driver", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+  if (SQLGetPrivateProfileString (drv, "Setup", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+  if (SQLGetPrivateProfileString ("Default", "Driver", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+  if (SQLGetPrivateProfileString ("Default", "Setup", "", drvbuf,
+    sizeof (drvbuf), "odbcinst.ini"))
+    { CHECK_DRVCONN_DIALBOX (drvbuf); }
+
+quit:
+
+  return retVal;
+}
+#endif
+
+
+#define RETURN(_ret)							\
+  do {									\
+    retcode = _ret;							\
+    goto end;								\
+  } while (0)
+
+
+
+static SQLRETURN
+_iodbcdm_SetConnectOption_init (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fOption,
+    SQLULEN		  vParam,
+    UCHAR		  waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  int retinfo = 0;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  SQLINTEGER strLength = 0;
+  void *ptr = (void *) vParam;
+  void *_vParam = NULL;
+
+  if (fOption >= 1000)
+    {
+      retinfo = 1;		/* Change SQL_ERROR -> SQL_SUCCESS_WITH_INFO */
+    }
+
+  if (penv->unicode_driver && waMode != 'W')
+    conv_direct = CD_A2W;
+  else if (!penv->unicode_driver && waMode == 'W')
+    conv_direct = CD_W2A;
+  else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+    conv_direct = CD_W2W;
+
+  switch (fOption)
+    {
+      case SQL_ATTR_TRACEFILE:
+      case SQL_CURRENT_QUALIFIER:
+      case SQL_TRANSLATE_DLL:
+      case SQL_APPLICATION_NAME:
+      case SQL_COPT_SS_ENLIST_IN_DTC:
+      case SQL_COPT_SS_PERF_QUERY_LOG:
+      case SQL_COPT_SS_PERF_DATA_LOG:
+      case SQL_CURRENT_SCHEMA:
+        if (conv_direct != CD_NONE)
+          {
+            _vParam = conv_text_m2d(conv, (void *)vParam, SQL_NTS, conv_direct);
+            ptr = _vParam;
+            strLength = SQL_NTS;
+          }
+        break;
+    }
+
+  if (penv->unicode_driver)
+    {
+      /* SQL_XXX_W */
+      if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectOptionW))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, ptr));
+        }
+#if (ODBCVER >= 0x300)
+      else if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectAttrW))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, ptr, strLength));
+        }
+#endif
+    }
+  else
+    {
+      /* SQL_XXX */
+      /* SQL_XXX_A */
+      if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectOption))
+           != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, vParam));
+        }
+      else if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectOptionA))
+           != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, vParam));
+        }
+#if (ODBCVER >= 0x300)
+      else if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectAttr))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, vParam, strLength));
+        }
+      else if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectAttrA))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, vParam, strLength));
+        }
+#endif
+    }
+  MEM_FREE(_vParam);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pdbc->herr, en_IM004);
+      return SQL_SUCCESS_WITH_INFO;
+    }
+
+  if (retcode != SQL_SUCCESS && retinfo)
+    return SQL_SUCCESS_WITH_INFO;
+
+  return retcode;
+}
+
+
+static SQLRETURN
+_iodbcdm_SetConnectAttr_init (
+    SQLHDBC		  hdbc,
+    SQLUSMALLINT	  fOption,
+    SQLULEN		  vParam)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_ERROR;
+  SQLINTEGER strLength = 0;
+  void *ptr = (void *) vParam;
+
+
+  if (penv->unicode_driver)
+    {
+#if (ODBCVER >= 0x300)
+      if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectAttrW))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, ptr, strLength));
+        }
+#endif
+    }
+  else
+    {
+#if (ODBCVER >= 0x300)
+      if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectAttr))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, vParam, strLength));
+        }
+      else if ((hproc = _iodbcdm_getproc (pdbc, en_SetConnectAttrA))
+          != SQL_NULL_HPROC)
+        {
+          CALL_DRIVER (hdbc, pdbc, retcode, hproc,
+	      (pdbc->dhdbc, fOption, vParam, strLength));
+        }
+#endif
+    }
+
+  return retcode;
+}
+
+
+
+static SQLRETURN
+_iodbcdm_getInfo_init (SQLHDBC hdbc,
+    SQLUSMALLINT fInfoType,
+    SQLPOINTER rgbInfoValue,
+    SQLSMALLINT cbInfoValueMax,
+    SQLSMALLINT * pcbInfoValue,
+    SQLCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+
+  waMode = waMode; /*UNUSED*/
+
+  switch(fInfoType)
+    {
+      case SQL_CURSOR_COMMIT_BEHAVIOR:
+      case SQL_CURSOR_ROLLBACK_BEHAVIOR:
+        break;
+      default:
+        return SQL_ERROR;
+    }
+
+  CALL_UDRIVER(hdbc, pdbc, retcode, hproc, penv->unicode_driver,
+    en_GetInfo, (
+       pdbc->dhdbc,
+       fInfoType,
+       rgbInfoValue,
+       cbInfoValueMax,
+       pcbInfoValue));
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pdbc->herr, en_IM004);
+      return SQL_SUCCESS_WITH_INFO;
+    }
+
+  return retcode;
+}
+
+
+static SQLRETURN
+_iodbcdm_finish_disconnect (HDBC hdbc, BOOL driver_disconnect)
+{
+  CONN (pdbc, hdbc);
+  HPROC hproc = SQL_NULL_HPROC;
+
+  DPRINTF ((stderr,
+      "DEBUG: _iodbcdm_finish_disconnect (conn %p, driver_disconnect %d)\n",
+      hdbc, driver_disconnect));
+
+  if (driver_disconnect)
+    {
+      SQLRETURN retcode;
+
+      hproc = _iodbcdm_getproc (pdbc, en_Disconnect);
+      if (hproc == SQL_NULL_HPROC)
+        {
+          PUSHSQLERR (pdbc->herr, en_IM001);
+          return SQL_ERROR;
+        }
+
+      ODBC_UNLOCK ();
+      CALL_DRIVER (hdbc, pdbc, retcode, hproc, (pdbc->dhdbc));
+      ODBC_LOCK ();
+
+      if (!SQL_SUCCEEDED (retcode))
+        {
+          /* diff from MS specs. We disallow
+           * driver SQLDisconnect() return
+           * SQL_SUCCESS_WITH_INFO and post
+           * error message.
+           */
+          return retcode;
+        }
+    }
+
+  /* free all statement handle(s) on this connection */
+  while (pdbc->hstmt != NULL)
+    _iodbcdm_dropstmt (pdbc->hstmt);
+
+  /* state transition */
+  pdbc->state = en_dbc_allocated;
+
+  return SQL_SUCCESS;
+}
+
+
+#if (ODBCVER >= 0x300)
+/*
+ * Set Retry Wait timeout
+ */
+static void
+_iodbcdm_pool_set_retry_wait (HDBC hdbc)
+{
+  CONN (pdbc, hdbc);
+  int retry_wait = 0;
+  char buf[1024];
+
+  /* Get the "Retry Wait" keyword value from the Pooling section */
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if (SQLGetPrivateProfileString ("ODBC Connection Pooling", "Retry Wait", "",
+         buf, sizeof (buf), "odbcinst.ini") != 0 &&
+         buf[0] != '\0')
+    retry_wait = atoi(buf);
+
+  DPRINTF ((stderr, "DEBUG: setting RetryWait %d (conn %p)\n",
+      retry_wait, hdbc));
+  pdbc->cp_retry_wait = time(NULL) + retry_wait;
+}
+
+
+extern SQLRETURN SQLFreeConnect_Internal (SQLHDBC hdbc);
+
+/*
+ * Drop connection from the pool
+ */
+void
+_iodbcdm_pool_drop_conn (HDBC hdbc, HDBC hdbc_prev)
+{
+  CONN (pdbc, hdbc);
+  CONN (pdbc_prev, hdbc_prev);
+
+  assert (!pdbc->cp_in_use);
+
+  DPRINTF ((stderr, "DEBUG: dropping connection %p (prev %p) from the pool\n",
+      hdbc, hdbc_prev));
+
+  /* remove from pool */
+  if (pdbc_prev != NULL)
+    pdbc_prev->next = pdbc->next;
+  else
+    {
+      GENV (genv, pdbc->genv);
+
+      genv->pdbc_pool = pdbc->next;
+    }
+
+  /* finish disconnect and free connection */
+  _iodbcdm_finish_disconnect (hdbc, TRUE);
+  SQLFreeConnect_Internal (hdbc);
+  MEM_FREE (hdbc);
+}
+
+
+/*
+ * Copy connection parameters from src to dst and reset src parameters
+ * so that src can be correctly freed by SQLDisconnect.
+ */
+static void
+_iodbcdm_pool_copy_conn (HDBC hdbc_dst, HDBC hdbc_src)
+{
+  CONN (pdbc_dst, hdbc_dst);
+  CONN (pdbc_src, hdbc_src);
+  HDBC next;
+  time_t cp_timeout, cp_expiry_time;
+
+  /* Preserve `next', `cp_timeout' and `cp_expiry_time' */
+  next = pdbc_dst->next;
+  cp_timeout = pdbc_dst->cp_timeout;
+  cp_expiry_time = pdbc_dst->cp_expiry_time;
+  *pdbc_dst = *pdbc_src;
+  pdbc_dst->next = next;
+  pdbc_dst->cp_timeout = cp_timeout;
+  pdbc_dst->cp_expiry_time = cp_expiry_time;
+
+  /* Reset parameters of source connection */
+  pdbc_src->herr = SQL_NULL_HERR;
+  pdbc_src->dhdbc = SQL_NULL_HDBC;
+  pdbc_src->henv = SQL_NULL_HENV;
+  pdbc_src->hstmt = SQL_NULL_HSTMT;
+  pdbc_src->hdesc = SQL_NULL_HDESC;
+  pdbc_src->current_qualifier = NULL;
+  pdbc_src->drvopt = NULL;
+
+  pdbc_src->cp_probe = NULL;
+  pdbc_src->cp_dsn = NULL;
+  pdbc_src->cp_uid = NULL;
+  pdbc_src->cp_pwd = NULL;
+  pdbc_src->cp_connstr = NULL;
+}
+
+
+/*
+ * Check if attributes of two connections match
+ */
+static BOOL
+_iodbcdm_pool_check_attr_match (HDBC hdbc, HDBC cp_hdbc)
+{
+  CONN (pdbc, hdbc);
+  GENV (genv, pdbc->genv);
+  CONN (cp_pdbc, cp_hdbc);
+  BOOL strict_match = (genv->cp_match == SQL_CP_STRICT_MATCH);
+
+  DPRINTF ((stderr, "DEBUG: check attr match (conn %p, cp_conn %p)\n",
+      hdbc, cp_hdbc));
+
+  /*
+   * Check attrs that must be set before connection has been made:
+   * - SQL_ATTR_PACKET_SIZE (packet_size)
+   * - SQL_ATTR_ODBC_CURSORS (odbc_cursors)
+   *
+   * SQL_ATTR_PACKET_SIZE can be different if !strict_match.
+   * The value of SQL_ATTR_LOGIN_TIMEOUT is not examined.
+   */
+  if (strict_match && pdbc->packet_size != cp_pdbc->packet_size)
+    {
+      DPRINTF ((stderr, "DEBUG: packet_size does not match (conn %p, cp_conn %p, strict_match %d)",
+        hdbc, cp_hdbc, strict_match));
+      return FALSE;
+    }
+
+  if (pdbc->odbc_cursors != cp_pdbc->odbc_cursors)
+    {
+      DPRINTF ((stderr, "DEBUG: odbc_cursors does not match (conn %p, cp_conn %p, strict_match %d)",
+        hdbc, cp_hdbc, strict_match));
+      return FALSE;
+    }
+
+  if (pdbc->conv.dm_cp != cp_pdbc->conv.dm_cp || pdbc->conv.drv_cp != cp_pdbc->conv.drv_cp)
+    {
+      DPRINTF ((stderr, "DEBUG: unicode mode does not match (conn %p, cp_conn %p)",
+        hdbc, cp_hdbc));
+      return FALSE;
+    }
+
+  /*
+   * Check attrs that must be set either before or after the connection
+   * has been made:
+   * - SQL_ATTR_ACCESS_MODE (access_mode, default SQL_MODE_DEFAULT)
+   * - SQL_ATTR_AUTOCOMMIT (autocommit, default SQL_AUTOCOMMIT_DEFAULT)
+   * - SQL_ATTR_CURRENT_CATALOG (current_qualifier)
+   * - SQL_ATTR_QUIET_MODE (quiet_mode)
+   * - SQL_ATTR_TXN_ISOLATION (txn_isolation, default SQL_TXN_READ_UNCOMMITTED)
+   *
+   * If an attr is not set by the application but set in the pool:
+   * - if there is a default, an attr is reset to the default value
+   * (see _iodbcdm_pool_reset_conn_attrs()).
+   * - if there is no default value, pooled connection is not considered
+   * a match
+   *
+   * If an attr is set by the application, this value overrides the
+   * value from the pool.
+   */
+  if (pdbc->current_qualifier == NULL && cp_pdbc->current_qualifier != NULL)
+    {
+      /* has not been set by application, but set in the pool */
+      DPRINTF ((stderr, "DEBUG: current_qualifier has not been set by application, but is set in the pool (conn %p, cp_conn %p)",
+        hdbc, cp_hdbc));
+      return FALSE;
+    }
+
+  if (pdbc->quiet_mode == 0 && cp_pdbc->quiet_mode != 0)
+    {
+      /* has not been set by application, but set in the pool */
+      DPRINTF ((stderr, "DEBUG: quiet_mode has not been set by application, but is set in the pool (conn %p, cp_conn %p)",
+        hdbc, cp_hdbc));
+      return FALSE;
+    }
+
+  return TRUE;
+}
+
+
+/*
+ * Reset connection attributes to the default values (if an attr is not set
+ * by application and there is a default) or to the value set by application.
+ */
+SQLRETURN
+_iodbcdm_pool_reset_conn_attrs (SQLHDBC hdbc, SQLHDBC cp_hdbc)
+{
+  CONN (pdbc, hdbc);
+  CONN (cp_pdbc, cp_hdbc);
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLRETURN ret;
+
+  if (pdbc->access_mode != cp_pdbc->access_mode)
+    {
+      cp_pdbc->access_mode = pdbc->access_mode;
+
+      ret = _iodbcdm_SetConnectOption_init (
+          cp_pdbc, SQL_ACCESS_MODE, cp_pdbc->access_mode, 'A');
+      retcode |= ret;
+    }
+
+  if (pdbc->autocommit != cp_pdbc->autocommit)
+    {
+      cp_pdbc->autocommit = pdbc->autocommit;
+
+      ret = _iodbcdm_SetConnectOption_init (
+	  cp_pdbc, SQL_AUTOCOMMIT, cp_pdbc->autocommit, 'A');
+      retcode |= ret;
+    }
+
+  if (pdbc->current_qualifier != NULL)
+    {
+      if (cp_pdbc->current_qualifier != NULL)
+        MEM_FREE (cp_pdbc->current_qualifier);
+      cp_pdbc->current_qualifier = pdbc->current_qualifier;
+      pdbc->current_qualifier = NULL;
+      cp_pdbc->current_qualifier_WA = pdbc->current_qualifier_WA;
+
+      ret = _iodbcdm_SetConnectOption_init (
+          cp_pdbc, SQL_CURRENT_QUALIFIER,
+	  (SQLULEN) cp_pdbc->current_qualifier, cp_pdbc->current_qualifier_WA);
+      retcode |= ret;
+    }
+
+  if (cp_pdbc->quiet_mode != pdbc->quiet_mode)
+    {
+      cp_pdbc->quiet_mode = pdbc->quiet_mode;
+
+      ret = _iodbcdm_SetConnectOption_init (
+	  cp_pdbc, SQL_QUIET_MODE, cp_pdbc->quiet_mode, 'A');
+      retcode |= ret;
+    }
+
+  if (pdbc->txn_isolation != cp_pdbc->txn_isolation)
+    {
+      cp_pdbc->txn_isolation = pdbc->txn_isolation;
+
+      ret = _iodbcdm_SetConnectOption_init (
+          cp_pdbc, SQL_TXN_ISOLATION, cp_pdbc->txn_isolation, 'A');
+      retcode |= ret;
+    }
+
+  return retcode;
+}
+
+
+extern SQLRETURN
+SQLAllocStmt_Internal (SQLHDBC hdbc, SQLHSTMT *phstmt);
+extern SQLRETURN
+SQLFreeStmt_Internal (SQLHSTMT hstmt, SQLUSMALLINT fOption);
+extern SQLRETURN SQL_API
+SQLExecDirect_Internal (SQLHSTMT hstmt,
+    SQLPOINTER szSqlStr, SQLINTEGER cbSqlStr, SQLCHAR waMode);
+extern SQLRETURN SQLFetch_Internal (SQLHSTMT hstmt);
+
+/*
+ * Execute CPProbe statement to check if connection is dead
+ */
+static SQLRETURN
+_iodbcdm_pool_exec_cpprobe (HDBC hdbc, char *cp_probe)
+{
+  HSTMT hstmt = SQL_NULL_HSTMT;
+  SQLRETURN retcode;
+  SQLSMALLINT num_cols;
+
+  DPRINTF ((stderr, "DEBUG: executing CPProbe (conn %p, stmt [%s])\n",
+      hdbc, cp_probe));
+
+  /* allocate statement handle */
+  retcode = SQLAllocStmt_Internal (hdbc, &hstmt);
+  if (!SQL_SUCCEEDED (retcode))
+    RETURN (retcode);
+
+  /* execute statement */
+  retcode = SQLExecDirect_Internal (hstmt, cp_probe, SQL_NTS, 'A');
+  if (!SQL_SUCCEEDED (retcode))
+    RETURN (retcode);
+
+  /* check that there is a result set */
+  retcode = _iodbcdm_NumResultCols (hstmt, &num_cols);
+  if (!SQL_SUCCEEDED (retcode))
+    RETURN (retcode);
+
+  /* if there was no result set -- success */
+  if (num_cols == 0)
+    RETURN (SQL_SUCCESS);
+
+  /* fetch results */
+  do
+    {
+      retcode = SQLFetch_Internal (hstmt);
+      if (!SQL_SUCCEEDED (retcode))
+        RETURN (retcode);
+    }
+  while (retcode != SQL_NO_DATA);
+
+  /* success */
+  RETURN (SQL_SUCCESS);
+
+end:
+  if (hstmt != SQL_NULL_HSTMT)
+    SQLFreeStmt_Internal (hstmt, SQL_DROP);
+  return retcode;
+}
+
+
+/*
+ * Check if connection is dead
+ */
+static BOOL
+_iodbcdm_pool_conn_dead (HDBC hdbc)
+{
+  CONN (pdbc, hdbc);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode;
+  SQLINTEGER attr_dead;
+
+  DPRINTF ((stderr, "DEBUG: checking if connection is dead (conn %p)\n",
+      hdbc));
+
+  /* first try SQLGetConnectAttr */
+  CALL_UDRIVER(pdbc, pdbc, retcode, hproc, 'A', en_GetConnectAttr,
+      (pdbc->dhdbc, SQL_ATTR_CONNECTION_DEAD, &attr_dead, 0, NULL));
+  if (hproc != SQL_NULL_HPROC && SQL_SUCCEEDED (retcode))
+    {
+      DPRINTF ((stderr, "DEBUG: GetConnectAttr: attr_dead = %ld (conn %p)\n",
+          attr_dead, hdbc));
+      return attr_dead == SQL_CD_TRUE;
+    }
+
+  /* try SQLGetConnectOption */
+  CALL_UDRIVER(pdbc, pdbc, retcode, hproc, 'A', en_GetConnectOption,
+      (pdbc->dhdbc, SQL_ATTR_CONNECTION_DEAD, &attr_dead));
+  if (hproc != SQL_NULL_HPROC && SQL_SUCCEEDED (retcode))
+    {
+      DPRINTF ((stderr, "DEBUG: GetConnectOption: attr_dead = %ld (conn %p)\n",
+          attr_dead, hdbc));
+      return attr_dead == SQL_CD_TRUE;
+    }
+
+  /* try CPProbe statement */
+  if (pdbc->cp_probe != NULL && STRLEN(pdbc->cp_probe) > 0)
+    {
+      retcode = _iodbcdm_pool_exec_cpprobe (pdbc, pdbc->cp_probe);
+      return SQL_SUCCEEDED (retcode);
+    }
+
+  /* don't know, assume it is alive */
+  return FALSE;
+}
+
+
+/*
+ * Get the connection from to the pool
+ *
+ * Returns 0 if the connection was put successfully
+ * Returns -1 otherwise
+ */
+static SQLRETURN
+_iodbcdm_pool_get_conn (
+    HDBC hdbc, char *dsn, char *uid, char *pwd, char *connstr)
+{
+  CONN (pdbc, hdbc);
+  GENV (genv, pdbc->genv);
+  DBC_t *cp_pdbc, *cp_pdbc_next, *cp_pdbc_prev = NULL;
+  time_t current_time;
+
+  DPRINTF ((stderr, "DEBUG: getting connection %p from the pool (dsn [%s], uid [%s], pwd [%s], connstr [%s])\n",
+      hdbc, dsn, uid, pwd, connstr));
+
+  current_time = time(NULL);
+
+  for (cp_pdbc = genv->pdbc_pool; cp_pdbc != NULL;
+       cp_pdbc_prev = cp_pdbc, cp_pdbc = cp_pdbc_next)
+    {
+      SQLRETURN retcode;
+
+      cp_pdbc_next = cp_pdbc->next;
+
+      /* skip connections in use */
+      if (cp_pdbc->cp_in_use)
+        {
+	  DPRINTF ((stderr, "DEBUG: skipping connection %p (in use)\n",
+            cp_pdbc));
+	  continue;
+	}
+
+      /*
+       * Check that pooled connection timeout has not expired
+       */
+      if (current_time >= cp_pdbc->cp_expiry_time)
+        {
+	  DPRINTF ((stderr, "DEBUG: connection %p expired (cp_expiry_time %d, current_time %d)\n",
+            cp_pdbc, cp_pdbc->cp_expiry_time, current_time));
+	  _iodbcdm_pool_drop_conn (cp_pdbc, cp_pdbc_prev);
+          cp_pdbc = cp_pdbc_prev;
+	  continue;
+        }
+
+      /*
+       * Check that requested dsn, uid, pwd and connstr match
+       * pooled connection
+       */
+      if (dsn != NULL)
+        {
+          if (cp_pdbc->cp_dsn == NULL ||
+              strcmp (dsn, cp_pdbc->cp_dsn) != 0)
+            continue;
+	}
+      else if (cp_pdbc->cp_dsn != NULL)
+        continue;
+      if (uid != NULL)
+        {
+          if (cp_pdbc->cp_uid == NULL ||
+              strcmp (uid, cp_pdbc->cp_uid) != 0)
+            continue;
+        }
+      else if (cp_pdbc->cp_uid != NULL)
+        continue;
+      if (pwd != NULL)
+        {
+          if (cp_pdbc->cp_pwd == NULL ||
+              strcmp (pwd, cp_pdbc->cp_pwd) != 0)
+            continue;
+        }
+      else if (cp_pdbc->cp_pwd != NULL)
+        continue;
+      if (connstr != NULL)
+        {
+          if (cp_pdbc->cp_connstr == NULL ||
+              strcmp (connstr, cp_pdbc->cp_connstr) != 0)
+            continue;
+        }
+      else if (cp_pdbc->cp_connstr != NULL)
+        continue;
+
+      DPRINTF ((stderr, "DEBUG: found matching pooled connection %p\n",
+          cp_pdbc));
+
+      /* check that connection attributes match */
+      if (!_iodbcdm_pool_check_attr_match (pdbc, cp_pdbc))
+	continue;
+
+      /*
+       * Match found!
+       */
+
+      /*
+       * Check Retry Wait timeout
+       */
+      if (cp_pdbc->cp_retry_wait != 0)
+	{
+	  if (current_time < cp_pdbc->cp_retry_wait)
+	    {
+	      /* Retry Wait timeout has not expired yet */
+              DPRINTF ((stderr,
+		  "DEBUG: RetryWait timeout has not expired yet (cp_pdbc %p, cp_retry_wait %d, current_time %d)\n",
+                  cp_pdbc, cp_pdbc->cp_retry_wait, current_time));
+
+              /* remember matching pooled connection */
+	      pdbc->cp_pdbc = cp_pdbc;
+
+	      return SQL_ERROR;
+	    }
+
+          DPRINTF ((stderr, "DEBUG: RetryWait timeout reset (cp_pdbc %p)\n",
+             cp_pdbc));
+          /* reset Retry Wait timeout */
+          cp_pdbc->cp_retry_wait = 0;
+        }
+
+      /*
+       * Check if connection is dead
+       */
+      if (_iodbcdm_pool_conn_dead (cp_pdbc))
+        {
+	  /* Connection is dead -- try to reconnect */
+          DPRINTF ((stderr, "DEBUG: pooled connection is dead (cp_pdbc %p)\n",
+             cp_pdbc));
+
+          /* remember matching pooled connection */
+	  pdbc->cp_pdbc = cp_pdbc;
+          cp_pdbc->cp_in_use = TRUE;
+
+	  return SQL_ERROR;
+        }
+
+      /* reset connection attrs */
+      retcode = _iodbcdm_pool_reset_conn_attrs (pdbc, cp_pdbc);
+      if (retcode != SQL_SUCCESS)
+        retcode = SQL_SUCCESS_WITH_INFO;
+
+      /* copy parameters */
+      _iodbcdm_pool_copy_conn (pdbc, cp_pdbc);
+
+      /* remember matching pooled connection */
+      pdbc->cp_pdbc = cp_pdbc;
+      cp_pdbc->cp_in_use = TRUE;
+
+      DPRINTF ((stderr, "DEBUG: got connection from the pool (cp_pdbc %p)\n",
+          cp_pdbc));
+      /* found a connection in a pool */
+      return retcode;
+    }
+
+  DPRINTF ((stderr, "DEBUG: no matching connection in the pool\n"));
+  /* can't find a connection in a pool */
+  return SQL_ERROR;
+}
+
+
+/*
+ * Put the connection back to the pool
+ *
+ * Return 0 if the connection was put successfully
+ * Return -1 otherwise
+ */
+static int
+_iodbcdm_pool_put_conn (HDBC hdbc)
+{
+  CONN (pdbc, hdbc);
+  GENV (genv, NULL);
+  DBC_t *cp_pdbc = pdbc->cp_pdbc;
+
+  DPRINTF ((stderr, "DEBUG: putting connection back to the pool (conn %p, dsn [%s], uid [%s], pwd [%s], connstr [%s])\n",
+      hdbc, pdbc->cp_dsn, pdbc->cp_uid, pdbc->cp_pwd, pdbc->cp_connstr));
+
+  if (cp_pdbc == NULL)
+    {
+      cp_pdbc = (DBC_t *) MEM_ALLOC (sizeof (DBC_t));
+      if (cp_pdbc == NULL)
+        {
+	  return -1;
+	}
+
+      /* put to the pool */
+      genv = (GENV_t *) pdbc->genv;
+      cp_pdbc->next = genv->pdbc_pool;
+      genv->pdbc_pool = cp_pdbc;
+
+      cp_pdbc->cp_timeout = pdbc->cp_timeout;
+      DPRINTF ((stderr, "DEBUG: new pooled connection %p\n", cp_pdbc));
+    }
+
+  /* copy out parameters */
+  _iodbcdm_pool_copy_conn(cp_pdbc, pdbc);
+  pdbc->cp_pdbc = NULL;
+
+  /* free all statement handle(s) on connection in pool */
+  while (cp_pdbc->hstmt != NULL)
+    _iodbcdm_dropstmt (cp_pdbc->hstmt);
+
+  /* set expiration time and other parameters for connection in pool */
+  cp_pdbc->cp_pdbc = NULL;
+  if (cp_pdbc->cp_retry_wait == 0)
+    {
+      /* set new expiry time only if we are not returning the connection
+	 to the pool after unsuccessful reconnect attempt */
+      cp_pdbc->cp_expiry_time = time(NULL) + cp_pdbc->cp_timeout;
+    }
+  cp_pdbc->cp_in_use = FALSE;
+
+  DPRINTF ((stderr, "DEBUG: connection %p put back to the pool (cp_pdbc %p, cp_timeout %d)\n",
+      hdbc, cp_pdbc, cp_pdbc->cp_timeout));
+  return 0;
+}
+#endif /* (ODBCVER >= 0x300) */
+
+
+/* - Load driver share library( or increase its reference count
+ *   if it has already been loaded by another active connection)
+ * - Call driver's SQLAllocEnv() (for the first reference only)
+ * - Call driver's SQLAllocConnect()
+ * - Call driver's SQLSetConnectOption() (set login time out)
+ * - Increase the bookkeeping reference count
+ */
+SQLRETURN
+_iodbcdm_driverload (
+    char * dsn,
+    char * drv,
+    HDBC hdbc,
+    SWORD thread_safe,
+    SWORD unload_safe,
+    IODBC_CHARSET iodbcinst_drv_cp,
+    UCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, NULL);
+  GENV (genv, NULL);
+  HDLL hdll = SQL_NULL_HDLL;
+  HPROC hproc;
+  SQLRETURN retcode = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  char buf[1024];
+  char path_tmp[1024];
+  char *path = drv;
+  char cp_probe[1024] = {""};
+  int cp_timeout = 0;
+  void *pfaux;
+  int driver_unicode_cp = -1;
+  SQLINTEGER wchar_id;
+
+  if (drv == NULL || ((char*)drv)[0] == '\0')
+    {
+      PUSHSQLERR (pdbc->herr, en_IM002);
+      return SQL_ERROR;
+    }
+
+  if (!IS_VALID_HDBC (pdbc) || pdbc->genv == SQL_NULL_HENV)
+    {
+      return SQL_INVALID_HANDLE;
+    }
+
+  /*
+   *  If drv does not start with / or ., we may have a symbolic driver name
+   */
+  if (!(drv[0] == '/' || drv[0] == '.'))
+    {
+      char *tmp_drv = NULL;
+
+      /*
+       *  Remove curly braces
+       */
+      if (drv[0] == '{')
+	{
+	  tmp_drv = strdup (drv);
+	  if (tmp_drv[strlen (drv) - 1] == '}')
+	    tmp_drv[strlen (drv) - 1] = '\0';
+	  drv = &tmp_drv[1];
+	}
+
+      /*
+       *  Hopefully the driver was registered under that name in the 
+       *  odbcinst.ini file
+       */
+      if (SQLGetPrivateProfileString ((char *) drv, "Driver", "",
+	      path_tmp, sizeof (path_tmp), "odbcinst.ini") && path_tmp[0])
+	path = path_tmp;
+
+      /*
+       *  Get CPTimeout value
+       */
+      SQLSetConfigMode (ODBC_BOTH_DSN);
+      if (SQLGetPrivateProfileString (drv, "CPTimeout", "",
+	    buf, sizeof(buf), "odbcinst.ini") && buf[0])
+        cp_timeout = atoi(buf);
+
+      /*
+       *  Get CPProbe value
+       */
+      SQLGetPrivateProfileString (drv, "CPProbe", "",
+   	    cp_probe, sizeof(cp_probe), "odbcinst.ini");
+
+      if (SQLGetPrivateProfileString ((char *) drv,
+          "DriverUnicodeType", "3", buf, sizeof (buf), "odbcinst.ini"))
+        {
+          if (STRCASEEQ (buf, "1") || STRCASEEQ (buf, "utf16") || STRCASEEQ (buf, "ucs2"))
+            iodbcinst_drv_cp = CP_UTF16;
+          else if (STRCASEEQ (buf, "2") || STRCASEEQ (buf, "utf8"))
+            iodbcinst_drv_cp = CP_UTF8;
+          else
+            iodbcinst_drv_cp = CP_UCS4;
+
+          DPRINTF ((stderr,
+            "DEBUG: _iodbcdm_driverload-0(odbcinst.ini) DriverUnicodeType=%s\n",
+              iodbcinst_drv_cp==CP_UCS4?"UCS4":(iodbcinst_drv_cp==CP_UTF16?"UTF16":"UTF8")));
+        }
+
+      if (tmp_drv)
+	free (tmp_drv);
+    }
+  else if (dsn != NULL && *dsn != '\0')
+    {
+      char tmp_drv[1024] = {""};
+
+      SQLSetConfigMode (ODBC_BOTH_DSN);
+      if (SQLGetPrivateProfileString ("ODBC Data Sources", dsn, "",
+	    tmp_drv, sizeof(tmp_drv), NULL) && tmp_drv[0])
+	{
+          /*
+           *  Get CPTimeout value
+           */
+          if (SQLGetPrivateProfileString (tmp_drv, "CPTimeout", "",
+	        buf, sizeof(buf), "odbcinst.ini") && buf[0])
+            cp_timeout = atoi(buf);
+
+          /*
+           *  Get CPProbe value
+           */
+          SQLGetPrivateProfileString (tmp_drv, "CPProbe", "",
+  	      cp_probe, sizeof(cp_probe), "odbcinst.ini");
+
+          if (SQLGetPrivateProfileString ((char *) tmp_drv,
+              "DriverUnicodeType", "3", buf, sizeof (buf), "odbcinst.ini"))
+            {
+              if (STRCASEEQ (buf, "1") || STRCASEEQ (buf, "utf16") || STRCASEEQ (buf, "ucs2"))
+                iodbcinst_drv_cp = CP_UTF16;
+              else if (STRCASEEQ (buf, "2") || STRCASEEQ (buf, "utf8"))
+                iodbcinst_drv_cp = CP_UTF8;
+              else
+                iodbcinst_drv_cp = CP_UCS4;
+
+              DPRINTF ((stderr,
+                "DEBUG: _iodbcdm_driverload-1(odbcinst.ini) DriverUnicodeType=%s\n",
+                  iodbcinst_drv_cp==CP_UCS4?"UCS4":(iodbcinst_drv_cp==CP_UTF16?"UTF16":"UTF8")));
+            }
+  	}
+    }
+
+  genv = (GENV_t *) pdbc->genv;
+
+  /* This will either load the driver dll or increase its reference count */
+  hdll = _iodbcdm_dllopen ((char *) path);
+  
+  if (hdll == SQL_NULL_HDLL)
+    {
+      PUSHSYSERR (pdbc->herr, _iodbcdm_dllerror ());
+      PUSHSQLERR (pdbc->herr, en_IM003);
+      return SQL_ERROR;
+    }
+
+  /* Set flag if it is safe to unload the driver after use */
+  if (unload_safe)
+    _iodbcdm_safe_unload (hdll);
+
+  penv = (ENV_t *) (pdbc->henv);
+
+  if (penv != NULL)
+    {
+      if (penv->hdll != hdll)
+	{
+	  _iodbcdm_driverunload (hdbc, 3);
+	  penv->hdll = hdll;
+	}
+      else
+	{
+	  /*
+	   * this will not unload the driver but only decrease its internal
+	   * reference count
+	   */
+	  _iodbcdm_dllclose (hdll);
+	}
+    }
+
+  if (penv == NULL)
+    {
+      /*
+       * find out whether this dll has already been loaded on another
+       * connection
+       */
+      for (penv = (ENV_t *) genv->henv;
+	  penv != NULL;
+	  penv = (ENV_t *) penv->next)
+	{
+	  if (penv->hdll == hdll)
+	    {
+	      /*
+	       * this will not unload the driver but only decrease its internal
+	       * reference count
+	       */
+	      _iodbcdm_dllclose (hdll);
+	      break;
+	    }
+	}
+
+      if (penv == NULL)
+	/* no connection attaching with this dll */
+	{
+	  int i;
+
+	  /* create a new dll env instance */
+	  penv = (ENV_t *) MEM_ALLOC (sizeof (ENV_t));
+
+	  if (penv == NULL)
+	    {
+	      _iodbcdm_dllclose (hdll);
+
+	      PUSHSQLERR (pdbc->herr, en_S1001);
+
+	      return SQL_ERROR;
+	    }
+
+	  penv->conv.dm_cp    = genv->conv.dm_cp;
+	  penv->conv.drv_cp   = iodbcinst_drv_cp;
+	  /*
+	   *  Initialize array of ODBC functions
+	   */
+	  for (i = 0; i < __LAST_API_FUNCTION__; i++)
+	    {
+#if 1 
+	      (penv->dllproc_tab)[i] = SQL_NULL_HPROC;
+#else
+	      (penv->dllproc_tab)[i] = _iodbcdm_getproc(pdbc, i);
+#endif
+	    }
+
+	  pdbc->henv = penv;
+	  pdbc->conv = penv->conv;
+	  penv->hdll = hdll;
+
+          /*
+           *  If the driver appears not to be thread safe, use a
+           *  driver mutex to serialize all calls to this driver
+           */
+          penv->thread_safe = thread_safe;
+          if (!penv->thread_safe)
+            MUTEX_INIT (penv->drv_lock);
+
+          penv->unicode_driver = 0;
+          /*
+           *  If the driver is Unicode
+           */
+          pfaux = _iodbcdm_getproc (pdbc, en_ConnectW);
+          if ((pfaux) && (pfaux != (void *)SQLConnectW))
+            penv->unicode_driver = 1;
+
+	  /* call driver's SQLAllocHandle() or SQLAllocEnv() */
+
+#if (ODBCVER >= 0x0300)
+	  hproc = _iodbcdm_getproc (pdbc, en_AllocHandle);
+
+	  if (hproc)
+	    {
+	      CALL_DRIVER (hdbc, genv, retcode, hproc,
+		  (SQL_HANDLE_ENV, SQL_NULL_HANDLE, &(penv->dhenv)));
+	      if (SQL_SUCCEEDED (retcode))
+		{		
+		  /* 
+		   * This appears to be an ODBC3 driver
+		   *
+		   * Try to set the app's requested version
+		   */
+		  SQLRETURN save_retcode = retcode;
+
+		  penv->dodbc_ver = SQL_OV_ODBC2;
+		  hproc = _iodbcdm_getproc (pdbc, en_SetEnvAttr);
+		  if (hproc != SQL_NULL_HPROC)
+		    {
+		      CALL_DRIVER (hdbc, genv, retcode, hproc,
+			  (penv->dhenv, SQL_ATTR_ODBC_VERSION, genv->odbc_ver, 
+			  0));
+		      if (retcode == SQL_SUCCESS)
+			penv->dodbc_ver = SQL_OV_ODBC3;
+		    }
+
+		  hproc = _iodbcdm_getproc (pdbc, en_GetEnvAttr);
+		  if (hproc != SQL_NULL_HPROC)
+                    {
+                      SQLINTEGER val, len;
+
+                      val = -1;
+                      CALL_DRIVER (hdbc, penv, retcode, hproc,
+			(penv->dhenv, SQL_ATTR_DRIVER_UNICODE_TYPE, &val, 0, 0));
+                      if (retcode == SQL_SUCCESS && val !=-1)
+                        {
+                          DPRINTF ((stderr,
+                           "DEBUG: _iodbcdm_driverload(ODBC Driver return=%d)\n", val));
+
+                          if (val == SQL_DM_CP_UCS4 || val == SQL_DM_CP_UTF16 || val == SQL_DM_CP_UTF8)
+                            {
+                              switch(val)
+                                {
+                                case SQL_DM_CP_UTF16:
+                                  penv->conv.drv_cp = CP_UTF16;
+                                  pdbc->conv.drv_cp = CP_UTF16;
+                                  driver_unicode_cp = CP_UTF16;
+                                  break;
+                                case SQL_DM_CP_UTF8:
+                                  penv->conv.drv_cp = CP_UTF8;
+                                  pdbc->conv.drv_cp = CP_UTF8;
+                                  driver_unicode_cp = CP_UTF8;
+                                  break;
+                                default:
+                                case SQL_DM_CP_UCS4:
+                                  penv->conv.drv_cp = CP_UCS4;
+                                  pdbc->conv.drv_cp = CP_UCS4;
+                                  driver_unicode_cp = CP_UCS4;
+                                  break;
+                                }
+                              DPRINTF ((stderr,
+                               "DEBUG: _iodbcdm_driverload(ODBC Driver return DriverUnicodeType=%s)\n",
+                                penv->conv.drv_cp==CP_UCS4
+                                  ?"UCS4"
+                                  :(penv->conv.drv_cp==CP_UTF16?"UTF16":"UTF8")));
+                            }
+                          else
+                            {
+                              penv->conv.drv_cp = iodbcinst_drv_cp;
+                              pdbc->conv.drv_cp = iodbcinst_drv_cp;
+
+                              DPRINTF ((stderr,
+                               "DEBUG: _iodbcdm_driverload(ODBC Driver use DriverUnicodeType=UCS4 (default))\n"));
+                            }
+                        }
+                    }
+
+		  retcode = save_retcode;
+		}
+	    }
+	  else			/* try driver's SQLAllocEnv() */
+#endif
+	    {
+	      hproc = _iodbcdm_getproc (pdbc, en_AllocEnv);
+
+	      if (hproc == SQL_NULL_HPROC)
+		{
+		  sqlstat = en_IM004;
+		}
+	      else
+		{
+#if (ODBCVER >= 0x0300)
+		  penv->dodbc_ver = SQL_OV_ODBC2;
+#endif
+		  CALL_DRIVER (hdbc, genv, retcode, hproc, (&(penv->dhenv)));
+		}
+	    }
+
+	  if (retcode == SQL_ERROR)
+	    {
+	      sqlstat = en_IM004;
+	    }
+
+	  if (sqlstat != en_00000)
+	    {
+	      _iodbcdm_dllclose (hdll);
+	      PUSHSQLERR (pdbc->herr, en_IM004);
+
+	      /* free internal env */
+	      MEM_FREE (penv);
+	      pdbc->henv = NULL;
+
+	      return SQL_ERROR;
+	    }
+
+          if (driver_unicode_cp == -1
+              && penv->unicode_driver
+              && dsn != NULL && *dsn != '\0')
+            {
+              SQLSetConfigMode (ODBC_BOTH_DSN);
+
+              if ( SQLGetPrivateProfileString ((char *) dsn,
+                    "DriverUnicodeType", "", buf, sizeof(buf), "odbc.ini"))
+                {
+                  if (STRCASEEQ (buf, "1") || STRCASEEQ (buf, "utf16"))
+                    {
+                      penv->conv.drv_cp = CP_UTF16;
+                      pdbc->conv.drv_cp = CP_UTF16;
+                    }
+                  else if (STRCASEEQ (buf, "2") || STRCASEEQ (buf, "utf8"))
+                    {
+                      penv->conv.drv_cp = CP_UTF8;
+                      pdbc->conv.drv_cp = CP_UTF8;
+                    }
+                  else if (STRCASEEQ (buf, "3") || STRCASEEQ (buf, "ucs4"))
+                    {
+                      penv->conv.drv_cp = CP_UCS4;
+                      pdbc->conv.drv_cp = CP_UCS4;
+                    }
+
+                  DPRINTF ((stderr,
+                   "DEBUG: _iodbcdm_driverload(DSN attribute) DriverUnicodeType=%s\n",
+                    penv->conv.drv_cp==CP_UCS4
+                      ?"UCS4":(penv->conv.drv_cp==CP_UTF16?"UTF16":"UTF8")));
+
+                }
+            }
+
+	  /* insert into dll env list */
+	  penv->next = (ENV_t *) genv->henv;
+	  genv->henv = penv;
+
+	  /* initiate this new env entry */
+	  penv->refcount = 0;	/* we will increase it after
+				 * driver's SQLAllocConnect()
+				 * success
+				 */
+	}
+      else /* penv != NULL */
+        {
+          pdbc->conv.drv_cp = penv->conv.drv_cp;
+#if (ODBCVER >= 0x0300)
+	  hproc = _iodbcdm_getproc (pdbc, en_GetEnvAttr);
+	  if (hproc != SQL_NULL_HPROC)
+            {
+              SQLINTEGER val;
+
+              val = -1;
+              CALL_DRIVER (hdbc, penv, retcode, hproc,
+	  	    (penv->dhenv, SQL_ATTR_DRIVER_UNICODE_TYPE, &val, 0, 0));
+              if (retcode == SQL_SUCCESS && val !=-1)
+                {
+                  if (val == SQL_DM_CP_UCS4 || val == SQL_DM_CP_UTF16 || val == SQL_DM_CP_UTF8)
+                    {
+                      switch(val)
+                        {
+                        case SQL_DM_CP_UTF16:
+                          driver_unicode_cp = CP_UTF16;
+                          break;
+                        case SQL_DM_CP_UTF8:
+                          driver_unicode_cp = CP_UTF8;
+                          break;
+                        default:
+                        case SQL_DM_CP_UCS4:
+                          driver_unicode_cp = CP_UCS4;
+                          break;
+                        }
+                    }
+                }
+            }
+#endif
+        }
+
+      pdbc->henv = penv;
+
+      if (pdbc->dhdbc == SQL_NULL_HDBC)
+	{
+
+#if (ODBCVER >= 0x0300)
+	  hproc = _iodbcdm_getproc (pdbc, en_AllocHandle);
+
+	  if (hproc)
+	    {
+	      CALL_DRIVER (hdbc, genv, retcode, hproc,
+		  (SQL_HANDLE_DBC, penv->dhenv, &(pdbc->dhdbc)));
+	    }
+	  else
+#endif
+
+	    {
+	      hproc = _iodbcdm_getproc (pdbc, en_AllocConnect);
+
+	      if (hproc == SQL_NULL_HPROC)
+		{
+		  sqlstat = en_IM005;
+		}
+	      else
+		{
+		  CALL_DRIVER (hdbc, genv, retcode, hproc,
+		      (penv->dhenv, &(pdbc->dhdbc)));
+		}
+	    }
+
+	  if (retcode == SQL_ERROR)
+	    {
+	      sqlstat = en_IM005;
+	    }
+
+	  if (sqlstat != en_00000)
+	    {
+	      _iodbcdm_driverunload (hdbc, 3);
+
+	      pdbc->dhdbc = SQL_NULL_HDBC;
+	      PUSHSQLERR (pdbc->herr, en_IM005);
+
+	      return SQL_ERROR;
+	    }
+	}
+
+      pdbc->henv = penv;
+      penv->refcount++;		/* bookkeeping reference count on this driver */
+    }
+  else  /*penv != NULL */
+    {
+      pdbc->conv.drv_cp = penv->conv.drv_cp;
+#if (ODBCVER >= 0x0300)
+      hproc = _iodbcdm_getproc (pdbc, en_GetEnvAttr);
+      if (hproc != SQL_NULL_HPROC)
+        {
+          SQLINTEGER val;
+
+          val = -1;
+          CALL_DRIVER (hdbc, penv, retcode, hproc,
+              (penv->dhenv, SQL_ATTR_DRIVER_UNICODE_TYPE, &val, 0, 0));
+          if (retcode == SQL_SUCCESS && val !=-1)
+            {
+              if (val == SQL_DM_CP_UCS4 || val == SQL_DM_CP_UTF16 || val == SQL_DM_CP_UTF8)
+                {
+                  switch(val)
+                    {
+                    case SQL_DM_CP_UTF16:
+                      driver_unicode_cp = CP_UTF16;
+                      break;
+                    case SQL_DM_CP_UTF8:
+                      driver_unicode_cp = CP_UTF8;
+                      break;
+                    default:
+                    case SQL_DM_CP_UCS4:
+                      driver_unicode_cp = CP_UCS4;
+                      break;
+                    }
+                }
+            }
+        }
+#endif
+    }
+
+  /* driver's login timeout option must been set before
+   * its SQLConnect() call */
+  if (pdbc->login_timeout != 0UL)
+    {
+      retcode = _iodbcdm_SetConnectOption_init (hdbc, SQL_LOGIN_TIMEOUT,
+	pdbc->login_timeout, waMode);
+
+      if (retcode == SQL_ERROR)
+        {
+          PUSHSQLERR (pdbc->herr, en_IM006);
+          return SQL_SUCCESS_WITH_INFO;
+        }
+    }
+
+  /*
+   *  Now set the driver specific options we saved earlier
+   */
+  if (pdbc->drvopt != NULL)
+    {
+      DRVOPT *popt;
+
+      for (popt = pdbc->drvopt; popt != NULL; popt = popt->next)
+        {
+          retcode = _iodbcdm_SetConnectOption_init (hdbc, popt->Option,
+	    popt->Param, popt->waMode);
+
+          if (retcode == SQL_ERROR)
+            {
+	      PUSHSQLERR (pdbc->herr, en_IM006);
+	      return SQL_SUCCESS_WITH_INFO;
+	    }
+        }
+    }
+
+
+    wchar_id = penv->conv.dm_cp;
+    
+    retcode = _iodbcdm_SetConnectAttr_init (hdbc, SQL_ATTR_APP_WCHAR_TYPE, wchar_id);
+
+    DPRINTF ((stderr, "DEBUG: _iodbcdm_driverload(set ODBC Driver WCHAR_TYPE=%d) retcode=%d\n", wchar_id, retcode));
+    
+    if (retcode == SQL_SUCCESS)
+      {
+        penv->conv.drv_cp = wchar_id;
+        pdbc->conv.drv_cp = wchar_id;
+
+        DPRINTF ((stderr,
+            "DEBUG: _iodbcdm_driverload(set ODBC Driver WCHAR_TYPE=%d) %s\n",
+               penv->conv.drv_cp,
+               penv->conv.drv_cp==CP_UCS4
+                          ?"UCS4"
+                          :(penv->conv.drv_cp==CP_UTF16?"UTF16":"UTF8")));
+      }
+    else if (driver_unicode_cp != -1)
+      {
+        wchar_id = driver_unicode_cp;
+        
+        retcode = _iodbcdm_SetConnectAttr_init (hdbc, SQL_ATTR_APP_WCHAR_TYPE, wchar_id);
+
+        DPRINTF ((stderr, "DEBUG: _iodbcdm_driverload(set ODBC Driver WCHAR_TYPE=%d) retcode=%d\n", wchar_id, retcode));
+        if (retcode == SQL_SUCCESS)
+          {
+            penv->conv.drv_cp = wchar_id;
+            pdbc->conv.drv_cp = wchar_id;
+
+            DPRINTF ((stderr,
+                "DEBUG: _iodbcdm_driverload(set ODBC Driver WCHAR_TYPE=%d) %s\n",
+                   penv->conv.drv_cp,
+                   penv->conv.drv_cp==CP_UCS4
+                          ?"UCS4"
+                          :(penv->conv.drv_cp==CP_UTF16?"UTF16":"UTF8")));
+          }
+      }
+
+  pdbc->cp_timeout = cp_timeout;
+  MEM_FREE (pdbc->cp_probe);
+  pdbc->cp_probe = strdup (cp_probe);
+
+  return SQL_SUCCESS;
+}
+
+
+/* - Call driver's SQLFreeConnect()
+ * - Call driver's SQLFreeEnv() ( for the last reference only)
+ * - Unload the share library( or decrease its reference
+ *   count if it is not the last reference )
+ * - decrease bookkeeping reference count
+ * - state transition to allocated
+ */
+SQLRETURN
+_iodbcdm_driverunload (HDBC hdbc, int ver)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, pdbc->henv);
+  GENV (genv, pdbc->genv);
+  ENV_t *tpenv;
+  HPROC hproc2, hproc3;
+  SQLRETURN retcode = SQL_SUCCESS;
+
+  if (!IS_VALID_HDBC (pdbc))
+    {
+      return SQL_INVALID_HANDLE;
+    }
+
+  if (penv == NULL || penv->hdll == SQL_NULL_HDLL ||
+      pdbc->dhdbc == SQL_NULL_HDBC)
+    {
+      return SQL_SUCCESS;
+    }
+
+  /*
+   *  When calling from an ODBC 2.x application, we favor the ODBC 2.x call 
+   *  in the driver if the driver implements both
+   */
+  hproc2 = _iodbcdm_getproc (pdbc, en_FreeConnect);
+#if (ODBCVER >= 0x0300)
+  hproc3 = _iodbcdm_getproc (pdbc, en_FreeHandle);
+
+  if (ver == 3 && hproc2 != SQL_NULL_HPROC && hproc3 != SQL_NULL_HPROC)
+    hproc2 = SQL_NULL_HPROC;
+#else
+  hproc3 = SQL_NULL_HPROC;
+#endif
+
+  if (hproc2 != SQL_NULL_HPROC)
+    {
+      CALL_DRIVER (hdbc, pdbc, retcode, hproc2, (pdbc->dhdbc));
+
+      pdbc->dhdbc = SQL_NULL_HDBC;
+    }
+#if (ODBCVER >= 0x0300)
+  else if (hproc3 != SQL_NULL_HPROC)
+    {
+      CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
+	  (SQL_HANDLE_DBC, pdbc->dhdbc));
+    }
+#endif
+
+  penv->refcount--;
+
+  if (!penv->refcount)
+    /* no other connections still attaching with this driver */
+    {
+      /*
+       *  When calling from an ODBC 2.x application, we favor the ODBC 2.x call 
+       *  in the driver if the driver implements both
+       */
+      hproc2 = _iodbcdm_getproc (pdbc, en_FreeEnv);
+#if (ODBCVER >= 0x0300)
+      hproc3 = _iodbcdm_getproc (pdbc, en_FreeHandle);
+
+      if (ver == 3 && hproc2 != SQL_NULL_HPROC && hproc3 != SQL_NULL_HPROC)
+	hproc2 = SQL_NULL_HPROC;
+#else
+      hproc3 = SQL_NULL_HPROC;
+#endif
+
+      if (hproc2 != SQL_NULL_HPROC)
+	{
+	  CALL_DRIVER (hdbc, genv, retcode, hproc2, (penv->dhenv));
+
+	  penv->dhenv = SQL_NULL_HENV;
+	}
+#if (ODBCVER >= 0x0300)
+      else if (hproc3 != SQL_NULL_HPROC)
+	{
+	  CALL_DRIVER (hdbc, genv, retcode, hproc3,
+	      (SQL_HANDLE_ENV, penv->dhenv));
+	}
+#endif
+
+      _iodbcdm_dllclose (penv->hdll);
+
+      penv->hdll = SQL_NULL_HDLL;
+
+      for (tpenv = (ENV_t *) genv->henv;
+	  tpenv != NULL; tpenv = (ENV_t *) tpenv->next)
+	{
+	  if (tpenv == penv)
+	    {
+	      genv->henv = penv->next;
+	      break;
+	    }
+
+	  if (tpenv->next == penv)
+	    {
+	      tpenv->next = penv->next;
+	      break;
+	    }
+	}
+
+      /* free internal env */
+      MEM_FREE (penv);
+      pdbc->henv = NULL;
+    }
+
+  /* pdbc->henv = SQL_NULL_HENV; */
+  pdbc->hstmt = SQL_NULL_HSTMT;
+  /* pdbc->herr = SQL_NULL_HERR;
+     -- delay to DM's SQLFreeConnect() */
+  pdbc->dhdbc = SQL_NULL_HDBC;
+  pdbc->state = en_dbc_allocated;
+
+  /* set connect options to default values */
+	/**********
+	pdbc->access_mode	= SQL_MODE_DEFAULT;
+	pdbc->autocommit	= SQL_AUTOCOMMIT_DEFAULT;
+	pdbc->login_timeout 	= 0UL;
+	**********/
+  pdbc->odbc_cursors = SQL_CUR_DEFAULT;
+  pdbc->packet_size = 0UL;
+  pdbc->quiet_mode = (UDWORD) NULL;
+  pdbc->txn_isolation = SQL_TXN_READ_UNCOMMITTED;
+
+#if (ODBCVER >= 0x0300)
+  if (pdbc->cp_probe != NULL)
+    {
+      MEM_FREE (pdbc->cp_probe);
+      pdbc->cp_probe = NULL;
+    }
+  if (pdbc->cp_dsn != NULL)
+    {
+      MEM_FREE (pdbc->cp_dsn);
+      pdbc->cp_dsn = NULL;
+    }
+  if (pdbc->cp_uid != NULL)
+    {
+      MEM_FREE (pdbc->cp_uid);
+      pdbc->cp_uid = NULL;
+    }
+  if (pdbc->cp_pwd != NULL)
+    {
+      MEM_FREE (pdbc->cp_pwd);
+      pdbc->cp_pwd = NULL;
+    }
+  if (pdbc->cp_connstr != NULL)
+    {
+      MEM_FREE (pdbc->cp_connstr);
+      pdbc->cp_connstr = NULL;
+    }
+#endif
+
+  if (pdbc->current_qualifier != NULL)
+    {
+      MEM_FREE (pdbc->current_qualifier);
+      pdbc->current_qualifier = NULL;
+    }
+
+  return SQL_SUCCESS;
+}
+
+
+static SQLRETURN
+_iodbcdm_dbcdelayset (HDBC hdbc, UCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLRETURN ret;
+
+  if (pdbc->access_mode != SQL_MODE_DEFAULT)
+    {
+      ret = _iodbcdm_SetConnectOption_init (hdbc, SQL_ACCESS_MODE,
+	      pdbc->access_mode, waMode);
+
+      retcode |= ret;
+    }
+
+  if (pdbc->autocommit != SQL_AUTOCOMMIT_DEFAULT)
+    {
+      ret = _iodbcdm_SetConnectOption_init (hdbc, SQL_AUTOCOMMIT,
+	      pdbc->autocommit, waMode);
+
+      retcode |= ret;
+    }
+
+  if (pdbc->current_qualifier != NULL)
+    {
+      ret = _iodbcdm_SetConnectOption_init (hdbc, SQL_CURRENT_QUALIFIER,
+	      (SQLULEN) pdbc->current_qualifier,
+	      pdbc->current_qualifier_WA);
+
+      retcode |= ret;
+    }
+
+  if (pdbc->packet_size != 0UL)
+    {
+      ret = _iodbcdm_SetConnectOption_init (hdbc, SQL_PACKET_SIZE,
+	      pdbc->packet_size, waMode);
+
+      retcode |= ret;
+    }
+
+  if (pdbc->quiet_mode != (UDWORD) NULL)
+    {
+      ret = _iodbcdm_SetConnectOption_init (hdbc, SQL_QUIET_MODE,
+	      pdbc->quiet_mode, waMode);
+
+      retcode |= ret;
+    }
+
+  if (pdbc->txn_isolation != SQL_TXN_READ_UNCOMMITTED)
+    {
+      ret = _iodbcdm_SetConnectOption_init (hdbc, SQL_TXN_ISOLATION,
+	      pdbc->txn_isolation, waMode);
+
+      retcode |= ret;
+    }
+
+  /* check error code for driver's SQLSetConnectOption() call */
+  if (!SQL_SUCCEEDED (retcode))
+    {
+      PUSHSQLERR (pdbc->herr, en_IM006);
+      retcode = SQL_ERROR;
+    }
+
+
+  /* get cursor behavior on transaction commit or rollback */
+  ret = _iodbcdm_getInfo_init (hdbc, SQL_CURSOR_COMMIT_BEHAVIOR,
+	    (PTR) & (pdbc->cb_commit),
+	    sizeof (pdbc->cb_commit),
+	    NULL, waMode);
+  retcode |= ret;
+
+  ret = _iodbcdm_getInfo_init (hdbc, SQL_CURSOR_ROLLBACK_BEHAVIOR,
+	    (PTR) & (pdbc->cb_rollback),
+	    sizeof (pdbc->cb_rollback),
+	    NULL, waMode);
+  retcode |= ret;
+
+  if (retcode != SQL_SUCCESS  && retcode != SQL_SUCCESS_WITH_INFO)
+    {
+      return SQL_ERROR;
+    }
+
+  return retcode;
+}
+
+
+static SQLRETURN
+_iodbcdm_con_settracing (HDBC hdbc, SQLCHAR *dsn, int dsnlen, UCHAR waMode)
+{
+  SQLUINTEGER trace = SQL_OPT_TRACE_OFF;
+  char buf[1024];
+
+  /* Unused */
+  hdbc=hdbc;
+  dsnlen=dsnlen;
+  waMode = waMode;
+
+  /* Get the TraceFile keyword value from the ODBC section */
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if ((SQLGetPrivateProfileString ((char *) dsn, "TraceFile", "", 
+	buf, sizeof (buf), "odbc.ini") == 0 || !buf[0]))
+    STRCPY (buf, SQL_OPT_TRACE_FILE_DEFAULT);
+
+  trace_set_filename (buf);	/* UTF-8 */
+
+  /* Get the Trace keyword value from the ODBC section */
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if (SQLGetPrivateProfileString ((char *) dsn, "Trace", "", 
+	buf, sizeof (buf), "odbc.ini")
+      && (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "yes")
+	  || STRCASEEQ (buf, "1")))
+    {
+      trace = SQL_OPT_TRACE_ON;
+    }
+
+  /* Set the trace flag now */
+  if (trace == SQL_OPT_TRACE_ON)
+    trace_start ();
+
+  return SQL_SUCCESS;
+}
+
+
+#define CATBUF(buf, str, buf_sz)					\
+  do {									\
+    if (_iodbcdm_strlcat (buf, str, buf_sz) >= buf_sz)			\
+      return -1;							\
+  } while (0)
+
+
+/*
+ * Merge the contents of .dsn file into config
+ */
+static int
+_iodbcdm_cfg_merge_filedsn (PCONFIG pconfig, const char *filedsn,
+			    char *buf, size_t buf_sz, int wide,
+			    DM_CONV *conv)
+{
+  BOOL override;	/* TRUE if params from conn str
+			   override params from .dsn file */
+  WORD len;
+  char *p, *p_next;
+  char entries[1024];
+  char value[1024];
+  char drv_value[1024] = {"\0"};
+  char *tmp = NULL;
+  int rc = 0;
+
+  /* identify params precedence */
+  if (SQLReadFileDSN (filedsn, "ODBC", "DRIVER", value, sizeof (value), &len) &&
+      len > 0)
+    {
+      /* if DRIVER is the same, then conn str params have precedence */
+      if (_iodbcdm_cfg_find (pconfig, "ODBC", "DRIVER") == 0 &&
+	  !strcasecmp (value, pconfig->value))
+        override = TRUE;
+      else
+        override = FALSE;
+    }
+  else
+    override = TRUE;
+
+  /* get list of entries in .dsn file */
+  if (!SQLReadFileDSN (filedsn, "ODBC", NULL,
+		       entries, sizeof (entries), &len))
+    return -1;
+
+  /* ignore DSN from connection string */
+  _iodbcdm_cfg_write (pconfig, "ODBC", "DSN", NULL);
+
+  /* add params from the .dsn file */
+  for (p = entries; *p != '\0'; p = p_next)
+    {
+      /* get next entry */
+      p_next = strchr (p, ';');
+      if (p_next)
+        *p_next++ = '\0';
+
+      if ((override || !strcasecmp (p, "DRIVER")) &&
+	  _iodbcdm_cfg_find (pconfig, "ODBC", p) == 0)
+        {
+	  /* skip param because it is specified in connection string */
+          continue;
+        }
+
+      if (!SQLReadFileDSN (filedsn, "ODBC", p, value, sizeof(value), &len))
+        return -1;
+      _iodbcdm_cfg_write (pconfig, "ODBC", p, value);
+    }
+
+  /* remove FILEDSN from new config */
+  _iodbcdm_cfg_write (pconfig, "ODBC", "FILEDSN", NULL);
+
+  if (_iodbcdm_cfg_find (pconfig, "ODBC", "DRIVER") == 0)
+    strncpy(drv_value, pconfig->value, sizeof(drv_value));
+
+  /* remove DRIVER from new config */
+  _iodbcdm_cfg_write (pconfig, "ODBC", "DRIVER", NULL);
+
+  /* construct new connection string */
+  if ((rc =_iodbcdm_cfg_to_string (pconfig, "ODBC", buf, buf_sz)) == -1)
+    goto done;
+
+  tmp = strdup(buf);
+  strncpy(buf, "DRIVER=", buf_sz);
+  CATBUF(buf, drv_value, buf_sz);
+  CATBUF(buf, ";", buf_sz);
+  CATBUF(buf, tmp, buf_sz);
+  MEM_FREE(tmp);
+
+  if (wide)
+    {
+      SQLWCHAR *_in = DM_U8toW (conv, (SQLCHAR *)buf, SQL_NTS);
+      if (_in == NULL)
+        {
+          rc = -1;
+          goto done;
+        }
+      DM_WCSNCPY (conv, buf, _in, buf_sz / DM_WCHARSIZE(conv));
+      MEM_FREE (_in);
+    }
+
+  rc = 0;
+
+done:
+  if (drv_value[0])
+    _iodbcdm_cfg_write (pconfig, "ODBC", "DRIVER", drv_value);
+    
+  return rc;
+}
+
+
+/*
+ * Save connection string into the file
+ */
+static int
+_iodbcdm_cfg_savefile (const char *savefile, void *conn_str, int wide,
+	DM_CONV *conv)
+{
+  int ret = 0;
+  PCONFIG pconfig;
+  BOOL atsection = FALSE;
+
+  /* parse connection string into pconfig */
+  if (_iodbcdm_cfg_init_str (&pconfig, conn_str, SQL_NTS, wide, conv) == -1)
+    return -1;
+
+  /* don't save PWD, FILEDSN and SAVEFILE */
+  _iodbcdm_cfg_write (pconfig, "ODBC", "PWD", NULL);
+  _iodbcdm_cfg_write (pconfig, "ODBC", "FILEDSN", NULL);
+  _iodbcdm_cfg_write (pconfig, "ODBC", "SAVEFILE", NULL);
+  _iodbcdm_cfg_write (pconfig, "ODBC", "DSN", NULL);
+
+  /* save the file */
+  SQLWriteFileDSN (savefile, "ODBC", "DSN", NULL);
+  _iodbcdm_cfg_rewind (pconfig);
+  while (_iodbcdm_cfg_nextentry (pconfig) == 0)
+    {
+      if (atsection)
+	{
+	  if (_iodbcdm_cfg_section (pconfig))
+	    {
+              /* found next section -- we're done */
+              break;
+            }
+	  else if (_iodbcdm_cfg_define (pconfig))
+	    {
+              if (!SQLWriteFileDSN (savefile, "ODBC",
+				    pconfig->id, pconfig->value))
+		{
+		  ret = -1;
+		  break;
+		}
+	    }
+	}
+      else if (_iodbcdm_cfg_section (pconfig)
+	  && !strcasecmp (pconfig->section, "ODBC"))
+	atsection = TRUE;
+    }
+
+  _iodbcdm_cfg_done (pconfig);
+  return ret;
+}
+
+
+static
+SQLRETURN SQL_API
+SQLConnect_Internal (SQLHDBC hdbc,
+    SQLPOINTER szDSN,
+    SQLSMALLINT cbDSN,
+    SQLPOINTER szUID,
+    SQLSMALLINT cbUID,
+    SQLPOINTER szAuthStr,
+    SQLSMALLINT cbAuthStr,
+    SQLCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, NULL);
+#if (ODBCVER >= 0x300)
+  GENV (genv, NULL);
+#endif
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLRETURN setopterr = SQL_SUCCESS;
+  /* MS SDK Guide specifies driver path can't longer than 255. */
+  char driver[1024] = { '\0' };
+  char buf[256];
+  HPROC hproc = SQL_NULL_HPROC;
+  SWORD thread_safe;
+  SWORD unload_safe;
+  void * _szDSN = NULL;
+  void * _szUID = NULL;
+  void * _szAuthStr = NULL;
+  SQLCHAR *_dsn = (SQLCHAR *) szDSN;
+  SQLSMALLINT _dsn_len = cbDSN;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = NULL;
+  IODBC_CHARSET drv_cp = CP_DEF;
+
+  /* check arguments */
+  if ((cbDSN < 0 && cbDSN != SQL_NTS)
+      || (cbUID < 0 && cbUID != SQL_NTS)
+      || (cbAuthStr < 0 && cbAuthStr != SQL_NTS)
+      || (cbDSN > SQL_MAX_DSN_LENGTH))
+    {
+      PUSHSQLERR (pdbc->herr, en_S1090);
+      RETURN (SQL_ERROR);
+    }
+
+  if (szDSN == NULL || cbDSN == 0)
+    {
+      PUSHSQLERR (pdbc->herr, en_IM002);
+      RETURN (SQL_ERROR);
+    }
+
+  /* check state */
+  if (pdbc->state != en_dbc_allocated)
+    {
+      PUSHSQLERR (pdbc->herr, en_08002);
+      RETURN (SQL_ERROR);
+    }
+
+
+  conv = (penv != SQL_NULL_HENV) ? &penv->conv : &((GENV_t *) pdbc->genv)->conv;
+
+  if (waMode == 'W')
+    {
+      _szDSN = (void *) DM_WtoU8(conv, szDSN, cbDSN);
+      _dsn = (SQLCHAR *) _szDSN;
+      _dsn_len = SQL_NTS;
+      if (_dsn == NULL)
+        {
+          PUSHSQLERR (pdbc->herr, en_S1001);
+          RETURN (SQL_ERROR);
+        }
+    }
+
+  /* Get the config mode */
+  if (_iodbcdm_con_settracing (pdbc, _dsn, _dsn_len, waMode) == SQL_ERROR)
+    RETURN (SQL_ERROR);
+
+#if (ODBCVER >= 0x300)
+  genv = (GENV_t *) pdbc->genv;
+
+  if (genv->connection_pooling != SQL_CP_OFF)
+    {
+      char *_uid = szUID;
+      char *_pwd = szAuthStr;
+
+      /*
+       * _dsn is already an UTF8 string so
+       * need to convert to UTF8 only szUID and szAuthStr
+       */
+      if (waMode == 'W')
+        {
+          if (szUID != NULL)
+	    {
+              _szUID = (void *) DM_WtoU8(conv, (SQLWCHAR *) szUID, cbUID);
+	      if (_szUID == NULL)
+	        {
+		  PUSHSQLERR (pdbc->herr, en_S1001);
+		  RETURN (SQL_ERROR);
+	        }
+	    }
+          if (szAuthStr != NULL)
+	    {
+              _szAuthStr = (void *) DM_WtoU8(conv,
+	          (SQLWCHAR *) szAuthStr, cbAuthStr);
+	      if (_szAuthStr == NULL)
+	        {
+		  PUSHSQLERR (pdbc->herr, en_S1001);
+		  RETURN (SQL_ERROR);
+	        }
+	    }
+	  _uid = _szUID;
+	  _pwd = _szAuthStr;
+        }
+
+      retcode = _iodbcdm_pool_get_conn (pdbc, (char *)_dsn, _uid, _pwd, NULL);
+      if (SQL_SUCCEEDED (retcode))
+        {
+	  /*
+	   * Got connection from the pool
+	   */
+
+          /* state transition */
+          pdbc->state = en_dbc_connected;
+
+          RETURN (retcode);
+        }
+
+      if (pdbc->cp_pdbc != NULL)
+        {
+	  /*
+	   * Dead connection was taken from pool
+	   */
+
+          if (pdbc->cp_pdbc->cp_retry_wait != 0)
+	    {
+	      /*
+	       * Retry Wait timeout has not expired yet
+	       */
+              PUSHSQLERR (pdbc->herr, en_08004);
+	      RETURN (SQL_ERROR);
+	    }
+
+	  /*
+	   * Free connection parameters.
+	   */
+	  if (waMode == 'W')
+	    {
+	      if (_szUID != NULL)
+	        {
+		  MEM_FREE (_szUID);
+		  _szUID = NULL;
+	        }
+	      if (_szAuthStr != NULL)
+	        {
+		  MEM_FREE (_szAuthStr);
+		  _szAuthStr = NULL;
+	        }
+	    }
+	}
+      else
+        {
+          /*
+	   * Connection was not found in the pool --
+	   * save connection parameters
+	   */
+	  if (pdbc->cp_dsn != NULL)
+	    MEM_FREE (pdbc->cp_dsn);
+	  if (pdbc->cp_uid != NULL)
+	    MEM_FREE (pdbc->cp_uid);
+	  if (pdbc->cp_pwd != NULL)
+	    MEM_FREE (pdbc->cp_pwd);
+
+          if (waMode == 'W')
+	    {
+	      pdbc->cp_dsn = _szDSN;
+	      _szDSN = NULL;
+	      pdbc->cp_uid = _szUID;
+	      _szUID = NULL;
+	      pdbc->cp_pwd = _szAuthStr;
+	      _szAuthStr = NULL;
+	    }
+	  else
+	    {
+	      pdbc->cp_dsn = strdup ((char *)_dsn);
+	      if (pdbc->cp_dsn == NULL)
+	        {
+		  PUSHSQLERR (pdbc->herr, en_S1001);
+		  RETURN (SQL_ERROR);
+		}
+	      if (_uid != NULL)
+	        {
+		  pdbc->cp_uid = strdup (_uid);
+		  if (pdbc->cp_uid == NULL)
+		    {
+		      PUSHSQLERR (pdbc->herr, en_S1001);
+		      RETURN (SQL_ERROR);
+		    }
+		}
+	      if (_pwd != NULL)
+	        {
+		  pdbc->cp_pwd = strdup (_pwd);
+		  if (pdbc->cp_pwd == NULL)
+		    {
+		      PUSHSQLERR (pdbc->herr, en_S1001);
+		      RETURN (SQL_ERROR);
+		    }
+		}
+	    }
+	}
+    }
+#endif /* (ODBCVER >= 0x300) */
+
+  /*
+   *  Check whether driver is thread safe
+   */
+  thread_safe = 1;		/* Assume driver is thread safe */
+
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if ( SQLGetPrivateProfileString ((char *) _dsn, "ThreadManager", "", 
+	buf, sizeof(buf), "odbc.ini") &&
+      (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "1")))
+    {
+      thread_safe = 0;	/* Driver needs a thread manager */
+    }
+
+  /*
+   *  Check if it is safe to unload the driver
+   */
+  unload_safe = 0;		/* Assume driver is not unload safe */
+
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if ( SQLGetPrivateProfileString ((char *) _dsn, "UnloadSafe", "", 
+	buf, sizeof(buf), "odbc.ini") &&
+      (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "1")))
+    {
+      unload_safe = 1;
+    }
+
+
+  /*
+   *  Get the name of the driver module and load it
+   */
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if ( SQLGetPrivateProfileString ((char *) _dsn, "Driver", "", 
+	(char *) driver, sizeof(driver), "odbc.ini") == 0)
+    /* No specified or default dsn section or
+     * no driver specification in this dsn section */
+    {
+      PUSHSQLERR (pdbc->herr, en_IM002);
+      RETURN (SQL_ERROR);
+    }
+
+  retcode = _iodbcdm_driverload ((char *)_dsn, (char *)driver, pdbc, thread_safe, unload_safe, drv_cp, waMode);
+
+  MEM_FREE(_szDSN);
+  _szDSN = NULL;
+
+  switch (retcode)
+    {
+    case SQL_SUCCESS:
+      break;
+
+    case SQL_SUCCESS_WITH_INFO:
+#if 0
+      /* 
+       *  Unsuccessful in calling driver's SQLSetConnectOption() to set 
+       *  login timeout.
+       */
+      setopterr = SQL_ERROR;
+#endif
+      break;
+
+    default:
+      return retcode;
+    }
+
+  penv = (ENV_t *) pdbc->henv;
+  conv = &pdbc->conv;
+
+  if (penv->unicode_driver && waMode != 'W')
+    conv_direct = CD_A2W;
+  else if (!penv->unicode_driver && waMode == 'W')
+    conv_direct = CD_W2A;
+  else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+    conv_direct = CD_W2W;
+
+  if (conv_direct != CD_NONE)
+    {
+      _szDSN = conv_text_m2d (conv, szDSN, cbDSN, conv_direct);
+      _szUID = conv_text_m2d (conv, szUID, cbUID, conv_direct);
+      _szAuthStr = conv_text_m2d (conv, szAuthStr, cbAuthStr, conv_direct);
+      cbDSN = SQL_NTS;
+      cbUID = SQL_NTS;
+      cbAuthStr = SQL_NTS;
+      szDSN = _szDSN;
+      szUID = _szUID;
+      szAuthStr = _szAuthStr;
+    }
+
+  ODBC_UNLOCK ();
+  CALL_UDRIVER(hdbc, pdbc, retcode, hproc, penv->unicode_driver,
+    en_Connect, (
+       pdbc->dhdbc,
+       szDSN,
+       cbDSN,
+       szUID,
+       cbUID,
+       szAuthStr,
+       cbAuthStr));
+  ODBC_LOCK ();
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      _iodbcdm_driverunload (pdbc, 3);
+      PUSHSQLERR (pdbc->herr, en_IM001);
+      RETURN (SQL_ERROR);
+    }
+
+  if (!SQL_SUCCEEDED (retcode))
+    {
+      /* not unload driver for retrieve error
+       * message from driver */
+		/*********
+		_iodbcdm_driverunload( hdbc , 3);
+		**********/
+
+      RETURN (retcode);
+    }
+
+  /* state transition */
+  pdbc->state = en_dbc_connected;
+
+  /* do delayed option setting */
+  setopterr |= _iodbcdm_dbcdelayset (pdbc, waMode);
+
+  if (setopterr != SQL_SUCCESS)
+    retcode = SQL_SUCCESS_WITH_INFO;
+
+end:
+#if (ODBCVER >= 0x300)
+  if (!SQL_SUCCEEDED (retcode) &&
+      pdbc->cp_pdbc != NULL)
+    {
+      int rc;
+
+      /*
+       * Dead connection was taken from the pool
+       * but reconnection attempt has failed:
+       * set cp_retry_wait time and return connection to the pool.
+       */
+      _iodbcdm_pool_set_retry_wait (pdbc);
+      rc = _iodbcdm_pool_put_conn (pdbc);
+      assert (rc == 0);
+    }
+#endif
+  if (_szDSN != NULL)
+    MEM_FREE(_szDSN);
+  if (_szUID != NULL)
+    MEM_FREE (_szUID);
+  if (_szAuthStr != NULL)
+    MEM_FREE (_szAuthStr);
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLConnect (
+  SQLHDBC		  hdbc,
+  SQLCHAR 		* szDSN,
+  SQLSMALLINT		  cbDSN,
+  SQLCHAR 		* szUID,
+  SQLSMALLINT		  cbUID,
+  SQLCHAR 		* szAuthStr,
+  SQLSMALLINT		  cbAuthStr)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLConnect (TRACE_ENTER,
+    	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr));
+
+  retcode =  SQLConnect_Internal (
+  	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr, 'A');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLConnect (TRACE_LEAVE,
+    	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr));
+}
+
+
+SQLRETURN SQL_API
+SQLConnectA (
+  SQLHDBC		  hdbc,
+  SQLCHAR 		* szDSN,
+  SQLSMALLINT		  cbDSN,
+  SQLCHAR 		* szUID,
+  SQLSMALLINT		  cbUID,
+  SQLCHAR 		* szAuthStr,
+  SQLSMALLINT		  cbAuthStr)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLConnect (TRACE_ENTER,
+    	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr));
+
+  retcode =  SQLConnect_Internal (
+  	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr, 'A');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLConnect (TRACE_LEAVE,
+    	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr));
+}
+
+
+SQLRETURN SQL_API
+SQLConnectW (SQLHDBC hdbc,
+    SQLWCHAR * szDSN,
+    SQLSMALLINT cbDSN,
+    SQLWCHAR * szUID,
+    SQLSMALLINT cbUID,
+    SQLWCHAR * szAuthStr,
+    SQLSMALLINT cbAuthStr)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLConnectW (TRACE_ENTER,
+    	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr));
+
+  retcode =  SQLConnect_Internal (
+  	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr,
+	'W');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLConnectW (TRACE_LEAVE,
+    	hdbc,
+	szDSN, cbDSN,
+	szUID, cbUID,
+	szAuthStr, cbAuthStr));
+}
+
+
+SQLRETURN SQL_API
+SQLDriverConnect_Internal (
+    SQLHDBC hdbc,
+    SQLHWND hwnd,
+    SQLPOINTER szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLPOINTER szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLPOINTER pcbConnStrOut,
+    SQLUSMALLINT fDriverCompletion,
+    SQLCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, NULL);
+#if (ODBCVER >= 0x300)
+  GENV (genv, NULL);
+#endif
+  HDLL hdll = NULL;
+  SQLCHAR *drv = NULL;
+  SQLCHAR drvbuf[1024];
+  SQLCHAR *dsn = NULL;
+  SQLCHAR dsnbuf[SQL_MAX_DSN_LENGTH + 1];
+  SQLWCHAR prov[2048];
+  SQLWCHAR StrInTmp[2048];
+  SWORD thread_safe;
+  SWORD unload_safe;
+  SQLCHAR buf[1024];
+  HPROC hproc = SQL_NULL_HPROC;
+  void *_ConnStrIn = NULL;
+  void *_ConnStrOut = NULL;
+  void *connStrOut = szConnStrOut;
+  void *connStrIn = szConnStrIn;
+  SQLSMALLINT connStrOutMax = cbConnStrOutMax;
+  SQLWCHAR connStrOut_buf[2048];
+  SQLWCHAR connStrIn_buf[2048];
+  UWORD config;
+  PCONFIG pconfig = NULL;
+  BOOL bCallDmDlg = FALSE;
+#if defined (__APPLE__) && !defined (NO_FRAMEWORKS)
+  CFBundleRef bundle = NULL;
+  CFBundleRef bundle_dll = NULL;
+  CFURLRef liburl = NULL;
+#endif
+  SQLCHAR *filedsn = NULL;
+  SQLCHAR *savefile = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = NULL;
+  IODBC_CHARSET drv_cp = CP_DEF;
+
+  HPROC dialproc = SQL_NULL_HPROC;
+
+  sqlstcode_t sqlstat = en_00000;
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLRETURN setopterr = SQL_SUCCESS;
+
+  /* check arguments */
+  if ((cbConnStrIn < 0 && cbConnStrIn != SQL_NTS) ||
+      (cbConnStrOutMax < 0 && cbConnStrOutMax != SQL_NTS))
+    {
+      PUSHSQLERR (pdbc->herr, en_S1090);
+      RETURN (SQL_ERROR);
+    }
+
+  /* check state */
+  if (pdbc->state != en_dbc_allocated)
+    {
+      PUSHSQLERR (pdbc->herr, en_08002);
+      RETURN (SQL_ERROR);
+    }
+
+  /* Save config mode */
+  SQLGetConfigMode (&config);
+
+  conv = (penv != SQL_NULL_HENV) ? &penv->conv : &((GENV_t *) pdbc->genv)->conv;
+
+  if (_iodbcdm_cfg_init_str (&pconfig, connStrIn, cbConnStrIn,
+			     waMode == 'W', conv) == -1)
+    {
+      PUSHSQLERR (pdbc->herr, en_HY001);
+      RETURN (SQL_ERROR);
+    }
+  assert (_iodbcdm_cfg_valid(pconfig));
+
+  /* lookup and save original SAVEFILE value */
+  if (_iodbcdm_cfg_find (pconfig, "ODBC", "SAVEFILE") == 0)
+    {
+      savefile = (SQLCHAR *)strdup (pconfig->value);
+      if (savefile == NULL)
+        {
+          PUSHSQLERR (pdbc->herr, en_HY001);
+          RETURN (SQL_ERROR);
+        }
+    }
+
+
+#if (ODBCVER >= 0x300)
+  genv = (GENV_t *) pdbc->genv;
+
+  /*
+   * Try to find pooled connection.
+   * Pooling is disabled if SAVEFILE is present.
+   */
+  if (genv->connection_pooling != SQL_CP_OFF && savefile == NULL)
+    {
+      char *_connstr = connStrIn;
+
+      if (fDriverCompletion != SQL_DRIVER_NOPROMPT)
+        {
+          PUSHSQLERR (pdbc->herr, en_HY110);
+          RETURN (SQL_ERROR);
+        }
+
+      if (waMode == 'W')
+        {
+          _ConnStrIn = DM_WtoU8(conv, (SQLWCHAR *) connStrIn, cbConnStrIn);
+	  if (_ConnStrIn == NULL)
+	    {
+              PUSHSQLERR (pdbc->herr, en_HY001);
+              RETURN (SQL_ERROR);
+	    }
+	  _connstr = _ConnStrIn;
+	}
+
+      retcode = _iodbcdm_pool_get_conn (pdbc, NULL, NULL, NULL, _connstr);
+      if (SQL_SUCCEEDED (retcode))
+        {
+	  /*
+	   * Got connection from the pool
+	   */
+
+          /* copy out connection string */
+          if (szConnStrOut != NULL)
+	    {
+	      if (waMode == 'W')
+		{
+		  DM_WCSNCPY (conv, szConnStrOut, szConnStrIn, cbConnStrOutMax);
+
+		  if (pcbConnStrOut != NULL)
+		    {
+		      if (conv && conv->dm_cp == CP_UTF8)
+			*(SQLSMALLINT *) pcbConnStrOut = strlen ((char *) szConnStrOut);
+		      else
+			*(SQLSMALLINT *) pcbConnStrOut = DM_WCSLEN (conv, szConnStrOut);
+		    }
+		}
+	      else
+		{
+		  _iodbcdm_strlcpy (szConnStrOut, szConnStrIn, cbConnStrOutMax);
+		  if (pcbConnStrOut != NULL)
+		    *(SQLSMALLINT *) pcbConnStrOut = strlen (szConnStrOut);
+		}
+	    }
+
+          /* state transition */
+          pdbc->state = en_dbc_connected;
+
+          RETURN (retcode);
+        }
+
+      if (pdbc->cp_pdbc != NULL)
+        {
+	  /*
+	   * Dead connection was taken from pool
+	   */
+
+          if (pdbc->cp_pdbc->cp_retry_wait != 0)
+	    {
+	      /*
+	       * Retry Wait timeout has not expired yet
+	       */
+              PUSHSQLERR (pdbc->herr, en_08004);
+	      RETURN (SQL_ERROR);
+	    }
+
+	  /*
+	   * Free connection parameters.
+	   */
+	  if (waMode == 'W')
+	    {
+	      if (_ConnStrIn != NULL)
+	        {
+		  MEM_FREE (_ConnStrIn);
+		  _ConnStrIn = NULL;
+	        }
+	    }
+        }
+      else
+        {
+          /*
+	   * Connection was not found in the pool --
+	   * save connection parameters
+	   */
+	  if (pdbc->cp_connstr != NULL)
+	    MEM_FREE (pdbc->cp_connstr);
+
+          if (waMode == 'W')
+	    {
+	      pdbc->cp_connstr = _ConnStrIn;
+	      _ConnStrIn = NULL;
+	    }
+	  else
+	    {
+              pdbc->cp_connstr = strdup (_connstr);
+	      if (pdbc->cp_connstr == NULL)
+	        {
+                  PUSHSQLERR (pdbc->herr, en_HY001);
+                  RETURN (SQL_ERROR);
+	        }
+	    }
+        }
+    }
+#endif /* (ODBCVER >= 0x300) */
+
+  /* always get (even if not requested) out connection string for SAVEFILE */
+  if (!connStrOut)
+    {
+      connStrOut = connStrOut_buf;
+      connStrOutMax = sizeof(connStrOut_buf);
+    }
+
+  /* now look for DSN or FILEDSN, whichever comes first */
+  _iodbcdm_cfg_rewind (pconfig);
+  while (_iodbcdm_cfg_nextentry (pconfig) == 0)
+    {
+      if (!_iodbcdm_cfg_define (pconfig))
+        continue;
+
+      if (!strcasecmp(pconfig->id, "DSN"))
+        {
+          /* not a file dsn */
+          break;
+        }
+      else if (!strcasecmp(pconfig->id, "FILEDSN"))
+        {
+          /* file dsn */
+          filedsn = (SQLCHAR *)strdup (pconfig->value);
+	  if (filedsn == NULL)
+	    {
+              PUSHSQLERR (pdbc->herr, en_HY001);
+              RETURN (SQL_ERROR);
+	    }
+	  break;
+	}
+    }
+
+
+  /* get connect parameters from .dsn file if requested */
+  if (filedsn != NULL)
+    {
+      /* merge params from .dsn file */
+      if (_iodbcdm_cfg_merge_filedsn (pconfig, (char *)filedsn,
+	      (char *) connStrIn_buf, sizeof (connStrIn_buf),
+	      waMode == 'W', conv) == -1)
+        {
+          PUSHSQLERR (pdbc->herr, en_IM015);
+          RETURN (SQL_ERROR);
+	}
+
+      /* update connection string and its length */
+      connStrIn = connStrIn_buf;
+      if (cbConnStrIn != SQL_NTS)
+	{
+	  if (waMode != 'W')
+	    cbConnStrIn = STRLEN (connStrIn);
+	  else
+	    cbConnStrIn = DM_WCSLEN (conv, connStrIn);
+	}
+    }
+
+  if (_iodbcdm_cfg_find (pconfig, "ODBC", "DRIVER") == 0)
+    {
+      /* copy because pconfig can be reinitialized later */
+      _iodbcdm_strlcpy ((char *) drvbuf, pconfig->value, sizeof (drvbuf));
+      drv = drvbuf;
+    }
+  if (_iodbcdm_cfg_find (pconfig, "ODBC", "DSN") == 0)
+    {
+      /* copy because pconfig can be reinitialized later */
+      _iodbcdm_strlcpy ((char *) dsnbuf, pconfig->value, sizeof (dsnbuf));
+      dsn = dsnbuf;
+    }
+
+  if (_iodbcdm_cfg_find (pconfig, "ODBC", "DriverUnicodeType") == 0)
+    {
+      if (STRCASEEQ(pconfig->value, "1") || STRCASEEQ(pconfig->value, "utf16"))
+        drv_cp = CP_UTF16;
+      else if (STRCASEEQ(pconfig->value, "2") || STRCASEEQ(pconfig->value, "utf8"))
+        drv_cp = CP_UTF8;
+      else if (STRCASEEQ(pconfig->value, "3") || STRCASEEQ(pconfig->value, "ucs4"))
+        drv_cp = CP_UCS4;
+
+      DPRINTF ((stderr,
+       "DEBUG: SQLDriverConnect DriverUnicodeType=%s\n",
+          drv_cp==CP_UCS4?"UCS4":(drv_cp==CP_UTF16?"UTF16":"UTF8")));
+    }
+
+  switch (fDriverCompletion)
+    {
+    case SQL_DRIVER_NOPROMPT:
+      /* Check if there's a DSN or DRIVER */
+      if (!dsn && !drv)
+	{
+	  PUSHSQLERR (pdbc->herr, en_IM007);
+	  RETURN (SQL_ERROR);
+	}
+      break;
+
+    case SQL_DRIVER_COMPLETE:
+    case SQL_DRIVER_COMPLETE_REQUIRED:
+      if (dsn != NULL || drv != NULL)
+	{
+	  break;
+	}
+      /* fall to next case */
+    case SQL_DRIVER_PROMPT:
+      /* Get data source dialog box function from
+       * current executable */
+      /* Not really sure here, but should load that from the iodbcadm */
+      if (waMode == 'A')
+	_iodbcdm_strlcpy ((char *) prov, connStrIn, sizeof (prov));
+      else if (conv && conv->dm_cp == CP_UTF8)
+	_iodbcdm_strlcpy ((char *) prov, connStrIn, sizeof (prov));
+      else
+        DM_WCSNCPY (conv, prov, connStrIn, sizeof (prov) / DM_WCHARSIZE(conv));
+
+#if 0
+        if (!dsn && !drv)
+          bCallDmDlg = TRUE;
+        else if ( _iodbcdm_CheckDriverLoginDlg(drv, dsn) == FALSE)
+          bCallDmDlg = TRUE;
+  
+        /* not call iODBC function "iodbcdm_drvconn_dialbox", if there is
+         * the function "_iodbcdm_drvconn_dialbox" in the odbc driver,
+         * odbc driver must call its function itself
+         */
+        if (!bCallDmDlg)
+          break;
+#endif
+
+      ODBC_UNLOCK ();
+#if defined (__APPLE__)
+# if !defined(NO_FRAMEWORKS)
+    bundle = CFBundleGetBundleWithIdentifier (CFSTR ("org.iodbc.core"));
+    if (bundle)
+      {
+        /* Search for the drvproxy library */
+        liburl =
+            CFBundleCopyResourceURL (bundle, CFSTR ("iODBCadm.bundle"),
+            NULL, NULL);
+          if (liburl) {
+              bundle_dll = CFBundleCreate (NULL, liburl);
+              if (bundle_dll){
+                  if (waMode != 'W')
+                      dialproc = (HPROC)CFBundleGetFunctionPointerForName (bundle_dll, CFSTR("iodbcdm_drvconn_dialbox"));
+                  else
+                      dialproc = (HPROC)CFBundleGetFunctionPointerForName (bundle_dll, CFSTR("iodbcdm_drvconn_dialboxw"));
+              }
+          }
+          
+          if (liburl)
+            CFRelease (liburl);
+      }
+      if (!bundle_dll)
+          break;
+# endif
+#else
+
+      hdll = _iodbcdm_dllopen ("libiodbcadm.so.2");
+            
+      if (!hdll)
+         break;
+            
+      if (waMode != 'W')
+        dialproc = _iodbcdm_dllproc (hdll, "iodbcdm_drvconn_dialbox");
+      else
+        dialproc = _iodbcdm_dllproc (hdll, "iodbcdm_drvconn_dialboxw");
+#endif
+
+      if (dialproc == SQL_NULL_HPROC)
+        {
+          sqlstat = en_IM008;
+          break;
+        }
+
+      {
+        IODBC_CHARSET m_charset = (conv) ? conv->dm_cp : CP_DEF;
+        ssize_t size = cbConnStrIn;
+
+        /*** convert DM_WCHAR => SYS_WCHAR ***/
+        if (waMode == 'A')
+	  _iodbcdm_strlcpy ((char *) prov, connStrIn, sizeof (prov));
+        else
+          {
+            if (size == SQL_NTS)
+              {
+                if (m_charset == CP_UTF8)
+	          size = strlen((char*) connStrIn);
+                else
+	          size = DM_WCSLEN (conv, connStrIn);
+	      }
+
+	    if (m_charset != CP_UTF8)
+	      size *= DM_WCHARSIZE(conv);
+
+	    if (size >= sizeof(prov))
+	      size = sizeof(prov) - DM_WCHARSIZE(conv);
+
+            size = dm_conv_W2W(connStrIn, cbConnStrIn, prov,
+		sizeof(prov)-sizeof(SQLWCHAR), m_charset, CP_DEF);
+            prov[size/sizeof(SQLWCHAR)] = L'\0';
+          }
+
+        retcode = dialproc (hwnd,	/* window or display handle */
+          prov,		        /* input/output dsn buf */
+          sizeof (prov) / (waMode == 'A' ? 1 : sizeof (SQLWCHAR)), /* buf size */
+          &sqlstat,		/* error code */
+          fDriverCompletion,	/* type of completion */
+          &config);		/* config mode */
+
+
+        ODBC_LOCK ();
+        fDriverCompletion = SQL_DRIVER_NOPROMPT;
+
+        if (retcode != SQL_SUCCESS)
+          {
+            if (retcode != SQL_NO_DATA_FOUND)
+  	      PUSHSQLERR (pdbc->herr, sqlstat);
+	    goto end;
+          }
+
+        if (waMode == 'W')
+          {
+            /*** convert SYS_WCHAR => DM_WCHAR ***/
+            size = dm_conv_W2W(prov, SQL_NTS, StrInTmp, sizeof(StrInTmp)-sizeof(SQLWCHAR),
+          	CP_DEF, m_charset);
+            StrInTmp[size/sizeof(SQLWCHAR)] = L'\0';
+            connStrIn = StrInTmp;
+          }
+        else
+          connStrIn = prov;
+      }
+
+      /*
+       * Recalculate length of connStrIn if needed, as it may have been
+       * changed by iodbcdm_drvconn_dialbox
+       */
+      if (cbConnStrIn != SQL_NTS)
+        {
+	  if (waMode != 'W')
+	    cbConnStrIn = STRLEN (connStrIn);
+	  else
+	    cbConnStrIn = DM_WCSLEN (conv, connStrIn);
+	}
+
+      if (_iodbcdm_cfg_parse_str (pconfig, connStrIn, cbConnStrIn,
+				  waMode == 'W', conv) == -1)
+        {
+          PUSHSQLERR (pdbc->herr, en_HY001);
+          RETURN (SQL_ERROR);
+        }
+      if (_iodbcdm_cfg_find (pconfig, "ODBC", "DSN") == 0)
+        dsn = (SQLCHAR *)pconfig->value;
+      if (_iodbcdm_cfg_find (pconfig, "ODBC", "DRIVER") == 0)
+        {
+          /* copy because pconfig can be reinitialized later */
+          _iodbcdm_strlcpy ((char *) drvbuf, pconfig->value, sizeof (drvbuf));
+          drv = drvbuf;
+        }
+      if (_iodbcdm_cfg_find (pconfig, "ODBC", "DriverUnicodeType") == 0)
+        {
+          if (STRCASEEQ(pconfig->value, "1") || STRCASEEQ(pconfig->value, "utf16"))
+            drv_cp = CP_UTF16;
+          else if (STRCASEEQ(pconfig->value, "2") || STRCASEEQ(pconfig->value, "utf8"))
+            drv_cp = CP_UTF8;
+          else if (STRCASEEQ(pconfig->value, "3") || STRCASEEQ(pconfig->value, "ucs4"))
+            drv_cp = CP_UCS4;
+
+          DPRINTF ((stderr,
+           "DEBUG: SQLDriverConnect DriverUnicodeType=%s\n",
+              drv_cp==CP_UCS4?"UCS4":(drv_cp==CP_UTF16?"UTF16":"UTF8")));
+        }
+      break;
+
+    default:
+      sqlstat = en_S1110;
+      break;
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pdbc->herr, sqlstat);
+      RETURN (SQL_ERROR);
+    }
+
+  if (dsn == NULL || *(char *) dsn == '\0')
+    {
+      dsn = (void *) "default";
+    }
+  else
+    /* if you want tracing, you must use a DSN */
+    {
+      setopterr |= 
+          _iodbcdm_con_settracing (pdbc, (SQLCHAR *) dsn, SQL_NTS, waMode);
+    }
+
+  /*
+   *  Check whether driver is thread safe
+   */
+  thread_safe = 1;		/* Assume driver is thread safe */
+
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if (SQLGetPrivateProfileString ((char *) dsn, "ThreadManager", "", 
+	(LPSTR)buf, sizeof (buf), "odbc.ini")
+      && (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "1")))
+    {
+      thread_safe = 0;		/* Driver needs a thread manager */
+    }
+
+  /*
+   *  Check whether driver is unload safe
+   */
+  unload_safe = 0;		/* Assume driver is not unload safe */
+
+  SQLSetConfigMode (ODBC_BOTH_DSN);
+  if (SQLGetPrivateProfileString ((char *) dsn, "UnloadSafe", "", 
+	(LPSTR)buf, sizeof (buf), "odbc.ini")
+      && (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "1")))
+    {
+      unload_safe = 1;
+    }
+
+  /*
+   *  Get the name of the driver module
+   */
+  if (drv == NULL || *(char *) drv == '\0')
+    {
+      SQLSetConfigMode (ODBC_BOTH_DSN);
+      if (SQLGetPrivateProfileString ((char *) dsn, "Driver", "", 
+	      (char *) drvbuf, sizeof (drvbuf), "odbc.ini") != 0)
+	{
+	  drv = drvbuf;
+	}
+    }
+
+  if (drv == NULL)
+    {
+      PUSHSQLERR (pdbc->herr, en_IM002);
+      RETURN (SQL_ERROR);
+    }
+
+  retcode =
+      _iodbcdm_driverload ((char *)dsn, (char *) drv, pdbc, thread_safe, unload_safe,
+      drv_cp, waMode);
+
+  switch (retcode)
+    {
+    case SQL_SUCCESS:
+      break;
+
+    case SQL_SUCCESS_WITH_INFO:
+#if 0
+      /* 
+       *  Unsuccessful in calling driver's SQLSetConnectOption() to set 
+       *  login timeout.
+       */
+      setopterr = SQL_ERROR;
+#endif
+      break;
+
+    default:
+      RETURN (retcode);
+    }
+
+#if (ODBCVER >= 0x300)
+  /*
+   * Pooling is disabled if SAVEFILE is present.
+   */
+  if (savefile != NULL)
+    pdbc->cp_timeout = 0;
+#endif
+
+  penv = (ENV_t *) pdbc->henv;
+  conv = &pdbc->conv;
+
+  if (penv->unicode_driver && waMode != 'W')
+    conv_direct = CD_A2W;
+  else if (!penv->unicode_driver && waMode == 'W')
+    conv_direct = CD_W2A;
+  else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+    conv_direct = CD_W2W;
+
+  if (conv_direct != CD_NONE)
+    {
+      if ((_ConnStrOut =
+	      malloc ((connStrOutMax + 1) * WCHAR_MAXSIZE)) == NULL)
+	{
+	  PUSHSQLERR (pdbc->herr, en_HY001);
+	  RETURN (SQL_ERROR);
+	}
+      _ConnStrIn = conv_text_m2d (conv, connStrIn, cbConnStrIn, conv_direct);
+
+      connStrOut = _ConnStrOut;
+      connStrIn = _ConnStrIn;
+      cbConnStrIn = SQL_NTS;
+    }
+
+  /* Restore config mode */
+  SQLSetConfigMode (config);
+
+  ODBC_UNLOCK (); 
+  CALL_UDRIVER (hdbc, pdbc, retcode, hproc, penv->unicode_driver,
+      en_DriverConnect, (pdbc->dhdbc,
+	  hwnd,
+	  connStrIn,
+	  cbConnStrIn,
+	  connStrOut, connStrOutMax, pcbConnStrOut, fDriverCompletion));
+  ODBC_LOCK ();
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      _iodbcdm_driverunload (pdbc, 3);
+      PUSHSQLERR (pdbc->herr, en_IM001);
+      RETURN (SQL_ERROR);
+    }
+
+  if (szConnStrOut && SQL_SUCCEEDED (retcode) && conv_direct != CD_NONE)
+    {
+      if (conv_direct == CD_A2W)
+        {
+	  /* ansi<=unicode */
+          dm_StrCopyOut2_W2A_d2m (conv, connStrOut,
+              (SQLCHAR *) szConnStrOut, cbConnStrOutMax, NULL, NULL);
+        }
+      else if (conv_direct == CD_W2A)
+        {
+	  /* unicode<=ansi */
+          dm_StrCopyOut2_A2W_d2m (conv, (SQLCHAR *) connStrOut,
+              szConnStrOut, cbConnStrOutMax * DM_WCHARSIZE(conv), NULL, NULL);
+        }
+      else if (conv_direct == CD_W2W)
+        {
+	  /* unicode<=unicode */
+          dm_StrCopyOut2_W2W_d2m (conv, connStrOut,
+              szConnStrOut, cbConnStrOutMax * DM_WCHARSIZE(conv), NULL, NULL);
+        }
+    }
+
+  if (szConnStrOut != NULL)
+    {
+      if (filedsn != NULL)
+        {
+          /* append FILEDSN to the out connection string */
+          if (waMode == 'W')
+            {
+              char tmp[4096] = {""};
+              size_t outSize = DM_WCSLEN(conv, szConnStrOut);
+              char *out = szConnStrOut;
+
+              out += outSize * DM_WCHARSIZE(conv);
+
+              _iodbcdm_strlcat (tmp, ";FILEDSN=", sizeof(tmp));
+              _iodbcdm_strlcat (tmp, (char *)filedsn, sizeof(tmp));
+              dm_StrCopyOut2_U8toW_d2m(conv, (SQLCHAR *)tmp, out,
+			(cbConnStrOutMax - outSize) * DM_WCHARSIZE(conv),
+			NULL, NULL);
+	    }
+          else
+            {
+              _iodbcdm_strlcat (szConnStrOut, ";FILEDSN=", cbConnStrOutMax);
+              _iodbcdm_strlcat (szConnStrOut, (char *)filedsn, cbConnStrOutMax);
+            }
+        }
+      if (savefile != NULL)
+        {
+          /* append SAVEFILE to the out connection string */
+          if (waMode == 'W')
+            {
+              char tmp[4096] = {""};
+              size_t outSize = DM_WCSLEN(conv, szConnStrOut);
+              char *out = szConnStrOut;
+
+              out += outSize * DM_WCHARSIZE(conv);
+
+              _iodbcdm_strlcat (tmp, ";SAVEFILE=", sizeof(tmp));
+              _iodbcdm_strlcat (tmp, (char *)savefile, sizeof(tmp));
+              dm_StrCopyOut2_U8toW_d2m(conv, (SQLCHAR *)tmp, out,
+			(cbConnStrOutMax - outSize) * DM_WCHARSIZE(conv),
+			NULL, NULL);
+	    }
+          else
+            {
+              _iodbcdm_strlcat (szConnStrOut, ";SAVEFILE=", cbConnStrOutMax);
+              _iodbcdm_strlcat (szConnStrOut, (char *)savefile, cbConnStrOutMax);
+            }
+        }
+
+      /* fixup pcbConnStrOut */
+      if (pcbConnStrOut != NULL)
+	{
+	  if (waMode == 'W')
+	    *(SQLSMALLINT *) pcbConnStrOut = DM_WCSLEN (conv, szConnStrOut);
+	  else
+	    *(SQLSMALLINT *) pcbConnStrOut = strlen (szConnStrOut);
+	}
+    }
+
+  if (!SQL_SUCCEEDED (retcode))
+    {
+      /* don't unload driver here for retrieve
+       * error message from driver */
+		/********
+		_iodbcdm_driverunload( hdbc , 3);
+		*********/
+
+      RETURN (retcode);
+    }
+
+  /* state transition */
+  pdbc->state = en_dbc_connected;
+
+  /* do delayed option setting */
+  setopterr |= _iodbcdm_dbcdelayset (pdbc, waMode);
+
+  if (setopterr != SQL_SUCCESS)
+    retcode = SQL_SUCCESS_WITH_INFO;
+
+  /* save .dsn file if requested */
+  if (savefile != NULL)
+    {
+      assert (connStrOut != NULL);
+
+      if (_iodbcdm_cfg_savefile ((char *)savefile, connStrOut,
+				 penv->unicode_driver, conv) == -1)
+        {
+	  PUSHSQLERR (pdbc->herr, en_01S08);
+	  retcode = SQL_SUCCESS_WITH_INFO;
+	}
+    }
+
+end:
+#if (ODBCVER >= 0x300)
+  if (!SQL_SUCCEEDED (retcode) &&
+      pdbc->cp_pdbc != NULL)
+    {
+      int rc;
+
+      /*
+       * Dead connection was taken from the pool
+       * but reconnection attempt has failed:
+       * set cp_retry_wait time and return connection to the pool.
+       */
+      _iodbcdm_pool_set_retry_wait (pdbc);
+      rc = _iodbcdm_pool_put_conn (pdbc);
+      assert (rc == 0);
+    }
+#endif
+  _iodbcdm_cfg_done (pconfig);
+  if (_ConnStrIn != NULL)
+    MEM_FREE (_ConnStrIn);
+  if (_ConnStrOut != NULL)
+    MEM_FREE (_ConnStrOut);
+  if (savefile != NULL)
+    MEM_FREE (savefile);
+  if (filedsn != NULL)
+    MEM_FREE (filedsn);
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLDriverConnect (SQLHDBC hdbc,
+    SQLHWND hwnd,
+    SQLCHAR * szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLCHAR * szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLSMALLINT * pcbConnStrOut,
+    SQLUSMALLINT fDriverCompletion)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLDriverConnect (TRACE_ENTER,
+	hdbc,
+	hwnd,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	fDriverCompletion));
+
+  retcode = SQLDriverConnect_Internal(
+      hdbc,
+      hwnd,
+      szConnStrIn, cbConnStrIn,
+      szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+      fDriverCompletion,
+      'A');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLDriverConnect (TRACE_LEAVE,
+	hdbc,
+	hwnd,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	fDriverCompletion));
+}
+
+
+SQLRETURN SQL_API
+SQLDriverConnectA (SQLHDBC hdbc,
+    SQLHWND hwnd,
+    SQLCHAR * szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLCHAR * szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLSMALLINT * pcbConnStrOut,
+    SQLUSMALLINT fDriverCompletion)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLDriverConnect (TRACE_ENTER,
+	hdbc,
+	hwnd,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	fDriverCompletion));
+
+  retcode = SQLDriverConnect_Internal(
+      hdbc,
+      hwnd,
+      szConnStrIn, cbConnStrIn,
+      szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+      fDriverCompletion,
+      'A');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLDriverConnect (TRACE_LEAVE,
+	hdbc,
+	hwnd,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	fDriverCompletion));
+}
+
+
+SQLRETURN SQL_API
+SQLDriverConnectW (SQLHDBC hdbc,
+    SQLHWND hwnd,
+    SQLWCHAR * szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLWCHAR * szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLSMALLINT * pcbConnStrOut,
+    SQLUSMALLINT fDriverCompletion)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLDriverConnectW (TRACE_ENTER,
+	hdbc,
+	hwnd,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	fDriverCompletion));
+
+  retcode = SQLDriverConnect_Internal(
+      hdbc,
+      hwnd,
+      szConnStrIn, cbConnStrIn,
+      szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+      fDriverCompletion,
+      'W');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLDriverConnectW (TRACE_LEAVE,
+	hdbc,
+	hwnd,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	fDriverCompletion));
+}
+
+
+SQLRETURN SQL_API
+SQLBrowseConnect_Internal (SQLHDBC hdbc,
+    SQLPOINTER szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLPOINTER szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax, SQLSMALLINT * pcbConnStrOut,
+    SQLCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, NULL);
+  char buf[1024];
+  SWORD thread_safe;
+  SWORD unload_safe;
+  HPROC hproc = SQL_NULL_HPROC;
+  void * _ConnStrIn = NULL;
+  void * _ConnStrOut = NULL;
+  void * connStrOut = szConnStrOut;
+  void * connStrIn = szConnStrIn;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = NULL;
+  IODBC_CHARSET drv_cp = CP_DEF;
+
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLRETURN setopterr = SQL_SUCCESS;
+
+  /* check arguments */
+  if ((cbConnStrIn < 0 && cbConnStrIn != SQL_NTS) || cbConnStrOutMax < 0)
+    {
+      PUSHSQLERR (pdbc->herr, en_S1090);
+      return SQL_ERROR;
+    }
+
+  conv = (penv != SQL_NULL_HENV) ? &penv->conv : &((GENV_t *) pdbc->genv)->conv;
+
+  if (pdbc->state == en_dbc_allocated)
+    {
+        PCONFIG pconfig;
+        void *drv = NULL, *dsn = NULL;
+
+        if (_iodbcdm_cfg_init_str (&pconfig, szConnStrIn, cbConnStrIn,
+			     waMode == 'W', conv) == -1)
+          {
+            PUSHSQLERR (pdbc->herr, en_HY001);
+            return SQL_ERROR;
+          }
+        if (_iodbcdm_cfg_find (pconfig, "ODBC", "DRIVER") == 0)
+          drv = pconfig->value;
+        if (_iodbcdm_cfg_find (pconfig, "ODBC", "DSN") == 0)
+          dsn = pconfig->value;
+
+        if (_iodbcdm_cfg_find (pconfig, "ODBC", "DriverUnicodeType") == 0)
+          {
+            if (STRCASEEQ(pconfig->value, "1") || STRCASEEQ(pconfig->value, "utf16"))
+              drv_cp = CP_UTF16;
+            else if (STRCASEEQ(pconfig->value, "2") || STRCASEEQ(pconfig->value, "utf8"))
+              drv_cp = CP_UTF8;
+            else if (STRCASEEQ(pconfig->value, "0") || STRCASEEQ(pconfig->value, "ucs4"))
+              drv_cp = CP_UCS4;
+
+            DPRINTF ((stderr,
+             "DEBUG: SQLBrowseConnect DriverUnicodeType=%s\n",
+                drv_cp==CP_UCS4?"UCS4":(drv_cp==CP_UTF16?"UTF16":"UTF8")));
+          }
+
+        if (dsn == NULL || ((char*)dsn)[0] == '\0')
+          dsn = (void *) "default";
+        else
+          /* if you want tracing, you must use a DSN */
+          {
+	    if (_iodbcdm_con_settracing (pdbc, (SQLCHAR *) dsn, SQL_NTS, waMode) == SQL_ERROR)
+	      {
+                _iodbcdm_cfg_done (pconfig);
+	        return SQL_ERROR;
+	      }
+	  }
+
+        /*
+         *  Check whether driver is thread safe
+         */
+        thread_safe = 1;		/* Assume driver is thread safe */
+
+        SQLSetConfigMode (ODBC_BOTH_DSN);
+        if ( SQLGetPrivateProfileString ((char *) dsn, "ThreadManager", "", 
+		buf, sizeof(buf), "odbc.ini") &&
+            (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "1")))
+          {
+            thread_safe = 0;	/* Driver needs a thread manager */
+          }
+
+        /*
+         *  Check whether driver is unload safe
+         */
+        unload_safe = 0;		/* Assume driver is not unload safe */
+
+        SQLSetConfigMode (ODBC_BOTH_DSN);
+        if ( SQLGetPrivateProfileString ((char *) dsn, "ThreadManager", "", 
+		buf, sizeof(buf), "odbc.ini") &&
+            (STRCASEEQ (buf, "on") || STRCASEEQ (buf, "1")))
+          {
+            unload_safe = 1;
+          }
+
+        /*
+         *  Get the name of the driver module and load it
+         */
+        if (drv == NULL || *(char*)drv == '\0')
+          {
+            SQLSetConfigMode (ODBC_BOTH_DSN);
+            if ( SQLGetPrivateProfileString ((char *) dsn, "Driver", "", 
+		buf, sizeof(buf), "odbc.ini") != 0)
+              {
+                drv = buf;
+              }
+          }
+
+      if (drv == NULL)
+	{
+	  PUSHSQLERR (pdbc->herr, en_IM002);
+          _iodbcdm_cfg_done (pconfig);
+	  return SQL_ERROR;
+	}
+
+      retcode = _iodbcdm_driverload (dsn, (char *) drv, pdbc, thread_safe,
+		unload_safe, drv_cp, waMode);
+      _iodbcdm_cfg_done (pconfig);
+
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	  break;
+
+	case SQL_SUCCESS_WITH_INFO:
+#if 0
+	  /* 
+	   *  Unsuccessful in calling driver's SQLSetConnectOption() to set 
+	   *  login timeout.
+	   */
+	  setopterr = SQL_ERROR;
+#endif
+	  break;
+
+	default:
+          return retcode;
+	}
+    }
+  else if (pdbc->state != en_dbc_needdata)
+    {
+      PUSHSQLERR (pdbc->herr, en_08002);
+      return SQL_ERROR;
+    }
+
+  penv = (ENV_t *) pdbc->henv;
+  conv = &pdbc->conv;
+
+  if (penv->unicode_driver && waMode != 'W')
+    conv_direct = CD_A2W;
+  else if (!penv->unicode_driver && waMode == 'W')
+    conv_direct = CD_W2A;
+  else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+    conv_direct = CD_W2W;
+
+  if (conv_direct != CD_NONE)
+    {
+      if ((_ConnStrOut = malloc((cbConnStrOutMax + 1)* WCHAR_MAXSIZE)) == NULL)
+	{
+          PUSHSQLERR (pdbc->herr, en_HY001);
+	  return SQL_ERROR;
+        }
+      _ConnStrIn = conv_text_m2d (conv, szConnStrIn, SQL_NTS, conv_direct);
+
+      connStrIn = _ConnStrIn;
+      cbConnStrIn = SQL_NTS;
+      connStrOut = _ConnStrOut;
+    }
+
+  ODBC_UNLOCK ();
+  CALL_UDRIVER(hdbc, pdbc, retcode, hproc, penv->unicode_driver,
+    en_BrowseConnect, (
+       pdbc->dhdbc,
+       connStrIn,
+       cbConnStrIn,
+       connStrOut,
+       cbConnStrOutMax,
+       pcbConnStrOut));
+  ODBC_LOCK ();
+
+  MEM_FREE(_ConnStrIn);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      MEM_FREE(_ConnStrOut);
+      _iodbcdm_driverunload (pdbc, 3);
+      pdbc->state = en_dbc_allocated;
+      PUSHSQLERR (pdbc->herr, en_IM001);
+      return SQL_ERROR;
+    }
+
+  if (szConnStrOut && SQL_SUCCEEDED (retcode) && conv_direct != CD_NONE)
+    {
+      if (conv_direct == CD_A2W)
+        {
+        /* ansi<=unicode*/
+          dm_StrCopyOut2_W2A_d2m (conv, connStrOut, (SQLCHAR *) szConnStrOut,
+		cbConnStrOutMax, NULL, NULL);
+        }
+      else if (conv_direct == CD_W2A)
+        {
+        /* unicode<=ansi*/
+          dm_StrCopyOut2_A2W_d2m (conv, (SQLCHAR *) connStrOut, szConnStrOut,
+		cbConnStrOutMax * DM_WCHARSIZE(conv), NULL, NULL);
+        }
+      else if (conv_direct == CD_W2W)
+        {
+        /* unicode<=unicode*/
+          dm_StrCopyOut2_W2W_d2m (conv, connStrOut, szConnStrOut,
+		cbConnStrOutMax * DM_WCHARSIZE(conv), NULL, NULL);
+        }
+    }
+
+  MEM_FREE(_ConnStrOut);
+
+  switch (retcode)
+    {
+    case SQL_SUCCESS:
+    case SQL_SUCCESS_WITH_INFO:
+      pdbc->state = en_dbc_connected;
+      setopterr |= _iodbcdm_dbcdelayset (pdbc, waMode);
+      if (setopterr != SQL_SUCCESS)
+	{
+	  retcode = SQL_SUCCESS_WITH_INFO;
+	}
+      break;
+
+    case SQL_NEED_DATA:
+      pdbc->state = en_dbc_needdata;
+      break;
+
+    case SQL_ERROR:
+      pdbc->state = en_dbc_allocated;
+      /* but the driver will not unloaded
+       * to allow application retrieve err
+       * message from driver
+       */
+      break;
+
+    default:
+      break;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLBrowseConnect (SQLHDBC hdbc,
+    SQLCHAR * szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLCHAR * szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLSMALLINT * pcbConnStrOut)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLBrowseConnect (TRACE_ENTER,
+      	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut));
+
+  retcode = SQLBrowseConnect_Internal (
+  	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	'A');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLBrowseConnect (TRACE_LEAVE,
+      	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut));
+}
+
+
+SQLRETURN SQL_API
+SQLBrowseConnectA (SQLHDBC hdbc,
+    SQLCHAR * szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLCHAR * szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLSMALLINT * pcbConnStrOut)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLBrowseConnect (TRACE_ENTER,
+      	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut));
+
+  retcode = SQLBrowseConnect_Internal (
+  	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	'A');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLBrowseConnect (TRACE_LEAVE,
+      	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut));
+}
+
+
+SQLRETURN SQL_API
+SQLBrowseConnectW (SQLHDBC hdbc,
+    SQLWCHAR * szConnStrIn,
+    SQLSMALLINT cbConnStrIn,
+    SQLWCHAR * szConnStrOut,
+    SQLSMALLINT cbConnStrOutMax,
+    SQLSMALLINT * pcbConnStrOut)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLBrowseConnectW (TRACE_ENTER,
+      	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut));
+
+  retcode = SQLBrowseConnect_Internal (
+  	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut,
+	'W');
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLBrowseConnectW (TRACE_LEAVE,
+      	hdbc,
+	szConnStrIn, cbConnStrIn,
+	szConnStrOut, cbConnStrOutMax, pcbConnStrOut));
+}
+
+
+static SQLRETURN
+SQLDisconnect_Internal (SQLHDBC hdbc)
+{
+  CONN (pdbc, hdbc);
+#if (ODBCVER >= 0x300)
+  GENV (genv, pdbc->genv);
+#endif
+  STMT (pstmt, NULL);
+
+  /* check hdbc state */
+  if (pdbc->state == en_dbc_allocated)
+    {
+      PUSHSQLERR (pdbc->herr, en_08003);
+      return SQL_ERROR;
+    }
+
+  /* check stmt(s) state */
+  for (pstmt = (STMT_t *) pdbc->hstmt;
+      pstmt != NULL;
+      pstmt = (STMT_t *) pstmt->next)
+    {
+      if (pstmt->state >= en_stmt_needdata
+	  || pstmt->asyn_on != en_NullProc)
+	/* In this case one need to call
+	 * SQLCancel() first */
+	{
+          PUSHSQLERR (pdbc->herr, en_S1010);
+	  return SQL_ERROR;
+	}
+    }
+
+#if (ODBCVER >= 0x300)
+  /*
+   * Try to return the connected connection to the pool if
+   * - connection was taken from the pool
+   * - pooling is enabled and CPTimeout > 0
+   */
+  if ((pdbc->state == en_dbc_connected || pdbc->state == en_dbc_hstmt)
+      && (pdbc->cp_pdbc != NULL ||
+           (genv->connection_pooling != SQL_CP_OFF && pdbc->cp_timeout > 0)))
+    {
+      if (_iodbcdm_pool_put_conn (pdbc) == 0)
+        {
+          _iodbcdm_finish_disconnect (pdbc, FALSE);
+          return SQL_SUCCESS;
+        }
+    }
+#endif /* (ODBCVER >= 0x300) */
+
+  return _iodbcdm_finish_disconnect (pdbc, TRUE);
+}
+
+
+SQLRETURN SQL_API
+SQLDisconnect (SQLHDBC hdbc)
+{
+  ENTER_HDBC (hdbc, 1,
+    trace_SQLDisconnect (TRACE_ENTER, hdbc));
+
+  retcode = SQLDisconnect_Internal (hdbc);
+
+  LEAVE_HDBC (hdbc, 1,
+    trace_SQLDisconnect (TRACE_LEAVE, hdbc));
+}
+
+
+SQLRETURN SQL_API
+SQLNativeSql_Internal (SQLHDBC hdbc,
+    SQLPOINTER szSqlStrIn,
+    SQLINTEGER cbSqlStrIn,
+    SQLPOINTER szSqlStr,
+    SQLINTEGER cbSqlStrMax,
+    SQLINTEGER * pcbSqlStr,
+    SQLCHAR waMode)
+{
+  CONN (pdbc, hdbc);
+  ENVR (penv, pdbc->henv);
+  sqlstcode_t sqlstat = en_00000;
+  SQLRETURN retcode = SQL_SUCCESS;
+  HPROC hproc = SQL_NULL_HPROC;
+  void * _SqlStrIn = NULL;
+  void * _SqlStr = NULL;
+  void * sqlStr = szSqlStr;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  /* check argument */
+  if (szSqlStrIn == NULL)
+    {
+      sqlstat = en_S1009;
+    }
+  else if (cbSqlStrIn < 0 && cbSqlStrIn != SQL_NTS)
+    {
+      sqlstat = en_S1090;
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pdbc->herr, sqlstat);
+      return SQL_ERROR;
+    }
+
+  /* check state */
+  if (pdbc->state <= en_dbc_needdata)
+    {
+      PUSHSQLERR (pdbc->herr, en_08003);
+      return SQL_ERROR;
+    }
+
+  if (penv->unicode_driver && waMode != 'W')
+    conv_direct = CD_A2W;
+  else if (!penv->unicode_driver && waMode == 'W')
+    conv_direct = CD_W2A;
+  else if (waMode == 'W' && conv->dm_cp!=conv->drv_cp)
+    conv_direct = CD_W2W;
+
+  if (conv_direct != CD_NONE)
+    {
+      if ((_SqlStr = malloc((cbSqlStrMax + 1) * WCHAR_MAXSIZE)) == NULL)
+        {
+          PUSHSQLERR (pdbc->herr, en_HY001);
+	  return SQL_ERROR;
+        }
+      _SqlStrIn = conv_text_m2d (conv, szSqlStrIn, SQL_NTS, conv_direct);
+
+      szSqlStrIn = _SqlStrIn;
+      cbSqlStrIn = SQL_NTS;
+      sqlStr = _SqlStr;
+    }
+
+  /* call driver */
+  CALL_UDRIVER(hdbc, pdbc, retcode, hproc, penv->unicode_driver,
+    en_NativeSql, (
+       pdbc->dhdbc,
+       szSqlStrIn,
+       cbSqlStrIn,
+       sqlStr,
+       cbSqlStrMax,
+       pcbSqlStr));
+
+  MEM_FREE(_SqlStrIn);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      MEM_FREE(_SqlStr);
+      PUSHSQLERR (pdbc->herr, en_IM001);
+
+      return SQL_ERROR;
+    }
+
+  if (szSqlStr && conv_direct != CD_NONE
+      && SQL_SUCCEEDED (retcode))
+    {
+      if (conv_direct == CD_A2W)
+        {
+        /* ansi<=unicode*/
+          dm_StrCopyOut2_W2A_d2m (conv, sqlStr, (SQLCHAR *) szSqlStr,
+		cbSqlStrMax, NULL, NULL);
+        }
+      else if (conv_direct == CD_W2A)
+        {
+        /* unicode<=ansi*/
+          dm_StrCopyOut2_A2W_d2m (conv, (SQLCHAR *) sqlStr, szSqlStr,
+		cbSqlStrMax * DM_WCHARSIZE(conv), NULL, NULL);
+        }
+      else if (conv_direct == CD_W2W)
+        {
+        /* unicode<=unicode*/
+          dm_StrCopyOut2_W2W_d2m (conv, sqlStr, szSqlStr,
+		cbSqlStrMax * DM_WCHARSIZE(conv), NULL, NULL);
+        }
+    }
+
+  MEM_FREE(_SqlStr);
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLNativeSql (
+    SQLHDBC hdbc,
+    SQLCHAR * szSqlStrIn,
+    SQLINTEGER cbSqlStrIn,
+    SQLCHAR * szSqlStr,
+    SQLINTEGER cbSqlStrMax,
+    SQLINTEGER * pcbSqlStr)
+{
+  ENTER_HDBC (hdbc, 0,
+    trace_SQLNativeSql (TRACE_ENTER,
+    	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr));
+
+  retcode = SQLNativeSql_Internal (
+  	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr,
+	'A');
+
+  LEAVE_HDBC (hdbc, 0,
+    trace_SQLNativeSql (TRACE_LEAVE,
+    	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr));
+}
+
+
+SQLRETURN SQL_API
+SQLNativeSqlA (
+    SQLHDBC hdbc,
+    SQLCHAR * szSqlStrIn,
+    SQLINTEGER cbSqlStrIn,
+    SQLCHAR * szSqlStr,
+    SQLINTEGER cbSqlStrMax,
+    SQLINTEGER * pcbSqlStr)
+{
+  ENTER_HDBC (hdbc, 0,
+    trace_SQLNativeSql (TRACE_ENTER,
+    	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr));
+
+  retcode = SQLNativeSql_Internal(
+  	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr,
+	'A');
+
+  LEAVE_HDBC (hdbc, 0,
+    trace_SQLNativeSql (TRACE_LEAVE,
+    	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr));
+}
+
+
+SQLRETURN SQL_API
+SQLNativeSqlW (
+    SQLHDBC hdbc,
+    SQLWCHAR * szSqlStrIn,
+    SQLINTEGER cbSqlStrIn,
+    SQLWCHAR * szSqlStr,
+    SQLINTEGER cbSqlStrMax,
+    SQLINTEGER * pcbSqlStr)
+{
+  ENTER_HDBC (hdbc, 0,
+    trace_SQLNativeSqlW (TRACE_ENTER,
+    	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr));
+
+  retcode = SQLNativeSql_Internal(
+  	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr,
+	'W');
+
+  LEAVE_HDBC (hdbc, 0,
+    trace_SQLNativeSqlW (TRACE_LEAVE,
+    	hdbc,
+	szSqlStrIn, cbSqlStrIn,
+	szSqlStr, cbSqlStrMax, pcbSqlStr));
+}

+ 269 - 0
odbc.mod/iodbc/iodbc/dlproc.c

@@ -0,0 +1,269 @@
+/*
+ *  dlproc.c
+ *
+ *  $Id$
+ *
+ *  Load driver and resolve driver's function entry point
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <iodbc.h>
+
+#include <sql.h>
+#include <sqlext.h>
+
+#include "dlproc.h"
+
+#include "unicode.h"
+#include "herr.h"
+#include "henv.h"
+#include "hdbc.h"
+
+#include "itrace.h"
+
+char *odbcapi_symtab[] =
+{
+    "UNKNOWN FUNCTION"
+#define FUNCDEF(A, B, C)	,C
+#include "henv.ci"
+#undef FUNCDEF
+};
+
+
+HPROC
+_iodbcdm_getproc (HDBC hdbc, int idx)
+{
+  CONN (pdbc, hdbc);
+  ENV_t *penv;
+  HPROC *phproc;
+
+  if (idx <= 0 || idx >= __LAST_API_FUNCTION__)
+    return SQL_NULL_HPROC;
+
+  penv = (ENV_t *) (pdbc->henv);
+
+  if (penv == NULL)
+    return SQL_NULL_HPROC;
+
+  phproc = penv->dllproc_tab + idx;
+
+  if (*phproc == SQL_NULL_HPROC)
+    *phproc = _iodbcdm_dllproc (penv->hdll, odbcapi_symtab[idx]);
+
+  return *phproc;
+}
+
+
+static dlproc_t *pRoot = NULL;
+
+
+HDLL
+_iodbcdm_dllopen (char *path)
+{
+  dlproc_t *pDrv = NULL, *p;
+
+  /*
+   *  Check if we have already loaded the driver
+   */
+  for (p = pRoot; p; p = p->next)
+    {
+      if (STREQ (p->path, path))
+	{
+	  pDrv = p;
+	  break;
+	}
+    }
+
+  /*
+   *  If already loaded, increase ref counter
+   */
+  if (pDrv)
+    {
+      pDrv->refcount++;
+
+      /*
+       *  If the driver was unloaded, load it again
+       */
+      if (pDrv->dll == NULL)
+	pDrv->dll = (HDLL) DLL_OPEN (path);
+
+      return pDrv->dll;
+    }
+
+  /*
+   *  Initialize new structure
+   */
+  if ((pDrv = calloc (1, sizeof (dlproc_t))) == NULL)
+    return NULL;
+
+  pDrv->refcount = 1;
+  pDrv->path = STRDUP (path);
+  pDrv->dll = (HDLL) DLL_OPEN (path);
+
+  /*
+   *  Add to linked list
+   */
+  pDrv->next = pRoot;
+  pRoot = pDrv;
+
+  return pDrv->dll;
+}
+
+
+HPROC
+_iodbcdm_dllproc (HDLL hdll, char *sym)
+{
+  return (HPROC) DLL_PROC (hdll, sym);
+}
+
+
+int
+_iodbcdm_dllclose (HDLL hdll)
+{
+  dlproc_t *pDrv = NULL, *p;
+
+  /*
+   *  Find loaded driver
+   */
+  for (p = pRoot; p; p = p->next)
+    {
+      if (p->dll == hdll)
+	{
+	  pDrv = p;
+	  break;
+	}
+    }
+
+  /*
+   *  Not found
+   */
+  if (!pDrv)
+    return -1;
+
+  /*
+   *  Decrease reference counter
+   */
+  pDrv->refcount--;
+
+  /*
+   *  Check if it is possible to unload the driver safely
+   * 
+   *  NOTE: Some drivers set explicit on_exit hooks, which makes it
+   *        impossible for the driver manager to unload the driver
+   *        as this would crash the executable at exit.
+   */
+  if (pDrv->refcount == 0 && pDrv->safe_unload)
+    {
+      DLL_CLOSE (pDrv->dll);
+      pDrv->dll = NULL;
+    }
+
+  return 0;
+}
+
+
+char *
+_iodbcdm_dllerror ()
+{
+  return DLL_ERROR ();
+}
+
+
+/* 
+ *  If driver manager determines this driver is safe, flag the driver can
+ *  be unloaded if not used.
+ */
+void
+_iodbcdm_safe_unload (HDLL hdll)
+{
+  dlproc_t *pDrv = NULL, *p;
+
+  /*
+   *  Find loaded driver
+   */
+  for (p = pRoot; p; p = p->next)
+    {
+      if (p->dll == hdll)
+	{
+	  pDrv = p;
+	  break;
+	}
+    }
+
+  /*
+   *  Driver not found
+   */
+  if (!pDrv)
+    return;
+
+  pDrv->safe_unload = 1;
+}

+ 121 - 0
odbc.mod/iodbc/iodbc/dlproc.h

@@ -0,0 +1,121 @@
+/*
+ *  dlproc.h
+ *
+ *  $Id$
+ *
+ *  Load driver and resolve driver's function entry point
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef	_DLPROC_H
+#define	_DLPROC_H
+
+#include <dlf.h>
+
+#if defined(_MAC) || defined (__cplusplus)
+typedef SQLRETURN (* HPROC) (...);
+#else
+typedef SQLRETURN (* HPROC) ();
+#endif
+
+#ifdef	DLDAPI_SVR4_DLFCN
+#include <dlfcn.h>
+#endif
+
+#ifdef DLDAPI_HP_SHL
+#include <dl.h>
+typedef shl_t HDLL;
+#elif !defined(WIN32)
+typedef void *HDLL;
+#endif
+
+
+typedef struct _dl_s
+{
+  char		* path;
+  HDLL		  dll;
+  unsigned int    refcount;
+  int 		  safe_unload;
+  struct _dl_s	* next;
+} dlproc_t;
+
+
+/* dlproc.c */
+HPROC _iodbcdm_getproc (HDBC hdbc, int idx);
+HDLL _iodbcdm_dllopen (char *path);
+HPROC _iodbcdm_dllproc (HDLL hdll, char *sym);
+int _iodbcdm_dllclose (HDLL hdll);
+char *_iodbcdm_dllerror (void);
+void _iodbcdm_safe_unload (HDLL hdll);
+
+#define	SQL_NULL_HDLL	((HDLL)NULL)
+#define	SQL_NULL_HPROC	((HPROC)NULL)
+#endif

+ 2054 - 0
odbc.mod/iodbc/iodbc/execute.c

@@ -0,0 +1,2054 @@
+/*
+ *  execute.c
+ *
+ *  $Id$
+ *
+ *  Invoke a query
+ *
+ *  The iODBC driver manager.
+ *
+ *  Copyright (C) 1995 Ke Jin <[email protected]>
+ *  Copyright (C) 1996-2021 OpenLink Software <[email protected]>
+ *  All Rights Reserved.
+ *
+ *  This software is released under the terms of either of the following
+ *  licenses:
+ *
+ *      - GNU Library General Public License (see LICENSE.LGPL)
+ *      - The BSD License (see LICENSE.BSD).
+ *
+ *  Note that the only valid version of the LGPL license as far as this
+ *  project is concerned is the original GNU Library General Public License
+ *  Version 2, dated June 1991.
+ *
+ *  While not mandated by the BSD license, any patches you make to the
+ *  iODBC source code may be contributed back into the iODBC project
+ *  at your discretion. Contributions will benefit the Open Source and
+ *  Data Access community as a whole. Submissions may be made at:
+ *
+ *      http://www.iodbc.org
+ *
+ *
+ *  GNU Library Generic Public License Version 2
+ *  ============================================
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; only
+ *  Version 2 of the License dated June 1991.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public
+ *  License along with this library; if not, write to the Free
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ *
+ *  The BSD License
+ *  ===============
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *  1. Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *  2. Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *  3. Neither the name of OpenLink Software Inc. nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ *  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ *  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ *  LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <iodbc.h>
+
+#include <sql.h>
+#include <sqlext.h>
+#include <sqlucode.h>
+
+#include "unicode.h"
+
+#include "dlproc.h"
+
+#include "herr.h"
+#include "henv.h"
+#include "hdbc.h"
+#include "hstmt.h"
+
+#include "itrace.h"
+
+void
+_iodbcdm_do_cursoropen (STMT_t * pstmt)
+{
+  SQLRETURN retcode;
+  SWORD ncol;
+
+  pstmt->state = en_stmt_executed;
+
+  retcode = _iodbcdm_NumResultCols ((SQLHSTMT) pstmt, &ncol);
+
+  if (SQL_SUCCEEDED (retcode))
+    {
+      if (ncol)
+	{
+	  pstmt->state = en_stmt_cursoropen;
+	  pstmt->cursor_state = en_stmt_cursor_opened;
+	}
+      else
+	{
+	  pstmt->state = en_stmt_executed;
+	  pstmt->cursor_state = en_stmt_cursor_no;
+	}
+    }
+}
+
+
+#if (ODBCVER >= 0x0300)
+
+SQLLEN
+_iodbcdm_OdbcCTypeSize (SWORD fCType)
+{
+  SQLLEN cbSize = 0;
+
+  switch (fCType)
+  {
+    /*
+     * ODBC fixed length types
+     */
+    case SQL_C_SHORT:
+    case SQL_C_SSHORT:
+      cbSize = sizeof (SQLSMALLINT);
+      break;
+
+    case SQL_C_USHORT:
+      cbSize = sizeof (SQLUSMALLINT);
+      break;
+
+    case SQL_C_LONG:
+    case SQL_C_SLONG:
+      cbSize = sizeof (SQLINTEGER);
+      break;
+
+    case SQL_C_ULONG:
+      cbSize = sizeof (SQLUINTEGER);
+      break;
+
+    case SQL_C_FLOAT:
+      cbSize = sizeof (SQLREAL);
+      break;
+
+    case SQL_C_DOUBLE:
+      cbSize = sizeof (SQLDOUBLE);
+      break;
+
+    case SQL_C_BIT:
+      cbSize = sizeof (SQLCHAR);
+      break;
+
+    case SQL_TINYINT:
+      cbSize = sizeof (SQLSCHAR);
+      break;
+
+    case SQL_C_STINYINT:
+      cbSize = sizeof (SQLSCHAR);
+      break;
+
+    case SQL_C_UTINYINT:
+      cbSize = sizeof (SQLCHAR);
+      break;
+
+    case SQL_C_DATE:
+#if (ODBCVER >= 0x0300)
+      cbSize = sizeof (SQL_DATE_STRUCT);
+#else
+      cbSize = sizeof (DATE_STRUCT);
+#endif
+      break;
+
+    case SQL_C_TIME:
+#if (ODBCVER >= 0x0300)
+      cbSize = sizeof (SQL_TIME_STRUCT);
+#else
+      cbSize = sizeof (TIME_STRUCT);
+#endif
+      break;
+
+    case SQL_C_TIMESTAMP:
+#if (ODBCVER >= 0x0300)
+      cbSize = sizeof (SQL_TIMESTAMP_STRUCT);
+#else
+      cbSize = sizeof (TIMESTAMP_STRUCT);
+#endif
+      break;
+
+#if (ODBCVER >= 0x0300)
+#ifdef ODBCINT64
+    case SQL_C_SBIGINT:
+      cbSize = sizeof (SQLBIGINT);
+      break;
+    case SQL_C_UBIGINT:
+      cbSize = sizeof (SQLUBIGINT);
+      break;
+#endif /* ODBCINT64 */
+
+    case SQL_C_TYPE_DATE:
+      cbSize = sizeof (SQL_DATE_STRUCT);
+      break;
+
+    case SQL_C_TYPE_TIME:
+      cbSize = sizeof (SQL_TIME_STRUCT);
+      break;
+
+    case SQL_C_TYPE_TIMESTAMP:
+      cbSize = sizeof (SQL_TIMESTAMP_STRUCT);
+      break;
+
+    case SQL_C_NUMERIC:
+      cbSize = sizeof (SQL_NUMERIC_STRUCT);
+      break;
+
+    case SQL_C_GUID:
+      cbSize = sizeof (SQLGUID);
+      break;
+#endif /* ODBCVER >= 0x0300 */
+    /*
+     * Variable length types and unsupported types
+     */
+    case SQL_C_CHAR:
+    case SQL_C_BINARY:
+    case SQL_C_WCHAR:
+    default:
+      break;
+  }
+
+  return cbSize;
+}
+
+
+static SQLLEN
+GetElementSize (PPARM pparm, DM_CONV *conv)
+{
+  SQLLEN elementSize;
+
+
+  if (pparm->pm_c_type == SQL_C_BINARY)
+    {
+      elementSize = pparm->pm_cbValueMax == 0
+	  ? pparm->pm_precision : pparm->pm_cbValueMax;
+
+      elementSize = (elementSize == 0) ? sizeof(SQLLEN) : elementSize;
+    }
+  else if (pparm->pm_c_type == SQL_C_CHAR)
+    {
+      elementSize = pparm->pm_cbValueMax == 0
+	  ? pparm->pm_precision + 1 : pparm->pm_cbValueMax;
+
+      elementSize = (elementSize == 0) ? sizeof(SQLLEN) : elementSize;
+    }
+  else if (pparm->pm_c_type == SQL_C_WCHAR)
+    {
+      if (pparm->pm_cbValueMax == 0)
+        {
+          if (conv && conv->dm_cp != conv->drv_cp)
+            elementSize = (pparm->pm_precision + 1) * DM_WCHARSIZE(conv);
+          else
+            elementSize = (pparm->pm_precision + 1) * sizeof(wchar_t);
+        }
+      else
+        elementSize = pparm->pm_cbValueMax;
+
+      elementSize = (elementSize == 0) ? sizeof(SQLLEN) : elementSize;
+    }
+  else				/* fixed length types */
+    {
+      /*elementSize = pparm->pm_size;*/
+      elementSize = _iodbcdm_OdbcCTypeSize(pparm->pm_c_type);
+    }
+
+  return elementSize;
+}
+
+
+/* DM=>DRV */
+static void
+_ExecConv_W2A(wchar_t *wdata, SQLLEN *pInd, UDWORD size, DM_CONV *conv)
+{
+  char *buf;
+
+  if (*pInd != SQL_NULL_DATA && *pInd != SQL_DATA_AT_EXEC && *pInd > SQL_LEN_DATA_AT_EXEC_OFFSET)
+    {
+      buf = (char*) conv_text_m2d(conv, wdata, (ssize_t)*pInd, CD_W2A);
+      if (buf != NULL)
+	strcpy((char*)wdata, buf);
+
+      MEM_FREE (buf);
+
+      if (pInd && *pInd != SQL_NTS)
+        {
+          if (conv->drv_cp == CP_UTF8)
+	    *pInd = strlen((char*)wdata);
+          else
+	    *pInd /= DRV_WCHARSIZE(conv);
+	}
+    }
+}
+
+
+/* DRV => DM */
+static void
+_ExecConv_A2W(char *data, SQLLEN *pInd, UDWORD size, DM_CONV *conv)
+{
+  wchar_t *buf;
+
+  if (*pInd != SQL_NULL_DATA && *pInd != SQL_DATA_AT_EXEC && *pInd > SQL_LEN_DATA_AT_EXEC_OFFSET)
+    {
+      buf = (wchar_t*) conv_text_d2m(conv, data, (ssize_t)*pInd, CD_A2W);
+      if (buf != NULL)
+	DM_WCSCPY (conv, data, buf);
+
+      MEM_FREE (buf);
+
+      if (pInd && *pInd != SQL_NTS)
+        {
+          if (conv->dm_cp == CP_UTF8)
+	    *pInd = strlen(data);
+          else
+	    *pInd *= DM_WCHARSIZE(conv);
+	}
+    }
+}
+
+
+static void
+_ExecConv_W2W(char *data, SQLLEN *pInd, UDWORD size, DM_CONV *conv,
+	BOOL bOutput)
+{
+  void *buf = NULL;
+
+  if (*pInd != SQL_NULL_DATA && *pInd != SQL_DATA_AT_EXEC && *pInd > SQL_LEN_DATA_AT_EXEC_OFFSET)
+    {
+      if (bOutput)
+        {
+          /* DRV => DM */
+          void *buf = conv_text_d2m(conv, data, (ssize_t)*pInd, CD_W2W);
+          if (buf != NULL)
+            {
+	      DM_WCSNCPY (conv, data, buf, size/DM_WCHARSIZE(conv));
+	      if (conv->dm_cp == CP_UTF8)
+	        data[size-1] = 0;
+	      else
+                DM_SetWCharAt(conv, data, size/DM_WCHARSIZE(conv)-1, 0);
+	    }
+
+          if (pInd && *pInd != SQL_NTS)
+            {
+	      if (conv->dm_cp == CP_UTF8)
+	        *pInd = strlen(data);
+	      else
+	        *pInd = DM_WCSLEN(conv, data) * DM_WCHARSIZE(conv);
+	    }
+        }
+      else
+        {
+          /* DM => DRV */
+          void *buf = conv_text_m2d(conv, data, (ssize_t)*pInd, CD_W2W);
+          if (buf != NULL)
+            {
+              DRV_WCSNCPY(conv, data, buf, size/DRV_WCHARSIZE(conv));
+              if (conv->drv_cp == CP_UTF8)
+                data[size-1] = 0;
+              else
+                DRV_SetWCharAt(conv, data, size/DRV_WCHARSIZE(conv)-1, 0);
+            }
+
+          if (pInd && *pInd != SQL_NTS)
+            {
+	      if (conv->drv_cp == CP_UTF8)
+	        *pInd = strlen(data);
+	      else
+	        *pInd = DRV_WCSLEN(conv, data) * DRV_WCHARSIZE(conv);
+	    }
+        }
+
+       MEM_FREE (buf);
+    }
+}
+
+
+static SQLRETURN
+_ConvParam (STMT_t *pstmt, PPARM pparm, SQLULEN row, BOOL bOutput,
+	DM_CONV *conv, SWORD unicode_driver)
+{
+  SQLLEN octetLen;
+  void *value;
+  SQLLEN *pInd = NULL;
+  SQLLEN elementSize = 0;
+  SQLUINTEGER bindOffset = pstmt->param_bind_offset;
+
+  if (pparm->pm_c_type != SQL_C_WCHAR)
+    return SQL_SUCCESS;
+
+  elementSize = GetElementSize (pparm, conv);
+
+  if (pstmt->param_bind_type)
+    {
+      /* row-wise binding of parameters in force */
+      if (pparm->pm_pOctetLength)
+	octetLen = *(SQLLEN *) ((char *) pparm->pm_pOctetLength
+	    + row * pstmt->param_bind_type + bindOffset);
+      else
+        octetLen = pparm->pm_size;
+
+      if (pparm->pm_pInd)
+        pInd = (SQLLEN *) ((char *) pparm->pm_pInd
+	        + row * pstmt->param_bind_type + bindOffset);
+    }
+  else
+    {
+      octetLen = pparm->pm_pOctetLength ?
+                 ((SQLLEN*)((char*)pparm->pm_pOctetLength + bindOffset))[row] :
+                 pparm->pm_size;
+      if (pparm->pm_pInd)
+        pInd = &((SQLLEN*)((char*)pparm->pm_pInd + bindOffset))[row];
+    }
+
+  if (!pInd || (pInd && *pInd == SQL_NULL_DATA ))
+    {
+      return SQL_SUCCESS;
+    }
+
+  if (octetLen == SQL_DATA_AT_EXEC || octetLen <= SQL_LEN_DATA_AT_EXEC_OFFSET)
+    {
+      value = NULL;
+      PUSHSQLERR (pstmt->herr, en_HYC00);  /* Unsupported Modes */
+      return SQL_ERROR;
+    }
+  else
+    value = pparm->pm_data;
+
+  if (value == NULL)
+    return 0;
+
+  if (pstmt->param_bind_type)
+    /* row-wise binding of parameters in force */
+    value = (char *) pparm->pm_data + row * pstmt->param_bind_type + bindOffset;
+  else
+    value = (char *) pparm->pm_data + row * elementSize + bindOffset;
+
+  if (unicode_driver)
+    _ExecConv_W2W(value, pInd, elementSize, conv, bOutput);
+  else
+    {
+      if (bOutput)
+        _ExecConv_A2W(value, pInd, elementSize, conv);
+      else
+        _ExecConv_W2A(value, pInd, elementSize, conv);
+    }
+  return SQL_SUCCESS;
+
+}
+
+
+static SQLRETURN
+_ConvRebindedParam (STMT_t *pstmt, PPARM pparm, SQLULEN row, BOOL bOutput,
+	DM_CONV *conv)
+{
+  SQLLEN octetLen;
+  void *val_dm;
+  void *val_drv;
+  SQLLEN *pInd_dm = NULL;
+  SQLLEN *pInd_drv = NULL;
+  SQLLEN elementSize = 0;
+  IODBC_CHARSET m_charset = (conv) ? conv->dm_cp : CP_DEF;
+  IODBC_CHARSET d_charset = (conv) ? conv->drv_cp : CP_DEF;
+  SQLUINTEGER bindOffset = pstmt->param_bind_offset;
+
+  elementSize = GetElementSize (pparm, conv);
+
+  if (pstmt->param_bind_type)
+    {
+      /* row-wise binding of parameters in force */
+      if (pparm->pm_pOctetLength)
+	octetLen = *(SQLLEN *) ((char *) pparm->pm_pOctetLength
+	    + row * pstmt->param_bind_type + bindOffset);
+      else
+        octetLen = pparm->pm_size;
+
+      if (pparm->pm_pInd)
+        {
+          pInd_dm = (SQLLEN *) ((char *) pparm->pm_pInd
+	        + row * pstmt->param_bind_type + bindOffset);
+          pInd_drv = (SQLLEN *) ((char *) pparm->pm_conv_pInd
+	        + row * pstmt->conv_param_bind_type);
+	}
+    }
+  else
+    {
+      octetLen = pparm->pm_pOctetLength ?
+                 ((SQLLEN*)((char*)pparm->pm_pOctetLength + bindOffset))[row] :
+                 pparm->pm_size;
+      if (pparm->pm_pInd)
+        {
+          pInd_dm = &((SQLLEN*)((char*)pparm->pm_pInd + bindOffset))[row];
+          pInd_drv = &((SQLLEN*)pparm->pm_conv_pInd)[row];
+        }
+    }
+
+  if (!pInd_dm)
+    return SQL_SUCCESS;
+
+  if (pstmt->param_bind_type && (octetLen == SQL_DATA_AT_EXEC || octetLen <= SQL_LEN_DATA_AT_EXEC_OFFSET))
+    {
+      PUSHSQLERR (pstmt->herr, en_HYC00);  /* Unsupported Modes */
+      return SQL_ERROR;
+    }
+
+  if (bOutput && (octetLen == SQL_DATA_AT_EXEC || octetLen <= SQL_LEN_DATA_AT_EXEC_OFFSET))
+    {
+      PUSHSQLERR (pstmt->herr, en_HYC00);  /* Unsupported Modes */
+      return SQL_ERROR;
+    }
+
+
+  if (bOutput && *pInd_drv == SQL_NULL_DATA
+     && (pparm->pm_usage == SQL_PARAM_OUTPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+    {
+      *pInd_dm = *pInd_drv;
+      return SQL_SUCCESS;
+    }
+  else if (!bOutput && (*pInd_dm == SQL_NULL_DATA || *pInd_dm == SQL_DATA_AT_EXEC || *pInd_dm <= SQL_LEN_DATA_AT_EXEC_OFFSET)
+     && (pparm->pm_usage == SQL_PARAM_INPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+    {
+      *pInd_drv = *pInd_dm;
+      return SQL_SUCCESS;
+    }
+
+
+  if (pparm->pm_data == NULL)
+    return SQL_SUCCESS;
+
+  if (pstmt->param_bind_type)
+    {
+      /* row-wise binding of parameters in force */
+      val_dm = (char *) pparm->pm_data + row * pstmt->param_bind_type + bindOffset;
+      val_drv = (char *) pparm->pm_conv_data + row * pstmt->conv_param_bind_type;
+    }
+  else
+    {
+      val_dm = (char *) pparm->pm_data + row * elementSize + bindOffset;
+      val_drv = (char *) pparm->pm_conv_data + row * pparm->pm_conv_el_size;
+    }
+
+  if (pparm->pm_c_type_orig == SQL_C_WCHAR)
+    {
+      SQLLEN len, size;
+      if (bOutput && (pparm->pm_usage == SQL_PARAM_OUTPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+        {
+          /* drv-dm */
+          len = (SQLLEN)*pInd_drv;
+
+          size = dm_conv_W2W(val_drv, len, val_dm, elementSize,
+              d_charset, m_charset);
+          if (m_charset == CP_UTF8)
+            *(char*)(val_dm + size) = 0;
+          else
+            DM_SetWCharAt(conv, val_dm, size/DM_WCHARSIZE(conv), 0);
+
+	  *pInd_dm = (*pInd_drv != SQL_NTS)? size: SQL_NTS;
+        }
+      else if (!bOutput && (pparm->pm_usage == SQL_PARAM_INPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+        {
+          /* dm-drv */
+          len = (SQLLEN)*pInd_dm;
+
+          size = dm_conv_W2W(val_dm, len, val_drv, pparm->pm_conv_el_size,
+              m_charset, d_charset);
+          if (d_charset == CP_UTF8)
+            *(char*)(val_drv + size) = 0;
+          else
+            DRV_SetWCharAt(conv, val_drv, size/DRV_WCHARSIZE(conv), 0);
+
+          *pInd_drv = (*pInd_dm != SQL_NTS)? size: SQL_NTS;
+        }
+    }
+  else
+    {
+      if (bOutput && (pparm->pm_usage == SQL_PARAM_OUTPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+        {
+          memcpy(val_dm, val_drv, elementSize);
+
+          if (pInd_dm)
+            *pInd_dm = *pInd_drv;
+        }
+      else if (!bOutput && (pparm->pm_usage == SQL_PARAM_INPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+        {
+          memcpy(val_drv, val_dm, elementSize);
+
+          if (pInd_dm)
+            *pInd_drv = *pInd_dm;
+        }
+    }
+
+  return SQL_SUCCESS;
+
+}
+
+
+static SQLRETURN
+_ReBindParam (STMT_t *pstmt, PPARM pparm)
+{
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc2 = SQL_NULL_HPROC;
+  HPROC hproc3 = SQL_NULL_HPROC;
+  SQLUINTEGER odbc_ver = ((GENV_t *) pdbc->genv)->odbc_ver;
+  SQLUINTEGER dodbc_ver = ((ENV_t *) pdbc->henv)->dodbc_ver;
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLSMALLINT nSqlType;
+
+
+  hproc2 = _iodbcdm_getproc (pstmt->hdbc, en_BindParameter);
+#if (ODBCVER >=0x0300)
+  hproc3 = _iodbcdm_getproc (pstmt->hdbc, en_BindParam);
+#endif
+
+  nSqlType = _iodbcdm_map_sql_type (pparm->pm_sql_type, penv->dodbc_ver);
+
+
+  if (odbc_ver == SQL_OV_ODBC2 &&
+      (  dodbc_ver == SQL_OV_ODBC2
+       || (dodbc_ver == SQL_OV_ODBC3 && hproc2 != SQL_NULL_HPROC)))
+    hproc3 = SQL_NULL_HPROC;
+
+#if (ODBCVER >=0x0300)
+  if (pparm->pm_usage == SQL_PARAM_INPUT && hproc2 == SQL_NULL_HPROC
+      && hproc3 != SQL_NULL_HPROC)
+    {
+      CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc3,
+	      (pstmt->dhstmt,
+	       pparm->pm_par,
+	       pparm->pm_c_type,
+	       nSqlType,
+	       pparm->pm_precision,
+	       pparm->pm_scale,
+	       pparm->pm_conv_data,
+	       pparm->pm_conv_pInd));
+    }
+  else
+#endif
+    {
+      if (hproc2 == SQL_NULL_HPROC)
+        {
+          PUSHSQLERR (pstmt->herr, en_IM001);
+          return SQL_ERROR;
+        }
+      CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc2,
+          (pstmt->dhstmt,
+           pparm->pm_par,
+           pparm->pm_usage,
+           pparm->pm_c_type,
+           nSqlType,
+           pparm->pm_precision,
+           pparm->pm_scale,
+           pparm->pm_conv_data,
+           pparm->pm_conv_el_size,
+           pparm->pm_conv_pInd));
+    }
+
+  return retcode;
+}
+
+
+static SQLRETURN
+_SQLExecute_ConvParams (SQLHSTMT hstmt, BOOL bOutput)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  SQLUINTEGER odbc_ver = ((GENV_t *) pdbc->genv)->odbc_ver;
+  SQLUINTEGER dodbc_ver = ((ENV_t *) pdbc->henv)->dodbc_ver;
+  PPARM pparm;
+  int maxpar;
+  int i;
+  SQLULEN j;
+  SQLULEN cRows = pstmt->paramset_size;
+  DM_CONV *conv = &pdbc->conv;
+  SQLRETURN retcode = SQL_SUCCESS;
+  IODBC_CHARSET m_charset = CP_DEF;
+  IODBC_CHARSET d_charset = CP_DEF;
+  BOOL needRebind = FALSE;
+  SQLLEN sz_mult = 1;
+  HPROC hproc2 = SQL_NULL_HPROC;
+  HPROC hproc3 = SQL_NULL_HPROC;
+
+  if (cRows == 0)
+    cRows = 1;
+
+  if (conv)
+    {
+      m_charset = conv ? conv->dm_cp: CP_DEF;
+      d_charset = conv ? conv->drv_cp: CP_DEF;
+
+      if (m_charset==CP_UTF16 && d_charset==CP_UCS4)
+        sz_mult = 2;
+      else if (m_charset==CP_UTF8 && d_charset==CP_UCS4)
+        sz_mult = 4;
+      else if (m_charset==CP_UTF8 && d_charset==CP_UTF16)
+        sz_mult = 2;
+      else
+        sz_mult = 1;
+    }
+
+  maxpar = pstmt->st_nparam;
+
+  if (penv->unicode_driver && !bOutput)
+    {
+      if (conv==NULL || (m_charset == d_charset))
+        {
+          needRebind = FALSE;
+        }
+/**
+      else if ((m_charset==CP_UCS4 && d_charset==CP_UTF16)
+             ||(m_charset==CP_UTF16 && d_charset==CP_UCS4)
+             ||(m_charset==CP_UTF8 && d_charset==CP_UTF16)
+             ||(m_charset==CP_UTF8 && d_charset==CP_UCS4))
+***/
+      else
+        {
+          /* check if we need rebind params */
+          pparm = pstmt->st_pparam;
+          for (i = 0; i < maxpar; i++, pparm++)
+            {
+              if (pparm->pm_data == NULL)
+                continue;
+
+              if (pparm->pm_c_type_orig == SQL_C_WCHAR)
+                {
+                  needRebind = TRUE;
+                  break;
+                }
+
+            }
+        }
+    }
+
+  if (needRebind && !bOutput)  /* mode this flag to PSTMT */
+    {
+      SQLULEN new_size = 0;
+      void *buf = NULL;
+
+      if (pstmt->param_bind_type) /* row-wise binding */
+        {
+          pparm = pstmt->st_pparam;
+          for (i = 0; i < maxpar; i++, pparm++)
+            {
+              if (pparm->pm_data == NULL)
+                continue;
+
+              new_size += sizeof(SQLLEN);
+
+              pparm->pm_conv_el_size = GetElementSize(pparm, conv);
+              if (pparm->pm_c_type == SQL_C_WCHAR)
+                pparm->pm_conv_el_size *= sz_mult;
+
+              new_size += pparm->pm_conv_el_size;
+            }
+
+          if (pstmt->params_buf)
+            {
+              free(pstmt->params_buf);
+              pstmt->params_buf = NULL;
+            }
+
+          buf = calloc((new_size*cRows), sizeof(char));
+          if (!buf)
+            {
+              PUSHSQLERR (pstmt->herr, en_HY001);
+              return SQL_ERROR;
+            }
+          pstmt->params_buf = buf;
+          pstmt->conv_param_bind_type = new_size;
+
+          /***** Reset Params *****/
+          hproc2 = _iodbcdm_getproc (pstmt->hdbc, en_FreeStmt);
+          if (hproc2 == SQL_NULL_HPROC)
+	    {
+	      PUSHSQLERR (pstmt->herr, en_IM001);
+	      return SQL_ERROR;
+	    }
+
+          CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc2,
+	      (pstmt->dhstmt, (SQLUSMALLINT)SQL_RESET_PARAMS));
+          if (!SQL_SUCCEEDED (retcode))
+            return retcode;
+
+
+          /***** Set Bind_type in driver to new size *****/
+          if (dodbc_ver == SQL_OV_ODBC3)
+            {
+              CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc3,
+                penv->unicode_driver, en_SetStmtAttr, (pstmt->dhstmt,
+		(SQLINTEGER)SQL_ATTR_PARAM_BIND_TYPE,
+                (SQLPOINTER)new_size, 0));
+              if (hproc3 == SQL_NULL_HPROC)
+                {
+	          PUSHSQLERR (pstmt->herr, en_IM001);
+	          return SQL_ERROR;
+                }
+            }
+          else
+            {
+              hproc2 = _iodbcdm_getproc (pstmt->hdbc, en_SetStmtOption);
+              if (hproc2 == SQL_NULL_HPROC)
+                hproc2 = _iodbcdm_getproc (pstmt->hdbc, en_SetStmtOptionA);
+
+              if (hproc2 == SQL_NULL_HPROC)
+                {
+	          PUSHSQLERR (pstmt->herr, en_IM001);
+	          return SQL_ERROR;
+                }
+
+              CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc2,
+	          (pstmt->dhstmt,
+	           (SQLUSMALLINT)SQL_ATTR_PARAM_BIND_TYPE,
+	           (SQLUINTEGER)new_size));
+
+            }
+          if (!SQL_SUCCEEDED (retcode))
+            return retcode;
+
+
+          if (cRows > 1)
+          {
+            /***** Set ParamSet size *****/
+            if (dodbc_ver == SQL_OV_ODBC3)
+            {
+              CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc3,
+                penv->unicode_driver, en_SetStmtAttr, (pstmt->dhstmt,
+		(SQLINTEGER)SQL_ATTR_PARAMSET_SIZE,
+                (SQLPOINTER)cRows, 0));
+              if (hproc3 == SQL_NULL_HPROC)
+                {
+	          PUSHSQLERR (pstmt->herr, en_IM001);
+	          return SQL_ERROR;
+                }
+            }
+            if (!SQL_SUCCEEDED (retcode))
+              return retcode;
+          }
+
+
+          /* rebind parameters */
+          pparm = pstmt->st_pparam;
+          buf = pstmt->params_buf;
+          for (i = 0; i < maxpar; i++, pparm++)
+            {
+              if (pparm->pm_data == NULL)
+                continue;
+
+              pparm->pm_conv_data = buf;
+              buf += pparm->pm_conv_el_size;
+
+              pparm->pm_conv_pInd = buf;
+              buf += sizeof(SQLLEN);
+
+              retcode = _ReBindParam(pstmt, pparm);
+              if (!SQL_SUCCEEDED (retcode))
+                return retcode;
+              pparm->rebinded = TRUE;
+
+            }
+        }
+
+      else /* col-wise binding  rebind all for avoid OFFSET related issues */
+        {
+
+          pparm = pstmt->st_pparam;
+          for (i = 0; i < maxpar; i++, pparm++)
+            {
+              SQLLEN *pInd_dm = NULL;
+              SQLUINTEGER bindOffset = pstmt->param_bind_offset;
+
+              if (pparm->pm_pInd)
+                pInd_dm = ((SQLLEN*)((char*)pparm->pm_pInd + bindOffset));
+
+              if (pparm->pm_data == NULL)
+                continue;
+
+              if (pparm->pm_tmp)
+                {
+                  free(pparm->pm_tmp);
+                  pparm->pm_tmp = NULL;
+                }
+              if (pparm->pm_tmp_Ind)
+                {
+                  free(pparm->pm_tmp_Ind);
+                  pparm->pm_tmp_Ind = NULL;
+                }
+
+              pparm->pm_conv_el_size = GetElementSize (pparm, conv);
+
+              if (cRows == 1 && pInd_dm
+                  && (*pInd_dm == SQL_DATA_AT_EXEC
+                      || *pInd_dm <= SQL_LEN_DATA_AT_EXEC_OFFSET))
+                {
+                  pparm->pm_conv_pInd = pparm->pm_pInd;
+                  pparm->pm_conv_data = pparm->pm_data;
+                }
+              else
+                {
+                  if (pparm->pm_c_type == SQL_C_WCHAR)
+                    pparm->pm_conv_el_size *= sz_mult;
+
+                  new_size = cRows * pparm->pm_conv_el_size;
+                  buf = calloc(new_size, sizeof(char));
+                  if (!buf)
+                    {
+                      PUSHSQLERR (pstmt->herr, en_HY001);
+                      return SQL_ERROR;
+                    }
+                  pparm->pm_tmp = pparm->pm_conv_data = buf;
+
+                  buf = calloc(cRows, sizeof(SQLLEN));
+                  if (!buf)
+                    {
+                      PUSHSQLERR (pstmt->herr, en_HY001);
+                      return SQL_ERROR;
+                    }
+                  pparm->pm_tmp_Ind = pparm->pm_conv_pInd = buf;
+                }
+
+              retcode = _ReBindParam(pstmt, pparm);
+              if (!SQL_SUCCEEDED (retcode))
+                return retcode;
+              pparm->rebinded = TRUE;
+
+            }
+
+        }
+
+      /***** Set ParamSet offset *****/
+      if (dodbc_ver == SQL_OV_ODBC3)
+        {
+          CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc3,
+            penv->unicode_driver, en_SetStmtAttr, (pstmt->dhstmt,
+	    (SQLINTEGER)SQL_ATTR_PARAM_BIND_OFFSET_PTR,
+            (SQLPOINTER)0, 0));
+          if (hproc3 == SQL_NULL_HPROC)
+            {
+	      PUSHSQLERR (pstmt->herr, en_IM001);
+	      return SQL_ERROR;
+            }
+        }
+    }
+
+  pparm = pstmt->st_pparam;
+  for (i = 0; i < maxpar; i++, pparm++)
+    {
+      if (pparm->pm_data == NULL)
+        continue;
+
+      if (pparm->rebinded)
+        {
+          if (bOutput && pparm->pm_usage == SQL_PARAM_INPUT)
+            continue;
+          for (j = 0; j < cRows; j++)
+            _ConvRebindedParam(pstmt, pparm, j, bOutput, conv);
+        }
+      else
+        {
+          if (bOutput && (pparm->pm_usage == SQL_PARAM_OUTPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+            {
+              if (pparm->pm_c_type_orig != SQL_C_WCHAR || m_charset == d_charset)
+                continue;
+
+              for (j = 0; j < cRows; j++)
+                _ConvParam(pstmt, pparm, j, bOutput, conv, penv->unicode_driver);
+            }
+          else if (!bOutput && (pparm->pm_usage == SQL_PARAM_INPUT || pparm->pm_usage == SQL_PARAM_INPUT_OUTPUT))
+            {
+              if (pparm->pm_c_type != SQL_C_WCHAR || m_charset == d_charset)
+                continue;
+
+              for (j = 0; j < cRows; j++)
+                _ConvParam(pstmt, pparm, j, bOutput, conv, penv->unicode_driver);
+
+              pparm->pm_c_type = SQL_C_CHAR;
+            }
+        }
+    } /* next column */
+
+  return SQL_SUCCESS;
+
+}
+
+#endif
+
+static SQLRETURN
+SQLExecute_Internal (SQLHSTMT hstmt)
+{
+  STMT (pstmt, hstmt);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode, rc;
+  sqlstcode_t sqlstat = en_00000;
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      switch (pstmt->state)
+	{
+	case en_stmt_allocated:
+	  sqlstat = en_S1010;
+	  break;
+
+	case en_stmt_executed_with_info:
+	case en_stmt_executed:
+	  if (!pstmt->prep_state)
+	    {
+	      sqlstat = en_S1010;
+	    }
+	  break;
+
+	case en_stmt_cursoropen:
+	  if (!pstmt->prep_state)
+	    {
+	      sqlstat = en_S1010;
+	    }
+	  break;
+
+	case en_stmt_fetched:
+	case en_stmt_xfetched:
+	  if (!pstmt->prep_state)
+	    {
+	      sqlstat = en_S1010;
+	    }
+	  else
+	    {
+	      sqlstat = en_24000;
+	    }
+	  break;
+
+	case en_stmt_needdata:
+	case en_stmt_mustput:
+	case en_stmt_canput:
+	  sqlstat = en_S1010;
+	  break;
+
+	default:
+	  break;
+	}
+    }
+  else if (pstmt->asyn_on != en_Execute)
+    {
+      sqlstat = en_S1010;
+    }
+
+  if (sqlstat == en_00000)
+    {
+      hproc = _iodbcdm_getproc (pstmt->hdbc, en_Execute);
+
+      if (hproc == SQL_NULL_HPROC)
+	{
+	  sqlstat = en_IM001;
+	}
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  if ((rc = _SQLExecute_ConvParams(hstmt, FALSE)) != SQL_SUCCESS)
+    return rc;
+
+  CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc, (pstmt->dhstmt));
+
+  /* stmt state transition */
+  if (pstmt->asyn_on == en_Execute)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_NEED_DATA:
+	case SQL_ERROR:
+	  pstmt->asyn_on = en_NullProc;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	default:
+	  return retcode;
+	}
+    }
+
+  if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
+    {
+      rc = _SQLExecute_ConvParams(hstmt, TRUE);
+      if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
+        retcode = rc;
+    }
+
+  switch (pstmt->state)
+    {
+    case en_stmt_prepared:
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	  _iodbcdm_do_cursoropen (pstmt);
+	  break;
+
+	case SQL_SUCCESS_WITH_INFO:
+	  pstmt->state = en_stmt_executed_with_info;
+	  break;
+
+	case SQL_NEED_DATA:
+	  pstmt->state = en_stmt_needdata;
+	  pstmt->need_on = en_Execute;
+          pstmt->st_need_param = NULL;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	  pstmt->asyn_on = en_Execute;
+	  break;
+
+	default:
+	  break;
+	}
+      break;
+
+    case en_stmt_executed:
+      switch (retcode)
+	{
+	case SQL_ERROR:
+	  pstmt->state = en_stmt_prepared;
+	  pstmt->cursor_state = en_stmt_cursor_no;
+	  break;
+
+	case SQL_NEED_DATA:
+	  pstmt->state = en_stmt_needdata;
+	  pstmt->need_on = en_Execute;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	  pstmt->asyn_on = en_Execute;
+	  break;
+
+	default:
+	  break;
+	}
+      break;
+
+    default:
+      break;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLExecute (SQLHSTMT hstmt)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLExecute (TRACE_ENTER, hstmt));
+
+  retcode = SQLExecute_Internal (hstmt);
+
+  LEAVE_STMT (hstmt,
+    trace_SQLExecute (TRACE_LEAVE, hstmt));
+}
+
+
+SQLRETURN SQL_API
+SQLExecDirect_Internal (SQLHSTMT hstmt,
+    SQLPOINTER szSqlStr,
+    SQLINTEGER cbSqlStr,
+    SQLCHAR waMode)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc = SQL_NULL_HPROC;
+  SQLRETURN retcode = SQL_SUCCESS;
+  SQLRETURN rc = SQL_SUCCESS;
+  sqlstcode_t sqlstat = en_00000;
+  void * _SqlStr = NULL;
+  CONV_DIRECT conv_direct = CD_NONE;
+  DM_CONV *conv = &pdbc->conv;
+
+  /* check arguments */
+  if (szSqlStr == NULL)
+    {
+      sqlstat = en_S1009;
+    }
+  else if (cbSqlStr < 0 && cbSqlStr != SQL_NTS)
+    {
+      sqlstat = en_S1090;
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      switch (pstmt->state)
+	{
+	case en_stmt_fetched:
+	case en_stmt_xfetched:
+	  sqlstat = en_24000;
+	  break;
+
+	case en_stmt_needdata:
+	case en_stmt_mustput:
+	case en_stmt_canput:
+	  sqlstat = en_S1010;
+	  break;
+
+	default:
+	  break;
+	}
+    }
+  else if (pstmt->asyn_on != en_ExecDirect)
+    {
+      sqlstat = en_S1010;
+    }
+
+  if (sqlstat != en_00000)
+    {
+      PUSHSQLERR (pstmt->herr, sqlstat);
+
+      return SQL_ERROR;
+    }
+
+  if (penv->unicode_driver && waMode != 'W')
+    conv_direct = CD_A2W;
+  else if (!penv->unicode_driver && waMode == 'W')
+    conv_direct = CD_W2A;
+  else if (waMode == 'W' && conv->dm_cp != conv->drv_cp)
+    conv_direct = CD_W2W;
+
+  if (conv_direct != CD_NONE)
+    {
+      _SqlStr = _iodbcdm_conv_var (pstmt, 0, szSqlStr, cbSqlStr, conv_direct);
+      szSqlStr = _SqlStr;
+      cbSqlStr = SQL_NTS;
+    }
+
+  if ((rc = _SQLExecute_ConvParams(hstmt, FALSE)) != SQL_SUCCESS)
+    return rc;
+
+  CALL_UDRIVER(pstmt->hdbc, pstmt, retcode, hproc, penv->unicode_driver,
+    en_ExecDirect, (
+       pstmt->dhstmt,
+       szSqlStr,
+       cbSqlStr));
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      _iodbcdm_FreeStmtVars(pstmt);
+      PUSHSQLERR (pstmt->herr, en_IM001);
+      return SQL_ERROR;
+    }
+
+  if (retcode != SQL_STILL_EXECUTING)
+    _iodbcdm_FreeStmtVars(pstmt);
+
+  /* stmt state transition */
+  if (pstmt->asyn_on == en_ExecDirect)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_NEED_DATA:
+	case SQL_ERROR:
+	  pstmt->asyn_on = en_NullProc;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	default:
+	  return retcode;
+	}
+    }
+
+  if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
+    {
+      rc = _SQLExecute_ConvParams(hstmt, TRUE);
+      if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
+        retcode = rc;
+    }
+
+  if (pstmt->state <= en_stmt_executed)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	  _iodbcdm_do_cursoropen (pstmt);
+	  pstmt->prep_state = 1;
+	  break;
+
+	case SQL_SUCCESS_WITH_INFO:
+	  pstmt->state = en_stmt_executed_with_info;
+	  pstmt->prep_state = 1;
+	  break;
+
+	case SQL_NEED_DATA:
+	  pstmt->state = en_stmt_needdata;
+	  pstmt->need_on = en_ExecDirect;
+          pstmt->st_need_param = NULL;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	  pstmt->asyn_on = en_ExecDirect;
+	  break;
+
+	case SQL_ERROR:
+	  pstmt->state = en_stmt_allocated;
+	  pstmt->cursor_state = en_stmt_cursor_no;
+	  pstmt->prep_state = 0;
+	  break;
+
+	default:
+	  break;
+	}
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLExecDirect (SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLExecDirect (TRACE_ENTER, hstmt, szSqlStr, cbSqlStr));
+
+  retcode = SQLExecDirect_Internal(hstmt, szSqlStr, cbSqlStr, 'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLExecDirect (TRACE_LEAVE, hstmt, szSqlStr, cbSqlStr));
+}
+
+
+#if ODBCVER >= 0x0300
+SQLRETURN SQL_API
+SQLExecDirectA (SQLHSTMT hstmt, SQLCHAR * szSqlStr, SQLINTEGER cbSqlStr)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLExecDirect (TRACE_ENTER, hstmt, szSqlStr, cbSqlStr));
+
+  retcode = SQLExecDirect_Internal(hstmt, szSqlStr, cbSqlStr, 'A');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLExecDirect (TRACE_LEAVE, hstmt, szSqlStr, cbSqlStr));
+}
+
+
+SQLRETURN SQL_API
+SQLExecDirectW (SQLHSTMT hstmt, SQLWCHAR * szSqlStr, SQLINTEGER cbSqlStr)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLExecDirectW (TRACE_ENTER, hstmt, szSqlStr, cbSqlStr));
+
+  retcode = SQLExecDirect_Internal(hstmt, szSqlStr, cbSqlStr, 'W');
+
+  LEAVE_STMT (hstmt,
+    trace_SQLExecDirectW (TRACE_LEAVE, hstmt, szSqlStr, cbSqlStr));
+}
+#endif
+
+static SQLRETURN
+SQLMoreResults_Internal (SQLHSTMT hstmt)
+{
+  STMT (pstmt, hstmt);
+  HPROC hproc;
+  SQLRETURN retcode;
+  SQLRETURN rc;
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      switch (pstmt->state)
+	{
+#if 0
+	case en_stmt_allocated:
+	case en_stmt_prepared:
+	  return SQL_NO_DATA_FOUND;
+#endif
+
+	case en_stmt_needdata:
+	case en_stmt_mustput:
+	case en_stmt_canput:
+	  PUSHSQLERR (pstmt->herr, en_S1010);
+	  return SQL_ERROR;
+
+	default:
+	  break;
+	}
+    }
+  else if (pstmt->asyn_on != en_MoreResults)
+    {
+      PUSHSQLERR (pstmt->herr, en_S1010);
+
+      return SQL_ERROR;
+    }
+
+  /* call driver */
+  hproc = _iodbcdm_getproc (pstmt->hdbc, en_MoreResults);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pstmt->herr, en_IM001);
+
+      return SQL_ERROR;
+    }
+
+  CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc,
+      (pstmt->dhstmt));
+
+  if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO || retcode == SQL_NO_DATA_FOUND)
+    {
+      rc = _SQLExecute_ConvParams(hstmt, TRUE);
+      if (rc != SQL_SUCCESS && rc != SQL_SUCCESS_WITH_INFO)
+        retcode = rc;
+    }
+
+  /* state transition */
+  if (pstmt->asyn_on == en_MoreResults)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_NO_DATA_FOUND:
+	case SQL_ERROR:
+	  pstmt->asyn_on = en_NullProc;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	default:
+	  return retcode;
+	}
+    }
+
+  switch (pstmt->state)
+    {
+    case en_stmt_allocated:
+    case en_stmt_prepared:
+      /* driver should return SQL_NO_DATA_FOUND */
+	  if (pstmt->prep_state)
+	    {
+	      pstmt->state = en_stmt_cursoropen;
+	    }
+	  else
+	    {
+	      pstmt->state = en_stmt_prepared;
+	    }
+      break;
+
+    case en_stmt_executed_with_info:
+	_iodbcdm_do_cursoropen (pstmt);
+	/* FALL THROUGH */
+
+    case en_stmt_executed:
+      if (retcode == SQL_NO_DATA_FOUND)
+	{
+	  if (pstmt->prep_state)
+	    {
+	      pstmt->state = en_stmt_prepared;
+	    }
+	  else
+	    {
+	      pstmt->state = en_stmt_cursoropen;
+	    }
+	}
+      else if (retcode == SQL_STILL_EXECUTING)
+	{
+	  pstmt->asyn_on = en_MoreResults;
+	}
+      break;
+
+    case en_stmt_cursoropen:
+    case en_stmt_fetched:
+    case en_stmt_xfetched:
+      if (retcode == SQL_SUCCESS)
+	{
+	  break;
+	}
+      else if (retcode == SQL_NO_DATA_FOUND)
+	{
+	  if (pstmt->prep_state)
+	    {
+	      pstmt->state = en_stmt_prepared;
+	    }
+	  else
+	    {
+	      pstmt->state = en_stmt_allocated;
+	    }
+	}
+      else if (retcode == SQL_STILL_EXECUTING)
+	{
+	  pstmt->asyn_on = en_MoreResults;
+	}
+      break;
+
+    default:
+      break;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLMoreResults (SQLHSTMT hstmt)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLMoreResults (TRACE_ENTER, hstmt));
+
+  retcode = SQLMoreResults_Internal (hstmt);
+
+  LEAVE_STMT (hstmt,
+    trace_SQLMoreResults (TRACE_LEAVE, hstmt));
+}
+
+
+static SQLRETURN
+SQLPutData_Internal (
+  SQLHSTMT		  hstmt,
+  SQLPOINTER		  rgbValue, 
+  SQLLEN		  cbValue)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  ENVR (penv, pdbc->henv);
+  HPROC hproc;
+  SQLRETURN retcode;
+  DM_CONV *conv = &pdbc->conv;
+  IODBC_CHARSET m_charset = CP_DEF;
+  IODBC_CHARSET d_charset = CP_DEF;
+
+  /* check argument value */
+  if (rgbValue == NULL &&
+      (cbValue != SQL_DEFAULT_PARAM && cbValue != SQL_NULL_DATA))
+    {
+      PUSHSQLERR (pstmt->herr, en_S1009);
+
+      return SQL_ERROR;
+    }
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      if (pstmt->state <= en_stmt_xfetched)
+	{
+	  PUSHSQLERR (pstmt->herr, en_S1010);
+
+	  return SQL_ERROR;
+	}
+    }
+  else if (pstmt->asyn_on != en_PutData)
+    {
+      PUSHSQLERR (pstmt->herr, en_S1010);
+
+      return SQL_ERROR;
+    }
+
+  /* call driver */
+  hproc = _iodbcdm_getproc (pstmt->hdbc, en_PutData);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pstmt->herr, en_IM001);
+
+      return SQL_ERROR;
+    }
+
+  if (conv)
+    {
+      m_charset = conv ? conv->dm_cp: CP_DEF;
+      d_charset = conv ? conv->drv_cp: CP_DEF;
+    }
+
+  if (pstmt->st_need_param != NULL && m_charset != d_charset
+     &&  pstmt->st_need_param->pm_c_type_orig == SQL_C_WCHAR)
+    {
+      SQLLEN drv_cbValue;
+      SQLPOINTER drv_rgbValue = conv_text_m2d_W2W(conv, rgbValue, cbValue,
+                                  &drv_cbValue);
+
+      CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc,
+          (pstmt->dhstmt, drv_rgbValue, drv_cbValue));
+
+      if (drv_rgbValue != NULL)
+        free(drv_rgbValue);
+    }
+  else
+    {
+      CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc,
+          (pstmt->dhstmt, rgbValue, cbValue));
+    }
+
+
+
+  /* state transition */
+  if (pstmt->asyn_on == en_PutData)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_ERROR:
+	  pstmt->asyn_on = en_NullProc;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	default:
+	  return retcode;
+	}
+    }
+
+  /* must in mustput or canput states */
+  switch (retcode)
+    {
+    case SQL_SUCCESS:
+    case SQL_SUCCESS_WITH_INFO:
+      pstmt->state = en_stmt_canput;
+      break;
+
+    case SQL_ERROR:
+      switch (pstmt->need_on)
+	{
+	case en_ExecDirect:
+	  pstmt->state = en_stmt_allocated;
+	  pstmt->need_on = en_NullProc;
+	  break;
+
+	case en_Execute:
+	  if (pstmt->prep_state)
+	    {
+	      pstmt->state = en_stmt_prepared;
+	      pstmt->need_on = en_NullProc;
+	    }
+	  break;
+
+	case en_SetPos:
+	  /* Is this possible ???? */
+	  pstmt->state = en_stmt_xfetched;
+	  break;
+
+	default:
+	  break;
+	}
+      break;
+
+    case SQL_STILL_EXECUTING:
+      pstmt->asyn_on = en_PutData;
+      break;
+
+    default:
+      break;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLPutData (
+  SQLHSTMT		  hstmt, 
+  SQLPOINTER		  rgbValue, 
+  SQLLEN		  cbValue)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLPutData (TRACE_ENTER, hstmt, rgbValue, cbValue));
+
+  retcode = SQLPutData_Internal (hstmt, rgbValue, cbValue);
+
+  LEAVE_STMT (hstmt,
+    trace_SQLPutData (TRACE_LEAVE, hstmt, rgbValue, cbValue));
+}
+
+
+static SQLRETURN
+SQLParamData_Internal (SQLHSTMT hstmt, SQLPOINTER * prgbValue)
+{
+  STMT (pstmt, hstmt);
+  HPROC hproc;
+  SQLRETURN retcode;
+  int i;
+
+  /* check argument */
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      if (pstmt->state <= en_stmt_xfetched)
+	{
+	  PUSHSQLERR (pstmt->herr, en_S1010);
+
+	  return SQL_ERROR;
+	}
+    }
+  else if (pstmt->asyn_on != en_ParamData)
+    {
+      PUSHSQLERR (pstmt->herr, en_S1010);
+
+      return SQL_ERROR;
+    }
+
+  /* call driver */
+  hproc = _iodbcdm_getproc (pstmt->hdbc, en_ParamData);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pstmt->herr, en_IM001);
+
+      return SQL_ERROR;
+    }
+
+  CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc, (pstmt->dhstmt, prgbValue));
+
+  /* state transition */
+  if (pstmt->asyn_on == en_ParamData)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_ERROR:
+	  pstmt->asyn_on = en_NullProc;
+	  break;
+
+	case SQL_STILL_EXECUTING:
+	default:
+	  return retcode;
+	}
+    }
+
+  if (pstmt->state < en_stmt_needdata)
+    {
+      return retcode;
+    }
+
+  switch (retcode)
+    {
+    case SQL_ERROR:
+      switch (pstmt->need_on)
+	{
+	case en_ExecDirect:
+	  pstmt->state = en_stmt_allocated;
+	  break;
+
+	case en_Execute:
+	  pstmt->state = en_stmt_prepared;
+	  break;
+
+	case en_SetPos:
+	  pstmt->state = en_stmt_xfetched;
+	  pstmt->cursor_state = en_stmt_cursor_xfetched;
+	  break;
+
+	default:
+	  break;
+	}
+      pstmt->need_on = en_NullProc;
+      break;
+
+    case SQL_SUCCESS:
+    case SQL_SUCCESS_WITH_INFO:
+      switch (pstmt->state)
+	{
+	case en_stmt_needdata:
+	  pstmt->state = en_stmt_mustput;
+	  break;
+
+	case en_stmt_canput:
+	  switch (pstmt->need_on)
+	    {
+	    case en_SetPos:
+	      pstmt->state = en_stmt_xfetched;
+	      pstmt->cursor_state = en_stmt_cursor_xfetched;
+	      break;
+
+	    case en_ExecDirect:
+	    case en_Execute:
+	      _iodbcdm_do_cursoropen (pstmt);
+	      break;
+
+	    default:
+	      break;
+	    }
+	  break;
+
+	default:
+	  break;
+	}
+      pstmt->need_on = en_NullProc;
+      break;
+
+    case SQL_NEED_DATA:
+      {
+	PPARM pparm = pstmt->st_pparam;
+	pstmt->state = en_stmt_mustput;
+	pstmt->st_need_param = NULL;
+
+	for (i = 0; i < pstmt->st_nparam; i++, pparm++)
+	  {
+	    if (pparm->pm_data == NULL)
+	      continue;
+
+	    if ((pparm->pm_c_type_orig == SQL_C_WCHAR
+		    || pparm->pm_c_type_orig == SQL_C_CHAR
+		    || pparm->pm_c_type_orig == SQL_C_BINARY)
+		&& prgbValue != NULL && pparm->pm_data == *prgbValue)
+	      {
+		pstmt->st_need_param = pparm;
+		break;
+	      }
+	  }
+      }
+      break;
+
+    default:
+      break;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLParamData (SQLHSTMT hstmt, SQLPOINTER * prgbValue)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLParamData (TRACE_ENTER, hstmt, prgbValue));
+
+  retcode = SQLParamData_Internal (hstmt, prgbValue);
+
+  LEAVE_STMT (hstmt,
+    trace_SQLParamData (TRACE_LEAVE, hstmt, prgbValue));
+}
+
+
+static SQLRETURN
+SQLNumParams_Internal (SQLHSTMT hstmt, SQLSMALLINT * pcpar)
+{
+  STMT (pstmt, hstmt);
+  HPROC hproc;
+  SQLRETURN retcode;
+
+  /* check argument */
+  if (!pcpar)
+    {
+      return SQL_SUCCESS;
+    }
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      switch (pstmt->state)
+	{
+	case en_stmt_allocated:
+	case en_stmt_needdata:
+	case en_stmt_mustput:
+	case en_stmt_canput:
+	  PUSHSQLERR (pstmt->herr, en_S1010);
+	  return SQL_ERROR;
+
+	default:
+	  break;
+	}
+    }
+  else if (pstmt->asyn_on != en_NumParams)
+    {
+      PUSHSQLERR (pstmt->herr, en_S1010);
+
+      return SQL_ERROR;
+    }
+
+  /* call driver */
+  hproc = _iodbcdm_getproc (pstmt->hdbc, en_NumParams);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pstmt->herr, en_IM001);
+
+      return SQL_ERROR;
+    }
+
+  CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc, (pstmt->dhstmt, pcpar));
+
+  /* state transition */
+  if (pstmt->asyn_on == en_NumParams)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_ERROR:
+	  break;
+
+	default:
+	  return retcode;
+	}
+    }
+
+  if (retcode == SQL_STILL_EXECUTING)
+    {
+      pstmt->asyn_on = en_NumParams;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLNumParams (SQLHSTMT hstmt, SQLSMALLINT * pcpar)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLNumParams (TRACE_ENTER, hstmt, pcpar));
+
+  retcode = SQLNumParams_Internal (hstmt, pcpar);
+
+  LEAVE_STMT (hstmt,
+    trace_SQLNumParams (TRACE_LEAVE, hstmt, pcpar));
+}
+
+
+static SQLRETURN
+SQLDescribeParam_Internal (
+    SQLHSTMT		  hstmt,
+    SQLUSMALLINT	  ipar,
+    SQLSMALLINT		* pfSqlType,
+    SQLULEN		* pcbColDef,
+    SQLSMALLINT		* pibScale, 
+    SQLSMALLINT 	* pfNullable)
+{
+  STMT (pstmt, hstmt);
+  CONN (pdbc, pstmt->hdbc);
+  GENV (genv, pdbc->genv);
+
+  HPROC hproc;
+  SQLRETURN retcode;
+
+  /* check argument */
+  if (ipar == 0)
+    {
+      PUSHSQLERR (pstmt->herr, en_S1093);
+
+      return SQL_ERROR;
+    }
+
+  /* check state */
+  if (pstmt->asyn_on == en_NullProc)
+    {
+      switch (pstmt->state)
+	{
+	case en_stmt_allocated:
+	case en_stmt_needdata:
+	case en_stmt_mustput:
+	case en_stmt_canput:
+	  PUSHSQLERR (pstmt->herr, en_S1010);
+	  return SQL_ERROR;
+
+	default:
+	  break;
+	}
+    }
+  else if (pstmt->asyn_on != en_DescribeParam)
+    {
+      PUSHSQLERR (pstmt->herr, en_S1010);
+
+      return SQL_ERROR;
+    }
+
+  /* call driver */
+  hproc = _iodbcdm_getproc (pstmt->hdbc, en_DescribeParam);
+
+  if (hproc == SQL_NULL_HPROC)
+    {
+      PUSHSQLERR (pstmt->herr, en_IM001);
+
+      return SQL_ERROR;
+    }
+
+  CALL_DRIVER (pstmt->hdbc, pstmt, retcode, hproc,
+      (pstmt->dhstmt, ipar, pfSqlType, pcbColDef, pibScale, pfNullable));
+
+  /*
+   *  Convert sql type to ODBC version of application
+   */
+  if (SQL_SUCCEEDED(retcode) && pfSqlType)
+    *pfSqlType = _iodbcdm_map_sql_type (*pfSqlType, genv->odbc_ver);
+
+
+  /* state transition */
+  if (pstmt->asyn_on == en_DescribeParam)
+    {
+      switch (retcode)
+	{
+	case SQL_SUCCESS:
+	case SQL_SUCCESS_WITH_INFO:
+	case SQL_ERROR:
+	  break;
+
+	default:
+	  return retcode;
+	}
+    }
+
+  if (retcode == SQL_STILL_EXECUTING)
+    {
+      pstmt->asyn_on = en_DescribeParam;
+    }
+
+  return retcode;
+}
+
+
+SQLRETURN SQL_API
+SQLDescribeParam (
+  SQLHSTMT		  hstmt,
+  SQLUSMALLINT		  ipar,
+  SQLSMALLINT 		* pfSqlType,
+  SQLULEN 		* pcbColDef,
+  SQLSMALLINT 		* pibScale,
+  SQLSMALLINT 		* pfNullable)
+{
+  ENTER_STMT (hstmt,
+    trace_SQLDescribeParam (TRACE_ENTER,
+      hstmt, ipar, pfSqlType,
+      pcbColDef, pibScale, pfNullable));
+
+  retcode = SQLDescribeParam_Internal ( hstmt, ipar, pfSqlType,
+      pcbColDef, pibScale, pfNullable);
+
+  LEAVE_STMT (hstmt,
+    trace_SQLDescribeParam (TRACE_LEAVE,
+      hstmt, ipar, pfSqlType,
+      pcbColDef, pibScale, pfNullable));
+}

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.