IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 9, 2025, 9:40:41 AM (14 months ago)
Author:
eugene
Message:

add support for xcstack, xcsky, xcff; update create (pxadmin) to be consistent with gpc1/gpc2; remove pstamp tables from pxadmin (not in gpc1/gpc2 db); fix a minor bug in addtool w.r.t. minidvodb_path; add -simple option to disttool; add updatesummitExp mode

Location:
trunk/ippTools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools

  • trunk/ippTools/src

  • trunk/ippTools/src/addtool.c

    r42712 r42837  
    16941694  // required
    16951695  PXOPT_LOOKUP_STR(minidvodb_group, config->args, "-set_minidvodb_group", true, false);
    1696   PXOPT_LOOKUP_STR(minidvodb_path, config->args, "-set_minidvodb_path", false, false);
     1696  PXOPT_LOOKUP_STR(minidvodb_path_raw, config->args, "-set_minidvodb_path", false, false);
    16971697  PXOPT_LOOKUP_STR(minidvodb_host, config->args, "-set_minidvodb_host", false, false);
    16981698  //optional
    1699   PXOPT_LOOKUP_STR(minidvodb_name, config->args, "-set_minidvodb_name", false, false);
     1699  PXOPT_LOOKUP_STR(minidvodb_name_raw, config->args, "-set_minidvodb_name", false, false);
    17001700  PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
    17011701  PXOPT_LOOKUP_STR(note,            config->args, "-set_note",            false, false);
     
    17061706  }
    17071707
    1708 //  psString minidvodbpath = "NULL";
    1709 
    1710   // I don't know how to get around the complaints of minidvodb_path can't be null. this 'fixes' it, but someone smarter can fix it properly.
    1711 //  if (minidvodb_path) {
    1712 //    minidvodbpath = minidvodb_path;
    1713 //  } else {
    1714 //    psError(PS_ERR_UNKNOWN, false, "require minidvodb_path");
    1715 //    return false;
    1716 //  }
    1717  
    17181708  if (!minidvodbRunInsert(config->dbh,
    17191709                          0, // job_id
    1720                           minidvodb_name,
     1710                          minidvodb_name_raw,
    17211711                          minidvodb_group,
    1722                           minidvodb_path,
     1712                          minidvodb_path_raw,
    17231713                          minidvodb_host,
    17241714                          "new",
     
    17411731  printf("%" PRId64 "\n", minidvodb_id);
    17421732
    1743  
    1744   if (!minidvodb_name) {
    1745     psStringAppend(&minidvodb_name, "%s.%" PRIu64,minidvodb_group,minidvodb_id);
    1746   }
    1747   if (minidvodb_path) {
    1748     psStringAppend(&minidvodb_path,"/%s",minidvodb_name);
    1749   }
    1750 
    1751   psString query = NULL;
    1752 
    1753   psStringAppend(&query, "UPDATE minidvodbRun SET minidvodb_path = '%s', minidvodb_name = '%s' where minidvodb_id = %" PRIu64";", minidvodb_path, minidvodb_name, minidvodb_id);
    1754 
    1755   if (!p_psDBRunQuery(config->dbh, query)) {
    1756     psError(PS_ERR_UNKNOWN, false, "database error");
    1757     psFree(query);
    1758     return false;
    1759   }
    1760 
    1761   if (!psDBCommit(config->dbh)) {
    1762     psError(PS_ERR_UNKNOWN, false, "database error");
    1763     return false;
    1764   }
     1733  // we created a new entry using the values supplied above for minidvodb_name_raw, minidvodb_host_raw.
     1734  // If minidvodb_name is not specified, it will be generated based on the value of minidvodb_group and
     1735  // the minidvodb_id of the new entry.  But this means we need to insert first, get the ID, then update.
     1736
     1737  bool doUpdate = false;
     1738
     1739  // Below: note that minidvodb_name_raw and minidvodb_path_raw are stored on config->args
     1740  // we need to work with a temporary external variable to avoid changing entries on the MD
     1741
     1742  // if minidvodb_name_raw is not specified above, create it from minidvodb_group
     1743  psString minidvodb_name = NULL;
     1744  if (minidvodb_name_raw) {
     1745    minidvodb_name = psStringCopy (minidvodb_name_raw);
     1746  } else {
     1747    psStringAppend(&minidvodb_name, "%s.%" PRIu64, minidvodb_group, minidvodb_id);
     1748    doUpdate = true;
     1749  }
     1750
     1751  // if minidvodb_path_raw IS specified above, update it with the minidvodb_name
     1752  psString minidvodb_path = NULL;
     1753  if (minidvodb_path_raw) {
     1754    psStringAppend(&minidvodb_path, "%s/%s", minidvodb_path_raw, minidvodb_name);
     1755    doUpdate = true;
     1756  }
     1757
     1758  if (doUpdate) {
     1759    psString query = NULL;
     1760
     1761    psStringAppend(&query, "UPDATE minidvodbRun SET minidvodb_path = '%s', minidvodb_name = '%s' where minidvodb_id = %" PRIu64";", minidvodb_path, minidvodb_name, minidvodb_id);
     1762
     1763    if (!p_psDBRunQuery(config->dbh, query)) {
     1764      psError(PS_ERR_UNKNOWN, false, "database error");
     1765      psFree(query);
     1766      return false;
     1767    }
     1768
     1769    if (!psDBCommit(config->dbh)) {
     1770      psError(PS_ERR_UNKNOWN, false, "database error");
     1771      return false;
     1772    }
     1773  }
     1774
     1775  psFree (minidvodb_name);
     1776  psFree (minidvodb_path);
    17651777
    17661778  return true;
Note: See TracChangeset for help on using the changeset viewer.