Esempio n. 1
0
Snapshot::Snapshot(JNIEnv* env)
{
	initElementNames();

	// The root entity is not visible to the end user
	rootEntity = addEntityToEntity(env, NULL, "root");

	// System entity is actually the root SQLM_ELM_COLLECTED
	systemEntity = NULL;
}
Esempio n. 2
0
int DLLEXPORT SMO_getElementName(SMOutputAPI* smoapi, SMO_elementType type,
		int index, char* name, int* length)
//
//  Purpose: Given an element index returns the element name.
//
//  Note: The caller is responsible for allocating memory for the char array
//    name. The caller passes the length of the array allocated and the length
//    of the name requested is returned. The name may be truncated if an array of
//    adequate length is not passed.
//
{
	int idx, errorcode = 0;

	// Initialize the name array if necessary
	if (smoapi->elementNames == NULL) initElementNames(smoapi);

	switch (type)
	{
	case subcatch:  if (index < 0 || index >= smoapi->Nsubcatch) errorcode = 423;
					else idx = index;
		break;
	case node:		if (index < 0 || index >= smoapi->Nnodes) errorcode = 423;
					else idx = smoapi->Nsubcatch + index;
		break;
	case link:      if (index < 0 || index >= smoapi->Nlinks) errorcode = 423;
					else idx = smoapi->Nsubcatch + smoapi->Nnodes + index;
	    break;
	case sys:       if (index < 0 || index >= smoapi->Npolluts) errorcode = 423;
					else idx = smoapi->Nsubcatch + smoapi->Nnodes + smoapi->Nlinks + index;
		break;
	default:        errorcode = 421;
	}

	if (!errorcode) {
		strncpy(name, smoapi->elementNames[idx].IDname, *length);

		*length = smoapi->elementNames[idx].length;
	}
	return errorcode;
}