IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 15, 2006, 4:44:45 PM (20 years ago)
Author:
jhoblitt
Message:

add -normstat

File:
1 edited

Legend:

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

    r8365 r8370  
    18791879static bool normstatMode(pxConfig *config)
    18801880{
    1881     PS_ASSERT_PTR_NON_NULL(config, NULL);
     1881    PS_ASSERT_PTR_NON_NULL(config, false);
     1882
     1883    // select detNormalizedStatImfile.*
     1884    // by:
     1885    // where det_id, iteration, class_id is not in detNormalizedImfile
     1886
     1887    psString query = psStringCopy(
     1888        "SELECT"
     1889        "   detNormalizedStatImfile.*"
     1890        " FROM detNormalizedStatImfile"
     1891        " LEFT JOIN detNormalizedImfile"
     1892        "   USING(det_id, iteration, class_id)"
     1893        " WHERE"
     1894        "   detNormalizedImfile.det_id IS NULL" 
     1895        "   AND detNormalizedImfile.iteration IS NULL" 
     1896        "   AnD detNormalizedImfile.class_id IS NULL" 
     1897        );
     1898
     1899    // XXX does it make sens to accept any search params?
     1900#if 0
     1901    if (config->where) {
     1902        psString whereClaus = psDBGenerateWhereConditionSQL(config->where);
     1903        psStringAppend(&query, " AND %s", whereClaus);
     1904        psFree(whereClaus);
     1905    }
     1906#endif
     1907
     1908    if (!p_psDBRunQuery(config->dbh, query)) {
     1909        psError(PS_ERR_UNKNOWN, false, "database error");
     1910        psFree(query);
     1911        return false;
     1912    }
     1913    psFree(query);
     1914
     1915    psArray *output = p_psDBFetchResult(config->dbh);
     1916    if (!output) {
     1917        // XXX check psError here
     1918        psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found");
     1919        return false;
     1920    }
     1921
     1922    bool simple = false;
     1923    {
     1924        bool status = false;
     1925        simple = psMetadataLookupBool(&status, config->args, "-simple");
     1926        if (!status) {
     1927            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");
     1928            psFree(output);
     1929            return false;
     1930        }
     1931    }
     1932
     1933    // negative simple so the default is true
     1934    if (!ippdbPrintMetadatas(stdout, output, "rawDetrendImfile", !simple)) {
     1935        psError(PS_ERR_UNKNOWN, false, "failed to print array");
     1936        psFree(output);
     1937        return false;
     1938    }
     1939
     1940    psFree(output);
    18821941
    18831942    return true;
Note: See TracChangeset for help on using the changeset viewer.