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