IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 28, 2007, 2:52:00 PM (19 years ago)
Author:
jhoblitt
Message:

fetch the last_fileset by camera/telescope instead of universally

File:
1 edited

Legend:

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

    r14023 r15091  
    6868{
    6969    PS_ASSERT_PTR_NON_NULL(config, NULL);
     70
     71    bool status = false;
     72    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
     73    if (!status) {
     74        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
     75        return false;
     76    }
     77    if (!camera) {
     78        psError(PS_ERR_UNKNOWN, true, "-inst is required");
     79        return false;
     80    }
     81
     82    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
     83    if (!status) {
     84        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
     85        return false;
     86    }
     87    if (!telescope) {
     88        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
     89        return false;
     90    }
     91
    7092    // find last fileset/exp_name (if we have one)
    7193    bool haveLastFileSet = false;
    7294    psString lastFileSet = NULL;
    7395    {
    74         char *query = "SELECT * from summitExp ORDER BY dateobs DESC LIMIT 1";
    75         if (!p_psDBRunQuery(config->dbh, query)) {
     96        char *query = "SELECT * from summitExp WHERE camera = \"%s\" and TELESCOPE = \"%s\" ORDER BY dateobs DESC LIMIT 1";
     97        if (!p_psDBRunQuery(config->dbh, query, camera, telescope)) {
    7698            psError(PS_ERR_UNKNOWN, false, "database error");
    7799            return false;
     
    97119    // invoke dsproductls
    98120    // dsproductls --uri <> --last_fileset <>
    99     bool status = false;
    100121    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    101122    psString cmd = NULL;
Note: See TracChangeset for help on using the changeset viewer.