IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11986


Ignore:
Timestamp:
Feb 21, 2007, 4:25:52 PM (19 years ago)
Author:
jhoblitt
Message:

change p6tool -define run to accept -p4_id ...

Location:
trunk/ippTools/src
Files:
2 edited

Legend:

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

    r11985 r11986  
    124124    }
    125125
     126    // we have to support multipe exp_tags
     127    psMetadataItem *p4_ids = psMetadataLookup(config->args, "-p4_id");
     128    if (!p4_ids) {
     129        // this shouldn't actually happen when using psArgs
     130        psError(PS_ERR_UNKNOWN, true, "-p4_id is required");
     131        return false;
     132    }
     133
    126134    psTime *registered = NULL;
    127135    {
     
    141149    p6RunRow *run = p6RunRowAlloc(
    142150            0,          // ID
    143             "reg",      // state
     151            "run",      // state
    144152            workdir,
    145153            NULL,       // dvodb
     
    153161        return true;
    154162    }
     163
     164    if (!psDBTransaction(config->dbh)) {
     165        psError(PS_ERR_UNKNOWN, false, "database error");
     166        return false;
     167    }
     168
    155169    if (!p6RunInsertObject(config->dbh, run)) {
     170        if (!psDBRollback(config->dbh)) {
     171            psError(PS_ERR_UNKNOWN, false, "database error");
     172        }
    156173        psError(PS_ERR_UNKNOWN, false, "database error");
    157174        psFree(run);
     
    161178    // get the assigned p4_id
    162179    run->p6_id = psDBLastInsertID(config->dbh);
     180
     181    // insert the p6InputSkyfile rows
     182    psListIterator *iter = psListIteratorAlloc(p4_ids->data.list, 0, false);
     183    psMetadataItem *item = NULL;
     184    while ((item = psListGetAndIncrement(iter))) {
     185        if (!p6InputSkyfileInsert(config->dbh, run->p6_id, atoi((char *)item->data.V))) {
     186            if (!psDBRollback(config->dbh)) {
     187                psError(PS_ERR_UNKNOWN, false, "database error");
     188            }
     189            psError(PS_ERR_UNKNOWN, false, "failed to insert p6InputSkyfile rows");
     190            return false;
     191        }
     192    }
     193    psFree(iter);
     194
     195    // point of no return
     196    if (!psDBCommit(config->dbh)) {
     197        psError(PS_ERR_UNKNOWN, false, "database error");
     198        return false;
     199    }
    163200
    164201    bool simple = false;
  • trunk/ippTools/src/stacktoolConfig.c

    r11985 r11986  
    5656    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-tess_id",  0,
    5757            "define tessellation ID (required)", NULL);
     58    psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-p4_id",
     59             PS_META_DUPLICATE_OK,
     60             "include this p4 ID (multiple OK, required)", NULL);
     61
    5862    psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-simple",  0,
    5963            "use the simple output format", false);
Note: See TracChangeset for help on using the changeset viewer.