Commit 6a783719 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix a bug causing UseCnc not being initialized for ODBC catalog tables.

  This made errors by calling SQLConnect or SQLDriverConnect randomly
  with incorrect parameters.
modified:
  storage/connect/tabodbc.cpp
  
- Removing GCC warnings  
modified:
  storage/connect/ha_connect.cc

- Typo
modified:
  storage/connect/odbconn.cpp
parent 180b2be6
......@@ -4850,12 +4850,13 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
int port= 0, hdr= 0, mxr __attribute__((unused))= 0, mxe= 0, rc= 0;
int cop __attribute__((unused)) = 0;
#if defined(ODBC_SUPPORT)
POPARM sop;
char *ucnc;
POPARM sop = NULL;
char *ucnc = NULL;
bool cnc= false;
int cto= -1, qto= -1;
#endif // ODBC_SUPPORT
uint tm, fnc= FNC_NO, supfnc= (FNC_NO | FNC_COL);
bool bif, ok= false, dbf= false, cnc= false;;
bool bif, ok= false, dbf= false;
TABTYPE ttp= TAB_UNDEF;
PQRYRES qrp= NULL;
PCOLRES crp;
......@@ -4916,6 +4917,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
mxr= atoi(GetListOption(g,"maxres", topt->oplist, "0"));
cto= atoi(GetListOption(g,"ConnectTimeout", topt->oplist, "-1"));
qto= atoi(GetListOption(g,"QueryTimeout", topt->oplist, "-1"));
if ((ucnc= GetListOption(g, "UseDSN", topt->oplist)))
cnc= (!*ucnc || *ucnc == 'y' || *ucnc == 'Y' || atoi(ucnc) != 0);
#endif
......@@ -4925,7 +4927,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
#endif // PROMPT_OK
} else {
host= "localhost";
user= "root";
user= (ttp == TAB_ODBC ? NULL : "root");
} // endif option_list
if (!(shm= (char*)db))
......@@ -5011,7 +5013,7 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
sop->Pwd= (char*)pwd;
sop->Cto= cto;
sop->Qto= qto;
sop->UseCnc=cnc;
sop->UseCnc= cnc;
ok= true;
} // endif's
......
......@@ -929,6 +929,7 @@ ODBConn::ODBConn(PGLOBAL g, TDBODBC *tdbp)
m_Scrollable = (tdbp) ? tdbp->Scrollable : false;
m_First = true;
m_Full = false;
m_UseCnc = false;
m_IDQuoteChar[0] = '"';
m_IDQuoteChar[1] = 0;
//*m_ErrMsg = '\0';
......@@ -1082,14 +1083,6 @@ int ODBConn::Open(PSZ ConnectString, POPARM sop, DWORD options)
AllocConnect(options);
/*ver = GetStringInfo(SQL_ODBC_VER);*/
#if 0
// Connect using SQLDriverConnect
if (DriverConnect(options)) {
strcpy(g->Message, MSG(CONNECT_CANCEL));
return 0;
} // endif
#endif // 0
if (!m_UseCnc) {
if (DriverConnect(options)) {
strcpy(g->Message, MSG(CONNECT_CANCEL));
......
......@@ -1560,6 +1560,7 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp)
Ops.Pwd = tdp->Password;
Ops.Cto = tdp->Cto;
Ops.Qto = tdp->Qto;
Ops.UseCnc = tdp->UseCnc;
} // end of TDBOTB constructor
/***********************************************************************/
......
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