void ComTdbHashGrby::displayContents(Space * space,ULng32 flag)
{
  ComTdb::displayContents(space,flag & 0xFFFFFFFE);

  if(flag & 0x00000008)
    {
      char buf[100];
      str_sprintf(buf, "\nFor ComTdbHashGrby :");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"resultRowLength = %d, extGroupedRowLength = %d",
		  resultRowLength_,extGroupedRowLength_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"keyLength = %d, isPartialGroup = %d, initialHashTableSize = %d",
		  keyLength_,isPartialGroup_,initialHashTableSize_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"memUsagePercent = %d, pressureThreshold = %d, minBuffersToFlush = %d",
		  memUsagePercent_,pressureThreshold_, minBuffersToFlush_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"logDiagnostics = %d", logDiagnostics());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "memoryQuotaMB = %d", memoryQuotaMB());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
  
  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}
Esempio n. 2
0
File: Menu.cpp Progetto: PADrend/GUI
//! ---|> Component
void Menu::doDisplay(const Geometry::Rect & region) {
	enableLocalDisplayProperties();
	displayDefaultShapes();
	getGUI().displayShape(PROPERTY_MENU_SHAPE,getLocalRect());
	disableLocalDisplayProperties();
	displayChildren(region,true);
	
	getGUI().displayShape(PROPERTY_MENU_OUTER_SHAPE,getLocalRect());

}
// -----------------------------------------------------------------------
// Used by the internal SHOWPLAN command to get attributes of a TDB in a
// string.
// -----------------------------------------------------------------------
NA_EIDPROC void ComTdb::displayContents(Space * space,ULng32 flag)
{

#ifndef __EID
  char buf[100];
  str_sprintf(buf, "Contents of %s [%d]:", getNodeName(),getExplainNodeId());
  Int32 j = str_len(buf);
  space->allocateAndCopyToAlignedSpace(buf, j, sizeof(short));
  for (Int32 k = 0; k < j; k++) buf[k] = '-';
  buf[j] = '\n';
  buf[j+1] = 0;
  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  if(flag & 0x00000008)
    {
  		str_sprintf(buf,"For ComTdb :");
		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

		str_sprintf(buf,"Class Version = %d, Class Size = %d",
                  getClassVersionID(),getClassSize());
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf,"InitialQueueSizeDown = %d, InitialQueueSizeUp = %d",
                   getInitialQueueSizeDown(),getInitialQueueSizeUp());
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf,"queueResizeLimit = %d, queueResizeFactor = %d",
                     getQueueResizeLimit(),getQueueResizeFactor());
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf, "queueSizeDown = %d, queueSizeUp = %d, numBuffers = %d, bufferSize = %d",
	        getMaxQueueSizeDown(), getMaxQueueSizeUp(), numBuffers_, bufferSize_);
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf, "estimatedRowUsed = %f, estimatedRowsAccessed = %f, expressionMode = %d", 
                  estRowsUsed_, estRowsAccessed_, expressionMode_);
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		str_sprintf(buf, "Flag = %b",flags_);
  		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

  		if (firstNRows() >= 0)
    		{
      		str_sprintf(buf, "Request Type: GET_N (%d) ", firstNRows());
      		space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    		}
    }
 #endif

  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}
Esempio n. 4
0
//! ---|> Component
void Connector::doDisplay(const Geometry::Rect & region){
	displayChildren(region);

	enableLocalDisplayProperties();
	displayDefaultShapes();	
	std::vector<Geometry::Vec2> points;
	for(Component * c=getFirstChild();c!=nullptr;c=c->getNext())
		points.emplace_back(c->getPosition());
	getGUI().displayLineShape(PROPERTY_CONNECTOR_LINE_SHAPE,points,0);
	disableLocalDisplayProperties();
}
void ComTdbSendTop::displayContents(Space *space, ULng32 flag)
{
  ComTdb::displayContents(space, flag & 0xFFFFFFFE);
  
  if (flag & 0x00000008)
  {
    char buf[256];
    
    str_sprintf(buf, "\nFor ComTdbSendTop :");
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    
    str_sprintf(buf, "childFragId_ = %d, sendTopFlags_ = %b",
                (Lng32) childFragId_, (Lng32) sendTopFlags_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

    str_sprintf(buf, "downRecordLength_ = %d, upRecordLength_ = %d",
                downRecordLength_, upRecordLength_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

    str_sprintf(buf, "sendBufferSize_ = %d, recvBufferSize_ = %d",
                sendBufferSize_, recvBufferSize_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

    if (sendTopFlags_ & EXTRACT_CONSUMER)
    {
      str_sprintf(buf, "This is a parallel extract consumer");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      const char *esp = getExtractEsp();
      str_sprintf(buf, "Extract ESP = %s", (esp ? esp : "(NULL)"));
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      const char *key = getExtractSecurityKey();
      str_sprintf(buf, "Security key = %s", (key ? key : "(NULL)"));
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }

    str_sprintf(buf, "Exchange uses SeaMonster: %s",
                getExchangeUsesSM() ? "yes" : "no");
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
  }

  if (flag & 0x00000001)
  {
    displayExpression(space,flag);
    displayChildren(space,flag);
  }
}
/** 
* Utility function only used when displaying the network topology.
* Recursively iterates through the network and displays the children of a node and then the children
* of those children, and then the children of those children, etc. using recursion.
* @param shortAddress the root at which to start getting the topology. Use 0000 for the Coordinator.
* @note does not retrieve children for the same node twice. Uses a Set to keep track of which nodes
* have been searched. This is done because occasionally two nodes will list the same child.
* @see http://en.wikipedia.org/wiki/Recursion_%28computer_science%29
* @return the number of children
* @todo handle case where starting index != 0. We will have to keep track of which nodes had
* additional children, and then call zdoRequestIeeeAddress() for the next group.
*/
static uint8_t displayChildren(uint16_t shortAddress)
{
    printf("Device %04X has ", shortAddress);
    
    moduleResult_t result = zdoRequestIeeeAddress(shortAddress, INCLUDE_ASSOCIATED_DEVICES, 0);
#define MAX_CHILDREN 5  // Max of 20 from Z-Stack. Of these 20, 7 can be routers, the rest end devices. 
                        // We reduce to fit in RAM on the LaunchPad since this is called recursively
    uint8_t childCount = 0;
    uint16_t children[MAX_CHILDREN];
    
    if (result == MODULE_SUCCESS)
    {
        if (!(addToSet(&searchedSet, shortAddress)))
        {
            printf("[addToSet failed for 0x%04X\r\n]", shortAddress);
        }
        
        childCount = zmBuf[SRSP_PAYLOAD_START + ZDO_IEEE_ADDR_RSP_NUMBER_OF_ASSOCIATED_DEVICES_FIELD];
        
        if (childCount > 0)
        {
            printf("%u children, starting with #%u:", childCount, zmBuf[SRSP_PAYLOAD_START + ZDO_IEEE_ADDR_RSP_START_INDEX_FIELD]);
            int i=0;
            int j;
            for (j = 0; j < (childCount*2) - 1; j += 2) // Iterate through all the children. Each is a 2B integer
            {
                children[i] = CONVERT_TO_INT(zmBuf[(j + SRSP_PAYLOAD_START + ZDO_IEEE_ADDR_RSP_ASSOCIATED_DEVICE_FIELD_START)], zmBuf[( j + SRSP_PAYLOAD_START + ZDO_IEEE_ADDR_RSP_ASSOCIATED_DEVICE_FIELD_START + 1)]);
                printf("<%04X> ", children[i]);
                i++;
            }
            printf("\r\n");
            
            for (i=0; i<childCount; i++)                     // Iterate through all children
            {
                if (!setContains(&searchedSet, children[i])) // Don't process the same short address twice!
                {
                    displayChildren(children[i]);            // Note use of recursion here
                }
            }
        } else {
            printf("no children\r\n");
        }
    } else {
        printf("Could not locate that device (Error Code 0x%02X)\r\n", result);
    }
    return childCount;
}
Esempio n. 7
0
void ComTdbOnlj::displayContents(Space * space,ULng32 flag)
{
      ComTdb::displayContents(space,flag & 0xFFFFFFFE);

      if(flag & 0x00000008)
        {
		      char buf[100];
	   		str_sprintf(buf, "\nFor ComTdbOnlj :\nFlags = %x, ljRecLen = %d, instantiatedRowAtpIndex = %d ",
      						flags_, ljRecLen_, instantiatedRowAtpIndex_);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
        }

      if(flag & 0x00000001)
        {
        		displayExpression(space,flag);
            displayChildren(space,flag);
        }
}
NA_EIDPROC void ComTdbUnion::displayContents(Space * space,ULng32 flag)
{
      ComTdb::displayContents(space,flag & 0xFFFFFFFE);

      if(flag & 0x00000008)
        {
		      char buf[100];
	   		str_sprintf(buf, "\nFor ComTdbUnion :\nFlags = %b, unionReclen = %d ",
      						flags_,unionReclen_);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
        }

      if(flag & 0x00000001)
        {
        		displayExpression(space,flag);
            displayChildren(space,flag);
        }
}
Esempio n. 9
0
void ComTdbParallelLabelOp::displayContents(Space *space, ULng32 flag)
{
   ComTdb::displayContents(space, flag & 0xFFFFFFFE);
   if (flag & 0x00000008)
   {
      char buf[100];
      str_sprintf(buf,"\nFor ComTdbParallelLabelOp: ");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf,"Operation = %d", operation_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
   }

   if (flag & 0x00000001)
   {
      displayExpression(space, flag);
      displayChildren(space, flag);
   }
}
void ComTdbSequence::displayContents(Space * space,ULng32 flag)
{
  ComTdb::displayContents(space,flag & 0xFFFFFFFE);

  if(flag & 0x00000008)
    {
      char buf[100];
      str_sprintf(buf, "\nFor ComTdbSequence :");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"recLen_ = %d, maxHistoryRows_ = %d, OLAPFlags_ = %b %s",
		  recLen_, maxHistoryRows_, OLAPFlags_,
		  isUnboundedFollowing() ? ", UNBOUNDED_FOLLOWING" : "");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"minFollowing_ = %d, OLAPBufferSize_ = %d, maxNumberOfOLAPBuffers_ = %d",
		  minFollowing_,OLAPBufferSize_,maxNumberOfOLAPBuffers_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"maxRowsInOLAPBuffer_ = %d, minNumberOfOLAPBuffers_ = %d",
		  maxRowsInOLAPBuffer_, minNumberOfOLAPBuffers_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "numberOfWinOLAPBuffers_ = %d, %s memoryQuotaMB = %d", 
		  numberOfWinOLAPBuffers_,
		  logDiagnostics() ? "LOG_DIAGNOSTICS," : "",
		  memoryQuotaMB());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"%s memUsagePercent = %d, pressureThreshold = %d",
		  isNoOverflow() ? "NO_OVERFLOW," : "",
		  memUsagePercent_,pressureThreshold_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

    }
  
  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}
Esempio n. 11
0
void ComTdbInterpretAsRow::displayContents(Space *space, ULng32 flag)
{
   ComTdb::displayContents(space, flag & 0xFFFFFFFE);
   if (flag & 0x00000008)
   {
      char buf[100];
      str_sprintf(buf,"\nFor ComTdbInterpretAsRow: ");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf,"Audit compression flag = %d", flags_.auditCompressionFlag_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "AuditRowImageLen = %d, extractedRowLen = %d", auditRowImageLen_, extractedRowLen_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
   }

   if (flag & 0x00000001)
   {
      displayExpression(space, flag);
      displayChildren(space, flag);
   }
}
NA_EIDPROC void ComTdbTupleFlow::displayContents(Space * space,ULng32 flag)
{
      ComTdb::displayContents(space,flag & 0xFFFFFFFE);

      if(flag & 0x00000008)
        {
		      char buf[100];

#pragma nowarn(1506)   // warning elimination 
      		Lng32 lFlags = flags_%65536;
#pragma warn(1506)  // warning elimination 
#pragma nowarn(1506)   // warning elimination 
		      Lng32 hFlags = (flags_- lFlags)/65536;
#pragma warn(1506)  // warning elimination 
 	   		str_sprintf(buf, "\nFor ComTdbTupleFlow :\nFlags = %b%b ",hFlags,lFlags );
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
        }

      if(flag & 0x00000001)
        {
        		displayExpression(space,flag);
            displayChildren(space,flag);
        }
}
static void stateMachine()
{
    while (1)
    {
        if (zigbeeNetworkStatus == NWK_ONLINE)
        {
            if(moduleHasMessageWaiting())      //wait until SRDY goes low indicating a message has been received.
            {
                getMessage();                 
                displayMessage();          
            }   
        }
        
        switch (state)
        {
        case STATE_IDLE:
            {
                /* process command line commands only if not doing anything else: */
                if (command != NO_CHARACTER_RECEIVED)
                {
                    /* parse the command entered, and go to the required state */
                    state = processCommand(command);                    
                    command = NO_CHARACTER_RECEIVED;
                }
                /* note: other flags (for different messages or events) can be added here */
                break;
            }
        case STATE_INIT:
            {
                printf("Starting State Machine\r\n");
                state = STATE_GET_DEVICE_TYPE;
                break;
            }
            /* A button press during startup will cause the application to prompt for device type */
        case STATE_GET_DEVICE_TYPE: 
            {
            set_type:                
                while (command == NO_CHARACTER_RECEIVED)
                {
                    printf("Setting Device Type: Press C for Coordinator, R for Router, or E for End Device.\r\n");
#define DEVICE_TYPE_DELAY_MS    2000
#define DEVICE_TYPE_DELAY_PER_CYCLE_MS  100
                    uint16_t delayCycles = DEVICE_TYPE_DELAY_MS / DEVICE_TYPE_DELAY_PER_CYCLE_MS;
                    while ((command == NO_CHARACTER_RECEIVED) && (delayCycles--) > 0)
                        delayMs(DEVICE_TYPE_DELAY_PER_CYCLE_MS);
                }
                
                switch (command)
                {
                case 'C':
                case 'c':
                    printf("Coordinator it is...\r\n");
                    zigbeeDeviceType = COORDINATOR;
                    break;
                case 'R':
                case 'r':
                    printf("Router it is...\r\n");
                    zigbeeDeviceType = ROUTER;
                    break;
                    
                case 'E':
                case 'e':
                    printf("End Device it is...\r\n");
                    zigbeeDeviceType = END_DEVICE;
                    break;
                default:
                    command = NO_CHARACTER_RECEIVED;
                    goto set_type;
                    
                }
                command = NO_CHARACTER_RECEIVED;
                state = STATE_MODULE_STARTUP;
                break;
            }
        case STATE_MODULE_STARTUP:
            {
#define MODULE_START_DELAY_IF_FAIL_MS 5000
                moduleResult_t result;
                /* Start with the default module configuration */
                struct moduleConfiguration defaultConfiguration = DEFAULT_MODULE_CONFIGURATION_COORDINATOR;
                /* Make any changes needed here (channel list, PAN ID, etc.)
                We Configure the Zigbee Device Type (Router, Coordinator, End Device) based on what user selected */
                defaultConfiguration.deviceType = zigbeeDeviceType;
                
                /* Change this below to be your operating region - MODULE_REGION_NORTH_AMERICA or MODULE_REGION_EUROPE */
#define OPERATING_REGION    (MODULE_REGION_NORTH_AMERICA) // or MODULE_REGION_EUROPE
                
                while ((result = expressStartModule(&defaultConfiguration, GENERIC_APPLICATION_CONFIGURATION, OPERATING_REGION)) != MODULE_SUCCESS)
                {
                    SET_NETWORK_FAILURE_LED_ON();          // Turn on the LED to show failure
                    handleModuleError(result);
                    printf("Retrying...\r\n");
                    delayMs(MODULE_START_DELAY_IF_FAIL_MS/2);                    
                    SET_NETWORK_FAILURE_LED_OFF();
                    delayMs(MODULE_START_DELAY_IF_FAIL_MS/2);
                }                
                printf("Success\r\n");
                state = STATE_DISPLAY_NETWORK_INFORMATION;
                zigbeeNetworkStatus = NWK_ONLINE;
                break;
            }
        case STATE_DISPLAY_NETWORK_INFORMATION:                 
            {
                printf("Module Information:\r\n");
                /* On network, display info about this network */
                displayNetworkConfigurationParameters();
                displayDeviceInformation();
                displayCommandLineInterfaceHelp();
                state = STATE_IDLE;   //startup is done!
                break;
            }
        case STATE_VALID_SHORT_ADDRESS_ENTERED:  //command line processor has a valid shortAddressEntered
            {
                state = pendingState;
                break;
            }
        case STATE_VALID_LONG_ADDRESS_ENTERED:
            {
                /* Flip byte order because we need to send it LSB first */
                int8_t temp[8];
                int i;
                for (i=0; i<8; i++)
                    temp[7-i] = longAddressEntered[i];
                
                memcpy(longAddressEntered, temp, 8);  //Store LSB first since that is how it will be sent:
                state = pendingState;
                break;
            }
        case STATE_SEND_MESSAGE_VIA_SHORT_ADDRESS:
            {
                printf("Send to 0x%04X\r\n", shortAddressEntered);
                moduleResult_t result = afSendData(DEFAULT_ENDPOINT,DEFAULT_ENDPOINT,shortAddressEntered, TEST_CLUSTER, testMessage, 5);
                if (result == MODULE_SUCCESS)
                {
                    printf("Success\r\n");
                } else {
                    handleModuleError(result);                    
#ifdef RESTART_AFTER_ZM_FAILURE
                    printf("\r\nRestarting\r\n");
                    state = STATE_MODULE_STARTUP;
                    continue;
#endif
                }
                state = STATE_IDLE;
                break;
            }
        case STATE_SEND_MESSAGE_VIA_LONG_ADDRESS:
            {
                printf("Send to (LSB first)");
                printHexBytes(longAddressEntered, 8);
                moduleResult_t result = afSendDataExtended(DEFAULT_ENDPOINT, DEFAULT_ENDPOINT, longAddressEntered,
                                                           DESTINATION_ADDRESS_MODE_LONG, TEST_CLUSTER, testMessage, 5);
                if (result == MODULE_SUCCESS)
                {
                    printf("Success\r\n");
                } else {
                    handleModuleError(result);
#ifdef RESTART_AFTER_ZM_FAILURE
                    printf("\r\nRestarting\r\n");
                    state = STATE_MODULE_STARTUP;
                    continue;
#endif
                }
                state = STATE_IDLE;
                break;
            }
            
#ifdef LEAVE_REQUEST            
        case STATE_MANAGEMENT_LEAVE_REQUEST:
            {
                printf("Sending Leave Request for MAC (LSB first)");
                printHexBytes(longAddressEntered, 8);
                moduleResult_t result = zdoManagementLeaveRequest(longAddressEntered, 0);
                
                if (result == MODULE_SUCCESS)
                {
                    printf("Success\r\n");
                } else {
                    handleModuleError(result);
                }
                state = STATE_IDLE;
                break;
            }
#endif
            
        case STATE_FIND_VIA_SHORT_ADDRESS:
            {
                printf("Looking for that device...\r\n");
                moduleResult_t result = zdoRequestIeeeAddress(shortAddressEntered, INCLUDE_ASSOCIATED_DEVICES, 0);
                if (result == MODULE_SUCCESS)
                {
#ifndef ZDO_NWK_ADDR_RSP_HANDLED_BY_APPLICATION
                    displayZdoAddressResponse(zmBuf + SRSP_PAYLOAD_START);
#endif
                } else {
                    handleModuleError(result);
                }
                state = STATE_IDLE;
                break;
            }
            
        case STATE_FIND_VIA_LONG_ADDRESS:
            {
                printf("Looking for that device...\r\n");
                moduleResult_t result = zdoNetworkAddressRequest(longAddressEntered, INCLUDE_ASSOCIATED_DEVICES, 0);
                if (result == MODULE_SUCCESS)
                {
#ifndef ZDO_NWK_ADDR_RSP_HANDLED_BY_APPLICATION
                    displayZdoAddressResponse(zmBuf + SRSP_PAYLOAD_START);
#endif
                } else {
                    handleModuleError(result);
                }
                state = STATE_IDLE;
                break;
            }
            
#ifdef INCLUDE_PERMIT_JOIN        
        case STATE_SET_PERMIT_JOIN_ON:
            {
                printf("Turning joining ON...\r\n");
                moduleResult_t result = zdoManagementPermitJoinRequest(shortAddressEntered, PERMIT_JOIN_ON_INDEFINITELY, 0);
                if (result == MODULE_SUCCESS)
                {
                    printf("Success\r\n");
                } else {
                    handleModuleError(result);
                }
                state = STATE_IDLE;
                break; 
            }
            
        case STATE_SET_PERMIT_JOIN_OFF:
            {
                printf("Turning joining OFF...\r\n");
                moduleResult_t result = zdoManagementPermitJoinRequest(shortAddressEntered, PERMIT_JOIN_OFF, 0);
                if (result == MODULE_SUCCESS)
                {
                    printf("Success\r\n");
                } else {
                    handleModuleError(result);
                }
                state = STATE_IDLE;
                break; 
            }   
#endif
            
#ifdef DISCOVER_NETWORKS             
        case STATE_NETWORK_DISCOVERY_REQUEST:
            {
                printf("Scanning...\r\n");
                moduleResult_t result = zdoNetworkDiscoveryRequest(ANY_CHANNEL_MASK, BEACON_ORDER_480_MSEC);
                if (result == MODULE_SUCCESS)
                {
                    printf("Success\r\n");
                } else {
                    handleModuleError(result);
                }
                state = STATE_IDLE;
                break; 
            }
#endif
            
#ifdef INCLUDE_NETWORK_TOPOLOGY
        case STATE_GET_NETWORK_TOPOLOGY:
            {
                printf("Displaying NWK Topology...........\r\n");                
                initSet(&searchedSet);
                // Start the recursive search for all children of the short address
                //removeAllFromSet();
                int8_t numChildren = displayChildren(shortAddressEntered);
                state = STATE_IDLE;
                break;
            }
#endif
            
        default:     //should never happen
            {
                printf("UNKNOWN STATE (%u)\r\n", state);
                state = STATE_IDLE;
            }
            break;
        }
    }
}
Esempio n. 14
0
//! ---|> Component
void Container::doDisplay(const Geometry::Rect & region) {
	enableLocalDisplayProperties();
	displayDefaultShapes();	
	disableLocalDisplayProperties();
	displayChildren(region);
}
Esempio n. 15
0
void ComTdbHbaseAccess::displayContents(Space * space,ULng32 flag)
{
  ComTdb::displayContents(space,flag & 0xFFFFFFFE);

  if(flag & 0x00000008)
    {
      char buf[1000];

      str_sprintf(buf, "\nFor ComTdbHbaseAccess :");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "accessType_ = %s", (char*)getAccessTypeStr(accessType_));
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "accessDetail_ = %s", getNodeName());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      if (samplingRate_ > 0)
        {
          // str_printf does not handle %f correctly, format as string first.
          char sbuf[20];
          snprintf(sbuf, sizeof(sbuf), "%f", samplingRate_);
          str_sprintf(buf, "samplingRate_ = %s", sbuf);
          space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
        }

      if (tableName_)
	{
	  str_sprintf(buf, "tableName_ = %s", (char*)tableName_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	}

      str_sprintf(buf, "asciiTI_ = %d, convertTI_ = %d, rowIdTI_ = %d, returnedTI_ = %d",
		  asciiTuppIndex_, convertTuppIndex_, rowIdTuppIndex_, returnedTuppIndex_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "rowIdAsciiTI_ = %d, updateTI_ = %d, mergeInsertTI_ = %d",
		  rowIdAsciiTuppIndex_, updateTuppIndex_, mergeInsertTuppIndex_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "returnedFetchedTI_ = %d, returnedUpdatedTI_ = %d, mergeInsertRowIdTI_ = %d",
		  returnedFetchedTuppIndex_, returnedUpdatedTuppIndex_,
		  mergeInsertRowIdTuppIndex_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "asciiRowLen_ = %d, convertRowLen_ = %d, rowIdLen_ = %d, outputRowLen_ = %d", 
		  asciiRowLen_, convertRowLen_, rowIdLen_, outputRowLen_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "updateRowLen_ = %d, returnFetchedRowLen_ = %d, returnUpdateedRowLen_ = %d", 
		  updateRowLen_, returnFetchedRowLen_, returnUpdatedRowLen_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "mergeInsertRowLen_ = %d, keyLen_ = %d", 
		  mergeInsertRowLen_, keyLen_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "Flag = %b",flags_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "server_ = %s, zkPort_ = %s", server(), zkPort());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      if (listOfFetchedColNames())
	{
	  str_sprintf(buf, "\nlistOfFetchedColNames_(numEntries = %d):\n",
		      listOfFetchedColNames()->numEntries());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	  if (sqHbaseTable())
	    showColNames(listOfFetchedColNames(), space);
	  else
	    showStrColNames(listOfFetchedColNames(), space);
	}

      if (listOfUpDeldColNames())
	{
	  str_sprintf(buf, "\nlistOfUpDeldColNames_(numEntries = %d):\n",
		      listOfUpDeldColNames()->numEntries());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	  
	  if (sqHbaseTable())
	    showColNames(listOfUpDeldColNames(), space);
	  else
	    showStrColNames(listOfUpDeldColNames(), space);

	  /*
	  if (updelColnameIsStr())
	    showStrColNames(listOfUpDeldColNames(), space);
	  else
	    showColNames(listOfUpDeldColNames(), space);
	  */
	}

      if (0)//listOfMergedColNames())
	{
	  str_sprintf(buf, "\nlistOfMergedColNames_(numEntries = %d):\n",
		      listOfMergedColNames()->numEntries());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	  
	  showColNames(listOfMergedColNames(), space);
	}

     if (listOfScanRows())
	{
	  str_sprintf(buf, "\nlistOfScanRows_(numEntries = %d):",
		      listOfScanRows()->numEntries());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	  listOfScanRows()->position();
	  for (Lng32 i = 0; i < listOfScanRows()->numEntries(); i++)
	    {
	      HbaseScanRows * hsr = (HbaseScanRows*)listOfScanRows()->getNext();

	      str_sprintf(buf, "\n  Entry #%d:", i+1);
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	      str_sprintf(buf, "    beginRowId_%s = ",
			  (hsr->beginKeyExclusive_ ? "(excl)" : "(incl)")); 
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	      
	      displayRowId(space, hsr->beginRowId());
	      
	      str_sprintf(buf, "    endRowId_%s = ",
			  (hsr->endKeyExclusive_ ? "(excl)" : "(incl)")); 			  
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	      displayRowId(space, hsr->endRowId());

	      if (0) //hsr->colNames())
		{
		  str_sprintf(buf, "\n    colNames_(numEntries = %d):",
			      hsr->colNames()->numEntries());
		  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		  
		  hsr->colNames()->position();
		  for (Lng32 j = 0; j < hsr->colNames()->numEntries(); j++)
		    {
		      str_sprintf(buf, "\n      Entry #%d:", j+1);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		      
		      char * colName = (char*)hsr->colNames()->getNext();
		      str_sprintf(buf, "        colName='%s'", colName);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		    } // for
		} // if colNames

	      str_sprintf(buf, "\n    colTS_=%Ld",
			  hsr->colTS_);
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	    } // for
	} // if

      if (listOfGetRows())
	{
	  str_sprintf(buf, "\nlistOfGetRows_(numEntries = %d):",
		      listOfGetRows()->numEntries());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	  listOfGetRows()->position();
	  for (Lng32 i = 0; i < listOfGetRows()->numEntries(); i++)
	    {
	      HbaseGetRows * hgr = (HbaseGetRows*)listOfGetRows()->getNext();

	      str_sprintf(buf, "\n  Entry #%d:", i+1);
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	      if (hgr->rowIds())
		{
		  str_sprintf(buf, "\n    rowIds_(numEntries = %d):",
			      hgr->rowIds()->numEntries());
		  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		  
		  hgr->rowIds()->position();
		  for (Lng32 j = 0; j < hgr->rowIds()->numEntries(); j++)
		    {
		      str_sprintf(buf, "      Entry #%d:", j+1);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		      
		      char * rowId = (char*)hgr->rowIds()->getNext();

		      ExpTupleDesc * asciiSourceTD =
			workCriDesc_->getTupleDescriptor(rowIdAsciiTuppIndex_);
		      
		      str_sprintf(buf, "      rowId_= ");
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

		      displayRowId(space, rowId);
		    } // for
		  
		} // if

	      if (0) //hgr->colNames())
		{
		  str_sprintf(buf, "\n    colNames_(numEntries = %d):",
			      hgr->colNames()->numEntries());
		  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		  
		  hgr->colNames()->position();
		  for (Lng32 j = 0; j < hgr->colNames()->numEntries(); j++)
		    {
		      str_sprintf(buf, "      Entry #%d:", j+1);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		      
		      char * colName = (char*)hgr->colNames()->getNext();
		      str_sprintf(buf, "        colName='%s'", colName);
		      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
		    } // for
		} // if

	      str_sprintf(buf, "\n    colTS_=%Ld",
			  hgr->colTS_);
	      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	    } // for
	} // if
      if (getHbaseSnapshotScanAttributes() &&
          getHbaseSnapshotScanAttributes()->getUseSnapshotScan())
      {
        str_sprintf(buf, "use_snapshot_scan = %s, snapshot_name = %s, snapshot_temp_location = %s",
                    "TRUE",
                    getHbaseSnapshotScanAttributes()->getSnapshotName(),
                    getHbaseSnapshotScanAttributes()->getSnapScanTmpLocation());
        space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }
      
    }
  
  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}
Esempio n. 16
0
void ComTdbCancel::displayContents(Space * space,ULng32 flag)
{
  ComTdb::displayContents(space,flag & 0xFFFFFFFE);

  if(flag & 0x00000008)
    {
    char buf[200];

    str_sprintf(buf, "\nFor ComTdbCancel :");
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

    if (action_ == CancelByQid)
    {
      str_sprintf(buf, "action_ = cancel by queryId ");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "qid_ = %s ", getQidText());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
    else if (action_ == CancelByPname)
    {
      str_sprintf(buf, "action_ = cancel by process name "
                       "with minimum blocking interval of %d seconds ", 
                  cancelPidBlockThreshold_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "cancelPname_ = %s ", getCancelPname());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
    else if (action_ == CancelByNidPid)
    {
      str_sprintf(buf, "action_ = cancel by nid,pid "
                       "with minimum blocking interval of %d seconds ",
                  cancelPidBlockThreshold_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "cancelNid_,cancelPid_ = %d,%d ", 
                  getCancelNid(), getCancelPid());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }
    else 
    {
      if (action_ == Activate)
      {
        str_sprintf(buf, "action_ = activate ");
        space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }
      else    // must be Suspend
      {
        if (forced_ == Force)
          str_sprintf(buf, "action_ = suspend (forced) ");
        else
          str_sprintf(buf, "action_ = suspend (safe) ");
        space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }
      str_sprintf(buf, "qid_ = %s ", getQidText());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }

    str_sprintf(buf, "comment_ = %s ", getCommentText());
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
    }

  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}
Esempio n. 17
0
void ComTdbHashj::displayContents(Space * space,ULng32 flag)
{
  ComTdb::displayContents(space,flag & 0xFFFFFFFE);

  if (flag & 0x00000008)
    {
      char buf[100];
      str_sprintf(buf, "\nFor ComTdbHashj :");
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,
		  "hjFlags = %b, isSemiJoin = %d, isLeftJoin = %d, isRightJoin = %d",
		  hjFlags_,isSemiJoin(),isLeftJoin(),isRightJoin());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"isAntiSemiJoin = %d, isUniqueHashJoin = %d, "
                       "isNoOverflow = %d, isReuse = %d",
		  isAntiSemiJoin(),isUniqueHashJoin(),isNoOverflow(),isReuse());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      if ( forceOverflowEvery() ) {
	str_sprintf(buf,"forceOverflowEvery = %d ",  forceOverflowEvery() );
	space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }
      if ( forceClusterSplitAfterMB() || forceHashLoopAfterNumBuffers() ) {
	str_sprintf(buf,"forceClusterSplitAfterMB = %d, forceHashLoopAfterNumBuffers = %d ",
		    forceClusterSplitAfterMB(), forceHashLoopAfterNumBuffers());
	space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }

      str_sprintf(buf,"bufferedWrites = %d, logDiagnostics = %d, hashBufferSize = %d",
		  bufferedWrites(), logDiagnostics(), hashBufferSize_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "memoryQuotaMB = %d, numClusters = %d", 
		  memoryQuotaMB(), numClusters());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "isReturnRightOrdered = %d, isPossibleMultipleCalls = %d ", 
		  isReturnRightOrdered(), isPossibleMultipleCalls());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"All or Nothing = %d, delayLeftRequest = %d ", 
		  isAntiSemiJoin() && ! rightSearchExpr_ , delayLeftRequest());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"leftRowLength = %d, rightRowLength = %d, instRowForLeftJoinLength = %d ",
		  leftRowLength_,rightRowLength_,instRowForLeftJoinLength_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"extLeftRowLength = %d, extRightRowLength = %d, minMaxRowLength = %d",
                  extLeftRowLength_,extRightRowLength_, minMaxRowLength_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"outerExpectedRows = %f, innerExpectedRows = %f",
				    outerExpectedRows(),innerExpectedRows());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"memUsagePercent = %d, pressureThreshold = %d",
		  memUsagePercent_,pressureThreshold_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"hjMemEstInMbPerCpu = %f, estimateErrorPenalty = %d ",
		  hjMemEstInMbPerCpu_, hjGrowthPercent_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf,"bmoCitizenshipFactor = %f, PhyMemoryContingencyMB = %d ",
		  bmoCitizenshipFactor_, pMemoryContingencyMB_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

    }

  if (flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}
Esempio n. 18
0
void ComTdbUdr::displayContents(Space *space, ULng32 flag)
{
  ComTdb::displayContents(space, flag & 0xFFFFFFFE);

  if (flag & 0x00000008)
  {
    const size_t sz = sizeof(short);
    char buf[512];

    str_sprintf(buf, "\nFor ComTdbUdr :");
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    Lng32 lowFlags = (Lng32) (flags_ % 65536);
    Lng32 highFlags = (Lng32) ((flags_ - lowFlags) / 65536);
    str_sprintf(buf, "flags = %b%b", highFlags, lowFlags);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    if (sqlName_)
    {
      char *s = sqlName_;
      str_sprintf(buf, "routineName = %s", s);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

    if (routineName_)
    {
      char *s = routineName_;
      str_sprintf(buf, "externalName = %s", s);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

    if (containerName_)
    {
      char *s = containerName_;
      str_sprintf(buf, "externalFile = %s", s);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

    if (externalPath_)
    {
      char *s = externalPath_;
      str_sprintf(buf, "externalPath = %s", s);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

    if (librarySqlName_)
    {
      char *s = librarySqlName_;
      str_sprintf(buf, "librarySqlName = %s", s);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

    // Some strings come from the user and there is no limit on the
    // maximum length. For these strings we will print two lines, the
    // first a header line and the second the actual string. For
    // example, the Java signature will look like this in the SHOWPLAN
    // output:
    //
    // signature =
    // (Ljava/lang/Float;[Ljava/lang/Float;)V
    //
    const char *s1;
    const char *s2;

    if (routineSignature_)
    {
      s1 = "\nsignature = ";
      s2 = routineSignature_;
      space->allocateAndCopyToAlignedSpace(s1, str_len(s1), sz);
      space->allocateAndCopyToAlignedSpace(s2, str_len(s2), sz);
    }

    if (runtimeOptions_)
    {
      s1 = "\nruntimeOptions = ";
      s2 = runtimeOptions_;
      space->allocateAndCopyToAlignedSpace(s1, str_len(s1), sz);
      space->allocateAndCopyToAlignedSpace(s2, str_len(s2), sz);
    }

    if (runtimeOptionDelimiters_)
    {
      s1 = "\noptionDelimiters = ";
      s2 = runtimeOptionDelimiters_;
      space->allocateAndCopyToAlignedSpace(s1, str_len(s1), sz);
      space->allocateAndCopyToAlignedSpace(s2, str_len(s2), sz);
    }

    str_sprintf(buf, "\nnumParameters = %d, maxResultSets = %d",
                numParams_, maxResultSets_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    
    str_sprintf(buf, "numInputValues = %d, numOutputValues = %d",
                numInputValues_, numOutputValues_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    
    str_sprintf(buf, "requestBufferSize = %d, replyBufferSize = %d",
                requestSqlBufferSize_, replySqlBufferSize_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    
    str_sprintf(buf, "requestRowLength = %d, replyRowLength = %d",
                requestRowLen_, replyRowLen_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    
    str_sprintf(buf, "outputRowLen = %d, stateAreaSize = %d",
                outputRowLen_, stateAreaSize_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    
    str_sprintf(buf, "requestTuppIndex = %d, replyTuppIndex = %d",
                (Int32) requestTuppIndex_, (Int32) replyTuppIndex_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "udrType = %d, languageType = %d",
                (Int32) udrType_, (Int32) languageType_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "parameterStyle = %d, sqlAccessMode = %d",
                (Int32) paramStyle_, (Int32) sqlAccessMode_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "transactionAttributes = %d", (Int32) transactionAttrs_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "externalSecurity = %d, routineOwnerId = %d",
                (Int32) externalSecurity_, (Int32) routineOwnerId_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    UInt32 i;
    for (i = 0; i < numParams_; i++)
    {
      const UdrFormalParamInfo *p = paramInfo_[i];

      str_sprintf(buf, "\nParameter %d", (Int32) i);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

      str_sprintf(buf, "  name [%s]", p->getParamName());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

      str_sprintf(buf, "  flags %b, type %d", p->getFlags(),
                  (Int32) p->getType());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

      str_sprintf(buf, "  precision %d, scale %d, charset %d, collation %d",
                  (Int32) p->getPrecision(), (Int32) p->getScale(),
                  (Int32) p->getEncodingCharSet(), (Int32) p->getCollation());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

    Queue *optData = getOptionalData();
    if (optData)
    {
      UInt32 dataElems = optData->numEntries();
      str_sprintf(buf, "\nNumber of optional data elements: %d",
                  (Int32) dataElems);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

      const char *s = NULL;
      i = 0;

      optData->position();
      while ((s = (const char *) optData->getNext()) != NULL)
      {
        // Each data element is prefixed by a 4-byte length field
        UInt32 len = 0;
        str_cpy_all((char *)&len, s, 4);

        str_sprintf(buf, "\nOptional data %d (length %d):",
                    (Int32) i++, (Int32) len);
        space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

        if (len > 0)
        {
          // Create a buffer containing at most 200 bytes of data
          if (len > 200)
            len = 200;
          char truncatedBuf[201];
          str_cpy_all(truncatedBuf, s + 4, len);
          truncatedBuf[len] = 0;

          // Change NULL bytes and non-ASCII characters to '.' for
          // display purposes
          for (UInt32 j = 0; j < len; j++)
          {
            if (truncatedBuf[j] == 0 || !isascii(truncatedBuf[j]))
              truncatedBuf[j] = '.';
          }
          
          space->allocateAndCopyToAlignedSpace(truncatedBuf, len, sz);
        }
      }
    }
    if (javaDebugPort_ > 0)
    {
      str_sprintf(buf, "\njavaDebugPort = %d, javaDebugTimeout = %d",
                  javaDebugPort_, javaDebugTimeout_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
    }

  } // if (flag & 0x00000008)

  if (flag & 0x00000001)
  {
    displayExpression(space,flag);
    displayChildren(space,flag);
  }
}
void ComTdbFastExtract::displayContents(Space *space, ULng32 flag)
{
  ComTdb::displayContents(space, flag & 0xFFFFFFFE);

  if (flag & 0x00000008)
  {
    const size_t sz = sizeof(short);
    char buf[512];

    str_sprintf(buf, "\nFor ComTdbFastExtract :");
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    Lng32 lowFlags = (Lng32) (flags_ % 65536);
    Lng32 highFlags = (Lng32) ((flags_ - lowFlags) / 65536);
    str_sprintf(buf, "flags = %b%b", highFlags, lowFlags);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "requestRowLength = %d ", requestRowLen_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "outputRowLen = %d ", outputRowLen_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    str_sprintf(buf, "childTuppIndex = %d ", (Int32) childDataTuppIndex_);
    space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);

    if (targetName_)
   {
	 char *s = targetName_;
	 str_sprintf(buf, "targetName = %s", s);
	 space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
   }

    if (hdfsHostName_)
   {
	 char *s = hdfsHostName_;
	 str_sprintf(buf, "hdfsHostName = %s", s);
	 space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
   }
    
   str_sprintf(buf,"hdfsPortNum = %d", hdfsPortNum_);
   space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(UInt16));

   if (delimiter_)
   {
	 char *s = delimiter_;
	 str_sprintf(buf, "delimiter = %s", s);
	 space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
   }

   if (header_)
   {
	 char *s = header_;
	 str_sprintf(buf, "header = %s", s);
	 space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
   }

   if (nullString_)
   {
	 char *s = nullString_;
	 str_sprintf(buf, "nullString = %s", s);
	 space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
   }

   if (recordSeparator_)
   {
	 char *s = recordSeparator_;
	 str_sprintf(buf, "recordSeparator = %s", s);
	 space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sz);
   }

   str_sprintf(buf,"numIOBuffers = %d", numIOBuffers_);
   space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(UInt16));

  } // if (flag & 0x00000008)

   displayExpression(space,flag);
   displayChildren(space,flag);

}
Esempio n. 20
0
void ComTdbRoot::displayContents(Space * space,ULng32 flag)
{
  ComTdb::displayContents(space,flag & 0xFFFFFFFE);
  
  if(flag & 0x00000008)
    {
      char buf[1000];
      str_sprintf(buf, "\nFor ComTdbRoot :\nFirstNRows = %d, baseTablenamePosition = %d ",
		  firstNRows_,baseTablenamePosition_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      str_sprintf(buf, "queryType_ = %d, planVersion_ = %d ",
		  queryType_, planVersion_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      UInt32 lFlags = rtFlags1_%65536;
      UInt32 hFlags = (rtFlags1_- lFlags)/65536;
      str_sprintf(buf,"rtFlags1_ = %b%b ",hFlags,lFlags);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      lFlags = rtFlags2_%65536;
      hFlags = (rtFlags2_- lFlags)/65536;
      str_sprintf(buf,"rtFlags2_ = %b%b ",hFlags,lFlags);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf,"rtFlags3_ = %b ", rtFlags3_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      lFlags = rtFlags4_%65536;
      hFlags = (rtFlags4_- lFlags)/65536;
      str_sprintf(buf,"rtFlags4_ = %b%b ",hFlags,lFlags);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      lFlags = rtFlags5_%65536;
      hFlags = (rtFlags5_- lFlags)/65536;
      str_sprintf(buf,"rtFlags5_ = %b%b ",hFlags,lFlags);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

      str_sprintf(buf, "queryType_ = %d", (Int32) queryType_);
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      str_sprintf(buf, "inputVarsSize_ = %d", inputVarsSize());
      space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      
      if(numUpdateCol_ != 0)
	{
	  str_sprintf(buf, "numUpdateCol = %d",numUpdateCol_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	}

      if (compoundStmtsInfo_ != 0)
	{
	  str_sprintf(buf,"compoundStmtsInfo_ = %b ",compoundStmtsInfo_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	}

      if (udrCount_ > 0 || maxResultSets_ > 0)
      {
        str_sprintf(buf, "UDR count = %d, Max Result Sets = %d",
                    (Int32) udrCount_, (Int32) maxResultSets_);
        space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }

      if( uninitializedMvCount_ > 0 )
      {
        str_sprintf(buf, 
                    "Uninitialized MV count = %d",
                    (Int32) uninitializedMvCount_);
        space->allocateAndCopyToAlignedSpace(buf, 
                                             str_len(buf), 
                                             sizeof(short));

        for( Int32 i = 0; i < uninitializedMvCount_; i++ )
        {
            UninitializedMvName currentMv = uninitializedMvList_[i];
            str_sprintf(buf, 
                    "Uninitialized MV (physical=%s,ansi=%s)\n",
                    currentMv.getPhysicalName(), currentMv.getAnsiName());
            space->allocateAndCopyToAlignedSpace(buf, 
                                                 str_len(buf), 
                                                 sizeof(short));
        }
      }
      
      if (hasCallStmtExpressions())
      {
        str_sprintf(buf, "Has CALL Statement Expressions = YES");
        space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
      }
    
      if (getRWRSInfo())
	{
	  str_sprintf(buf, "rwrsMaxSize_ = %d", getRWRSInfo()->rwrsMaxSize());
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	  str_sprintf(buf, "rwrsInputSizeIndex_ = %d, rwrsMaxInputRowlenIndex_ = %d, ", 
		      getRWRSInfo()->rwrsInputSizeIndex_, getRWRSInfo()->rwrsMaxInputRowlenIndex_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	  str_sprintf(buf, "rwrsBufferAddrIndex_ = %d, rwrsPartnNumIndex_ = %d",
		      getRWRSInfo()->rwrsBufferAddrIndex_, getRWRSInfo()->rwrsPartnNumIndex_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));

	  str_sprintf(buf, "rwrsMaxInternalRowlen_ = %d",
		      getRWRSInfo()->rwrsMaxInternalRowlen_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	  
	  str_sprintf(buf,"flags_ = %b ", getRWRSInfo()->flags_);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
	}

      Lng32 fragOffset;
      Lng32 fragLen;
      Lng32 topNodeOffset;
      if (getFragDir()->getExplainFragDirEntry
          (fragOffset, fragLen, topNodeOffset) == 0)
        {
          char buf[64];
          str_sprintf(buf, "explain_plan_size = %d", fragLen);
	  space->allocateAndCopyToAlignedSpace(buf, str_len(buf), sizeof(short));
        }

    }
  
  if(flag & 0x00000001)
    {
      displayExpression(space,flag);
      displayChildren(space,flag);
    }
}