diff -urNad mysql-connector-odbc-5.1.13-src/BUILD.unix mysql-connector-odbc-5.1.12-src/BUILD.unix
--- mysql-connector-odbc-5.1.13-src/BUILD.unix	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/BUILD.unix	2013-01-24 18:58:34.000000000 +0200
@@ -94,36 +94,12 @@
  -DODBC_INCLUDES=/path/to/headers
  -DODBC_LIB_DIR=/path/to/libs
 
-And you might need to help cmake find the MySQL headers and libraries, 
-by setting the environment variable or additional parameters 
-MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR or MYSQL_DIR to the appropriate location. 
-For example:
+And you might need to help cmake find the MySQL headers, by setting 
+the environment variable MYSQL_DIR to the appropriate location. For
+example:
 
- $ export MYSQL_INCLUDE_DIR=/usr/local/mysql/include
- $ export MYSQL_LIB_DIR=/usr/local/mysql/lib
  $ export MYSQL_DIR=/usr/local/mysql
   
-Mysql client library(libmysqlclient.a) is build statically with 
-MyODBC. If you want to build dynamically or want to specify mysql client 
-library name with which MyODBC should get linked, use MYSQLCLIENT_LIB_NAME 
-additional parameter with mysqlclient library name.
-
- -DMYSQLCLIENT_LIB_NAME=mysqlclient lib name with extension
- 
-In MyODBC, mysql_config is used to find MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR, 
-MYSQL_LINK_FLAGS and MYSQL_CXXFLAGS each of which can be overriden if they 
-are provided as additional parameters in cmake. mysql_config location can 
-be specified using MYSQL_CONFIG_EXECUTABLE additional parameter.
-
- -DMYSQL_CONFIG_EXECUTABLE=/path/to/mysql_config
- -DMYSQL_LINK_FLAGS=mysql link flags
- -DMYSQL_CXXFLAGS=mysql C++ linkage flags
- 
-If you want to enable C++ linkage to mysql client library, then specify 
-MYSQL_CXX_LINKAGE to true. By default, MYSQL_CXX_LINKAGE is enabled for 
-mysql version greater then equal to 5.6.4
- -DMYSQL_CXX_LINKAGE=1
-
 Upon success, CMake will create the appropriate make files. Then,
 execute make:
 
diff -urNad mysql-connector-odbc-5.1.13-src/BUILD.win mysql-connector-odbc-5.1.12-src/BUILD.win
--- mysql-connector-odbc-5.1.13-src/BUILD.win	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/BUILD.win	2013-01-24 18:58:34.000000000 +0200
@@ -41,24 +41,10 @@
 and installs a shortcut into the Start menu to open a command prompt
 with these variables set.
 
-You need to set MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR or MYSQL_DIR to point
-to where the MySQL server is installed, using the short-style filenames:
+You need to set MYSQL_DIR to point to where the MySQL server is
+installed, using the short-style filenames:
 
-  set MYSQL_INCLUDE_DIR=C:\PROGRA~1\MySQL\MYSQLS~1.0\include
-  set MYSQL_LIB_DIR=C:\PROGRA~1\MySQL\MYSQLS~1.0\lib
   set MYSQL_DIR=C:\PROGRA~1\MySQL\MYSQLS~1.0
- 
-Mysql client library(mysqlclient.lib) is build statically with 
-MyODBC. If you want to build dynamically or want to specify mysql client 
-library name with which MyODBC should get linked, use MYSQLCLIENT_LIB_NAME 
-additional parameter with mysqlclient library name.
-
- -DMYSQLCLIENT_LIB_NAME=mysqlclient lib name with extension
- 
-If you want to enable C++ linkage to mysql client library, then specify 
-MYSQL_CXX_LINKAGE to true. By default, MYSQL_CXX_LINKAGE is enabled for 
-mysql version greater then equal to 5.6.4
- -DMYSQL_CXX_LINKAGE=1
 
 Build Connector/ODBC using the "cmake" command-line tool by doing the
 following from the source root directory (in a command prompt window);
diff -urNad mysql-connector-odbc-5.1.13-src/CMakeLists.txt mysql-connector-odbc-5.1.12-src/CMakeLists.txt
--- mysql-connector-odbc-5.1.13-src/CMakeLists.txt	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/CMakeLists.txt	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # The MySQL Connector/ODBC is licensed under the terms of the GPLv2
 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 
@@ -32,7 +32,7 @@
 
 SET(CONNECTOR_MAJOR "5")
 SET(CONNECTOR_MINOR "1")
-SET(CONNECTOR_PATCH "13")
+SET(CONNECTOR_PATCH "12")
 SET(CONNECTOR_LEVEL "")
 
 IF(CONNECTOR_MINOR LESS 10)
@@ -50,7 +50,7 @@
 SET(EDIT_WARNING_MESSAGE "Please do not edit this file - it is generated by cmake. Edit its source file instead.")
 
 CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/VersionInfo.h.cmake ${CMAKE_SOURCE_DIR}/VersionInfo.h @ONLY)
-CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/macosx/postflight.in ${CMAKE_SOURCE_DIR}/scripts/macosx/postflight @ONLY)
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/scripts/macosx/postflight.in.cmake ${CMAKE_SOURCE_DIR}/scripts/macosx/postflight.in @ONLY)
 IF(WIN32)
 	CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/Install.bat.cmake ${CMAKE_SOURCE_DIR}/Install.bat @ONLY)
 	CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/Uninstall.bat.cmake ${CMAKE_SOURCE_DIR}/Uninstall.bat @ONLY)
@@ -69,12 +69,7 @@
 #-------------- unixodbc/iodbc/win -------------------
 IF(WIN32)
         SET(ODBCLIB odbc32)
-        IF (ODBCCP32_LIB)
-          SET(ODBCINSTLIB ${ODBCCP32_LIB})
-        ELSE (ODBCCP32_LIB)
-          SET(ODBCINSTLIB odbccp32)
-        ENDIF (ODBCCP32_LIB)
-        MESSAGE(STATUS "ODBC Installation Library: ${ODBCINSTLIB}")
+        SET(ODBCINSTLIB odbccp32)
 ELSE(WIN32)
         IF(WITH_UNIXODBC)
                 SET(ODBCLIB odbc)
@@ -187,7 +182,7 @@
                         SET(NEW_FLAGS "${CMAKE_${TYPE}_FLAGS${CFG}}")
 
                         # fix up static libc flags
-                        #STRING(REPLACE "/MD" "/MT" NEW_FLAGS "${NEW_FLAGS}")
+                        STRING(REPLACE "/MD" "/MT" NEW_FLAGS "${NEW_FLAGS}")
 
                         # Add some additional help for debug builds
                         IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
@@ -271,7 +266,7 @@
 CPackSourceConfig\\\\.cmake
 CPackConfig\\\\.cmake
 VersionInfo\\\\.h$
-postflight$
+postflight\\\\.in$
 /cmake_install\\\\.cmake
 /CTestTestfile\\\\.cmake
 /CMakeFiles/
diff -urNad mysql-connector-odbc-5.1.13-src/ChangeLog mysql-connector-odbc-5.1.12-src/ChangeLog
--- mysql-connector-odbc-5.1.13-src/ChangeLog	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/ChangeLog	2013-01-24 18:58:34.000000000 +0200
@@ -1,43 +1,3 @@
-5.1.13
-
-  Functionality added or changed:
-  * Added new variable in cmake config files ODBCCP32_LIB for odbccpp32.lib path, 
-    and MYSQLCLIENT_LIB_NAME for linking mysqlclient statically or dynamically by 
-    specifying mysqlclient library (libmysql.*, mysqlclient.*, libmysqlclient_r.*, 
-    libmysqlclient.*) to be used. Mysql CPP linkage for mysql version >= 5.6.4 
-    (wl#6738)
-  * Added a new test module for crash bugs (my_crash.c)
-
-
-  Bugs fixed:
-  * query_print will cause core dump in 32-bit application 
-    (Bug #16367440/68201)
-  * Datetime and timestamp second fractions need removing the trailing 
-    zeros (Bug# 16294197/65418)
-  * Crash in SQLSetConnectAttr(SQL_ATTR_CURRENT_CATALOG) (Bug# 16526604/63844)
-  * Added CLEARTEXT authentication connection option ENABLE_CLEARTEXT_PLUGIN.
-    (Bug#16445091)
-  * Binding string to decimal parameter always uses system locale setting
-    (Bug# 11766369/59469)
-  * Driver use the char ';' as separator in attributes string instead 
-    of the '\0' (Bug# 15940689/66548)
-  * DSN connection parameters override those specified in the connection
-    string (Bug# 11760574/52996)
-  * MSSQL linked server connected to MySQL 5.1.9 driver causes hard crash
-    (Bug# 16604346/63386)
-  * Need to add a lock to access connections member in ENV structure
-    (Bug# 17240611/69864)
-  * Visual Studio 2010 crashes when reading rows from any table in Server 
-    Explorer (Bug# 17304031/69950)
-  * Corrected MYSQL_NUM_VERSION calculation error in FindMysql.cmake. 
-    MYSQL_LIB_DIR, MYSQL_INCLUDE_DIR, MYSQL_LINK_FLAGS and MYSQL_CXXFLAGS will
-    be obtained from mysql_config only when they are not provided using cmake 
-    options.
-  * Valgrind error, simple loop fix (Bug# 17397596/64105)
-
-
-----
-
 5.1.12 (16-Jan--2013)
 
   Functionality added or changed:
@@ -73,9 +33,8 @@
   Functionality added or changed:
   * MyODBC queries log is written to %TEMP%\myodbc.sql, or to C:\myodbc.sql if
     TEMP is not defined.
-  * Added pre-fetch functionality and PREFETCH connection string option 
-    implemented through LIMIT to avoid reading the entire resultset for full
-    table SELECT queries. (WL#6211)
+  * Added pre-fetch functionality implemented through LIMIT to avoid reading the
+    entire resultset for full table SELECT queries. (WL#6211)
 
   Bugs fixed:
   * Fractional parts of second is ignored in SQLGetData. (Bug #12767740/60646)
@@ -164,7 +123,6 @@
   * Added GUI options for MIN_DATE_TO_ZERO and ZERO_DATE_TO_MIN connection
     options. (Bug #30539)
   * Function SQLProcedureColumns() implemented. (Bug #50400)
-  * Added NO_I_S connection option.
 
   Bugs fixed:
   * If NO_BACKSLASH_ESCAPES mode is used on a server, escaping binary data
@@ -307,7 +265,6 @@
   * Added SSLVERIFY connection option to verify server certificate. By default
     certificate is not verified now. (Bug #34648)
   * Database list height is autoadjusted in Windows GUI. (Bug #33918)
-  * Added new connection string option DFLT_BIGINT_BIND_STR
 
   Bugs fixed:
   * Recordset-based update fails if blob field is queried. (Bug #19065)
diff -urNad mysql-connector-odbc-5.1.13-src/cmake/FindMySQL.cmake mysql-connector-odbc-5.1.12-src/cmake/FindMySQL.cmake
--- mysql-connector-odbc-5.1.13-src/cmake/FindMySQL.cmake	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/cmake/FindMySQL.cmake	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 #--------------------------------------------------------
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # The MySQL Connector/ODBC is licensed under the terms of the GPLv2
 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -23,131 +23,19 @@
 
 ##########################################################################
 
-MACRO(_MYSQL_CONFIG VAR _regex _opt)
-   EXECUTE_PROCESS(COMMAND ${MYSQL_CONFIG_EXECUTABLE} ${_opt}
-       OUTPUT_VARIABLE _mysql_config_output
-       )
-   SET(_var ${_mysql_config_output})
-   STRING(REGEX MATCHALL "${_regex}([^ ]+)" _mysql_config_output "${_mysql_config_output}")
-   STRING(REGEX REPLACE "^[ \t]+" "" _mysql_config_output "${_mysql_config_output}")
-   STRING(REGEX REPLACE "[\r\n]$" "" _mysql_config_output "${_mysql_config_output}")
-   STRING(REGEX REPLACE "${_regex}" "" _mysql_config_output "${_mysql_config_output}")
-   SEPARATE_ARGUMENTS(_mysql_config_output)
-   SET(${VAR} ${_mysql_config_output})
-ENDMACRO(_MYSQL_CONFIG _regex _opt)
-
-
-MACRO(_MYSQL_CONFIG_REPLACE VAR _regex1 _replace _regex2 _opt)
-   EXECUTE_PROCESS(COMMAND ${MYSQL_CONFIG_EXECUTABLE} ${_opt}
-       OUTPUT_VARIABLE _mysql_config_output1
-       )
-   SET(_var ${_mysql_config_output1})
-   STRING(REGEX MATCHALL "${_regex2}([^ ]+)" _mysql_config_output1 "${_mysql_config_output1}")
-   STRING(REGEX REPLACE "^[ \t]+" "" _mysql_config_output1 "${_mysql_config_output1}")
-   STRING(REGEX REPLACE "[\r\n]$" "" _mysql_config_output1 "${_mysql_config_output1}")
-   STRING(REGEX REPLACE "${_regex2}" "" _mysql_config_output1 "${_mysql_config_output1}")
-   STRING(REGEX REPLACE "${_regex1}" "${_replace}" _mysql_config_output1 "${_mysql_config_output1}")
-   SET(${VAR} ${_mysql_config_output1})
-ENDMACRO(_MYSQL_CONFIG_REPLACE _regex1 _replace _regex2 _opt)
-
-
-IF (MYSQLCLIENT_LIB_NAME)
-  IF (${MYSQLCLIENT_LIB_NAME} MATCHES "libmysqlclient_r.a" 
-       OR ${MYSQLCLIENT_LIB_NAME} MATCHES "libmysqlclient.a" 
-       OR ${MYSQLCLIENT_LIB_NAME} MATCHES "mysqlclient*")
-    SET(MYSQLCLIENT_STATIC_LINKING 1)
-  ELSEIF (${MYSQLCLIENT_LIB_NAME} MATCHES "libmysqlclient_r.so" 
-           OR ${MYSQLCLIENT_LIB_NAME} MATCHES "libmysqlclient.so" 
-           OR ${MYSQLCLIENT_LIB_NAME} MATCHES "libmysql.*")
-    SET(MYSQLCLIENT_STATIC_LINKING 0)
-  ENDIF (${MYSQLCLIENT_LIB_NAME} MATCHES "libmysqlclient_r.a" 
-       OR ${MYSQLCLIENT_LIB_NAME} MATCHES "libmysqlclient.a" 
-       OR ${MYSQLCLIENT_LIB_NAME} MATCHES "mysqlclient*")
-ELSE (MYSQLCLIENT_LIB_NAME)
-  IF (WIN32)
-    SET(MYSQLCLIENT_LIB_NAME "mysqlclient.lib")
-  ELSE (WIN32)
-    SET(MYSQLCLIENT_LIB_NAME "libmysqlclient.a libmysqlclient_r.a")
-  ENDIF (WIN32)
-  SET(MYSQLCLIENT_STATIC_LINKING 1)
-ENDIF (MYSQLCLIENT_LIB_NAME)
-SEPARATE_ARGUMENTS(MYSQLCLIENT_LIB_NAME)
-
-
-IF (NOT MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
-  IF (EXISTS "$ENV{MYSQL_DIR}/bin/mysql_config")
-    SET(MYSQL_CONFIG_EXECUTABLE "$ENV{MYSQL_DIR}/bin/mysql_config")
-  ELSE (EXISTS "$ENV{MYSQL_DIR}/bin/mysql_config")
-    FIND_PROGRAM(MYSQL_CONFIG_EXECUTABLE
-      NAMES mysql_config
-      DOC "full path of mysql_config"
-      PATHS /usr/bin
-        /usr/local/bin
-        /opt/mysql/mysql/bin
-        /usr/local/mysql/bin
-    )
-  ENDIF (EXISTS "$ENV{MYSQL_DIR}/bin/mysql_config")
-ENDIF (NOT MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
- 
-
-IF(MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
-  MESSAGE(STATUS "mysql_config was found ${MYSQL_CONFIG_EXECUTABLE}")
-
-  EXECUTE_PROCESS(COMMAND ${MYSQL_CONFIG_EXECUTABLE} "--version"
-          OUTPUT_VARIABLE __MYSQL_VERSION
-          )
-
-  # Clean up so only numeric, in case of "-alpha" or similar
-  STRING(REGEX MATCHALL "([0-9]+.[0-9]+.[0-9]+)" MYSQL_VERSION "${__MYSQL_VERSION}")
-  # To create a fully numeric version, first normalize so N.NN.NN
-  STRING(REGEX REPLACE "[.]([0-9])[.]" ".0\\1." MYSQL_NUM_VERSION "${MYSQL_VERSION}")
-  STRING(REGEX REPLACE "[.]([0-9])$"   ".0\\1"  MYSQL_NUM_VERSION "${MYSQL_NUM_VERSION}")
-  # Finally remove the dot
-  STRING(REGEX REPLACE "[.]" "" MYSQL_NUM_VERSION "${MYSQL_NUM_VERSION}")
-
-  IF(MYSQL_CXX_LINKAGE OR MYSQL_NUM_VERSION GREATER 50603)
-    EXECUTE_PROCESS(COMMAND ${MYSQL_CONFIG_EXECUTABLE} "--cxxflags"
-            OUTPUT_VARIABLE _mysql_config_output
-            )
-    SET(MYSQL_CXX_LINKAGE 1)
-  ELSE (MYSQL_CXX_LINKAGE OR MYSQL_NUM_VERSION GREATER 50603)
-    EXECUTE_PROCESS(COMMAND ${MYSQL_CONFIG_EXECUTABLE} "--cflags"
-            OUTPUT_VARIABLE _mysql_config_output
-            )
-  ENDIF(MYSQL_CXX_LINKAGE OR MYSQL_NUM_VERSION GREATER 50603)
-
-  # Remove the stl4port dependency
-  STRING(REGEX REPLACE "-library=stlport4" "" _mysql_config_output "${_mysql_config_output}")
-
-  IF (NOT MYSQL_LINK_FLAGS)
-    STRING(REGEX MATCHALL "-m([^\r\n]+)" MYSQL_LINK_FLAGS "${_mysql_config_output}")
-  ENDIF (NOT MYSQL_LINK_FLAGS)
-  IF (NOT MYSQL_CXXFLAGS)
-    STRING(REGEX REPLACE "[\r\n]$" "" MYSQL_CXXFLAGS "${_mysql_config_output}")
-  ENDIF (NOT MYSQL_CXXFLAGS)
-#  ADD_DEFINITIONS("${MYSQL_CXXFLAGS}")
-ENDIF (MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
-
-
-#----------------- FIND MYSQL_INCLUDE_DIR -------------------
-IF(NOT MYSQL_INCLUDE_DIR AND MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
-  _MYSQL_CONFIG(MYSQL_INCLUDE_DIR "(^| )-I" "--include")
-ELSE(NOT MYSQL_INCLUDE_DIR AND MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
-  MESSAGE(STATUS "ENV{MYSQL_DIR} = $ENV{MYSQL_DIR}")
-  FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
-    ${MYSQL_INCLUDE_DIR}
-    $ENV{MYSQL_INCLUDE_DIR}
-    $ENV{MYSQL_DIR}/include
-    /usr/include/mysql
-    /usr/local/include/mysql
-    /opt/mysql/mysql/include
-    /opt/mysql/mysql/include/mysql
-    /usr/local/mysql/include
-    /usr/local/mysql/include/mysql
-    $ENV{ProgramFiles}/MySQL/*/include
-    $ENV{SystemDrive}/MySQL/*/include)
-ENDIF(NOT MYSQL_INCLUDE_DIR AND MYSQL_CONFIG_EXECUTABLE AND NOT WIN32)
 
+#-------------- FIND MYSQL_INCLUDE_DIR ------------------
+FIND_PATH(MYSQL_INCLUDE_DIR mysql.h
+		$ENV{MYSQL_INCLUDE_DIR}
+		$ENV{MYSQL_DIR}/include
+		/usr/include/mysql
+		/usr/local/include/mysql
+		/opt/mysql/mysql/include
+		/opt/mysql/mysql/include/mysql
+		/usr/local/mysql/include
+		/usr/local/mysql/include/mysql
+		$ENV{ProgramFiles}/MySQL/*/include
+		$ENV{SystemDrive}/MySQL/*/include)
 
 #----------------- FIND MYSQL_LIB_DIR -------------------
 IF (WIN32)
@@ -163,171 +51,73 @@
 		ADD_DEFINITIONS(-DDBUG_OFF)
 	ENDIF (CMAKE_BUILD_TYPE STREQUAL Debug)
 
-  FIND_LIBRARY(MYSQL_LIB 
-    NAMES 
-      ${MYSQLCLIENT_LIB_NAME}
-    PATHS
-      ${MYSQL_LIB_DIR}
-      ${MYSQL_LIB_DIR}/lib/${libsuffixDist}
-      ${MYSQL_LIB_DIR}/lib  #mysqlclient may be in lib for some c/c distros
-      ${MYSQL_LIB_DIR}/libmysql/${libsuffixBuild}
-      ${MYSQL_LIB_DIR}/client/${libsuffixBuild}
-      $ENV{MYSQL_LIB_DIR}
-      $ENV{MYSQL_LIB_DIR}/lib/${libsuffixDist}
-      $ENV{MYSQL_LIB_DIR}/lib  #mysqlclient may be in lib for some c/c distros
-      $ENV{MYSQL_LIB_DIR}/libmysql/${libsuffixBuild}
-      $ENV{MYSQL_LIB_DIR}/client/${libsuffixBuild}
-      $ENV{MYSQL_DIR}/lib/${libsuffixDist}
-      $ENV{MYSQL_DIR}/lib  #mysqlclient may be in lib for some c/c distros
-      $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
-      $ENV{MYSQL_DIR}/client/${libsuffixBuild}
-      $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
-      $ENV{ProgramFiles}/MySQL/*/lib
-      $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist}
-      $ENV{SystemDrive}/MySQL/*/lib)
-
-  SET(MYSQL_LIBRARIES ${MYSQL_LIB}) 
-  IF(MYSQL_LIB)
-    GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
-  ENDIF(MYSQL_LIB)
+	FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient
+				 PATHS
+				 $ENV{MYSQL_DIR}/lib/${libsuffixDist}
+				 $ENV{MYSQL_DIR}/lib
+				 $ENV{MYSQL_DIR}/libmysql
+				 $ENV{MYSQL_DIR}/lib
+				 $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+				 $ENV{MYSQL_DIR}/client/${libsuffixBuild}
+				 $ENV{MYSQL_DIR}/libmysql/${libsuffixBuild}
+				 $ENV{ProgramFiles}/MySQL/*/lib/${libsuffixDist}
+				 $ENV{ProgramFiles}/MySQL/*/lib
+				 $ENV{SystemDrive}/MySQL/*/lib/${libsuffixDist})
 ELSE (WIN32)
-  IF (NOT MYSQL_LIB_DIR AND MYSQL_CONFIG_EXECUTABLE)
-    # In MySQL Server 5.6.10 "mysql_config" outputs -lssl
-                 # -lcrypto dependencies even if (as it is with the
-    # Oracle built binaries) OpenSSL is linked statically
-    # to the client library and no reference is needed.
-    # We remove the OpenSSL libraries if -DREMOVE_OPENSSL_DEP
-    # is given
-    IF (REMOVE_OPENSSL_DEP)
-       LIST(REMOVE_ITEM MYSQL_LIBRARIES "ssl" "crypto")
-    ENDIF (REMOVE_OPENSSL_DEP)
- 
-    FIND_LIBRARY(MYSQL_LIB 
-      NAMES 
-        ${MYSQLCLIENT_LIB_NAME}
-      PATHS
-        ${MYSQL_LIB_DIR}
-        ${MYSQL_LIB_DIR}/libmysql_r/.libs
-        ${MYSQL_LIB_DIR}/lib
-        ${MYSQL_LIB_DIR}/lib/mysql
-        $ENV{MYSQL_LIB_DIR}
-        $ENV{MYSQL_LIB_DIR}/libmysql_r/.libs
-        $ENV{MYSQL_LIB_DIR}/lib
-        $ENV{MYSQL_LIB_DIR}/lib/mysql
-        $ENV{MYSQL_DIR}/libmysql_r/.libs
-        $ENV{MYSQL_DIR}/lib
-        $ENV{MYSQL_DIR}/lib/mysql
-        ${MYSQL_CLIB_DIR}
-        ${MYSQL_CLIB_DIR}/libmysql_r/.libs
-        ${MYSQL_CLIB_DIR}/lib
-        ${MYSQL_CLIB_DIR}/lib/mysql
-        /usr/lib/mysql
-        /usr/local/lib/mysql
-        /usr/local/mysql/lib
-        /usr/local/mysql/lib/mysql
-        /opt/mysql/mysql/lib
-        /opt/mysql/mysql/lib/mysql)
-   
-    IF (MYSQLCLIENT_STATIC_LINKING)
-      _MYSQL_CONFIG_REPLACE(MYSQL_LIBRARIES 
-             "(mysqlclient|mysqlclient_r)" "${MYSQL_LIB}" "(^| )-l" "--libs")
-    ELSE (MYSQLCLIENT_STATIC_LINKING)
-      _MYSQL_CONFIG(MYSQL_LIBRARIES "(^| )-l" "--libs")
-    ENDIF (MYSQLCLIENT_STATIC_LINKING)
-
-    _MYSQL_CONFIG(MYSQL_CLIB_DIR "(^| )-L" "--libs")
-
-    IF (NOT MYSQL_LIB_DIR)
-      SET(MYSQL_LIB_DIR ${MYSQL_CLIB_DIR}) 
-    ENDIF (NOT MYSQL_LIB_DIR)
-  ELSE (NOT MYSQL_LIB_DIR AND MYSQL_CONFIG_EXECUTABLE)
-    FIND_LIBRARY(MYSQL_LIB 
-      NAMES 
-        ${MYSQLCLIENT_LIB_NAME}
-      PATHS
-        ${MYSQL_LIB_DIR}
-        ${MYSQL_LIB_DIR}/libmysql_r/.libs
-        ${MYSQL_LIB_DIR}/lib
-        ${MYSQL_LIB_DIR}/lib/mysql
-        $ENV{MYSQL_LIB_DIR}
-        $ENV{MYSQL_LIB_DIR}/libmysql_r/.libs
-        $ENV{MYSQL_LIB_DIR}/lib
-        $ENV{MYSQL_LIB_DIR}/lib/mysql
-        $ENV{MYSQL_DIR}/libmysql_r/.libs
-        $ENV{MYSQL_DIR}/lib
-        $ENV{MYSQL_DIR}/lib/mysql
-        /usr/lib/mysql
-        /usr/local/lib/mysql
-        /usr/local/mysql/lib
-        /usr/local/mysql/lib/mysql
-        /opt/mysql/mysql/lib
-        /opt/mysql/mysql/lib/mysql)
-
-    SET(MYSQL_LIBRARIES ${MYSQL_LIB})
-    IF(MYSQL_LIB)
-      GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
-    ENDIF(MYSQL_LIB)
-  ENDIF (NOT MYSQL_LIB_DIR AND MYSQL_CONFIG_EXECUTABLE)
-
-  IF (MYSQLCLIENT_STATIC_LINKING AND
-      NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-    LIST(APPEND MYSQL_LIBRARIES "rt")
-  ENDIF ()
+	FIND_LIBRARY(MYSQL_LIB NAMES mysqlclient_r
+				 PATHS
+				 $ENV{MYSQL_DIR}/libmysql_r/.libs
+				 $ENV{MYSQL_DIR}/lib
+				 $ENV{MYSQL_DIR}/lib/mysql
+				 /usr/lib/mysql
+				 /usr/local/lib/mysql
+				 /usr/local/mysql/lib
+				 /usr/local/mysql/lib/mysql
+				 /opt/mysql/mysql/lib
+				 /opt/mysql/mysql/lib/mysql)
 ENDIF (WIN32)
 
-# Optionally add more libraries from the command line
-# using -DEXTRA_MYSQL_DEP=...
-IF (EXTRA_MYSQL_DEP)
-   LIST(APPEND MYSQL_LIBRARIES ${EXTRA_MYSQL_DEP})
-ENDIF (EXTRA_MYSQL_DEP)
-
-SET(MYSQL_CLIENT_LIBS ${MYSQL_LIBRARIES})
+IF(MYSQL_LIB)
+	GET_FILENAME_COMPONENT(MYSQL_LIB_DIR ${MYSQL_LIB} PATH)
+ENDIF(MYSQL_LIB)
 
-SET(VERBOSE 1)
 IF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
 	SET(MYSQL_FOUND TRUE)
 
-  MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR}")
-  MESSAGE(STATUS "MySQL Library    : ${MYSQL_LIBRARIES}")
-  MESSAGE(STATUS "MySQL Library dir: ${MYSQL_LIB_DIR}")
-  MESSAGE(STATUS "MySQL CXXFLAGS: ${MYSQL_CXXFLAGS}")
-  MESSAGE(STATUS "MySQL Link flags: ${MYSQL_LINK_FLAGS}")
-  
-  IF (MYSQL_VERSION)
-    MESSAGE(STATUS "MySQL Version: ${MYSQL_VERSION}")
-  ELSE (MYSQL_VERSION)
-    IF(WIN32)
-      #SET(CMAKE_REQUIRED_LIBRARIES ${MYSQL_LIB})
-    ELSE(WIN32)
-      INCLUDE(CheckFunctionExists)
-      INCLUDE(CheckLibraryExists)
-      # For now this works only on *nix
-      SET(CMAKE_REQUIRED_LIBRARIES ${MYSQL_LIBRARIES})
-      SET(CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR})
-      CHECK_FUNCTION_EXISTS("mysql_set_character_set" HAVE_SET_CHARSET)
-      CHECK_LIBRARY_EXISTS(mysqlclient "mysql_set_character_set" ${MYSQL_LIB_DIR} HAVE_SET_CHARSET_IN_LIB)
-      SET(CMAKE_REQUIRED_LIBRARIES)
-      SET(CMAKE_REQUIRED_INCLUDES)
-      IF (HAVE_SET_CHARSET OR HAVE_SET_CHARSET_IN_LIB)
-        MESSAGE(STATUS "libmysql version - ok")
-      ELSE (HAVE_SET_CHARSET OR HAVE_SET_CHARSET_IN_LIB)
-        MESSAGE(FATAL_ERROR "Versions < 4.1.13 (for MySQL 4.1.x) and < 5.0.7 for (MySQL 5.0.x) are not supported. Please update your libraries.")
-      ENDIF (HAVE_SET_CHARSET OR HAVE_SET_CHARSET_IN_LIB)
-    ENDIF(WIN32)
-  ENDIF(MYSQL_VERSION)
-
-  MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR}")
-  MESSAGE(STATUS "MySQL Library dir: ${MYSQL_LIB_DIR}")
-  MESSAGE(STATUS "MySQL CXXFLAGS: ${MYSQL_CXXFLAGS}")
-  MESSAGE(STATUS "MySQL Link flags: ${MYSQL_LINK_FLAGS}")
-
 	INCLUDE_DIRECTORIES(${MYSQL_INCLUDE_DIR})
 	LINK_DIRECTORIES(${MYSQL_LIB_DIR})
 
+	FIND_LIBRARY(MYSQL_ZLIB zlib PATHS ${MYSQL_LIB_DIR})
+	FIND_LIBRARY(MYSQL_YASSL yassl PATHS ${MYSQL_LIB_DIR})
+	FIND_LIBRARY(MYSQL_TAOCRYPT taocrypt PATHS ${MYSQL_LIB_DIR})
+	IF (WIN32)
+		SET(MYSQL_CLIENT_LIBS mysqlclient)
+	ELSE (WIN32)
+		SET(MYSQL_CLIENT_LIBS mysqlclient_r)
+	ENDIF (WIN32)
+	IF (MYSQL_ZLIB)
+		SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} zlib)
+	ENDIF (MYSQL_ZLIB)
+	IF (MYSQL_YASSL)
+		SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} yassl)
+	ENDIF (MYSQL_YASSL)
+	IF (MYSQL_TAOCRYPT)
+		SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} taocrypt)
+	ENDIF (MYSQL_TAOCRYPT)
+	IF (EXTRA_MYSQL_DEP)
+		SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ${EXTRA_MYSQL_DEP})
+	ENDIF (EXTRA_MYSQL_DEP)
+	# Added needed mysqlclient dependencies on Windows
+	IF (WIN32)
+		SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ws2_32)
+	ELSE (WIN32)
+		FIND_PACKAGE(Threads)
+		SET(MYSQL_CLIENT_LIBS ${MYSQL_CLIENT_LIBS} ${CMAKE_THREAD_LIBS_INIT})
+	ENDIF (WIN32)
+
+	MESSAGE(STATUS "MySQL Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
+	MESSAGE(STATUS "MySQL client libraries: ${MYSQL_CLIENT_LIBS}")
 ELSE (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
-  IF(NOT WIN32)
-    MESSAGE(SEND_ERROR "mysql_config wasn't found, -DMYSQL_CONFIG_EXECUTABLE=...")
-  ENDIF(NOT WIN32)
-  MESSAGE(FATAL_ERROR "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR} cxxflags: ${MYSQL_CXXFLAGS}")
+	MESSAGE(FATAL_ERROR "Cannot find MySQL. Include dir: ${MYSQL_INCLUDE_DIR}  library dir: ${MYSQL_LIB_DIR}")
 ENDIF (MYSQL_INCLUDE_DIR AND MYSQL_LIB_DIR)
 
diff -urNad mysql-connector-odbc-5.1.13-src/cmake/FindODBC.cmake mysql-connector-odbc-5.1.12-src/cmake/FindODBC.cmake
--- mysql-connector-odbc-5.1.13-src/cmake/FindODBC.cmake	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/cmake/FindODBC.cmake	2013-01-24 18:58:34.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # The MySQL Connector/ODBC is licensed under the terms of the GPLv2
 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -54,7 +54,6 @@
 IF(ODBC_LIB_DIR)
 
   SET(ODBC_LINK_FLAGS "-L${ODBC_LIB_DIR} -l${ODBCLIB} -l${ODBCINSTLIB}")
-  SET(ODBC_DRIVER_LINK_FLAGS "-L${ODBC_LIB_DIR} -l${ODBCINSTLIB}")
 
 ENDIF(ODBC_LIB_DIR)
 
diff -urNad mysql-connector-odbc-5.1.13-src/driver/CMakeLists.txt mysql-connector-odbc-5.1.12-src/driver/CMakeLists.txt
--- mysql-connector-odbc-5.1.13-src/driver/CMakeLists.txt	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/CMakeLists.txt	2013-01-24 18:58:34.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 # The MySQL Connector/ODBC is licensed under the terms of the GPLv2
 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -43,25 +43,10 @@
 INSTALL(TARGETS myodbc5 DESTINATION ${LIB_SUBDIR})
 
 IF(WIN32)
-  IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib/debug)
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib)
-  ELSEIF(CMAKE_BUILD_TYPE STREQUAL "")
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib/opt)
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib)
-  ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
-
-  IF (MYSQLCLIENT_STATIC_LINKING)
-    SET_TARGET_PROPERTIES(myodbc5 PROPERTIES
-      LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMTD /NODEFAULTLIB:LIBCMT"
-      LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
-      LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")
-  ENDIF (MYSQLCLIENT_STATIC_LINKING)
-
 	TARGET_LINK_LIBRARIES(myodbc5 myodbc3u
 				${MYSQL_CLIENT_LIBS} ${ODBCINSTLIB} ${SECURE32_LIB})
 ELSE(WIN32)
-	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ODBC_DRIVER_LINK_FLAGS}")
+	SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ODBC_LINK_FLAGS}")
 	TARGET_LINK_LIBRARIES(myodbc5 ${MYSQL_CLIENT_LIBS} ${CMAKE_THREAD_LIBS_INIT} m)
 	TARGET_LINK_LIBRARIES(myodbc5 myodbc3u)
 
@@ -73,12 +58,9 @@
 
 ENDIF(WIN32)
 
-IF (MYSQL_CXX_LINKAGE)
-  SET_TARGET_PROPERTIES(myodbc5 PROPERTIES 
-        LINKER_LANGUAGE CXX
-        COMPILE_FLAGS "${MYSQLODBCCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
-ENDIF (MYSQL_CXX_LINKAGE)
-
+IF(MYSQL_CXX_LINKAGE)
+  SET_TARGET_PROPERTIES(myodbc5 PROPERTIES LINKER_LANGUAGE CXX)
+ENDIF(MYSQL_CXX_LINKAGE)
 
 GET_TARGET_PROPERTY(DRIVER_LOCATION myodbc5 LOCATION)
 
diff -urNad mysql-connector-odbc-5.1.13-src/driver/ansi.c mysql-connector-odbc-5.1.12-src/driver/ansi.c
--- mysql-connector-odbc-5.1.13-src/driver/ansi.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/ansi.c	2013-01-24 18:58:34.000000000 +0200
@@ -563,13 +563,7 @@
     SQLINTEGER len= SQL_NTS;
     uint errors;
 
-    /* 
-      When SQLGetConnectAttr is called before connecting
-      dbc->ansi_charset_info and dbc->cxn_charset_info will be NULL,
-      so we can just copy the char_value as is.
-    */
-    if (dbc->ansi_charset_info && dbc->cxn_charset_info &&
-        dbc->ansi_charset_info->number != dbc->cxn_charset_info->number)
+    if (dbc->ansi_charset_info->number != dbc->cxn_charset_info->number)
     {
       char_value= sqlchar_as_sqlchar(dbc->cxn_charset_info,
                                      dbc->ansi_charset_info,
diff -urNad mysql-connector-odbc-5.1.13-src/driver/connect.c mysql-connector-odbc-5.1.12-src/driver/connect.c
--- mysql-connector-odbc-5.1.13-src/driver/connect.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/connect.c	2013-01-24 18:58:34.000000000 +0200
@@ -232,14 +232,7 @@
 #if MYSQL_VERSION_ID >= 50610
   if (ds->can_handle_exp_pwd)
   {
-    //mysql_options(mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, (char *)&on);
-  }
-#endif
-
-#if (MYSQL_VERSION_ID >= 50527 && MYSQL_VERSION_ID < 50600) || MYSQL_VERSION_ID >= 50607
-  if (ds->enable_cleartext_plugin)
-  {
-    mysql_options(mysql, MYSQL_ENABLE_CLEARTEXT_PLUGIN, (char *)&on);
+    mysql_options(mysql, MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS, (char *)&on);
   }
 #endif
 
@@ -520,16 +513,7 @@
    This also allows us to get pszDRIVER (if not already given).
   */
   if (ds->name)
-  {
-     ds_lookup(ds);
-    
-    /* 
-      If DSN is used:
-      1 - we want the connection string options to override DSN options
-      2 - no need to check for parsing erros as it was done before
-    */
-    ds_from_kvpair(ds, szConnStrIn, (SQLWCHAR)';');
-  }
+    ds_lookup(ds);
 #endif
 
   /* If FLAG_NO_PROMPT is not set, force prompting off. */
diff -urNad mysql-connector-odbc-5.1.13-src/driver/driver.c mysql-connector-odbc-5.1.12-src/driver/driver.c
--- mysql-connector-odbc-5.1.13-src/driver/driver.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/driver.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2001, 2007 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/driver/driver.h mysql-connector-odbc-5.1.12-src/driver/driver.h
--- mysql-connector-odbc-5.1.13-src/driver/driver.h	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/driver.h	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -132,10 +132,6 @@
 # define ER_MUST_CHANGE_PASSWORD_LOGIN 1820
 #endif
 
-#ifndef CR_AUTH_PLUGIN_CANNOT_LOAD_ERROR
-# define CR_AUTH_PLUGIN_CANNOT_LOAD_ERROR 2059
-#endif
-
 /* Connection flags to validate after the connection*/
 #define CHECK_AUTOCOMMIT_ON	1  /* AUTOCOMMIT_ON */
 #define CHECK_AUTOCOMMIT_OFF	2  /* AUTOCOMMIT_OFF */
@@ -239,9 +235,6 @@
     /* connection we were allocated on */
     struct tagDBC *dbc;
   } exp;
-#ifdef THREAD
-  pthread_mutex_t lock;
-#endif
 } DESC;
 
 /* descriptor record */
@@ -332,9 +325,7 @@
   SQLINTEGER   odbc_ver;
   LIST	       *connections;
   MYERROR      error;
-#ifdef THREAD
-  pthread_mutex_t lock;
-#endif
+
 } ENV;
 
 
diff -urNad mysql-connector-odbc-5.1.13-src/driver/error.c mysql-connector-odbc-5.1.12-src/driver/error.c
--- mysql-connector-odbc-5.1.13-src/driver/error.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/error.c	2013-01-24 18:58:34.000000000 +0200
@@ -272,7 +272,6 @@
             state= "08S01";
             break;
         case ER_MUST_CHANGE_PASSWORD_LOGIN:
-        case CR_AUTH_PLUGIN_CANNOT_LOAD_ERROR:
             state= "08004"; /* Server rejected the connection */
                             /* The data source rejected the establishment of the
                                connection for implementation-defined reasons. */
diff -urNad mysql-connector-odbc-5.1.13-src/driver/execute.c mysql-connector-odbc-5.1.12-src/driver/execute.c
--- mysql-connector-odbc-5.1.13-src/driver/execute.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/execute.c	2013-01-24 18:58:34.000000000 +0200
@@ -564,28 +564,8 @@
 
                 if (time->fraction)
                 {
-                  char *tmp_buf= buff + length;
-
-                  /* Start cleaning from the end */
-                  int tmp_pos= 9;
-
-                  sprintf(tmp_buf, ".%09d", time->fraction);
-
-                  /*
-                    ODBC specification defines nanoseconds granularity for
-                    the fractional part of seconds. MySQL only supports 
-                    microseconds for TIMESTAMP, TIME and DATETIME.
-
-                    We are trying to remove the trailing zeros because this 
-                    does not really modify the data, but often helps to substitute
-                    9 digits with only 6.
-                  */
-                  while (tmp_pos && tmp_buf[tmp_pos] == '0')
-                  {
-                    tmp_buf[tmp_pos--]= 0;
-                  }
-
-                  length+= tmp_pos + 1;
+                  sprintf(buff + length, ".%09d", time->fraction);
+                  length+= 10;
                 }
 
                 data= buff;
@@ -741,35 +721,19 @@
             {
                 char *to= buff, *from= data;
                 char *end= from+length;
-                char *local_thousands_sep= thousands_sep;
-                char *local_decimal_point= decimal_point;
-                uint local_thousands_sep_length= thousands_sep_length;
-                uint local_decimal_point_length= decimal_point_length;
-
-                if (!stmt->dbc->ds->dont_use_set_locale)
-                {
-                  /* force use of . as decimal point */
-                  local_thousands_sep= ",";
-                  local_thousands_sep_length= 1;
-                  local_decimal_point= ".";
-                  local_decimal_point_length= 1;
-                }
-
                 while ( *from && from < end )
                 {
-                  if ( from[0] == local_thousands_sep[0] && is_prefix(from,local_thousands_sep) )
-                  {
-                    from+= local_thousands_sep_length;
-                  }
-                  else if ( from[0] == local_decimal_point[0] && is_prefix(from,local_decimal_point) )
-                  {
-                    from+= local_decimal_point_length;
-                    *to++='.';
-                  }
-                  else
-                  {
-                *to++= *from++;
-                  }
+                  /* I wonder if following code really respects dont_use_set_locale
+                     and if it does, then how? */
+                    if ( from[0] == thousands_sep[0] && is_prefix(from,thousands_sep) )
+                        from+= thousands_sep_length;
+                    else if ( from[0] == decimal_point[0] && is_prefix(from,decimal_point) )
+                    {
+                        from+= decimal_point_length;
+                        *to++='.';
+                    }
+                    else
+                        *to++= *from++;
                 }
                 if ( to == buff )
                     *to++='0';    /* Fix for empty strings */
diff -urNad mysql-connector-odbc-5.1.13-src/driver/handle.c mysql-connector-odbc-5.1.12-src/driver/handle.c
--- mysql-connector-odbc-5.1.13-src/driver/handle.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/handle.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -62,7 +62,6 @@
 
 SQLRETURN SQL_API my_SQLAllocEnv(SQLHENV FAR *phenv)
 {
-  ENV FAR **env= (ENV FAR**) phenv;
 #ifdef _UNIX_
   /* Init thread key just once for all threads */
   pthread_once(&myodbc_thread_key_inited, myodbc_thread_key_create);
@@ -86,7 +85,7 @@
         return SQL_ERROR;
     }
 #endif /* _UNIX_ */
-    pthread_mutex_init(&(*env)->lock,NULL);
+
     return SQL_SUCCESS;
 }
 
@@ -122,8 +121,6 @@
 
 SQLRETURN SQL_API my_SQLFreeEnv(SQLHENV henv)
 {
-    ENV FAR *env= (ENV FAR*) henv;
-    pthread_mutex_destroy(&env->lock);
 #ifndef _UNIX_
     GlobalUnlock(GlobalHandle((HGLOBAL) henv));
     GlobalFree(GlobalHandle((HGLOBAL) henv));
@@ -248,9 +245,7 @@
     dbc->last_query_time= (time_t) time((time_t*) 0);
     dbc->txn_isolation= DEFAULT_TXN_ISOLATION;
     dbc->env= penv;
-    pthread_mutex_lock(&penv->lock);
     penv->connections= list_add(penv->connections,&dbc->list);
-    pthread_mutex_unlock(&penv->lock);
     dbc->list.data= dbc;
     dbc->unicode= 0;
     dbc->ansi_charset_info= dbc->cxn_charset_info= NULL;
@@ -288,9 +283,7 @@
     LIST *ldesc;
     LIST *next;
 
-    pthread_mutex_lock(&dbc->env->lock);
     dbc->env->connections= list_delete(dbc->env->connections,&dbc->list);
-    pthread_mutex_unlock(&dbc->env->lock);
     x_free(dbc->database);
     if (dbc->ds)
       ds_delete(dbc->ds);
@@ -511,10 +504,8 @@
     }
     else
     {
-      if(stmt->result && stmt->result->field_alloc.pre_alloc)
-      {
+      if(stmt->result->field_alloc.pre_alloc)
         free_root(&stmt->result->field_alloc, MYF(0));
-      }
 
       x_free(stmt->result);
     }
@@ -618,14 +609,11 @@
     return set_dbc_error(dbc, "HY001", "Memory allocation error", MYERR_S1001);
 
   desc->exp.dbc= dbc;
-  pthread_mutex_init(&desc->lock, NULL);
 
   /* add to this connection's list of explicit descriptors */
   e= (LIST *) my_malloc(sizeof(LIST), MYF(0));
   e->data= desc;
-  pthread_mutex_lock(&dbc->lock);
   dbc->exp_desc= list_add(dbc->exp_desc, e);
-  pthread_mutex_unlock(&dbc->lock);
 
   *pdesc= desc;
   return SQL_SUCCESS;
@@ -655,9 +643,7 @@
   {
     if (ldesc->data == desc)
     {
-      pthread_mutex_lock(&dbc->lock);
       dbc->exp_desc= list_delete(dbc->exp_desc, ldesc);
-      pthread_mutex_unlock(&dbc->lock);
       x_free(ldesc);
       break;
     }
@@ -675,7 +661,6 @@
     x_free(lstmt);
   }
 
-  pthread_mutex_destroy(&desc->lock);
   desc_free(desc);
   return SQL_SUCCESS;
 }
diff -urNad mysql-connector-odbc-5.1.13-src/driver/options.c mysql-connector-odbc-5.1.12-src/driver/options.c
--- mysql-connector-odbc-5.1.13-src/driver/options.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/options.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -434,15 +434,9 @@
       return set_handle_error(SQL_HANDLE_DBC, hdbc, MYERR_S1000,
                               "Unable to get current catalog", 0);
     }
-    else if (is_connected(dbc))
-    {
-      *char_attr= (SQLCHAR *)(dbc->database ? dbc->database : "null");
-    }
     else
     {
-      return set_handle_error(SQL_HANDLE_DBC, hdbc, MYERR_S1C00,
-                              "Getting catalog name is not supported "\
-                              "before connection is established", 0);
+      *char_attr= (SQLCHAR *)(dbc->database ? dbc->database : "null");
     }
     break;
 
@@ -608,9 +602,7 @@
                 /* otherwise, associate this statement with the desc */
                 LIST *e= (LIST *) my_malloc(sizeof(LIST), MYF(0));
                 e->data= stmt;
-                pthread_mutex_lock(&desc->lock);
                 desc->exp.stmts= list_add(desc->exp.stmts, e);
-                pthread_mutex_unlock(&desc->lock);
               }
 
               desc->desc_type= desc_type;
diff -urNad mysql-connector-odbc-5.1.13-src/driver/transact.c mysql-connector-odbc-5.1.12-src/driver/transact.c
--- mysql-connector-odbc-5.1.13-src/driver/transact.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/transact.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2000, 2007 MySQL AB, 2009, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -104,12 +105,10 @@
   switch (HandleType) {
   case SQL_HANDLE_ENV:
     henv= (ENV *)Handle;
-    pthread_mutex_lock(&henv->lock);
     for (current= henv->connections; current; current= current->next)
     {
         my_transact((DBC *)current->data, CompletionType);
     }
-    pthread_mutex_unlock(&henv->lock);
     break;
 
   case SQL_HANDLE_DBC:
diff -urNad mysql-connector-odbc-5.1.13-src/driver/unicode.c mysql-connector-odbc-5.1.12-src/driver/unicode.c
--- mysql-connector-odbc-5.1.13-src/driver/unicode.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/unicode.c	2013-01-24 18:58:34.000000000 +0200
@@ -428,20 +428,8 @@
     SQLWCHAR *wvalue;
     SQLINTEGER len= SQL_NTS;
     uint errors;
-    CHARSET_INFO *result_charset_info= dbc->cxn_charset_info;
-
-    /* 
-      When SQLGetConnectAttr is called before connecting the connection
-      is not established yet and its charset is unknown. We assume UTF8
-      as the most suitable charset for the string result.
-    */
-    if(!dbc->cxn_charset_info)
-    {
-      result_charset_info= get_charset_by_csname("utf8", MYF(MY_CS_PRIMARY),
-                                                 MYF(0));
-    }
 
-    wvalue= sqlchar_as_sqlwchar(result_charset_info, char_value,
+    wvalue= sqlchar_as_sqlwchar(dbc->cxn_charset_info, char_value,
                                 &len, &errors);
 
     /* value_max is in bytes, we want it in chars. */
diff -urNad mysql-connector-odbc-5.1.13-src/driver/utility.c mysql-connector-odbc-5.1.12-src/driver/utility.c
--- mysql-connector-odbc-5.1.13-src/driver/utility.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/driver/utility.c	2013-01-24 18:58:34.000000000 +0200
@@ -2275,13 +2275,7 @@
 {
     if ( log_file && query )
     {
-      /*
-        because of bug 68201 we bring the result of time() call
-        to 64-bits in any case
-      */
-      long long time_now= time(NULL);
-
-      fprintf(log_file, "%lld:%s;\n", time_now, query);
+      fprintf(log_file, "%lld:%s;\n", time(NULL), query);
     }
 }
 
diff -urNad mysql-connector-odbc-5.1.13-src/installer/CMakeLists.txt mysql-connector-odbc-5.1.12-src/installer/CMakeLists.txt
--- mysql-connector-odbc-5.1.13-src/installer/CMakeLists.txt	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/installer/CMakeLists.txt	2013-01-24 18:58:34.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # The MySQL Connector/ODBC is licensed under the terms of the GPLv2
 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -32,36 +32,15 @@
 ADD_EXECUTABLE(myodbc-installer myodbc3i.c)
 
 IF(WIN32)
-  IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib/debug)
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib)
-  ELSEIF(CMAKE_BUILD_TYPE STREQUAL "")
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib/opt)
-    LINK_DIRECTORIES(${MYSQL_DIR}/lib)
-  ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
-
   TARGET_LINK_LIBRARIES(myodbc-installer myodbc3u ${ODBCLIB} ${ODBCINSTLIB}
       ${MYSQL_CLIENT_LIBS})
-  IF (MYSQLCLIENT_STATIC_LINKING)
-    SET_TARGET_PROPERTIES(myodbc-installer PROPERTIES
-      LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT"
-      LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
-      LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")
-  ENDIF (MYSQLCLIENT_STATIC_LINKING)
-  SET_TARGET_PROPERTIES(myodbc-installer PROPERTIES 
-        LINK_FLAGS "${MYSQLODBCCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}")
 ELSE(WIN32)
   SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ODBC_LINK_FLAGS}")
-  TARGET_LINK_LIBRARIES(myodbc-installer myodbc3u  
-      ${ODBC_LINK_FLAGS} ${MYSQL_CLIENT_LIBS} ${CMAKE_THREAD_LIBS_INIT} m)
-  SET_TARGET_PROPERTIES(myodbc-installer PROPERTIES 
-        LINK_FLAGS "${MYSQLODBCCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}")
+  TARGET_LINK_LIBRARIES(myodbc-installer myodbc3u ${MYSQL_CLIENT_LIBS} ${CMAKE_THREAD_LIBS_INIT} m)
 ENDIF(WIN32)
 
 IF(MYSQL_CXX_LINKAGE)
-  SET_TARGET_PROPERTIES(myodbc-installer PROPERTIES 
-        LINKER_LANGUAGE CXX
-        COMPILE_FLAGS "${MYSQLODBCCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
+  SET_TARGET_PROPERTIES(myodbc-installer PROPERTIES LINKER_LANGUAGE CXX)
 ENDIF(MYSQL_CXX_LINKAGE)
 
 INSTALL(TARGETS myodbc-installer DESTINATION bin)
diff -urNad mysql-connector-odbc-5.1.13-src/scripts/macosx/postflight.in mysql-connector-odbc-5.1.12-src/scripts/macosx/postflight.in
--- mysql-connector-odbc-5.1.13-src/scripts/macosx/postflight.in	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/scripts/macosx/postflight.in	1970-01-01 02:00:00.000000000 +0200
@@ -1,105 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
-#
-# The MySQL Connector/ODBC is licensed under the terms of the GPLv2
-# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 
-# MySQL Connectors. There are special exceptions to the terms and 
-# conditions of the GPLv2 as it is applied to this software, see the 
-# FLOSS License Exception
-# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
-#
-# This program is free software; you can redistribute it and/or modify 
-# it under the terms of the GNU General Public License as published 
-# by the Free Software Foundation; version 2 of the License.
-#
-# This program 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 General Public License
-# for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
-
-##############################################################################
-#
-#  Post Install file for MySQL Connector ODBC @CONNECTOR_MAJOR@.@CONNECTOR_MINOR@
-#
-##############################################################################
-
-# ----------------------------------------------------------------------
-# ENSURE WE HAVE INI FILES
-#
-# Upon a fresh install of OS X these files do not exist. The ODBC Installer
-# library calls should create these files for us when we do stuff like
-# request to register a driver but this does not seem to happen and the
-# request fails. So we we start by making sure we have some, mostly, empty
-# ini files in place before we make installer calls.
-#
-# Also note that there are many places where these ini files *could* go
-# based upon the search algorithm in the default ODBC system or any other
-# ODBC system which may get installed. We choose the following because they
-# seem to be the ones created when we use the standard ODBC Administrator
-# application.
-# ----------------------------------------------------------------------
-
-libdir=/usr/local/lib
-bindir=/usr/local/bin
-
-for admdir in ~/Library/ODBC /Library/ODBC
-do
-  echo "Ensuring $admdir, odbcinst.ini and odbc.ini exists..."
-  if [ ! -d $admdir ] ; then
-      mkdir $admdir
-      chmod 775 $admdir
-      chown root:admin $admdir
-  fi
-
-  if [ ! -f $admdir/odbc.ini ] ; then
-      echo "[ODBC Data Sources]"        > $admdir/odbc.ini
-      echo ""                          >> $admdir/odbc.ini
-      echo "[ODBC]"                    >> $admdir/odbc.ini
-      echo "Trace         = 0"         >> $admdir/odbc.ini
-      echo "TraceAutoStop = 0"         >> $admdir/odbc.ini
-      echo "TraceFile     ="           >> $admdir/odbc.ini
-      echo "TraceLibrary  ="           >> $admdir/odbc.ini
-      chmod 664 $admdir/odbc.ini
-      chown root:admin $admdir/odbc.ini
-  fi
-
-  if [ ! -f $admdir/odbcinst.ini ] ; then
-      echo "[ODBC Drivers]"             > $admdir/odbcinst.ini
-      echo ""                          >> $admdir/odbcinst.ini
-      echo "[ODBC Connection Pooling]" >> $admdir/odbcinst.ini
-      echo "PerfMon    = 0"            >> $admdir/odbcinst.ini
-      echo "Retry Wait = "             >> $admdir/odbcinst.ini
-      chmod 664 $admdir/odbcinst.ini
-      chown root:admin $admdir/odbcinst.ini
-  fi
-done
-
-# ----------------------------------------------------------------------
-# SET USER PERMISSIONS
-#
-# Note that if the Mac OS X "ODBC Administrator" is run before this
-# script, and unlocked (root rights), it would save files in the user
-# area with root permissions, causing trouble later when trying to
-# change user settings without unlocking (root rights).
-# ----------------------------------------------------------------------
-if [ "$USER" -a "$GROUPS" ] ; then
-    chown -R $USER:$GROUPS ~/Library/ODBC
-fi
-
-# ----------------------------------------------------------------------
-# REGISTER THE DRIVER
-# ----------------------------------------------------------------------
-echo "Registering driver..."
-#$bindir/myodbc-installer -a -d -n "MySQL ODBC @CONNECTOR_MAJOR@.@CONNECTOR_MINOR@ Driver" -t "Driver=$libdir/libmyodbc5.so;Setup=$libdir/libmyodbc3S.so;"
-$bindir/myodbc-installer -a -d -n "MySQL ODBC @CONNECTOR_MAJOR@.@CONNECTOR_MINOR@ Driver" -t "Driver=$libdir/libmyodbc5.so;"
-
-# ----------------------------------------------------------------------
-# CREATE A SAMPLE DSN
-# ----------------------------------------------------------------------
-echo "Ensuring sample data source name (myodbc) exists..."
-$bindir/myodbc-installer -a -s -n myodbc -t "Driver=MySQL ODBC @CONNECTOR_MAJOR@.@CONNECTOR_MINOR@ Driver;SERVER=localhost;"
diff -urNad mysql-connector-odbc-5.1.13-src/scripts/macosx/postflight.in.cmake mysql-connector-odbc-5.1.12-src/scripts/macosx/postflight.in.cmake
--- mysql-connector-odbc-5.1.13-src/scripts/macosx/postflight.in.cmake	1970-01-01 02:00:00.000000000 +0200
+++ mysql-connector-odbc-5.1.12-src/scripts/macosx/postflight.in.cmake	2013-01-24 18:58:34.000000000 +0200
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# The MySQL Connector/ODBC is licensed under the terms of the GPLv2
+# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most 
+# MySQL Connectors. There are special exceptions to the terms and 
+# conditions of the GPLv2 as it is applied to this software, see the 
+# FLOSS License Exception
+# <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
+#
+# This program is free software; you can redistribute it and/or modify 
+# it under the terms of the GNU General Public License as published 
+# by the Free Software Foundation; version 2 of the License.
+#
+# This program 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 General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
+
+##############################################################################
+#
+#  Post Install file for MySQL Connector ODBC 5.1
+#
+##############################################################################
+
+# ----------------------------------------------------------------------
+# ENSURE WE HAVE INI FILES
+#
+# Upon a fresh install of OS X these files do not exist. The ODBC Installer
+# library calls should create these files for us when we do stuff like
+# request to register a driver but this does not seem to happen and the
+# request fails. So we we start by making sure we have some, mostly, empty
+# ini files in place before we make installer calls.
+#
+# Also note that there are many places where these ini files *could* go
+# based upon the search algorithm in the default ODBC system or any other
+# ODBC system which may get installed. We choose the following because they
+# seem to be the ones created when we use the standard ODBC Administrator
+# application.
+# ----------------------------------------------------------------------
+
+libdir=/usr/local/lib
+bindir=/usr/local/bin
+
+for admdir in ~/Library/ODBC /Library/ODBC
+do
+  echo "Ensuring $admdir, odbcinst.ini and odbc.ini exists..."
+  if [ ! -d $admdir ] ; then
+      mkdir $admdir
+      chmod 775 $admdir
+      chown root:admin $admdir
+  fi
+
+  if [ ! -f $admdir/odbc.ini ] ; then
+      echo "[ODBC Data Sources]"        > $admdir/odbc.ini
+      echo ""                          >> $admdir/odbc.ini
+      echo "[ODBC]"                    >> $admdir/odbc.ini
+      echo "Trace         = 0"         >> $admdir/odbc.ini
+      echo "TraceAutoStop = 0"         >> $admdir/odbc.ini
+      echo "TraceFile     ="           >> $admdir/odbc.ini
+      echo "TraceLibrary  ="           >> $admdir/odbc.ini
+      chmod 664 $admdir/odbc.ini
+      chown root:admin $admdir/odbc.ini
+  fi
+
+  if [ ! -f $admdir/odbcinst.ini ] ; then
+      echo "[ODBC Drivers]"             > $admdir/odbcinst.ini
+      echo ""                          >> $admdir/odbcinst.ini
+      echo "[ODBC Connection Pooling]" >> $admdir/odbcinst.ini
+      echo "PerfMon    = 0"            >> $admdir/odbcinst.ini
+      echo "Retry Wait = "             >> $admdir/odbcinst.ini
+      chmod 664 $admdir/odbcinst.ini
+      chown root:admin $admdir/odbcinst.ini
+  fi
+done
+
+# ----------------------------------------------------------------------
+# SET USER PERMISSIONS
+#
+# Note that if the Mac OS X "ODBC Administrator" is run before this
+# script, and unlocked (root rights), it would save files in the user
+# area with root permissions, causing trouble later when trying to
+# change user settings without unlocking (root rights).
+# ----------------------------------------------------------------------
+if [ "$USER" -a "$GROUPS" ] ; then
+    chown -R $USER:$GROUPS ~/Library/ODBC
+fi
+
+# ----------------------------------------------------------------------
+# REGISTER THE DRIVER
+# ----------------------------------------------------------------------
+echo "Registering driver..."
+#$bindir/myodbc-installer -a -d -n "MySQL ODBC 5.1 Driver" -t "Driver=$libdir/libmyodbc5.so;Setup=$libdir/libmyodbc3S.so;"
+$bindir/myodbc-installer -a -d -n "MySQL ODBC 5.1 Driver" -t "Driver=$libdir/libmyodbc5.so;"
+
+# ----------------------------------------------------------------------
+# CREATE A SAMPLE DSN
+# ----------------------------------------------------------------------
+echo "Ensuring sample data source name (myodbc) exists..."
+$bindir/myodbc-installer -a -s -n myodbc -t "Driver=MySQL ODBC 5.1 Driver;SERVER=localhost;"
diff -urNad mysql-connector-odbc-5.1.13-src/setupgui/CMakeLists.txt mysql-connector-odbc-5.1.12-src/setupgui/CMakeLists.txt
--- mysql-connector-odbc-5.1.13-src/setupgui/CMakeLists.txt	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/setupgui/CMakeLists.txt	2013-01-24 18:58:34.000000000 +0200
@@ -57,17 +57,6 @@
                       myodbc3u ${ODBCLIB} ${ODBCINSTLIB} ${MYSQL_CLIENT_LIBS}
                       ${PLATFORM_LIBS})
 
-IF (WIN32)
-  IF (MYSQLCLIENT_STATIC_LINKING)
-    SET_TARGET_PROPERTIES(myodbc5S PROPERTIES
-      LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT"
-      LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
-      LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")
-  ENDIF (MYSQLCLIENT_STATIC_LINKING)
-ENDIF (WIN32)
-
 IF(MYSQL_CXX_LINKAGE)
-  SET_TARGET_PROPERTIES(myodbc5S PROPERTIES 
-        LINKER_LANGUAGE CXX
-        COMPILE_FLAGS "${MYSQLODBCCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
+  SET_TARGET_PROPERTIES(myodbc5S PROPERTIES LINKER_LANGUAGE CXX)
 ENDIF(MYSQL_CXX_LINKAGE)
diff -urNad mysql-connector-odbc-5.1.13-src/setupgui/windows/odbcdialogparams.cpp mysql-connector-odbc-5.1.12-src/setupgui/windows/odbcdialogparams.cpp
--- mysql-connector-odbc-5.1.13-src/setupgui/windows/odbcdialogparams.cpp	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/setupgui/windows/odbcdialogparams.cpp	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -314,7 +314,6 @@
   GET_BOOL(CONNECTION_TAB, allow_multiple_statements);
   GET_BOOL(CONNECTION_TAB, clientinteractive);
   GET_BOOL(CONNECTION_TAB, can_handle_exp_pwd);
-  GET_BOOL(CONNECTION_TAB, enable_cleartext_plugin);
 
   getStrFieldData(&params.charset , CONNECTION_TAB, IDC_EDIT_charset);
   getStrFieldData(&params.initstmt, CONNECTION_TAB, IDC_EDIT_initstmt);
@@ -381,7 +380,6 @@
   SET_BOOL(CONNECTION_TAB, allow_multiple_statements);
   SET_BOOL(CONNECTION_TAB, clientinteractive);
   SET_BOOL(CONNECTION_TAB, can_handle_exp_pwd);
-  SET_BOOL(CONNECTION_TAB, enable_cleartext_plugin);
 
   if ( TabCtrl_1.hTabPages[CONNECTION_TAB-1])
   {
diff -urNad mysql-connector-odbc-5.1.13-src/setupgui/windows/odbcdialogparams.rc mysql-connector-odbc-5.1.12-src/setupgui/windows/odbcdialogparams.rc
--- mysql-connector-odbc-5.1.13-src/setupgui/windows/odbcdialogparams.rc	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/setupgui/windows/odbcdialogparams.rc	2013-01-24 18:58:34.000000000 +0200
@@ -145,8 +145,6 @@
 // Second Column
     CONTROL         "Can Handle Expired Password",IDC_CHECK_can_handle_exp_pwd
                     "Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,12,113,10
-    CONTROL         "Enable Cleartext Authentication",IDC_CHECK_enable_cleartext_plugin
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,125,27,113,10
 
 END
 
diff -urNad mysql-connector-odbc-5.1.13-src/setupgui/windows/resource.h mysql-connector-odbc-5.1.12-src/setupgui/windows/resource.h
--- mysql-connector-odbc-5.1.13-src/setupgui/windows/resource.h	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/setupgui/windows/resource.h	2013-01-24 18:58:34.000000000 +0200
@@ -120,7 +120,6 @@
 #define IDC_CHECK_cursor_prefetch_number 10045
 #define IDC_EDIT_cursor_prefetch_number 10046
 #define IDC_CHECK_can_handle_exp_pwd    10047
-#define IDC_CHECK_enable_cleartext_plugin 10048
 #define IDC_BUTTON_TEST                 11014
 #define IDC_BUTTON_HELP                 11015
 #define IDC_STATIC                      -1
diff -urNad mysql-connector-odbc-5.1.13-src/test/CMakeLists.txt mysql-connector-odbc-5.1.12-src/test/CMakeLists.txt
--- mysql-connector-odbc-5.1.13-src/test/CMakeLists.txt	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/CMakeLists.txt	2013-01-24 18:58:34.000000000 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 #
 # The MySQL Connector/ODBC is licensed under the terms of the GPLv2
 # <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -38,33 +38,16 @@
   SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ODBC_LINK_FLAGS}")
 ENDIF(NOT WIN32)
 
-FOREACH(T my_basics my_blob my_bulk my_catalog1 my_catalog2 my_crash my_curext my_cursor
+FOREACH(T my_basics my_blob my_bulk my_catalog1 my_catalog2 my_curext my_cursor
 		my_datetime my_desc my_dyn_cursor my_error my_info my_keys my_param
-		my_prepare my_relative my_result1 my_result2 my_scroll my_setup my_tran
+		my_prepare my_relative my_result1 my_result2 my_scroll my_tran
 		my_types my_unicode my_unixodbc my_use_result my_bug13766)
 	ADD_EXECUTABLE(${T} ${T}.c)
 
-  IF(MYSQL_CXX_LINKAGE)
-    SET_TARGET_PROPERTIES(${T} PROPERTIES 
-          LINKER_LANGUAGE CXX
-          LINK_FLAGS "${MYSQLODBCCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}"
-          COMPILE_FLAGS "${MYSQLODBCCONN_COMPILE_FLAGS_ENV} ${MYSQL_CXXFLAGS}")
-  ENDIF(MYSQL_CXX_LINKAGE)
-
-  INSTALL(TARGETS ${T} DESTINATION test COMPONENT tests)
-  SET_TARGET_PROPERTIES(${T} PROPERTIES 
-      LINK_FLAGS "${MYSQLODBCCONN_LINK_FLAGS_ENV} ${MYSQL_LINK_FLAGS}")
+    INSTALL(TARGETS ${T} DESTINATION test COMPONENT tests)
 
 	IF(WIN32)
-    IF (MYSQLCLIENT_STATIC_LINKING)
-      SET_TARGET_PROPERTIES(${T} PROPERTIES
-        LINK_FLAGS_DEBUG "/NODEFAULTLIB:LIBCMT"
-        LINK_FLAGS_RELWITHDEBINFO "/NODEFAULTLIB:LIBCMT"
-        LINK_FLAGS_RELEASE "/NODEFAULTLIB:LIBCMT")
-    ENDIF (MYSQLCLIENT_STATIC_LINKING)
 	  TARGET_LINK_LIBRARIES(${T} ${ODBCLIB} ${ODBCINSTLIB})
-  ELSE(WIN32)
-    TARGET_LINK_LIBRARIES(${T} ${ODBC_LINK_FLAGS} ${ODBCINSTLIB})
 	ENDIF(WIN32)
 	
 	ADD_TEST(${T} ${T})
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_basics.c mysql-connector-odbc-5.1.12-src/test/my_basics.c
--- mysql-connector-odbc-5.1.13-src/test/my_basics.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_basics.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -1129,126 +1129,6 @@
 }
 
 
-/*
-  Bug#45378 - Crash in SQLSetConnectAttr
-*/
-DECLARE_TEST(t_bug63844)
-{
-  SQLHDBC hdbc1;
-  SQLCHAR *DatabaseName = mydb;
-
-  /* 
-    We are not going to use alloc_basic_handles() for a special purpose:
-    SQLSetConnectAttr() is to be called before the connection is made
-  */  
-  ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1));
-
-  ok_con(hdbc1, SQLSetConnectAttr(hdbc1, SQL_ATTR_CURRENT_CATALOG,
-                                  DatabaseName, strlen(DatabaseName)));
-
-  /* The driver crashes here on getting connected */
-  ok_con(hdbc1, get_connection(&hdbc1, NULL, NULL, NULL, NULL, NULL));
-
-  ok_con(hdbc1, SQLDisconnect(hdbc1));
-  ok_con(hdbc1, SQLFreeConnect(hdbc1));
-
-  return OK;
-}
-
-
-/*
-  Bug#52996 - DSN connection parameters override those specified in the 
-  connection string
-*/
-DECLARE_TEST(t_bug52996)
-{
-  int res= OK;
-
-  /* TODO: remove #ifdef _WIN32 when Linux and MacOS setup is released */
-#ifdef _WIN32
-  int i, len;
-  SQLCHAR attrs[8192];
-  SQLCHAR drv[128];
-  SQLINTEGER row_count= 0;
-  DECLARE_BASIC_HANDLES(henv1, hdbc1, hstmt1);
-
-  ok_sql(hstmt, "DROP TABLE IF EXISTS bug52996");
-  ok_sql(hstmt, "CREATE TABLE bug52996 (id int primary key, c1 int)");
-  ok_sql(hstmt, "INSERT INTO bug52996 (id, c1) VALUES "\
-                 "(1,1),(2,2),(3,3)");
-
-  /* 
-    Use ';' as separator because sprintf doesn't work after '\0'
-    The last attribute in the list must end with ';'
-  */
-
-  sprintf((char*)attrs, "DSN=bug52996dsn;SERVER=%s;USER=%s;PASSWORD=%s;"
-                          "DATABASE=%s;FOUND_ROWS=1;",
-                          myserver, myuid, mypwd, mydb);
-
-  len= strlen(attrs);
-  
-  /* replacing ';' by '\0' */
-  for (i= 0; i < len; ++i)
-  {
-    if (attrs[i] == ';')
-      attrs[i]= '\0';
-  }
-
-  /* Adding the extra string termination to get \0\0 */
-  attrs[i]= '\0';
-
-  if (mydriver[0] == '{')
-  {
-    /* We need to remove {} in the driver name or it will not register */
-    len= strlen(mydriver);
-    memcpy(drv, mydriver+1, sizeof(SQLCHAR)*(len-2));
-    drv[len-2]= '\0';
-  }
-  else
-  {
-    memcpy(drv, mydriver, sizeof(SQLCHAR)*len);
-    drv[len]= '\0';
-  }
-
-  /* 
-    Trying to remove the DSN if it is left from the previous run, 
-    no need to check the result
-  */
-  SQLConfigDataSource(NULL, ODBC_REMOVE_DSN, drv, "DSN=bug52996dsn\0\0");
-
-  /* Create the DSN */
-  ok_install(SQLConfigDataSource(NULL, ODBC_ADD_DSN, drv, attrs));
-
-  /* Connect using the new DSN and override FOUND_ROWS option in DSN */
-  is(OK == alloc_basic_handles_with_opt(&henv1, &hdbc1, &hstmt1, 
-                               "bug52996dsn",
-                               NULL, NULL, NULL, "FOUND_ROWS=0"));
-
-  /* Check the affected tows */
-  ok_sql(hstmt1, "UPDATE bug52996 SET c1=3 WHERE id < 4 ");
-  ok_stmt(hstmt1, SQLRowCount(hstmt1, &row_count));
-
-  if(row_count != 2)
-  {
-    /* We don't want to return immediately before clean up DSN and table */
-    res= FAIL;
-  }
-
-  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
-  ok_con(hdbc1, SQLDisconnect(hdbc1));
-
-  free_basic_handles(&henv1, &hdbc1, &hstmt1);
-
-  ok_sql(hstmt, "DROP TABLE bug52996");
-
-  ok_install(SQLConfigDataSource(NULL, ODBC_REMOVE_DSN, drv, "DSN=bug52996dsn\0\0"));
-#endif
-
-  return res;
-}
-
-
 BEGIN_TESTS
   ADD_TEST(my_basics)
   ADD_TEST(t_max_select)
@@ -1277,8 +1157,6 @@
   ADD_TEST(t_bug44971)
   ADD_TEST(t_bug48603)
   ADD_TEST(t_bug45378)
-  ADD_TEST(t_bug63844)
-  ADD_TEST(t_bug52996)
 END_TESTS
 
 
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_bug13766.c mysql-connector-odbc-5.1.12-src/test/my_bug13766.c
--- mysql-connector-odbc-5.1.13-src/test/my_bug13766.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_bug13766.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_bulk.c mysql-connector-odbc-5.1.12-src/test/my_bulk.c
--- mysql-connector-odbc-5.1.13-src/test/my_bulk.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_bulk.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2007 MySQL AB, 2008, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_catalog1.c mysql-connector-odbc-5.1.12-src/test/my_catalog1.c
--- mysql-connector-odbc-5.1.13-src/test/my_catalog1.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_catalog1.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_catalog2.c mysql-connector-odbc-5.1.12-src/test/my_catalog2.c
--- mysql-connector-odbc-5.1.13-src/test/my_catalog2.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_catalog2.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -1056,33 +1056,6 @@
 }
 
 
-/* 
-  Bug #69448 MySQL ODBC drivers incorrectly quotes TableName when 
-  calling SQLPrimaryKeys
-*/
-DECLARE_TEST(t_bug69448)
-{
- 
-  SQLCHAR buff[255];
-
-  ok_sql(hstmt, "DROP TABLE IF EXISTS `table``69448`");
-
-  ok_sql(hstmt, "CREATE TABLE `table``69448`(id int primary key)");
-
-  ok_stmt(hstmt, SQLPrimaryKeys(hstmt, NULL, SQL_NTS, NULL, SQL_NTS, 
-                               "table`69448", SQL_NTS));
-
-  ok_stmt(hstmt, SQLFetch(hstmt));
-
-  /* check the table name and PK name */
-  is_str(my_fetch_str(hstmt, buff, 3), "table`69448", 11);
-  is_str(my_fetch_str(hstmt, buff, 4), "id", 2);
-
-  ok_sql(hstmt, "DROP TABLE IF EXISTS `table``69448`");
-  return OK;
-}
-
-
 BEGIN_TESTS
   ADD_TEST(t_bug37621)
   ADD_TEST(t_bug34272)
@@ -1100,7 +1073,6 @@
   ADD_TEST(t_bug14085211_part1)
   ADD_TODO(t_bug14085211_part2)
   ADD_TEST(t_sqlcolumns_after_select)
-  ADD_TODO(t_bug69448)
 END_TESTS
 
 myoption &= ~(1 << 30);
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_crash.c mysql-connector-odbc-5.1.12-src/test/my_crash.c
--- mysql-connector-odbc-5.1.13-src/test/my_crash.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_crash.c	1970-01-01 02:00:00.000000000 +0200
@@ -1,58 +0,0 @@
-/*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
-
-  The MySQL Connector/ODBC is licensed under the terms of the GPLv2
-  <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
-  MySQL Connectors. There are special exceptions to the terms and
-  conditions of the GPLv2 as it is applied to this software, see the
-  FLOSS License Exception
-  <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
-  
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published
-  by the Free Software Foundation; version 2 of the License.
-  
-  This program 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 General Public License
-  for more details.
-  
-  You should have received a copy of the GNU General Public License along
-  with this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
-*/
-
-#include "odbctap.h"
-#include "../VersionInfo.h"
-
-/*
-  Bug #69950 Visual Studio 2010 crashes when reading rows from any 
-  table in Server Explorer
-*/
-DECLARE_TEST(t_bug69950)
-{
-  /* Make sure such table does not exist! */
-  ok_sql(hstmt, "DROP TABLE IF EXISTS t_bug69950");
-
-  /* Create an EMPTY fake result set */
-  ok_stmt(hstmt, SQLTables(hstmt, mydb, SQL_NTS, NULL, 0, 
-                           "t_bug69950", SQL_NTS, "TABLE", SQL_NTS));
-
-  expect_stmt(hstmt, SQLFetch(hstmt), SQL_NO_DATA_FOUND);
-  expect_stmt(hstmt, SQLMoreResults(hstmt), SQL_NO_DATA_FOUND);
-
-  /* CRASH! */
-  ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_CLOSE));
-
-  return OK;
-}
-
-BEGIN_TESTS
-  ADD_TEST(t_bug69950)
-END_TESTS
-
-myoption &= ~(1 << 30);
-RUN_TESTS_ONCE
-myoption |= (1 << 30);
-testname_suffix= "_no_i_s";
-RUN_TESTS
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_curext.c mysql-connector-odbc-5.1.12-src/test/my_curext.c
--- mysql-connector-odbc-5.1.13-src/test/my_curext.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_curext.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_cursor.c mysql-connector-odbc-5.1.12-src/test/my_cursor.c
--- mysql-connector-odbc-5.1.13-src/test/my_cursor.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_cursor.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_datetime.c mysql-connector-odbc-5.1.12-src/test/my_datetime.c
--- mysql-connector-odbc-5.1.13-src/test/my_datetime.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_datetime.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -31,18 +31,9 @@
   SQLCHAR          szTs[50];
   TIMESTAMP_STRUCT ts;
   SQLLEN           len;
-  int is_fraction_capable = mysql_min_version(hdbc, "5.6.", 4);
 
   ok_sql(hstmt, "DROP TABLE IF EXISTS my_ts");
-
-  if(is_fraction_capable)
-  {
-    ok_sql(hstmt, "CREATE TABLE my_ts (ts TIMESTAMP(6))");
-  }
-  else
-  {
-    ok_sql(hstmt, "CREATE TABLE my_ts (ts TIMESTAMP)");
-  }
+  ok_sql(hstmt, "CREATE TABLE my_ts (ts TIMESTAMP)");
 
   /* insert using SQL_C_CHAR to SQL_TIMESTAMP */
   strcpy((char *)szTs, "2002-01-07 10:20:49.06");
@@ -64,8 +55,7 @@
   ts.hour= 19;
   ts.minute= 47;
   ts.second= 59;
-  ts.fraction= is_fraction_capable ? 123456000 : 0;
-
+  ts.fraction= 4;
   ok_stmt(hstmt, SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT,
                                   SQL_C_TIMESTAMP, SQL_TIMESTAMP,
                                   0, 0, &ts, sizeof(ts), NULL));
@@ -82,10 +72,7 @@
   ok_stmt(hstmt, SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 1));
 
   ok_stmt(hstmt, SQLGetData(hstmt, 1, SQL_C_CHAR, szTs, sizeof(szTs), &len));
-  
-  is_str(szTs, is_fraction_capable ? "2002-01-07 10:20:49.060000" : 
-                                     "2002-01-07 10:20:49", len);
-
+  is_str(szTs, "2002-01-07 10:20:49", len);
   printf("# row1 using SQL_C_CHAR: %s (%ld)\n", szTs, len);
 
   ok_stmt(hstmt, SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 1));
@@ -97,8 +84,6 @@
   is_num(ts.hour,  10);
   is_num(ts.minute,20);
   is_num(ts.second,49);
-  is_num(ts.fraction, is_fraction_capable ? 60000000 : 0);
-
   printf("# row1 using SQL_C_TIMESTAMP: %d-%d-%d %d:%d:%d.%d (%ld)\n",
          ts.year, ts.month,ts.day, ts.hour, ts.minute, ts.second, ts.fraction,
          len);
@@ -106,8 +91,7 @@
   ok_stmt(hstmt, SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 2));
 
   ok_stmt(hstmt, SQLGetData(hstmt, 1, SQL_C_CHAR, szTs, sizeof(szTs), &len));
-  is_str(szTs, is_fraction_capable ? "2002-01-07 19:47:59.123456" :
-                                      "2002-01-07 19:47:59", len);
+  is_str(szTs, "2002-01-07 19:47:59", len);
   printf("# row2 using SQL_C_CHAR: %s(%ld)\n", szTs, len);
 
   ok_stmt(hstmt, SQLFetchScroll(hstmt, SQL_FETCH_ABSOLUTE, 2));
@@ -119,8 +103,6 @@
   is_num(ts.hour,  19);
   is_num(ts.minute,47);
   is_num(ts.second,59);
-  is_num(ts.fraction, is_fraction_capable ? 123456000 : 0);
-
   printf("# row2 using SQL_C_TIMESTAMP: %d-%d-%d %d:%d:%d.%d (%ld)\n",
          ts.year, ts.month,ts.day, ts.hour, ts.minute, ts.second, ts.fraction,
          len);
@@ -151,7 +133,6 @@
 {
   SQLRETURN rc;
   SQL_TIMESTAMP_STRUCT ts, ts1, ts2;
-  int is_fraction_capable = mysql_min_version(hdbc, "5.6.", 4);
 
   ts.day    = 02;
   ts.month  = 8;
@@ -159,66 +140,68 @@
   ts.hour   = 18;
   ts.minute = 20;
   ts.second = 45;
-  ts.fraction = is_fraction_capable ? 555000 : 0;   
+  ts.fraction = 05;   
 
   memcpy(&ts1, (void*) &ts, sizeof(SQL_TIMESTAMP_STRUCT));
-
-  memcpy(&ts2, (void*) &ts1, sizeof(SQL_TIMESTAMP_STRUCT));
-
-  /* 
-    SQL_TIME cannot have the fractional part
-    http://msdn.microsoft.com/en-us/library/ms709385%28v=vs.85%29.aspx
-  */
+  /* For SQL_TIME fraction is truncated and that would cause error */
   ts1.fraction= 0;
 
+  memcpy(&ts2, (void*) &ts1, sizeof(SQL_TIMESTAMP_STRUCT));
   /* Same for SQL_DATE - time is truncated -> error */
-  ts2.hour= ts2.minute= ts2.second= ts2.fraction= 0;
+  ts2.hour= ts2.minute= ts2.second= 0;
 
   ok_sql(hstmt, "DROP TABLE IF EXISTS t_tstotime");
 
-  ok_con(hdbc, SQLTransact(NULL,hdbc,SQL_COMMIT));
+  rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
+  mycon(hdbc,rc);
 
-  if(is_fraction_capable)
-  {
-    ok_sql(hstmt,"create table t_tstotime(col1 date,col2 time, col3 timestamp(6))");
-  }
-  else
-  {
-    ok_sql(hstmt,"create table t_tstotime(col1 date ,col2 time, col3 timestamp)");
-  }
+  rc = tmysql_exec(hstmt,"create table t_tstotime(col1 date ,col2 time, col3 timestamp)");
+  mystmt(hstmt,rc);
 
-  ok_con(hdbc, SQLTransact(NULL,hdbc,SQL_COMMIT));
+  rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
+  mycon(hdbc,rc);
 
-  ok_stmt(hstmt, SQLFreeStmt(hstmt,SQL_CLOSE));
+  rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+  mystmt(hstmt,rc);
 
   /* TIMESTAMP TO DATE, TIME and TS CONVERSION */
-  ok_stmt(hstmt, SQLPrepare(hstmt, (SQLCHAR *)"insert into t_tstotime(col1,col2,col3) values(?,?,?)",SQL_NTS));
+  rc = SQLPrepare(hstmt, (SQLCHAR *)"insert into t_tstotime(col1,col2,col3) values(?,?,?)",SQL_NTS);
+  mystmt(hstmt,rc);   
 
-  ok_stmt(hstmt, SQLBindParameter(hstmt,1,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
-                                  SQL_DATE,0,0,&ts2,sizeof(ts2),NULL));
+  rc = SQLBindParameter(hstmt,1,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
+                        SQL_DATE,0,0,&ts2,sizeof(ts2),NULL);
+  mystmt(hstmt,rc);
 
-  //ts1.fraction= 0;
-  ok_stmt(hstmt, SQLBindParameter(hstmt,2,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
-                                  SQL_TIME,0,0,&ts1,sizeof(ts1),NULL));
+  rc = SQLBindParameter(hstmt,2,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
+                        SQL_TIME,0,0,&ts1,sizeof(ts1),NULL);
+  mystmt(hstmt,rc);
 
-  ok_stmt(hstmt, SQLBindParameter(hstmt,3,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
-                                  SQL_TIMESTAMP,0,0,&ts,sizeof(ts),NULL));
+  rc = SQLBindParameter(hstmt,3,SQL_PARAM_INPUT,SQL_C_TIMESTAMP,
+                        SQL_TIMESTAMP,0,0,&ts,sizeof(ts),NULL);
+  mystmt(hstmt,rc);
 
-  ok_stmt(hstmt, SQLExecute(hstmt));
+  rc = SQLExecute(hstmt);
+  mystmt(hstmt,rc);
 
-  ok_stmt(hstmt, SQLFreeStmt(hstmt,SQL_RESET_PARAMS));
+  rc = SQLFreeStmt(hstmt,SQL_RESET_PARAMS);
+  mystmt(hstmt,rc);  
 
-  ok_stmt(hstmt, SQLFreeStmt(hstmt,SQL_CLOSE));
+  rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+  mystmt(hstmt,rc);  
 
-  ok_con(hdbc, SQLTransact(NULL,hdbc,SQL_COMMIT));
+  rc = SQLTransact(NULL,hdbc,SQL_COMMIT);
+  mycon(hdbc,rc);
 
-  ok_sql(hstmt,"select * from t_tstotime");
+  rc = tmysql_exec(hstmt,"select * from t_tstotime");
+  mystmt(hstmt,rc);  
 
   my_assert( 1 == myresult(hstmt));
 
-  ok_stmt(hstmt, SQLFreeStmt(hstmt,SQL_UNBIND));
+  rc = SQLFreeStmt(hstmt,SQL_UNBIND);
+  mystmt(hstmt,rc);
 
-  ok_stmt(hstmt, SQLFreeStmt(hstmt,SQL_CLOSE));
+  rc = SQLFreeStmt(hstmt,SQL_CLOSE);
+  mystmt(hstmt,rc);
 
   ok_sql(hstmt, "DROP TABLE IF EXISTS t_tstotime");
 
@@ -1002,7 +985,7 @@
   ts.hour= 19;
   ts.minute= 47;
   ts.second= 59;
-  ts.fraction= 4000;
+  ts.fraction= 4;
 
   /* Fractional truncation */
   expect_sql(hstmt, "SELECT ? AS foo", SQL_ERROR);
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_desc.c mysql-connector-odbc-5.1.12-src/test/my_desc.c
--- mysql-connector-odbc-5.1.13-src/test/my_desc.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_desc.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_dyn_cursor.c mysql-connector-odbc-5.1.12-src/test/my_dyn_cursor.c
--- mysql-connector-odbc-5.1.13-src/test/my_dyn_cursor.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_dyn_cursor.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_error.c mysql-connector-odbc-5.1.12-src/test/my_error.c
--- mysql-connector-odbc-5.1.13-src/test/my_error.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_error.c	2013-01-24 18:58:34.000000000 +0200
@@ -589,7 +589,7 @@
   ok_env(henv, SQLAllocConnect(henv, &hdbc1));
 
   /* Expecting error without OPT_CAN_HANDLE_EXPIRED_PASSWORDS */
-  expect_dbc(hdbc1, get_connection(&hdbc1, NULL, "t_pwd_expire", "foo", NULL, NULL),
+  expect_dbc(hdbc1, get_connection(&hdbc1, NULL, "t_pwd_expire", "foo", NULL),
               SQL_ERROR);
 
   {
@@ -610,7 +610,7 @@
   }
 
   /* Expecting error as password has not been reset */
-  ok_con(hdbc1, get_connection(&hdbc1, NULL, "t_pwd_expire", "foo", NULL,
+  ok_con(hdbc1, get_connection(&hdbc1, NULL, "t_pwd_expire", "foo",
                                 "CAN_HANDLE_EXP_PWD=1"));
 
   /*strcat((char *)conn_in, ";INITSTMT={set password= password('bar')}");*/
@@ -626,8 +626,7 @@
   ok_con(hdbc1, SQLDisconnect(hdbc1));
 
   /* Checking we can get connection with new credentials */
-  ok_con(hdbc1, get_connection(&hdbc1, mydsn, "t_pwd_expire", "bar", NULL,
-                               NULL));
+  ok_con(hdbc1, get_connection(&hdbc1, mydsn, "t_pwd_expire", "bar", NULL));
   ok_con(hdbc1, SQLAllocStmt(hdbc1, &hstmt1));
 
   /* Also verifying that we got normal connection */
@@ -644,77 +643,6 @@
   return OK;
 }
 
-/*
-  Bug#16445091: CLEARTEXT AUTHENTICATION NOT PRESENT IN ODBC
-*/
-DECLARE_TEST(t_cleartext_password)
-{
-  SQLHDBC hdbc1;
-  SQLHSTMT hstmt1;
-  SQLRETURN rc;
-  SQLCHAR sql_state[6];
-  SQLINTEGER  err_code= 0;                              
-  SQLCHAR     err_msg[SQL_MAX_MESSAGE_LENGTH]= {0};
-  SQLSMALLINT err_len= 0;
-  SQLCHAR server_version[MYSQL_NAME_LEN+1];
-  unsigned int major1= 0, minor1= 0, build1= 0;
-
-  if (!mysql_min_version(hdbc, "5.5.16", 6) )
-  {
-    skip("The server does not support tested functionality(Cleartext Auth)");
-  }
-
-  SQLExecDirect(hstmt, (SQLCHAR *)"DROP USER 't_ct_user'@'%'", SQL_NTS);
-
-  if (!SQL_SUCCEEDED(SQLExecDirect(hstmt, 
-            "GRANT ALL ON *.* TO "
-            "'t_ct_user'@'%' IDENTIFIED WITH "
-            "'authentication_pam'", SQL_NTS))) 
-  {
-    skip("The authentication_pam plugin not loaded");
-  }
-
-  ok_env(henv, SQLAllocConnect(henv, &hdbc1));
-
-  /* 
-    Expecting error CR_AUTH_PLUGIN_CANNOT_LOAD_ERROR 
-    without option ENABLE_CLEARTEXT_PLUGIN
-  */
-  if(!SQL_SUCCEEDED(get_connection(&hdbc1, mydsn, "t_ct_user", "t_ct_pass",
-                        mydb, NULL)))
-  {
-    SQLGetDiagRec(SQL_HANDLE_DBC, hdbc1, 1, sql_state, &err_code, err_msg,
-                  SQL_MAX_MESSAGE_LENGTH - 1, &err_len);
-
-    printMessage("%s %d %s", sql_state, err_code, err_msg);
-    if ((strncmp(sql_state, "08004", 5) != 0 || err_code != 2059))
-    {                                                                               
-      return FAIL;
-    }
-  }  
-
-  /* 
-    Expecting error other then CR_AUTH_PLUGIN_CANNOT_LOAD_ERROR 
-    as option ENABLE_CLEARTEXT_PLUGIN is used
-  */
-  if(!SQL_SUCCEEDED(get_connection(&hdbc1, mydsn, "t_ct_user", "t_ct_pass",
-                        mydb, "ENABLE_CLEARTEXT_PLUGIN=1")))
-  {
-    SQLGetDiagRec(SQL_HANDLE_DBC, hdbc1, 1, sql_state, &err_code, err_msg,
-                  SQL_MAX_MESSAGE_LENGTH - 1, &err_len);
-    printMessage("%s %d %s", sql_state, err_code, err_msg);
-
-    if ((strncmp(sql_state, "08004", 5) == 0 && err_code == 2059))
-    {                                                                               
-      return FAIL;
-    }
-  }
-
-  ok_sql(hstmt, "DROP USER 't_ct_user'@'%'");
-
-  return OK;
-}
-
 
 BEGIN_TESTS
 #ifndef NO_DRIVERMANAGER
@@ -737,7 +665,6 @@
   ADD_TEST(t_bug13542600)
   ADD_TEST(t_bug14285620)
   ADD_TEST(t_passwordexpire)
-  ADD_TEST(t_cleartext_password)
 END_TESTS
 
 RUN_TESTS
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_info.c mysql-connector-odbc-5.1.12-src/test/my_info.c
--- mysql-connector-odbc-5.1.13-src/test/my_info.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_info.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_keys.c mysql-connector-odbc-5.1.12-src/test/my_keys.c
--- mysql-connector-odbc-5.1.13-src/test/my_keys.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_keys.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_param.c mysql-connector-odbc-5.1.12-src/test/my_param.c
--- mysql-connector-odbc-5.1.13-src/test/my_param.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_param.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_prepare.c mysql-connector-odbc-5.1.12-src/test/my_prepare.c
--- mysql-connector-odbc-5.1.13-src/test/my_prepare.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_prepare.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2008 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_relative.c mysql-connector-odbc-5.1.12-src/test/my_relative.c
--- mysql-connector-odbc-5.1.13-src/test/my_relative.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_relative.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2007, 2008 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_result1.c mysql-connector-odbc-5.1.12-src/test/my_result1.c
--- mysql-connector-odbc-5.1.13-src/test/my_result1.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_result1.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_result2.c mysql-connector-odbc-5.1.12-src/test/my_result2.c
--- mysql-connector-odbc-5.1.13-src/test/my_result2.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_result2.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_scroll.c mysql-connector-odbc-5.1.12-src/test/my_scroll.c
--- mysql-connector-odbc-5.1.13-src/test/my_scroll.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_scroll.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2007, 2008 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_setup.c mysql-connector-odbc-5.1.12-src/test/my_setup.c
--- mysql-connector-odbc-5.1.13-src/test/my_setup.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_setup.c	1970-01-01 02:00:00.000000000 +0200
@@ -1,100 +0,0 @@
-/*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
-
-  The MySQL Connector/ODBC is licensed under the terms of the GPLv2
-  <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
-  MySQL Connectors. There are special exceptions to the terms and
-  conditions of the GPLv2 as it is applied to this software, see the
-  FLOSS License Exception
-  <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
-  
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published
-  by the Free Software Foundation; version 2 of the License.
-  
-  This program 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 General Public License
-  for more details.
-  
-  You should have received a copy of the GNU General Public License along
-  with this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
-*/
-
-#include "odbctap.h"
-
-/**
-  Bug #66548: Driver use the char ';' as separator in attributes string 
-              instead of the '\0'
-*/
-DECLARE_TEST(t_bug66548)
-{
-  /* TODO: remove #ifdef _WIN32 when Linux and MacOS setup is released */
-#ifdef _WIN32
-  SQLCHAR attrs[8192];
-  SQLCHAR drv[128];
-  SQLCHAR conn_out[512];
-  SQLSMALLINT conn_out_len;
-  int i, len;
-  HDBC hdbc1;
-  
-  /* 
-    Use ';' as separator because sprintf doesn't work after '\0'
-    The last attribute in the list must end with ';'
-  */
-
-  sprintf((char*)attrs, "DSN=bug66548dsn;SERVER=%s;USER=%s;PASSWORD=%s;"
-                          "DATABASE=%s;", myserver, myuid, mypwd, mydb);
-
-  len= strlen(attrs);
-  
-  /* replacing ';' by '\0' */
-  for (i= 0; i < len; ++i)
-  {
-    if (attrs[i] == ';')
-      attrs[i]= '\0';
-  }
-
-  /* Adding the extra string termination to get \0\0 */
-  attrs[i]= '\0';
-
-  if (mydriver[0] == '{')
-  {
-    /* We need to remove {} in the driver name or it will not register */
-    len= strlen(mydriver);
-    memcpy(drv, mydriver+1, sizeof(SQLCHAR)*(len-2));
-    drv[len-2]= '\0';
-  }
-
-  /* 
-    Trying to remove the DSN if it is left from the previous run, 
-    no need to check the result
-  */
-  SQLConfigDataSource(NULL, ODBC_REMOVE_DSN, drv, "DSN=bug66548dsn\0\0");
-
-  /* Create the DSN */
-  ok_install(SQLConfigDataSource(NULL, ODBC_ADD_DSN, drv, attrs));
-
-  ok_env(henv, SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc1));
-
-  /* Try connecting using the newly created DSN */
-  ok_con(hdbc1, SQLDriverConnect(hdbc1, NULL, "DSN=bug66548dsn", SQL_NTS, conn_out,
-                                 sizeof(conn_out), &conn_out_len,
-                                 SQL_DRIVER_NOPROMPT));
-  ok_con(hdbc1, SQLDisconnect(hdbc1));
-  ok_con(hdbc1, SQLFreeHandle(SQL_HANDLE_DBC, hdbc1));
-
-  ok_install(SQLConfigDataSource(NULL, ODBC_REMOVE_DSN, drv, "DSN=bug66548dsn\0\0"));
-#endif
-
-  return OK;
-}
-
-
-BEGIN_TESTS
-  ADD_TEST(t_bug66548)
-END_TESTS
-
-
-RUN_TESTS
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_tran.c mysql-connector-odbc-5.1.12-src/test/my_tran.c
--- mysql-connector-odbc-5.1.13-src/test/my_tran.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_tran.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2007 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_types.c mysql-connector-odbc-5.1.12-src/test/my_types.c
--- mysql-connector-odbc-5.1.13-src/test/my_types.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_types.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_unicode.c mysql-connector-odbc-5.1.12-src/test/my_unicode.c
--- mysql-connector-odbc-5.1.13-src/test/my_unicode.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_unicode.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_unixodbc.c mysql-connector-odbc-5.1.12-src/test/my_unixodbc.c
--- mysql-connector-odbc-5.1.13-src/test/my_unixodbc.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_unixodbc.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,6 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2003, 2007, 2008 MySQL AB, 2010 Sun Microsystems, Inc.
+  Use is subject to license terms.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/my_use_result.c mysql-connector-odbc-5.1.12-src/test/my_use_result.c
--- mysql-connector-odbc-5.1.13-src/test/my_use_result.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/my_use_result.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
diff -urNad mysql-connector-odbc-5.1.13-src/test/odbctap.h mysql-connector-odbc-5.1.12-src/test/odbctap.h
--- mysql-connector-odbc-5.1.13-src/test/odbctap.h	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/test/odbctap.h	2013-01-24 18:58:34.000000000 +0200
@@ -53,7 +53,6 @@
 
 #include <sql.h>
 #include <sqlext.h>
-#include <odbcinst.h>
 
 /* for clock() */
 #include <time.h>
@@ -150,8 +149,6 @@
 
 char *SKIP_REASON= NULL;
 
-#define USE_DRIVER (char *)-1
-
 typedef int (*test_func)(SQLHDBC, SQLHSTMT, SQLHENV);
 static void print_diag(SQLRETURN rc, SQLSMALLINT htype, SQLHANDLE handle,
 		       const char *text, const char *file, int line);
@@ -229,9 +226,6 @@
   gc_blk.counter= 0;
 }
 
-#define DECLARE_BASIC_HANDLES(E, C, S) SQLHENV E; \
-  SQLHDBC C; \
-  SQLHSTMT S
 
 #define BEGIN_TESTS my_test tests[]= {
 #define ADD_TEST(name) { #name, name, OK   },
@@ -479,21 +473,6 @@
 
 
 /**
-  Verify that the results of an ODBC function call on an environment handle
-  was SQL_SUCCESS or SQL_SUCCESS_WITH_INFO.
-
-  @param call    The function call
-*/
-#define ok_install(call) \
-do { \
-  BOOL rc= (call); \
-  print_diag_installer(rc, #call, __FILE__, __LINE__); \
-  if (!rc) \
-    return FAIL; \
-} while (0)
-
-
-/**
   Verify that a Boolean expression is true.
   It's recommended to use is_num, is_str, etc macros instead of "is(a==b)",
   since those will show values being compared, in a log.
@@ -592,8 +571,6 @@
 
 
 /**
-  Print error and diagnostic information for ODBC API functions that did not
-  finish with SQL_SUCCESS(_WITH_INFO) result
 */
 static void print_diag(SQLRETURN rc, SQLSMALLINT htype, SQLHANDLE handle,
 		       const char *text, const char *file, int line)
@@ -622,32 +599,6 @@
 }
 
 
-/**
-  Print error and diagnostic information for ODBC INSTALLER API functions 
-  that did not return TRUE (1)
-*/
-static void print_diag_installer(BOOL is_success, const char *text, 
-                                 const char *file, int line)
-{
-  if (!is_success)
-  {
-    SQLCHAR     message[SQL_MAX_MESSAGE_LENGTH];
-    SQLINTEGER  error_code;
-    SQLSMALLINT length;
-    SQLRETURN   drc;
-
-    drc= SQLInstallerError(1, &error_code, message, SQL_MAX_MESSAGE_LENGTH - 1, &length);
-
-    if (SQL_SUCCEEDED(drc))
-      printf("# [%s] %s in %s on line %d\n",
-             text, message, file, line);
-    else
-      printf("# Did not get expected diagnostics from SQLInstallerError() = %d"
-             " in file %s on line %d\n", drc, file, line);
-  }
-}
-
-
 /* UTILITY MACROS */
 #define myenv(henv,r)  \
   do { \
@@ -1144,47 +1095,31 @@
    and my_str_options, respectively.
    myoption, mysock and myport values are used. */
 int get_connection(SQLHDBC *hdbc, const SQLCHAR *dsn, const SQLCHAR *uid,
-                   const SQLCHAR *pwd, const SQLCHAR *db, 
-                   const SQLCHAR *options)
+                   const SQLCHAR *pwd, const SQLCHAR *options)
 {
-  /* Buffers have to be large enough to contain SSL options and long names */
-  SQLCHAR     connIn[4096], connOut[4096];
-  SQLCHAR     dsn_buf[MAX_NAME_LEN]= {0}, socket_buf[MAX_NAME_LEN]= {0};
-  SQLCHAR     db_buf[MAX_NAME_LEN]= {0}, port_buf[MAX_NAME_LEN]= {0};
+  SQLCHAR     connIn[MAX_NAME_LEN*2], connOut[MAX_NAME_LEN*2];
   SQLSMALLINT len;
   SQLRETURN   rc;
 
-  /* We never set the custom DSN, but sometimes use DRIVER instead */
-  if (dsn == NULL)
-    sprintf((char *)dsn_buf, "DSN=%s", (char *)mydsn);
-  else if (dsn == USE_DRIVER)
-    sprintf((char *)dsn_buf, "DRIVER=%s", (char *)mydriver);
-  else
-    sprintf((char *)dsn_buf, "DSN=%s", (char *)dsn);
-
   /* Defaults */
+  if (dsn     == NULL) dsn=     mydsn;
   if (uid     == NULL) uid=     myuid;
   if (pwd     == NULL) pwd=     mypwd;
-  if (db      == NULL) db=      mydb;
   if (options == NULL) options= my_str_options;
 
-  sprintf((char *)connIn, "%s;UID=%s;PWD=%s;OPTION=%d",
-          (char *)dsn_buf, (char *)uid, (char *)pwd, myoption);
+  sprintf((char *)connIn, "DSN=%s;UID=%s;PWD=%s;DATABASE=test;OPTION=%d",
+          (char *)dsn, (char *)uid, (char *)pwd, myoption);
 
   if (mysock && mysock[0])
   {
-    sprintf((char *)socket_buf, ";SOCKET=%s", (char *)mysock);
-    strcat((char *)connIn, socket_buf);
-  }
-  if (db && db[0])
-  {
-    sprintf((char *)db_buf, ";DATABASE=%s", (char *)db);
-    strcat((char *)connIn, (char *)db_buf);
+    strcat((char *)connIn, ";SOCKET=");
+    strcat((char *)connIn, (char *)mysock);
   }
   if (myport)
   {
-    sprintf(port_buf, ";PORT=%d", myport);
-    strcat((char *)connIn, port_buf);
+    char buff[20];
+    sprintf(buff, ";PORT=%d", myport);
+    strcat((char *)connIn, buff);
   }
 
   if (options != NULL && options[0] > 0)
@@ -1194,7 +1129,7 @@
   }
 
   rc= SQLDriverConnect(*hdbc, NULL, connIn, SQL_NTS, connOut,
-                       MAX_NAME_LEN, &len, SQL_DRIVER_NOPROMPT);
+                                 MAX_NAME_LEN, &len, SQL_DRIVER_NOPROMPT);
 
   if (SQL_SUCCEEDED(rc))
   {
@@ -1203,22 +1138,11 @@
     rc= SQLSetConnectAttr(*hdbc, SQL_ATTR_AUTOCOMMIT,
                                   (SQLPOINTER)SQL_AUTOCOMMIT_ON, 0);
   }
-  else
-  {
-    /* re-build and print the connection string with hidden password */
-    printf("# Connection failed with the following Connection string: " \
-           "\n%s;UID=%s;PWD=*******%s%s%s;%s\n", 
-           dsn_buf, uid, socket_buf, db_buf, port_buf, options);
-  }
 
   return rc;
 }
 
-
-int alloc_basic_handles_with_opt(SQLHENV *henv, SQLHDBC *hdbc, 
-                                 SQLHSTMT *hstmt,  const SQLCHAR *dsn, 
-                                 const SQLCHAR *uid, const SQLCHAR *pwd, 
-                                 const SQLCHAR *db, const SQLCHAR *options)
+int alloc_basic_handles(SQLHENV *henv, SQLHDBC *hdbc, SQLHSTMT *hstmt)
 {
   ok_env(*henv, SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, henv));
 
@@ -1227,7 +1151,7 @@
 
   ok_env(*henv, SQLAllocHandle(SQL_HANDLE_DBC, *henv, hdbc));
 
-  ok_con(*hdbc, get_connection(hdbc, dsn, uid, pwd, db, options));
+  ok_con(*hdbc, get_connection(hdbc, mydsn, myuid, mypwd, my_str_options));
 
   ok_con(*hdbc, SQLAllocHandle(SQL_HANDLE_STMT, *hdbc, hstmt));
 
@@ -1235,15 +1159,6 @@
 }
 
 
-int alloc_basic_handles(SQLHENV *henv, SQLHDBC *hdbc, SQLHSTMT *hstmt)
-{
-  return alloc_basic_handles_with_opt(henv, hdbc, hstmt, (SQLCHAR *)mydsn, 
-                                      (SQLCHAR *)myuid, (SQLCHAR *)mypwd,
-                                      (SQLCHAR *)mydb, 
-                                      (SQLCHAR *)my_str_options);
-}
-
-
 int free_basic_handles(SQLHENV *henv,SQLHDBC *hdbc, SQLHSTMT *hstmt)
 {
   /* We don't care if this succeeds, the connection may have gone away. */
diff -urNad mysql-connector-odbc-5.1.13-src/util/installer.c mysql-connector-odbc-5.1.12-src/util/installer.c
--- mysql-connector-odbc-5.1.13-src/util/installer.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/util/installer.c	2013-01-24 18:58:34.000000000 +0200
@@ -164,8 +164,6 @@
 static SQLWCHAR W_PREFETCH[]= {'P','R','E','F','E','T','C','H',0};
 static SQLWCHAR W_CAN_HANDLE_EXP_PWD[]=
   {'C','A','N','_','H','A','N','D','L','E','_','E','X','P','_','P','W','D',0};
-static SQLWCHAR W_ENABLE_CLEARTEXT_PLUGIN[]=
-  {'E','N','A','B','L','E','_','C','L','E','A', 'R', 'T', 'E', 'X', 'T', '_','P','L','U','G','I','N',0};
 
 /* DS_PARAM */
 /* externally used strings */
@@ -194,8 +192,7 @@
                         W_ZERO_DATE_TO_MIN, W_MIN_DATE_TO_ZERO,
                         W_MULTI_STATEMENTS, W_COLUMN_SIZE_S32,
                         W_NO_BINARY_RESULT, W_DFLT_BIGINT_BIND_STR,
-                        W_CLIENT_INTERACTIVE, W_NO_I_S, W_PREFETCH, 
-                        W_CAN_HANDLE_EXP_PWD, W_ENABLE_CLEARTEXT_PLUGIN};
+                        W_CLIENT_INTERACTIVE, W_NO_I_S, W_PREFETCH, W_CAN_HANDLE_EXP_PWD};
 static const
 int dsnparamcnt= sizeof(dsnparams) / sizeof(SQLWCHAR *);
 /* DS_PARAM */
@@ -812,8 +809,6 @@
     *booldest= &ds->no_information_schema;
   else if (!sqlwcharcasecmp(W_CAN_HANDLE_EXP_PWD, param))
     *booldest= &ds->can_handle_exp_pwd;
-  else if (!sqlwcharcasecmp(W_ENABLE_CLEARTEXT_PLUGIN, param))
-    *booldest= &ds->enable_cleartext_plugin;
 
   /* DS_PARAM */
 }
@@ -1014,9 +1009,7 @@
 
     attrs= end;
     /* If delim is NULL then double-NULL is the end of key-value pairs list */
-    while ((delim && *attrs == delim) ||
-           (!delim && !*attrs && *(attrs+1)) ||
-           *attrs == ' ')
+    while ((delim && *attrs == delim) || *attrs == ' ')
       ++attrs;
   }
 
@@ -1277,7 +1270,6 @@
   if (ds_add_intprop(ds->name, W_DFLT_BIGINT_BIND_STR, ds->default_bigint_bind_str)) goto error;
   if (ds_add_intprop(ds->name, W_NO_I_S, ds->no_information_schema)) goto error;
   if (ds_add_intprop(ds->name, W_CAN_HANDLE_EXP_PWD, ds->can_handle_exp_pwd)) goto error;
-  if (ds_add_intprop(ds->name, W_ENABLE_CLEARTEXT_PLUGIN, ds->enable_cleartext_plugin)) goto error;
   /* DS_PARAM */
 
   rc= 0;
diff -urNad mysql-connector-odbc-5.1.13-src/util/installer.h mysql-connector-odbc-5.1.12-src/util/installer.h
--- mysql-connector-odbc-5.1.13-src/util/installer.h	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/util/installer.h	2013-01-24 18:58:34.000000000 +0200
@@ -114,7 +114,6 @@
   BOOL auto_increment_null_search;
   BOOL handle_binary_as_char;
   BOOL can_handle_exp_pwd;
-  BOOL enable_cleartext_plugin;
   /*  */
   BOOL dont_prompt_upon_connect;
   BOOL dynamic_cursor;
diff -urNad mysql-connector-odbc-5.1.13-src/util/stringutil.c mysql-connector-odbc-5.1.12-src/util/stringutil.c
--- mysql-connector-odbc-5.1.13-src/util/stringutil.c	2013-09-25 19:57:53.000000000 +0300
+++ mysql-connector-odbc-5.1.12-src/util/stringutil.c	2013-01-24 18:58:34.000000000 +0200
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+  Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
 
   The MySQL Connector/ODBC is licensed under the terms of the GPLv2
   <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -55,9 +55,8 @@
   my_bool free_str= FALSE;
 
   if (str && *len == SQL_NTS)
-  {
     *len= strlen((char *)str);
-  }
+
   if (!str || *len == 0)
   {
     *len= 0;
@@ -95,13 +94,13 @@
     return NULL;
   }
 
-  for (pos= str, i= 0; pos < str_end && *pos != 0; )
+  for (pos= str, i= 0; *pos && pos < str_end; )
   {
     if (sizeof(SQLWCHAR) == 4)
     {
       int consumed= utf8toutf32(pos, (UTF32 *)(out + i++));
       pos+= consumed;
-      if (consumed == 0)
+      if (!consumed)
       {
         *errors+= 1;
         break;
@@ -112,7 +111,7 @@
       UTF32 u32;
       int consumed= utf8toutf32(pos, &u32);
       pos+= consumed;
-      if (consumed == 0)
+      if (!consumed)
       {
         *errors+= 1;
         break;
@@ -125,9 +124,7 @@
   out[i]= 0;
 
   if (free_str)
-  {
     x_free(str);
-  }
 
   return out;
 }
