IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 9, 2017, 12:05:55 PM (9 years ago)
Author:
watersc1
Message:

Add option of using old (r35192) or current (r37974) warp-stack diff SQL.

File:
1 edited

Legend:

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

    r38041 r40109  
    12341234  psMetadata *where = psMetadataAlloc();
    12351235
     1236  PXOPT_LOOKUP_BOOL(lapQuery, config->args, "-lap_query", false);
     1237 
    12361238  PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "==");
    12371239  PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "==");
     
    12451247  PXOPT_COPY_STR(config->args, where, "-stack_label", "stackRun.label", "==");
    12461248  PXOPT_COPY_STR(config->args, where, "-stack_data_group", "stackRun.data_group", "==");
     1249
    12471250
    12481251  // Add position dependence here.
     
    12771280 
    12781281  // Get query file
    1279   psString query = pxDataGet("difftool_definewarpstack.sql");
     1282  psString query;
     1283  if (lapQuery) {
     1284    query = pxDataGet("difftool_definewarpstack.sql");
     1285  }
     1286  else {
     1287    query = pxDataGet("difftool_definewarpstack_old.sql");
     1288  }
     1289 
    12801290  if (!query) {
    12811291    psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement");
     
    12841294
    12851295  psString whereClause = psDBGenerateWhereConditionSQL(where,NULL);
    1286   psString diffWhereClause = psStringCopy("");
    1287   psString joinWhereClause = psStringCopy("");
    1288  
    1289   // Don't queue things that already have diffs.
    1290   if (! (reRun || newTemplates) ) {
    1291     psStringAppend(&joinWhereClause, "\nAND diff_id IS NULL\n");
     1296  psString whereClauseString = psStringCopy("");
     1297  if (lapQuery) {
     1298    psString diffWhereClause = psStringCopy("");
     1299    psString joinWhereClause = psStringCopy("");
     1300   
     1301    // Don't queue things that already have diffs.
     1302    if (! (reRun || newTemplates) ) {
     1303      psStringAppend(&joinWhereClause, "\nAND diff_id IS NULL\n");
     1304    }
     1305    // Append diff qualifiers, if we have them
     1306    if (label) {
     1307      psStringAppend(&diffWhereClause, "\nAND ((diffRun.label = '%s') OR (diffRun.label IS NULL))",label);
     1308    }
     1309    if (data_group) {
     1310      psStringAppend(&diffWhereClause, "\nAND ((diffRun.data_group = '%s') OR (diffRun.data_group IS NULL))",data_group);
     1311    }
     1312    if (reduction) {
     1313      psStringAppend(&diffWhereClause, "\nAND ((diffRun.reduction = '%s') OR (diffRun.reduction IS NULL))",reduction);
     1314    }
     1315
     1316    psStringAppend(&whereClauseString, " \n AND %s ", whereClause);
     1317    //  fprintf(stderr,query,whereClauseString);
     1318
     1319    // This is just a simple query, so we don't need to do a transaction
     1320    if (!p_psDBRunQueryF(config->dbh, query, whereClauseString, diffWhereClause,joinWhereClause)) {
     1321      psError(PS_ERR_UNKNOWN, false, "database error");
     1322      psFree(query);
     1323      psFree(whereClause);
     1324      return(false);
     1325    }
     1326   
     1327    psFree(diffWhereClause);
     1328    psFree(joinWhereClause);
     1329   
    12921330  }
    1293   // Append diff qualifiers, if we have them
    1294   if (label) {
    1295     psStringAppend(&diffWhereClause, "\nAND ((diffRun.label = '%s') OR (diffRun.label IS NULL))",label);
     1331  else {
     1332    // Don't queue things that already have diffs.
     1333    if (! (reRun || newTemplates) ) {
     1334      psStringAppend(&whereClause, "\nAND diff_id IS NULL\n");
     1335    }
     1336    // Append diff qualifiers, if we have them
     1337    if (label) {
     1338      psStringAppend(&whereClause, "\nAND ((diffRun.label = '%s') OR (diffRun.label IS NULL))",label);
     1339    }
     1340    if (data_group) {
     1341      psStringAppend(&whereClause, "\nAND ((diffRun.data_group = '%s') OR (diffRun.data_group IS NULL))",data_group);
     1342    }
     1343    if (reduction) {
     1344      psStringAppend(&whereClause, "\nAND ((diffRun.reduction = '%s') OR (diffRun.reduction IS NULL))",reduction);
     1345    }
     1346
     1347    psStringAppend(&whereClauseString, " \n AND %s ", whereClause);
     1348    if (!p_psDBRunQueryF(config->dbh, query, whereClauseString)) {
     1349      psError(PS_ERR_UNKNOWN, false, "database error");
     1350      psFree(query);
     1351      psFree(whereClause);
     1352      return(false);
     1353    }
     1354
    12961355  }
    1297   if (data_group) {
    1298     psStringAppend(&diffWhereClause, "\nAND ((diffRun.data_group = '%s') OR (diffRun.data_group IS NULL))",data_group);
    1299   }
    1300   if (reduction) {
    1301     psStringAppend(&diffWhereClause, "\nAND ((diffRun.reduction = '%s') OR (diffRun.reduction IS NULL))",reduction);
    1302   }
    1303 
    1304   psString whereClauseString = psStringCopy("");
    1305   psStringAppend(&whereClauseString, " \n AND %s ", whereClause);
    1306   //  fprintf(stderr,query,whereClauseString);
    1307 
    1308   // This is just a simple query, so we don't need to do a transaction
    1309   if (!p_psDBRunQueryF(config->dbh, query, whereClauseString, diffWhereClause,joinWhereClause)) {
    1310     psError(PS_ERR_UNKNOWN, false, "database error");
    1311     psFree(query);
    1312     psFree(whereClause);
    1313     return(false);
    1314   }
     1356   
    13151357  psFree(query);
    13161358  psFree(whereClause);
Note: See TracChangeset for help on using the changeset viewer.