Changeset 8532
- Timestamp:
- Aug 23, 2006, 2:54:38 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r8531 r8532 1587 1587 { 1588 1588 PS_ASSERT_PTR_NON_NULL(config, false); 1589 1590 // find detStackedImfiles 1591 psArray *stackedImfiles = 1592 detStackedImfileSelectRowObjects(config->dbh, config->where, 0); 1593 if (!stackedImfiles) { 1594 psError(PS_ERR_UNKNOWN, false, "no detStackedImfile rows found"); 1595 return NULL; 1596 } 1597 1598 // remove detNormalizedImfiles 1599 psArray *normalizedImfiles = detNormalizedImfileSelectRowObjects( 1600 config->dbh, config->where, 0); 1601 // XXX trace the not found case 1602 if (normalizedImfiles) { 1603 for (long i = 0; i < psArrayLength(stackedImfiles); i++) { 1604 for (long j = 0; j < psArrayLength(normalizedImfiles); j++) { 1605 if (( 1606 ((detStackedImfileRow *)stackedImfiles->data[i])->det_id 1607 == 1608 ((detNormalizedImfileRow *)normalizedImfiles->data[j])->det_id) 1609 && 1610 (((detStackedImfileRow *)stackedImfiles->data[i])->iteration 1611 == 1612 ((detNormalizedImfileRow *)normalizedImfiles->data[j])->iteration) 1613 && 1614 (strcmp( 1615 ((detStackedImfileRow *)stackedImfiles->data[i])->class_id, 1616 ((detNormalizedImfileRow *)normalizedImfiles->data[j])->class_id) 1617 == 0)) { 1618 // remove the detStackedImfiles from the list 1619 psArrayRemove(stackedImfiles, stackedImfiles->data[i]); 1620 i--; 1621 break; 1622 } 1623 } 1624 } 1625 psFree(normalizedImfiles); 1589 1590 // select detStackedImfile.* 1591 // by: 1592 // where det_id, iteration, class_id is not in detNormalizedImfile 1593 1594 psString query = psStringCopy( 1595 "SELECT" 1596 " detStackedImfile.*" 1597 " FROM detStackedImfile" 1598 " LEFT JOIN detNormalizedImfile" 1599 " USING(det_id, iteration, class_id)" 1600 " WHERE" 1601 " detNormalizedImfile.det_id IS NULL" 1602 " AND detNormalizedImfile.iteration IS NULL" 1603 " AND detNormalizedImfile.class_id IS NULL" 1604 ); 1605 1606 if (config->where) { 1607 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "detStackedImfile"); 1608 psStringAppend(&query, " AND %s", whereClause); 1609 psFree(whereClause); 1610 } 1611 1612 if (!p_psDBRunQuery(config->dbh, query)) { 1613 psError(PS_ERR_UNKNOWN, false, "database error"); 1614 psFree(query); 1615 return false; 1616 } 1617 psFree(query); 1618 1619 psArray *output = p_psDBFetchResult(config->dbh); 1620 if (!output) { 1621 // XXX check psError here 1622 psError(PS_ERR_UNKNOWN, false, "no pending rawDetrendExp rows found"); 1623 return false; 1626 1624 } 1627 1625 … … 1632 1630 if (!status) { 1633 1631 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 1634 return false; 1635 } 1636 } 1637 1638 // print imfile list 1639 if (stackedImfiles->n) { 1640 // negative simple so the default is true 1641 if (!detStackedImfilePrintObjects(stdout, stackedImfiles, !simple)) { 1642 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1643 psFree(stackedImfiles); 1644 return false; 1645 } 1646 } 1647 1648 psFree(stackedImfiles); 1632 psFree(output); 1633 return false; 1634 } 1635 } 1636 1637 // negative simple so the default is true 1638 if (!ippdbPrintMetadatas(stdout, output, "rawDetrendImfile", !simple)) { 1639 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1640 psFree(output); 1641 return false; 1642 } 1643 1644 psFree(output); 1649 1645 1650 1646 return true; … … 1946 1942 " detNormalizedImfile.det_id IS NULL" 1947 1943 " AND detNormalizedImfile.iteration IS NULL" 1948 " A nD detNormalizedImfile.class_id IS NULL"1944 " AND detNormalizedImfile.class_id IS NULL" 1949 1945 ); 1950 1946
Note:
See TracChangeset
for help on using the changeset viewer.
