IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 22, 2010, 1:58:02 PM (16 years ago)
Author:
bills
Message:

changes to support updating only a subset of the components of a run

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/chiptool.c

    r27195 r27391  
    5959static bool importrunMode(pxConfig *config);
    6060static bool runstateMode(pxConfig *config);
     61static bool setimfiletoupdateMode(pxConfig *config);
    6162
    6263# define MODECASE(caseName, func) \
     
    101102        MODECASE(CHIPTOOL_MODE_IMPORTRUN,               importrunMode);
    102103        MODECASE(CHIPTOOL_MODE_RUNSTATE,                runstateMode);
     104        MODECASE(CHIPTOOL_MODE_SETIMFILETOUPDATE,       setimfiletoupdateMode);
    103105        default:
    104106            psAbort("invalid option (this should not happen)");
     
    428430        return false;
    429431    }
    430     psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id)");
     432    psString query = psStringCopy("UPDATE chipRun JOIN rawExp USING(exp_id) -- join hook %s\n");
    431433
    432434    // pxUpdateRun gets parameters from config->args and updates
    433     bool result = pxUpdateRun(config, where, &query, "chipRun", true);
     435    bool result = pxUpdateRun(config, where, &query, "chipRun", "chip_id", "chipProcessedImfile", true);
    434436    if (!result) {
    435437        psError(psErrorCodeLast(), false, "pxUpdateRun failed");
     
    17201722    return true;
    17211723}
     1724
     1725// a very specfic function to queue a cleaned chipProcessedImfile to be updated
     1726static bool setimfiletoupdateMode(pxConfig *config)
     1727{
     1728    PS_ASSERT_PTR_NON_NULL(config, NULL);
     1729
     1730    PXOPT_LOOKUP_S64(chip_id, config->args, "-chip_id", true, false);
     1731    PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", false, false);
     1732    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
     1733
     1734    psString query = pxDataGet("chiptool_setimfiletoupdate.sql");
     1735    if (!query) {
     1736        psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     1737        return false;
     1738    }
     1739
     1740    psString setHook = psStringCopy("");
     1741    if (label) {
     1742        psStringAppend(&setHook, "\n , chipRun.label = '%s'", label);
     1743    }
     1744
     1745    if (class_id) {
     1746        psStringAppend(&query, " AND (chipProcessedImfile.class_id = '%s')", class_id);
     1747    }
     1748
     1749    if (!p_psDBRunQueryF(config->dbh, query, setHook, chip_id)) {
     1750        psError(PS_ERR_UNKNOWN, false, "database error");
     1751        return false;
     1752    }
     1753
     1754    psFree(setHook);
     1755    psFree(query);
     1756
     1757    return true;
     1758}
Note: See TracChangeset for help on using the changeset viewer.