MCPcopy Create free account
hub / github.com/MariaDB/server / GetDataSources

Method GetDataSources

storage/connect/odbconn.cpp:2093–2132  ·  view source on GitHub ↗

/ Get the list of Data Sources and set it in qrp. */ /

Source from the content-addressed store, hash-verified

2091/* Get the list of Data Sources and set it in qrp. */
2092/***********************************************************************/
2093bool ODBConn::GetDataSources(PQRYRES qrp)
2094 {
2095 bool rv = false;
2096 UCHAR *dsn, *des;
2097 UWORD dir = SQL_FETCH_FIRST;
2098 SWORD n1, n2, p1, p2;
2099 PCOLRES crp1 = qrp->Colresp, crp2 = qrp->Colresp->Next;
2100 RETCODE rc;
2101
2102 n1 = crp1->Clen;
2103 n2 = crp2->Clen;
2104
2105 try {
2106 rc = SQLAllocEnv(&m_henv);
2107
2108 if (!Check(rc))
2109 ThrowDBX(rc, "SQLAllocEnv"); // Fatal
2110
2111 for (int i = 0; i < qrp->Maxres; i++) {
2112 dsn = (UCHAR*)crp1->Kdata->GetValPtr(i);
2113 des = (UCHAR*)crp2->Kdata->GetValPtr(i);
2114 rc = SQLDataSources(m_henv, dir, dsn, n1, &p1, des, n2, &p2);
2115
2116 if (rc == SQL_NO_DATA_FOUND)
2117 break;
2118 else if (!Check(rc))
2119 ThrowDBX(rc, "SQLDataSources");
2120
2121 qrp->Nblin++;
2122 dir = SQL_FETCH_NEXT;
2123 } // endfor i
2124
2125 } catch(DBX *x) {
2126 snprintf(m_G->Message, sizeof(m_G->Message), "%s: %s", x->m_Msg, x->GetErrorMessage(0));
2127 rv = true;
2128 } // end try/catch
2129
2130 Close();
2131 return rv;
2132 } // end of GetDataSources
2133
2134/***********************************************************************/
2135/* Get the list of Drivers and set it in qrp. */

Callers 1

ODBCDataSourcesFunction · 0.80

Calls 4

CloseFunction · 0.85
GetValPtrMethod · 0.80
GetErrorMessageMethod · 0.80
CheckClass · 0.50

Tested by

no test coverage detected