IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 7, 2006, 6:44:56 PM (20 years ago)
Author:
jhoblitt
Message:

minor cleanups in defineMode()
start implementation of -rerun

File:
1 edited

Legend:

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

    r7423 r7424  
    101101        return false;
    102102    }
     103
     104    // grab the 'position' column's value as the new det_id
    103105    detRunInsert(config->dbh, det_type);
    104106    long det_id = psDBLastInsertID(config->dbh);
     
    106108    // we have to support multipe exp_ids
    107109    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
     110    if (!item) {
     111        // this shouldn't actually happen when using psArgs
     112        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     113        return false;
     114    }
    108115    psMetadata *where = psMetadataAlloc();
    109116
     
    115122        while ((mItem = psListGetAndIncrement(iter))) {
    116123            psString exp_id = mItem->data.V;
    117             // if exp_id is NULL then it means that -exp_id has not specified
     124            // if exp_id is NULL then it means that -exp_id has not been
     125            // specified
    118126            if (!exp_id) {
    119127                psError(PS_ERR_UNKNOWN, true,
     
    139147            }
    140148        }
     149        psFree(iter);
    141150    } else {
    142151        // rollback
     
    17921801    }
    17931802
    1794     return true;
    1795 }
     1803    // we have to support multipe exp_ids
     1804    psMetadataItem *item = psMetadataLookup(config->args, "-exp_id");
     1805    if (!item) {
     1806        // this shouldn't actually happen when using psArgs
     1807        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
     1808        return false;
     1809    }
     1810    psMetadata *where = psMetadataAlloc();
     1811
     1812    // make sure that -exp_id was parsed correctly
     1813    // XXX this can be removed someday
     1814    if (item->type == PS_DATA_METADATA_MULTI) {
     1815        psListIterator *iter = psListIteratorAlloc(item->data.list, 0, false);
     1816        psMetadataItem *mItem = NULL;
     1817        while ((mItem = psListGetAndIncrement(iter))) {
     1818            psString exp_id = mItem->data.V;
     1819            // if exp_id is NULL then it means that -exp_id has not been
     1820            // specified
     1821            if (!exp_id) {
     1822                psError(PS_ERR_UNKNOWN, true,
     1823                        "at least one -exp_id is required");
     1824                psFree(where);
     1825                return false;
     1826            }
     1827
     1828            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id",
     1829                        PS_META_DUPLICATE_OK, "==", exp_id)) {
     1830                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
     1831                psFree(iter);
     1832                psFree(where);
     1833                return false;
     1834            }
     1835        }
     1836        psFree(iter);
     1837    } else {
     1838        psAbort(config->argv[0],
     1839                "-exp_id was not parsed correctly (this should not happen");
     1840    }
     1841
     1842    if (where->list->n < 1) {
     1843        psFree(where);
     1844        where = NULL;
     1845    }
     1846
     1847    // check that the specified exp_ids actually exist in the iteration zero
     1848    // detInputExp set
     1849
     1850    // add the det_id & iteration == 0 to the where claus
     1851    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
     1852                (psS32)atol(det_id))) {
     1853        psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
     1854        psFree(where);
     1855        return false;
     1856    }
     1857    if (!psMetadataAddS32(where, PS_LIST_TAIL, "iteration", 0, "==", 0)) {
     1858        psError(PS_ERR_UNKNOWN, false, "failed to add item iteration");
     1859        psFree(where);
     1860        return false;
     1861    }
     1862
     1863    psArray *detrendExps = detInputExpSelectRowObjects(config->dbh, where, 0);
     1864    psFree(where);
     1865    if (!detrendExps) {
     1866        psError(PS_ERR_UNKNOWN, false, "no rawDetrendExp rows found");
     1867        return false;
     1868    }
     1869
     1870    return true;
     1871}
Note: See TracChangeset for help on using the changeset viewer.