Changeset 11450 for trunk/psModules/src/detrend/pmDetrendDB.c
- Timestamp:
- Jan 30, 2007, 2:39:07 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/detrend/pmDetrendDB.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/detrend/pmDetrendDB.c
r11421 r11450 7 7 #include <pslib.h> 8 8 #include "pmConfig.h" 9 #include "pmConfigCommand.h" 9 10 #include "pmFPA.h" 10 11 #include "pmFPALevel.h" … … 101 102 PS_ASSERT_PTR_NON_NULL(config->site, NULL); 102 103 103 bool mdok; // Status of MD lookup104 const char *dbserver = psMetadataLookupStr(&mdok, config->site, "DBSERVER"); // Database server105 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 name110 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 user115 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 password120 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 125 104 int status, exit_status; 126 char *line = NULL;105 psString line = NULL; 127 106 char *time = psTimeToISO (&options->time); 128 107 char *type = pmDetrendTypeToString (options->type); … … 130 109 131 110 pmDetrendSelectResults *results = pmDetrendSelectResultsAlloc(); 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); 111 psStringAppend(&line, "detselect -search -inst %s -det_type %s -time %s", options->camera, type, time); 135 112 136 113 if (options->filter) { 137 psStringAppend (&line, " -filter %s", options->filter);114 psStringAppend(&line, " -filter %s", options->filter); 138 115 } 139 116 if (options->exptime > -1.0) { 140 psStringAppend (&line, " -exptime %f", options->exptime);117 psStringAppend(&line, " -exptime %f", options->exptime); 141 118 } 142 119 if (options->airmass > -1.0) { 143 psStringAppend (&line, " -airmass %f", options->airmass); 144 } 145 120 psStringAppend(&line, " -airmass %f", options->airmass); 121 } 122 123 pmConfigDatabaseCommand(&line, config); 124 pmConfigTraceCommand(&line); 146 125 psTrace("psModules.detrend", 5, "running %s", line); 147 126 … … 214 193 // detselect -select -detID (detID) -classID (classID) 215 194 // returns: (detID) (classID) (filename) DONE 216 char *pmDetrendFile (const char *detID, const char *classID )195 char *pmDetrendFile (const char *detID, const char *classID, const pmConfig *config) 217 196 { 218 197 unsigned int nFail; … … 222 201 223 202 bool status; 224 char *line = NULL;203 psString line = NULL; 225 204 psArray *array = NULL; 226 205 227 206 // generate the detselect command 228 207 psStringAppend (&line, "detselect -select %s -class_id %s", detID, classID); 208 pmConfigDatabaseCommand(&line, config); 209 pmConfigTraceCommand(&line); 229 210 psTrace("psModules.detrend", 5, "running %s", line); 230 211
Note:
See TracChangeset
for help on using the changeset viewer.
