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