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

Function JDBCDrivers

storage/connect/jdbconn.cpp:571–631  ·  view source on GitHub ↗

/ JDBCDrivers: constructs the result blocks containing all JDBC */ drivers available on the local host. */ Called with info=true to have result column names. */ /

Source from the content-addressed store, hash-verified

569/* Called with info=true to have result column names. */
570/*************************************************************************/
571PQRYRES JDBCDrivers(PGLOBAL g, int maxres, bool info)
572{
573 int buftyp[] ={TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_STRING};
574 XFLD fldtyp[] ={FLD_NAME, FLD_EXTRA, FLD_DEFAULT, FLD_REM };
575 unsigned int length[] ={ 128, 32, 4, 256 };
576 bool b[] ={ false, false, false, true };
577 int i, ncol = 4;
578 PCOLRES crp;
579 PQRYRES qrp;
580 JDBConn *jcp = NULL;
581
582 /************************************************************************/
583 /* Do an evaluation of the result size. */
584 /************************************************************************/
585 if (!info) {
586 jcp = new(g) JDBConn(g, NULL);
587
588 if (jcp->Open(g) != RC_OK)
589 return NULL;
590
591 if (!maxres)
592 maxres = 256; // Estimated max number of drivers
593
594 } else
595 maxres = 0;
596
597 if (trace(1))
598 htrc("JDBCDrivers: max=%d len=%d\n", maxres, length[0]);
599
600 /************************************************************************/
601 /* Allocate the structures used to refer to the result set. */
602 /************************************************************************/
603 qrp = PlgAllocResult(g, ncol, maxres, 0, buftyp, fldtyp, length, false, true);
604
605 for (i = 0, crp = qrp->Colresp; crp; i++, crp = crp->Next) {
606 if (b[i])
607 crp->Kdata->SetNullable(true);
608
609 switch (i) {
610 case 0: crp->Name = "Name"; break;
611 case 1: crp->Name = "Version"; break;
612 case 2: crp->Name = "Compliant"; break;
613 case 3: crp->Name = "Description"; break;
614 } // endswitch
615
616 } // endfor i
617
618 /************************************************************************/
619 /* Now get the results into blocks. */
620 /************************************************************************/
621 if (!info && qrp && jcp->GetDrivers(qrp))
622 qrp = NULL;
623
624 if (!info)
625 jcp->Close();
626
627 /************************************************************************/
628 /* Return the result pointer for use by GetData routines. */

Callers 2

GetResultMethod · 0.85

Calls 6

PlgAllocResultFunction · 0.85
htrcFunction · 0.70
OpenMethod · 0.45
SetNullableMethod · 0.45
GetDriversMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected