/**************************************************************************** Desc: Returns specific information about the most recent error that occured within FLAIM. ****************************************************************************/ FLMEXP RCODE FLMAPI FlmGetDiagInfo( HFDB hDb, eDiagInfoType eDiagCode, void * pvDiagInfo) { RCODE rc = FERR_OK; FDB * pDb; if ((pDb = (FDB *)hDb) == NULL) { rc = RC_SET( FERR_NOT_FOUND); goto Exit; } fdbUseCheck( pDb); /* Now, copy over the data into the users variable */ switch( eDiagCode) { case FLM_GET_DIAG_INDEX_NUM : if (!(pDb->Diag.uiInfoFlags & FLM_DIAG_INDEX_NUM)) { rc = RC_SET( FERR_NOT_FOUND); goto Exit; } else { *((FLMUINT *)pvDiagInfo) = pDb->Diag.uiIndexNum; } break; case FLM_GET_DIAG_DRN : if (!(pDb->Diag.uiInfoFlags & FLM_DIAG_DRN)) { rc = RC_SET( FERR_NOT_FOUND); goto Exit; } else { *((FLMUINT *)pvDiagInfo) = pDb->Diag.uiDrn; } break; case FLM_GET_DIAG_FIELD_NUM : if (!(pDb->Diag.uiInfoFlags & FLM_DIAG_FIELD_NUM)) { rc = RC_SET( FERR_NOT_FOUND); goto Exit; } else { *((FLMUINT *)pvDiagInfo) = pDb->Diag.uiFieldNum; } break; case FLM_GET_DIAG_FIELD_TYPE : if (!(pDb->Diag.uiInfoFlags & FLM_DIAG_FIELD_TYPE)) { rc = RC_SET( FERR_NOT_FOUND); goto Exit; } else { *((FLMUINT *)pvDiagInfo) = pDb->Diag.uiFieldType; } break; case FLM_GET_DIAG_ENC_ID : if (!(pDb->Diag.uiInfoFlags & FLM_DIAG_ENC_ID)) { rc = RC_SET( FERR_NOT_FOUND); goto Exit; } else { *((FLMUINT *)pvDiagInfo) = pDb->Diag.uiEncId; } break; default: flmAssert( 0); rc = RC_SET( FERR_NOT_FOUND); goto Exit; } Exit: if( pDb) { fdbUnuse( pDb); } return( rc); }
/**************************************************************************** Desc : Returns the type of the current database transaction. ****************************************************************************/ FLMEXP RCODE FLMAPI FlmDbGetTransType( HFDB hDb, FLMUINT * puiTransTypeRV) { RCODE rc = FERR_OK; FDB * pDb = (FDB *)hDb; if (IsInCSMode( hDb)) { fdbInitCS( pDb); CS_CONTEXT * pCSContext = pDb->pCSContext; FCL_WIRE Wire( pDb->pCSContext, pDb); // Send a request to get the transaction type. if( RC_BAD( rc = Wire.sendOp( FCS_OPCLASS_TRANS, FCS_OP_TRANSACTION_GET_TYPE))) { goto Exit; } if (RC_BAD( rc = Wire.sendTerminate())) { goto Transmission_Error; } // Read the response. if (RC_BAD( rc = Wire.read())) { goto Transmission_Error; } *puiTransTypeRV = Wire.getTransType(); rc = Wire.getRCode(); goto Exit; Transmission_Error: pCSContext->bConnectionGood = FALSE; goto Exit; } if (!pDb) { rc = RC_SET( FERR_BAD_HDL); goto Exit; } fdbUseCheck( pDb); pDb->uiInitNestLevel++; (void)flmResetDiag( pDb); // If the transaction is an internal transaction that is invisible to // the application, return FLM_NO_TRANS. Application is not supposed // see invisible transactions. *puiTransTypeRV = (FLMUINT)(((pDb->uiTransType == FLM_NO_TRANS) || (pDb->uiFlags & FDB_INVISIBLE_TRANS)) ? (FLMUINT)FLM_NO_TRANS : pDb->uiTransType); // See if the database is being forced to close if( RC_BAD( rc = flmCheckDatabaseState( pDb))) { goto Exit; } Exit: flmExit( FLM_DB_GET_TRANS_TYPE, pDb, rc); return( rc); }