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

Function ODBCDataSources

storage/connect/odbconn.cpp:584–634  ·  view source on GitHub ↗

/ ODBCDataSources: constructs the result blocks containing all ODBC */ data sources available on the local host. */ Called with info=true to have result column names. */ /

Source from the content-addressed store, hash-verified

582/* Called with info=true to have result column names. */
583/*************************************************************************/
584PQRYRES ODBCDataSources(PGLOBAL g, int maxres, bool info)
585 {
586 int buftyp[] = {TYPE_STRING, TYPE_STRING};
587 XFLD fldtyp[] = {FLD_NAME, FLD_REM};
588 unsigned int length[] = {0, 256};
589 bool b[] = {false, true};
590 int i, n = 0, ncol = 2;
591 PCOLRES crp;
592 PQRYRES qrp;
593 ODBConn *ocp = NULL;
594
595 /************************************************************************/
596 /* Do an evaluation of the result size. */
597 /************************************************************************/
598 if (!info) {
599 ocp = new(g) ODBConn(g, NULL);
600 n = ocp->GetMaxValue(SQL_MAX_DSN_LENGTH);
601 length[0] = (n) ? (n + 1) : 256;
602
603 if (!maxres)
604 maxres = 512; // Estimated max number of data sources
605
606 } else {
607 length[0] = 256;
608 maxres = 0;
609 } // endif info
610
611 if (trace(1))
612 htrc("ODBCDataSources: max=%d len=%d\n", maxres, length[0]);
613
614 /************************************************************************/
615 /* Allocate the structures used to refer to the result set. */
616 /************************************************************************/
617 qrp = PlgAllocResult(g, ncol, maxres, IDS_DSRC,
618 buftyp, fldtyp, length, false, true);
619
620 for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next)
621 if (b[i])
622 crp->Kdata->SetNullable(true);
623
624 /************************************************************************/
625 /* Now get the results into blocks. */
626 /************************************************************************/
627 if (!info && qrp && ocp->GetDataSources(qrp))
628 qrp = NULL;
629
630 /************************************************************************/
631 /* Return the result pointer for use by GetData routines. */
632 /************************************************************************/
633 return qrp;
634 } // end of ODBCDataSources
635
636/**************************************************************************/
637/* ODBCTables: constructs the result blocks containing all tables in */

Callers 2

GetResultMethod · 0.85

Calls 5

PlgAllocResultFunction · 0.85
GetDataSourcesMethod · 0.80
htrcFunction · 0.70
GetMaxValueMethod · 0.45
SetNullableMethod · 0.45

Tested by

no test coverage detected