BOOL GetComputerName (LPSTR lpBuffer, LPDWORD nSize) { short actualSize; NODENUMBER_TO_NODENAME_( -1L,// Node number (if not present or -1 is the current node) lpBuffer, // buffer that contains the name *nSize, // buffer size &actualSize);// actual size returned lpBuffer[actualSize] = '\0'; *nSize = actualSize; return TRUE; }
NABoolean NAClusterInfo::NODE_ID_TO_NAME(Int32 nodeId, char *nodeName, short maxLen, short *actualLen) { //Currently, this method behaves as same as NODENUMBER_TO_NODENAME_(), //which always returns "\\NSK", the only reason for doing this is to //avoid diff in regression test and core file dumped when exiting sqlci.(don't know why.) NODENUMBER_TO_NODENAME_(nodeId, nodeName, maxLen, actualLen); return TRUE; //Following code may be used in future to provide real node id to name map. *actualLen = 0; if (nodeIdToNodeNameMap_->contains(&nodeId)) { NAString * value = nodeIdToNodeNameMap_->getFirstValue(&nodeId); *actualLen = value->length(); strncpy(nodeName, value->data(), maxLen < (*actualLen) ? maxLen : (*actualLen)); return TRUE; } return FALSE; }