IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11421


Ignore:
Timestamp:
Jan 29, 2007, 6:46:20 PM (19 years ago)
Author:
Paul Price
Message:

detselect needs the database connection information on the command-line.

Location:
trunk/psModules/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r11417 r11421  
    868868
    869869    // search for existing detrend data (detID)
    870     pmDetrendSelectResults *results = pmDetrendSelect (options);
     870    pmDetrendSelectResults *results = pmDetrendSelect (options, config);
    871871    if (!results) {
    872872        psError (PS_ERR_IO, false, "no matching detrend data");
  • trunk/psModules/src/detrend/pmDetrendDB.c

    r11108 r11421  
    66#include <string.h>
    77#include <pslib.h>
     8#include "pmConfig.h"
    89#include "pmFPA.h"
    910#include "pmFPALevel.h"
     
    9394// detselect -camera (camera) -time (time) -type (type) [others]
    9495// returns: (type) (class) (exp_flag) DONE
    95 pmDetrendSelectResults *pmDetrendSelect (const pmDetrendSelectOptions *options)
    96 {
     96pmDetrendSelectResults *pmDetrendSelect (const pmDetrendSelectOptions *options,
     97        const pmConfig *config)
     98{
     99    PS_ASSERT_PTR_NON_NULL(options, NULL);
     100    PS_ASSERT_PTR_NON_NULL(config, NULL);
     101    PS_ASSERT_PTR_NON_NULL(config->site, NULL);
     102
     103    bool mdok;                          // Status of MD lookup
     104    const char *dbserver = psMetadataLookupStr(&mdok, config->site, "DBSERVER"); // Database server
     105    if (!mdok || strlen(dbserver) == 0) {
     106        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBSERVER in site configuration.\n");
     107        return NULL;
     108    }
     109    const char *dbname = psMetadataLookupStr(&mdok, config->site, "DBNAME"); // Database name
     110    if (!mdok || strlen(dbname) == 0) {
     111        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBNAME in site configuration.\n");
     112        return NULL;
     113    }
     114    const char *dbuser = psMetadataLookupStr(&mdok, config->site, "DBUSER"); // Database user
     115    if (!mdok || strlen(dbuser) == 0) {
     116        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBUSER in site configuration.\n");
     117        return NULL;
     118    }
     119    const char *dbpassword = psMetadataLookupStr(&mdok, config->site, "DBPASSWORD"); // Database password
     120    if (!mdok || strlen(dbpassword) == 0) {
     121        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBPASSWORD in site configuration.\n");
     122        return NULL;
     123    }
     124
    97125    int status, exit_status;
    98126    char *line = NULL;
     
    101129    unsigned int nFail;
    102130
    103     // XXXXX ***** MAJOR HACK ***** Josh dropped INST from detrun, so I am using 'object' for
    104     // now in dettool ('object' is not relevant to detrun!!!)
    105 
    106131    pmDetrendSelectResults *results = pmDetrendSelectResultsAlloc();
    107     psStringAppend (&line, "detselect -search -inst %s -det_type %s -time %s", options->camera, type, time);
     132    psStringAppend (&line, "detselect -search -inst %s -det_type %s -time %s "
     133                    "-dbserver %s -dbname %s -dbuser %s -dbpassword %s",
     134                    options->camera, type, time, dbserver, dbname, dbuser, dbpassword);
    108135
    109136    if (options->filter) {
  • trunk/psModules/src/detrend/pmDetrendDB.h

    r11253 r11421  
    99 * @author EAM, IfA
    1010 *
    11  * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12  * @date $Date: 2007-01-24 02:54:15 $
     11 * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12 * @date $Date: 2007-01-30 04:46:20 $
    1313 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
    1414 */
     
    2020/// @{
    2121
     22#include "pmConfig.h"
    2223#include "pmFPALevel.h"
    2324
     
    6364pmDetrendSelectOptions *pmDetrendSelectOptionsAlloc(const char *camera, psTime time, pmDetrendType type);
    6465pmDetrendSelectResults *pmDetrendSelectResultsAlloc();
    65 pmDetrendSelectResults *pmDetrendSelect (const pmDetrendSelectOptions *options);
     66pmDetrendSelectResults *pmDetrendSelect (const pmDetrendSelectOptions *options, const pmConfig *config);
    6667char *pmDetrendFile (const char *detID, const char *classID);
    6768
Note: See TracChangeset for help on using the changeset viewer.