C Examples: DbiGetTranInfo

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

C Examples: DbiGetTranInfo

Return to chapter overview

Gets the specified transaction information.

This example uses the following input:
         fDbiGetTranInfo(hDb, xTran, Buffer);

DBIResult fDbiGetTranInfo(hDBIDb hTmpDb, hDBIXact hXact, pCHAR XactInfo)

{

   DBIResult   rslt;

   XInfo       xinfo;

   CHAR        XState[10] = {"Unknown"};

   CHAR        XType[20] = {"Unknown"};

 

   rslt = Chk(DbiGetTranInfo(hTmpDb, hXact, &xinfo));

   if (rslt == DBIERR_NONE)

   {

      switch (xinfo.exState)

      {

         case xsACTIVE:

         strcpy(XState, "Active");

         break;

         case xsINACTIVE:

         strcpy(XState, "Inactive");

         break;

      }

      switch (xinfo.eXIL)

      {

         case xilDIRTYREAD:

         strcpy(XType, "Dirty Read");

         break;

         case xilREADCOMMITTED:

         strcpy(XType, "Read Committed");

         break;

         case xilREPEATABLEREAD:

         strcpy(XType, "Repeatable Read");

         break;

      }

   }

   wsprintf(XactInfo, "Transaction State: %s, Isolation Level: %s, Nests: %d",

            XState, XType, xinfo.uNests);

   return rslt;

}