Commit 4f9e09ef authored by Alexander Barkov's avatar Alexander Barkov

Fixing ODBC related compilation failures:

- without ODBC: adding a few "#ifdef CONNECT_SUPPORT"
- with ODBC on Linux: conflicting definitions for DWORD
  in sql.h (unixODBC) vs global.h.
  Using "typedef unsigned int DWORD", as this is how MS SQK defines it
  and matches unixODBC definition.

Removing sqlutil.h. value.cpp now uses sql.h and sqlext.h instead.


removed:
  storage/connect/sqlutil.h
modified:
  storage/connect/global.h
  storage/connect/value.cpp
  storage/connect/value.h
parent 6690bafc
...@@ -143,7 +143,7 @@ typedef unsigned char BYTE; ...@@ -143,7 +143,7 @@ typedef unsigned char BYTE;
typedef char *LPSTR; typedef char *LPSTR;
typedef char *PSZ; typedef char *PSZ;
#if !defined(NODW) #if !defined(NODW)
typedef int DWORD; typedef unsigned int DWORD;
#endif // !NODW #endif // !NODW
#undef HANDLE #undef HANDLE
typedef int HANDLE; typedef int HANDLE;
......
#define SQL_UNKNOWN_TYPE 0
#define SQL_CHAR 1
#define SQL_NUMERIC 2
#define SQL_DECIMAL 3
#define SQL_INTEGER 4
#define SQL_SMALLINT 5
#define SQL_FLOAT 6
#define SQL_REAL 7
#define SQL_DOUBLE 8
#define SQL_DATETIME 9
#define SQL_VARCHAR 12
#define SQL_TYPE_NULL 0
#define SQL_DATE 9
#define SQL_INTERVAL 10
#define SQL_TIME 10
#define SQL_TIMESTAMP 11
#define SQL_LONGVARCHAR (-1)
#define SQL_BINARY (-2)
#define SQL_VARBINARY (-3)
#define SQL_LONGVARBINARY (-4)
#define SQL_BIGINT (-5)
#define SQL_TINYINT (-6)
#define SQL_BIT (-7)
#define SQL_GUID (-11)
#define SQL_C_CHAR SQL_CHAR /* CHAR, VARCHAR, DECIMAL, NUMERIC */
#define SQL_C_LONG SQL_INTEGER /* INTEGER */
#define SQL_C_SHORT SQL_SMALLINT /* SMALLINT */
#define SQL_C_FLOAT SQL_REAL /* REAL */
#define SQL_C_DOUBLE SQL_DOUBLE /* FLOAT, DOUBLE */
#define SQL_C_TIMESTAMP SQL_TIMESTAMP
...@@ -32,15 +32,17 @@ ...@@ -32,15 +32,17 @@
#include "my_global.h" #include "my_global.h"
#if defined(WIN32) #if defined(WIN32)
//#include <windows.h> //#include <windows.h>
#include <sql.h>
#include <sqlext.h>
#else // !WIN32 #else // !WIN32
#include <string.h> #include <string.h>
#include "sqlutil.h"
#endif // !WIN32 #endif // !WIN32
#include <math.h> #include <math.h>
#ifdef ODBC_SUPPORT
#include <sql.h>
#include <sqlext.h>
#endif
#undef DOMAIN // Was defined in math.h #undef DOMAIN // Was defined in math.h
/***********************************************************************/ /***********************************************************************/
...@@ -198,6 +200,7 @@ int GetDBType(int type) ...@@ -198,6 +200,7 @@ int GetDBType(int type)
return tp; return tp;
} // end of GetPLGType } // end of GetPLGType
#if ODBC_SUPPORT
/***********************************************************************/ /***********************************************************************/
/* GetSQLType: returns the SQL_TYPE corresponding to a PLG type. */ /* GetSQLType: returns the SQL_TYPE corresponding to a PLG type. */
/***********************************************************************/ /***********************************************************************/
...@@ -235,6 +238,8 @@ int GetSQLCType(int type) ...@@ -235,6 +238,8 @@ int GetSQLCType(int type)
return tp; return tp;
} // end of GetSQLCType } // end of GetSQLCType
#endif /* ODBC_SUPPORT */
/***********************************************************************/ /***********************************************************************/
/* GetFormatType: returns the FORMAT character(s) according to type. */ /* GetFormatType: returns the FORMAT character(s) according to type. */
...@@ -274,6 +279,7 @@ int GetFormatType(char c) ...@@ -274,6 +279,7 @@ int GetFormatType(char c)
return type; return type;
} // end of GetFormatType } // end of GetFormatType
#ifdef ODBC_SUPPORT
/***********************************************************************/ /***********************************************************************/
/* TranslateSQLType: translate a SQL Type to a PLG type. */ /* TranslateSQLType: translate a SQL Type to a PLG type. */
/***********************************************************************/ /***********************************************************************/
...@@ -338,6 +344,7 @@ int TranslateSQLType(int stp, int prec, int& len) ...@@ -338,6 +344,7 @@ int TranslateSQLType(int stp, int prec, int& len)
return type; return type;
} // end of TranslateSQLType } // end of TranslateSQLType
#endif ODBC_SUPPORT
/***********************************************************************/ /***********************************************************************/
/* IsTypeChar: returns true for character type(s). */ /* IsTypeChar: returns true for character type(s). */
......
...@@ -39,14 +39,18 @@ typedef struct _datpar *PDTP; // For DTVAL ...@@ -39,14 +39,18 @@ typedef struct _datpar *PDTP; // For DTVAL
/* Utilities used to test types and to allocated values. */ /* Utilities used to test types and to allocated values. */
/***********************************************************************/ /***********************************************************************/
int GetPLGType(int); int GetPLGType(int);
#ifdef ODBC_SUPPORT
short GetSQLType(int); short GetSQLType(int);
int GetSQLCType(int); int GetSQLCType(int);
#endif
PVAL AllocateValue(PGLOBAL, void *, short); PVAL AllocateValue(PGLOBAL, void *, short);
// Exported functions // Exported functions
DllExport PSZ GetTypeName(int); DllExport PSZ GetTypeName(int);
DllExport int GetTypeSize(int, int); DllExport int GetTypeSize(int, int);
#ifdef ODBC_SUPPORT
DllExport int TranslateSQLType(int stp, int prec, int& len); DllExport int TranslateSQLType(int stp, int prec, int& len);
#endif
DllExport char *GetFormatType(int); DllExport char *GetFormatType(int);
DllExport int GetFormatType(char); DllExport int GetFormatType(char);
DllExport int GetDBType(int); DllExport int GetDBType(int);
......
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