nucm-logo

NUCM-2.0 Documentation
Interface: Query: nc_existsversion


[Collection | Query | Attribute]

[nc_list | nc_gettype | nc_version | nc_lastversion | nc_existsversion | nc_isinitiated]

Signature

int  nc_existsversion(const char*  path,
                      const char*  p_cwd,
		      const char*  version)

Functionality

Determines whether the version determined by the parameter version of the artifact determined by the interpretation of the parameters path and p_cwd exists.

Return Values

1: everything went ok and the version does exist
0: everything went ok and the version does not exist
-1: an error occurred

NdbErrno Codes

NdbOk :everything went ok
NdbUnknown :the path does not represent a NUCM artifact
NdbNotOpen :the NUCM artifact has not been opened in the workspace
NdbConnect :the server is down or not reachable
NdbComm :a communication error occurred
NdbProtocol:a failure occurred in the NUCM protocol
NdbNotAvail:service is not available

Example

Assuming a repository is filled with projects, and in particular contains a project "my_project". To examine which versions of "my_project" exist, the following code fragment can be used:
   #include "nc.h"

   char  lastversion[MAX_VERSION_LENGTH + 1];
   char  version[MAX_VERSION_LENGTH + 1];
   int  result;
   int  i;

   nc_lastversion("//serl.cs.colorado.edu:1234/nucm_root/my_project/4",
		  "",
		  lastversion);
   for (i = 1 ; i <= atoi(lastversion) ; i++) {
      sprintf(version, "%d", i);
      result = nc_existsversion("//serl.cs.colorado.edu:1234/nucm_root/my_project/4",
				"",
				version);
      if (result == -1) {
	 printf("Error during examination of existence of version %d", i);
      } else if (result == 0) {
	 printf("Version %d does not exist\n", i);
      } else {
	 printf("Version %d does exist\n", i);
      }
   }

[Top | Quick Index] [Concepts | Interface]

SERL <serl.cs.colorado.edu>