/* System headers */ #include #include #include #include #include /* Local headers */ #include "pcms_api.h" #include "pcms_event.h" #include "clientapi.h" #define DIM_CMDE_CREATE_BASELINE "CBL \"%s:%s\" /PART=\"%s:%s.A;1\" /TEMPLATE_ID=\"ITEMS_APPROUVES\" /WORKSET=\"%s:%s\" /LEVEL=\"0\" /TYPE=\"APPCONSTIT\" /ATTRIBUTES=(NOM_ODT=\"ODTGEN\",VERSION_ODT=\"%s\",) /SCOPE=\"PART\"\n" #define DIM_CMDE_CREATE_RELEASE "REL \"%s:%s\" /BASELINE=\"%s:%s\" /DIRECTORY=\"%s\" /TEMPLATE=\"%s\" /FILENAME=\"%s\" /NOEXPAND /NOOVERWRITE\n" #define DIM_CMDE_LINK_CUSTOMER "FRC \"%s:%s\" /CUSTOMER=\"%s\" /LOCATION=\"%s\" /PROJECT=\"%s\"\n" int main() { int conId = PCMS_ERROR; int status = EXIT_SUCCESS; char userName[255] = "test"; // User ID char usrPasswd[255] = "testpassword"; // Password char dbName[255] = "dbtest"; // Db Name char hostName[255] = "localhost"; // Server char dsn[255] = "cmtgc12"; // DB Connection if ((conId = PcmsClntApiSilentConnect(userName, usrPasswd, hostName, 0, dbName, 0, dsn))==PCMS_ERROR) { (void)fprintf(stderr,"Error: Unable to connect to PCMS\n"); return(EXIT_FAILURE); } PcmsObjStruct obj = { 0 }; obj.objType = PCMS_PRODUCT; int noUids = 0; int *uids = NULL; if (PcmsQuery(conId, &obj, 0, &noUids, &uids) == PCMS_OK && noUids) { for (int i = 0; i < noUids; i++) { if (PcmsInitUid(conId, uids[i], PCMS_PRODUCT, &obj) != PCMS_OK) continue; // use "obj" to get details of Product printf("%s : %s\n", "Product", obj.productId ); } } return ( status ); }