Commit ebf2da00 authored by Alexander Barkov's avatar Alexander Barkov

Fixing compilation problems on Unix:

1. Conflicting declarations:

In file included from /usr/include/sql.h:19:0,
     from <path>/storage/connect/odbconn.h:15,
     from <path>/storage/connect/ha_connect.cc:117:
/usr/include/sqltypes.h:98:23: error: conflicting declaration
  ‘typedef unsigned int DWORD’

os.h and unixODBC's sqltypes.h (included from sql.h) have conflicting
declarations, because unixODBC for some reasons incorrectly defines
DWORD as "unsigned int", while we define DWORD as "unsigned long"
(which is the Microsoft way).

We should never include os.h and odbconn.h from the same file.
Inside tabodbc.cpp DWORD must be seen as sql.h defines it.
In all other files DWORD must be seen as os.h defines it.

Fix:
Moving ODBC catalog function prototypes into a separate file odbccat.h.
Fixing ha_connect.cc to include odbccat.h instead of odbcon.h

2. Use of ambiguous overloaded function in myconn.cpp:
There's no a method SetValue(const char *fmt, int i);
There's only a method SetValue(char *fmt, int i);

Fixing the call accordingly:

-    crp->Kdata->SetValue((fmt) ? fmt : "", i);
+    crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);

Note, this is a quick hack. The correct fix would be to change
the method prototype to have the "fmt" argument as "const char *".
However, it is tightly related to about 300 other places where
"char*" is used instead of "const char *". We'll need to fix
all of them gradually (in separate changes).


added:
  storage/connect/odbccat.h
modified:
  storage/connect/ha_connect.cc
  storage/connect/myconn.cpp
  storage/connect/odbconn.h
  storage/connect/tabodbc.cpp
parent f6ca3b05
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
#include "global.h" #include "global.h"
#include "plgdbsem.h" #include "plgdbsem.h"
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
#include "odbconn.h" #include "odbccat.h"
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
#if defined(MYSQL_SUPPORT) #if defined(MYSQL_SUPPORT)
#include "myconn.h" #include "myconn.h"
......
...@@ -208,7 +208,7 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db, ...@@ -208,7 +208,7 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
crp->Kdata->SetValue(fld, i); crp->Kdata->SetValue(fld, i);
crp = crp->Next; // New crp = crp->Next; // New
crp->Kdata->SetValue((fmt) ? fmt : "", i); crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);
crp = crp->Next; // New (charset) crp = crp->Next; // New (charset)
fld = myc.GetCharField(2); fld = myc.GetCharField(2);
......
/***********************************************************************/
/* ODBC catalog function prototypes. */
/***********************************************************************/
PQRYRES ODBCDataSources(PGLOBAL g, bool info);
PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info);
PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info);
PQRYRES ODBCDrivers(PGLOBAL g, bool info);
...@@ -4,14 +4,6 @@ ...@@ -4,14 +4,6 @@
//nclude <windows.h> /* Windows include file */ //nclude <windows.h> /* Windows include file */
//nclude <windowsx.h> /* Message crackers */ //nclude <windowsx.h> /* Message crackers */
/***********************************************************************/
/* Catalog function prototypes. */
/***********************************************************************/
PQRYRES ODBCDataSources(PGLOBAL g, bool info);
PQRYRES MyODBCCols(PGLOBAL g, char *dsn, char *tab, bool info);
PQRYRES ODBCTables(PGLOBAL g, char *dsn, char *tabpat, bool info);
PQRYRES ODBCDrivers(PGLOBAL g, bool info);
/***********************************************************************/ /***********************************************************************/
/* Included C-definition files required by the interface. */ /* Included C-definition files required by the interface. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
#include "plgdbsem.h" #include "plgdbsem.h"
#include "xtable.h" #include "xtable.h"
#include "tabodbc.h" #include "tabodbc.h"
#include "odbccat.h"
#include "tabmul.h" #include "tabmul.h"
#include "reldef.h" #include "reldef.h"
#include "tabcol.h" #include "tabcol.h"
......
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