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

Method SetUUID

storage/connect/jdbconn.cpp:660–727  ·  view source on GitHub ↗

/ Search for UUID columns. */ /

Source from the content-addressed store, hash-verified

658/* Search for UUID columns. */
659/***********************************************************************/
660bool JDBConn::SetUUID(PGLOBAL g, PTDBJDBC tjp)
661{
662 int ncol, ctyp;
663 bool brc = true;
664 PCSZ fnc = "GetColumns";
665 PCOL colp;
666 JCATPARM *cap;
667 //jint jtyp;
668 jboolean rc = false;
669 jobjectArray parms;
670 jmethodID catid = nullptr;
671
672 if (gmID(g, catid, fnc, "([Ljava/lang/String;)I"))
673 return true;
674 else if (gmID(g, intfldid, "IntField", "(ILjava/lang/String;)I"))
675 return true;
676 else if (gmID(g, readid, "ReadNext", "()I"))
677 return true;
678
679 cap = AllocCatInfo(g, JCAT_COL, tjp->Schema, tjp->TableName, NULL);
680 SQLQualifiedName name(cap);
681
682 // Build the java string array
683 parms = env->NewObjectArray(4, env->FindClass("java/lang/String"), NULL);
684 env->SetObjectArrayElement(parms, 0, env->NewStringUTF(name.ptr(2)));
685 env->SetObjectArrayElement(parms, 1, env->NewStringUTF(name.ptr(1)));
686 env->SetObjectArrayElement(parms, 2, env->NewStringUTF(name.ptr(0)));
687
688 for (colp = tjp->GetColumns(); colp; colp = colp->GetNext()) {
689 env->SetObjectArrayElement(parms, 3, env->NewStringUTF(colp->GetName()));
690 ncol = env->CallIntMethod(job, catid, parms);
691
692 if (Check(ncol)) {
693 snprintf(g->Message, sizeof(g->Message), "%s: %s", fnc, Msg);
694 goto err;
695 } // endif Check
696
697 rc = env->CallBooleanMethod(job, readid);
698
699 if (Check(rc)) {
700 snprintf(g->Message, sizeof(g->Message), "ReadNext: %s", Msg);
701 goto err;
702 } else if (rc == 0) {
703 snprintf(g->Message, sizeof(g->Message), "table %s does not exist", tjp->TableName);
704 goto err;
705 } // endif rc
706
707 // Should return 666 is case of error (not done yet)
708 ctyp = (int)env->CallIntMethod(job, intfldid, 5, nullptr);
709
710 //if (Check((ctyp == 666) ? -1 : 1)) {
711 // snprintf(g->Message, sizeof(g->Message), "Getting ctyp: %s", Msg);
712 // goto err;
713 //} // endif ctyp
714
715 if (ctyp == 1111)
716 ((PJDBCCOL)colp)->uuid = true;
717

Callers 1

OpenDBMethod · 0.80

Calls 6

AllocCatInfoFunction · 0.70
CheckClass · 0.50
ptrMethod · 0.45
GetColumnsMethod · 0.45
GetNextMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected