1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

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
This commit is contained in:
Alexander Barkov
2013-02-11 10:16:52 +04:00
parent f6ca3b05f2
commit ebf2da0045
5 changed files with 10 additions and 10 deletions

View File

@@ -114,7 +114,7 @@
#include "global.h"
#include "plgdbsem.h"
#if defined(ODBC_SUPPORT)
#include "odbconn.h"
#include "odbccat.h"
#endif // ODBC_SUPPORT
#if defined(MYSQL_SUPPORT)
#include "myconn.h"

View File

@@ -208,7 +208,7 @@ PQRYRES MyColumns(PGLOBAL g, const char *host, const char *db,
crp->Kdata->SetValue(fld, i);
crp = crp->Next; // New
crp->Kdata->SetValue((fmt) ? fmt : "", i);
crp->Kdata->SetValue((fmt) ? fmt : (char*) "", i);
crp = crp->Next; // New (charset)
fld = myc.GetCharField(2);

View File

@@ -0,0 +1,7 @@
/***********************************************************************/
/* 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);

View File

@@ -4,14 +4,6 @@
//nclude <windows.h> /* Windows include file */
//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. */
/***********************************************************************/

View File

@@ -66,6 +66,7 @@
#include "plgdbsem.h"
#include "xtable.h"
#include "tabodbc.h"
#include "odbccat.h"
#include "tabmul.h"
#include "reldef.h"
#include "tabcol.h"