• Alexander Barkov's avatar
    Fixing compilation problems on Unix: · ebf2da00
    Alexander Barkov authored
    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
    ebf2da00
odbconn.h 6.7 KB