Commit 733ab86c authored by Alexander Barkov's avatar Alexander Barkov

Adding an option to switch off ICONV support:

cmake -DCONNECT_WITH_ICONV=0

modified:
  storage/connect/CMakeLists.txt
  storage/connect/tabodbc.cpp
  storage/connect/tabodbc.h
parent f09ae60d
......@@ -210,13 +210,18 @@ ENDIF(CONNECT_WITH_ODBC)
#
# iconv
#
IF(UNIX)
SET(ICONV_LIBRARY "")
ELSE()
#Windows
# TODO: this is to be localized
SET(ICONV_LIBRARY "D:/libxml/lib/iconv.lib")
ENDIF(UNIX)
OPTION(CONNECT_WITH_ICONV "Compile CONNECT with iconv support" ON)
IF(CONNECT_WITH_ICONV)
add_definitions(-DICONV_SUPPORT)
IF(UNIX)
SET(ICONV_LIBRARY "")
ELSE()
#Windows
# TODO: this is to be localized
SET(ICONV_LIBRARY "D:/libxml/lib/iconv.lib")
ENDIF(UNIX)
ENDIF(CONNECT_WITH_ICONV)
#
......
......@@ -272,7 +272,7 @@ void TDBODBC::SetFile(PGLOBAL g, PSZ fn)
DBQ = fn;
} // end of SetFile
#if !defined(NO_ICONV)
#ifdef ICONV_SUPPORT
/******************************************************************/
/* Convert an UTF-8 string to latin characters. */
/******************************************************************/
......@@ -290,7 +290,7 @@ int TDBODBC::Decode(iconv_t cd, char *utf, char *buf, size_t n)
buf[n - o] = '\0';
return rc;
} // end of Decode
#endif // !NO_ICONV
#endif // ICONV_SUPPORT
/***********************************************************************/
/* MakeSQL: make the SQL statement use with ODBC connection. */
......@@ -305,11 +305,11 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
bool first = true;
PTABLE tablep = To_Table;
PCOL colp;
#if !defined(NO_ICONV)
#ifdef ICONV_SUPPORT
iconv_t cd = iconv_open("ISO-8859-1", "UTF-8");
#else
void *cd = NULL;
#endif // !NO_ICONV
void *cd = NULL;
#endif // ICONV_SUPPORT
if (!cnt) {
// Normal SQL statement to retrieve results
......@@ -405,9 +405,9 @@ char *TDBODBC::MakeSQL(PGLOBAL g, bool cnt)
strcat(strcat(sql, ownp), ".");
strcat(sql, tabname);
#if !defined(NO_ICONV)
#ifdef ICONV_SUPPORT
iconv_close(cd);
#endif // !NO_ICONV
#endif // ICONV_SUPPORT
if (To_Filter)
strcat(strcat(sql, " WHERE "), To_Filter);
......
......@@ -5,9 +5,9 @@
/* */
/* This file contains the TDBODBC classes declares. */
/***********************************************************************/
#if !defined(NO_ICONV)
#ifdef ICONV_SUPPORT
#include <iconv.h>
#endif // !NO_ICONV
#endif // ICONV_SUPPORT
#include "colblk.h"
typedef class ODBCDEF *PODEF;
......@@ -88,12 +88,12 @@ class TDBODBC : public TDBASE {
protected:
// Internal functions
#if !defined(NO_ICONV)
#ifdef ICONV_SUPPORT
int Decode(iconv_t cd, char *utf, char *buf, size_t n);
#else // NO_ICONV
#else // no ICONV_SUPPORT
inline int Decode(void *cd, char *str, char *buf, size_t n)
{strncpy(buf, str, n); return 0;}
#endif // NO_ICONV
#endif // ICONV_SUPPORT
char *MakeSQL(PGLOBAL g, bool cnt);
//bool MakeUpdate(PGLOBAL g, PSELECT selist);
//bool MakeInsert(PGLOBAL g);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment