diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 515db711fca..4f8c39db8a6 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -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 diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index c767a11d28c..c11f2a6892f 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -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)); diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 35561568c74..9fa9c4698e3 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -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 /***********************************************************************/