Changeset 27839 for branches/simmosaic_branches/ippTools/src/dettool.c
- Timestamp:
- May 3, 2010, 8:45:22 AM (16 years ago)
- Location:
- branches/simmosaic_branches
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/dettool.c (modified) (55 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/simmosaic_branches
- Property svn:mergeinfo changed
-
branches/simmosaic_branches/ippTools/src
- Property svn:ignore
-
old new 1 *.la 2 *.lo 1 3 .deps 2 4 .gdb_history … … 4 6 Makefile 5 7 Makefile.in 8 addtool 9 caltool 10 camtool 11 chiptool 6 12 config.h 7 13 config.h.in 8 stamp-h1 9 *.la 10 *.lo 14 detselect 15 dettool 16 difftool 17 disttool 18 dqstatstool 19 faketool 20 flatcorr 21 guidetool 22 magicdstool 23 magictool 24 pstamptool 25 pubtool 26 pxadmin 27 pxdata.c 28 pxinject 11 29 pxtoolsErrorCodes.c 12 30 pxtoolsErrorCodes.h 13 pxadmin14 pxinject15 pztool16 31 pzgetexp 17 32 pzgetimfiles 33 pztool 34 receivetool 18 35 regtool 19 guidetool 20 chiptool 21 camtool 36 stacktool 37 stamp-h1 22 38 warptool 23 difftool24 stacktool25 faketool26 dettool27 detselect28 pxdata.c29 magictool30 magicdstool31 caltool32 flatcorr33 pstamptool34 disttool35 receivetool36 37 pubtool
-
- Property svn:ignore
-
branches/simmosaic_branches/ippTools/src/dettool.c
r24779 r27839 94 94 MODECASE(DETTOOL_MODE_PENDINGCLEANUP_PROCESSEDEXP, pendingcleanup_processedexpMode); 95 95 MODECASE(DETTOOL_MODE_DONECLEANUP_PROCESSEDEXP, donecleanup_processedexpMode); 96 MODECASE(DETTOOL_MODE_UPDATESTATE_PROCESSED, updatestateprocessedMode); 96 97 // stacked 97 98 MODECASE(DETTOOL_MODE_TOSTACKED, tostackedMode); … … 142 143 MODECASE(DETTOOL_MODE_PENDINGCLEANUP_RESIDEXP, pendingcleanup_residexpMode); 143 144 MODECASE(DETTOOL_MODE_DONECLEANUP_RESIDEXP, donecleanup_residexpMode); 145 MODECASE(DETTOOL_MODE_UPDATESTATE_RESID, updatestateresidMode); 144 146 // detrunsummary 145 147 MODECASE(DETTOOL_MODE_TODETRUNSUMMARY, todetrunsummaryMode); … … 150 152 MODECASE(DETTOOL_MODE_UPDATEDETRUN, updatedetrunMode); 151 153 MODECASE(DETTOOL_MODE_RERUN, rerunMode); 154 MODECASE(DETTOOL_MODE_PENDINGCLEANUP_DETRUNSUMMARY, pendingcleanup_detrunsummaryMode); 152 155 // register 153 156 MODECASE(DETTOOL_MODE_REGISTER_DETREND, register_detrendMode); … … 184 187 psString query = pxDataGet("dettool_pending.sql"); 185 188 if (!query) { 186 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");187 return false; 188 } 189 189 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 190 return false; 191 } 192 190 193 psMetadata *where = psMetadataAlloc(); 191 194 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); … … 257 260 psError(PS_ERR_UNKNOWN, false, "verify mode requires both -ref_det_id and -ref_iter"); 258 261 return false; 259 } 262 } 260 263 if (strcmp(mode, "verify") && ((ref_det_id != 0) || (ref_iter != -1))) { 261 264 psError(PS_ERR_UNKNOWN, false, "master mode cannot have -ref_det_id or -ref_iter set"); 262 265 return false; 263 } 264 266 } 267 265 268 PXOPT_LOOKUP_STR(camera, config->args, "-inst", false, false); 266 269 PXOPT_LOOKUP_STR(telescope, config->args, "-telescope", false, false); … … 276 279 PXOPT_LOOKUP_F64(posang_min, config->args, "-posang_min", false, false); 277 280 PXOPT_LOOKUP_F64(posang_max, config->args, "-posang_max", false, false); 278 PXOPT_LOOKUP_F64(solang_min, config->args, "-s olang_min", false, false);279 PXOPT_LOOKUP_F64(solang_max, config->args, "-s olang_max", false, false);281 PXOPT_LOOKUP_F64(solang_min, config->args, "-sun_angle_min", false, false); 282 PXOPT_LOOKUP_F64(solang_max, config->args, "-sun_angle_max", false, false); 280 283 PXOPT_LOOKUP_TIME(time_begin, config->args, "-time_begin", false, false); 281 284 PXOPT_LOOKUP_TIME(time_end, config->args, "-time_end", false, false); … … 307 310 psMetadataItem *mItem = NULL; 308 311 while ((mItem = psListGetAndIncrement(iter))) { 309 psS64 exp_id = mItem->data.S64;312 psS64 exp_id = mItem->data.S64; 310 313 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", PS_META_DUPLICATE_OK, "==", exp_id)) { 311 314 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); … … 316 319 } 317 320 psFree(iter); 318 } 321 } 319 322 if (item->type == PS_DATA_S64) { 320 psS64 exp_id = item->data.S64;321 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", PS_META_DUPLICATE_OK, "==", exp_id)) {322 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");323 psFree(where);324 return false;325 }326 } 323 psS64 exp_id = item->data.S64; 324 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", PS_META_DUPLICATE_OK, "==", exp_id)) { 325 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 326 psFree(where); 327 return false; 328 } 329 } 327 330 328 331 if (psListLength(where->list) < 1) { … … 504 507 psError(PS_ERR_UNKNOWN, false, "verify mode requires both -ref_det_id and -ref_iter"); 505 508 return false; 506 } 509 } 507 510 if (strcmp(mode, "verify") && ((ref_det_id != 0) || (ref_iter != -1))) { 508 511 psError(PS_ERR_UNKNOWN, false, "master mode cannot have -ref_det_id or -ref_iter set"); 509 512 return false; 510 } 513 } 511 514 512 515 PXOPT_LOOKUP_STR(filelevel, config->args, "-filelevel", false, false); … … 521 524 PXOPT_LOOKUP_F64(posang_min, config->args, "-posang_min", false, false); 522 525 PXOPT_LOOKUP_F64(posang_max, config->args, "-posang_max", false, false); 523 PXOPT_LOOKUP_F64(solang_min, config->args, "-s olang_min", false, false);524 PXOPT_LOOKUP_F64(solang_max, config->args, "-s olang_max", false, false);526 PXOPT_LOOKUP_F64(solang_min, config->args, "-sun_angle_min", false, false); 527 PXOPT_LOOKUP_F64(solang_max, config->args, "-sun_angle_max", false, false); 525 528 526 529 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); … … 549 552 PXOPT_COPY_F32(config->args, where, "-select_airmass_max", "airmass", "<="); 550 553 PXOPT_COPY_F32(config->args, where, "-select_sat_pixel_frac_max", "sat_pixel_frac", "<="); 554 PXOPT_COPY_F32(config->args, where, "-select_sat_pixel_frac_min", "sat_pixel_frac", ">="); 551 555 PXOPT_COPY_F32(config->args, where, "-select_exp_time_min", "exp_time", ">="); 552 556 PXOPT_COPY_F32(config->args, where, "-select_exp_time_max", "exp_time", "<="); … … 557 561 PXOPT_COPY_F64(config->args, where, "-select_posang_min", "posang", ">="); 558 562 PXOPT_COPY_F64(config->args, where, "-select_posang_max", "posang", "<="); 559 PXOPT_COPY_F64(config->args, where, "-select_solang_min", "solang", ">="); 560 PXOPT_COPY_F64(config->args, where, "-select_solang_max", "solang", "<="); 563 PXOPT_COPY_F64(config->args, where, "-select_sun_angle_min", "sun_angle", ">="); 564 PXOPT_COPY_F64(config->args, where, "-select_sun_angle_max", "sun_angle", "<="); 565 PXOPT_COPY_F64(config->args, where, "-select_sun_alt_min", "sun_alt", ">="); 566 PXOPT_COPY_F64(config->args, where, "-select_sun_alt_max", "sun_alt", "<="); 561 567 562 568 PXOPT_COPY_F64(config->args, where, "-select_moon_angle_min", "moon_angle", ">="); … … 670 676 label, 671 677 ref_det_id, 672 ref_iter678 ref_iter 673 679 ); 674 680 psS64 det_id = psDBLastInsertID(config->dbh); … … 739 745 { 740 746 PS_ASSERT_PTR_NON_NULL(config, false); 741 747 742 748 // XXX this mode is not well-tested: probably need to specify iteration here 743 749 PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required … … 756 762 psError(PS_ERR_UNKNOWN, false, "verify mode requires both -ref_det_id and -ref_iter"); 757 763 return false; 758 } 764 } 759 765 if (strcmp(mode, "verify") && ((ref_det_id != 0) || (ref_iter != -1))) { 760 766 psError(PS_ERR_UNKNOWN, false, "master mode cannot have -ref_det_id or -ref_iter set"); 761 767 return false; 762 } 768 } 763 769 764 770 // the new detRun may have different values for these limits: … … 775 781 PXOPT_LOOKUP_F64(posang_min, config->args, "-set_posang_min", false, false); 776 782 PXOPT_LOOKUP_F64(posang_max, config->args, "-set_posang_max", false, false); 777 PXOPT_LOOKUP_F64(solang_min, config->args, "-set_s olang_min", false, false);778 PXOPT_LOOKUP_F64(solang_max, config->args, "-set_s olang_max", false, false);783 PXOPT_LOOKUP_F64(solang_min, config->args, "-set_sun_angle_min", false, false); 784 PXOPT_LOOKUP_F64(solang_max, config->args, "-set_sun_angle_max", false, false); 779 785 PXOPT_LOOKUP_TIME(registered, config->args, "-set_registered", false, false); 780 786 PXOPT_LOOKUP_TIME(time_begin, config->args, "-set_time_begin", false, false); … … 814 820 815 821 if (iteration < 0) { 816 iteration = detRun->iteration;822 iteration = detRun->iteration; 817 823 } 818 824 … … 974 980 psString query = pxDataGet("dettool_definebydetrun.sql"); 975 981 if (!query) { 976 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");982 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 977 983 return false; 978 984 } … … 986 992 987 993 if (only_accepted) { 988 psStringAppend(&query, " AND accept = 1");994 psStringAppend(&query, " AND accept = 1"); 989 995 } 990 996 … … 1065 1071 psString query = pxDataGet("dettool_runs.sql"); 1066 1072 if (!query) { 1067 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1073 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1068 1074 return false; 1069 1075 } … … 1135 1141 psString query = pxDataGet("dettool_childlessrun.sql"); 1136 1142 if (!query) { 1137 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1143 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1138 1144 psFree(where); 1139 1145 return false; … … 1209 1215 psString query = pxDataGet("dettool_input.sql"); 1210 1216 if (!query) { 1211 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1217 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1212 1218 psFree(where); 1213 1219 return false; … … 1261 1267 psString query = pxDataGet("dettool_raw.sql"); 1262 1268 if (!query) { 1263 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1269 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1264 1270 return false; 1265 1271 } … … 1335 1341 } 1336 1342 1337 // used by updatedetrunMode 1343 // used by updatedetrunMode 1338 1344 bool startNewIteration(pxConfig *config, psS64 det_id) 1339 1345 { … … 1342 1348 psString query = pxDataGet("dettool_start_new_iteration.sql"); 1343 1349 if (!query) { 1344 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");1350 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 1345 1351 return false; 1346 1352 } … … 1561 1567 } 1562 1568 detInputExpRow *newInputExp = detInputExpRowAlloc( 1563 det_id,1569 det_id, 1564 1570 newIteration, 1565 1571 inputExp->exp_id, … … 1613 1619 PXOPT_LOOKUP_F64(posang_min, config->args, "-posang_min", false, false); 1614 1620 PXOPT_LOOKUP_F64(posang_max, config->args, "-posang_max", false, false); 1615 PXOPT_LOOKUP_F64(solang_min, config->args, "-s olang_min", false, false);1616 PXOPT_LOOKUP_F64(solang_max, config->args, "-s olang_max", false, false);1621 PXOPT_LOOKUP_F64(solang_min, config->args, "-sun_angle_min", false, false); 1622 PXOPT_LOOKUP_F64(solang_max, config->args, "-sun_angle_max", false, false); 1617 1623 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 1618 1624 PXOPT_LOOKUP_TIME(time_begin, config->args, "-time_begin", false, false); … … 1659 1665 solang_max, 1660 1666 label, 1661 ref_det_id,1662 ref_iter1667 ref_det_id, 1668 ref_iter 1663 1669 )) { 1664 1670 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1710 1716 { 1711 1717 PS_ASSERT_PTR_NON_NULL(config, false); 1712 1718 1713 1719 PXOPT_LOOKUP_S64(det_id, config->args, "-det_id", true, false); // required 1714 1720 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); // required … … 1725 1731 1726 1732 if (!detRegisteredImfileInsert(config->dbh, 1727 det_id,1728 0, // the iteration is fixed at 01729 class_id,1730 uri,1731 bg,1732 bg_stdev,1733 bg_mean_stdev,1734 user_1,1735 user_2,1736 user_3,1737 user_4,1738 user_5,1739 path_base,1740 "full", 1741 0 // fault code1742 )) {1733 det_id, 1734 0, // the iteration is fixed at 0 1735 class_id, 1736 uri, 1737 bg, 1738 bg_stdev, 1739 bg_mean_stdev, 1740 user_1, 1741 user_2, 1742 user_3, 1743 user_4, 1744 user_5, 1745 path_base, 1746 "full", 1747 0 // fault code 1748 )) { 1743 1749 psError(PS_ERR_UNKNOWN, false, "database error"); 1744 1750 return false; … … 1825 1831 if (!strcmp(data_state, "drop")) return true; 1826 1832 if (!strcmp(data_state, "register")) return true; 1833 // These are valid data states, and are necessary for the cleanup to work correctly. 1834 if (!strcmp(data_state, "full")) return true; 1835 if (!strcmp(data_state, "goto_cleaned")) return true; 1836 if (!strcmp(data_state, "goto_scrubbed")) return true; 1837 if (!strcmp(data_state, "goto_purged")) return true; 1838 if (!strcmp(data_state, "cleaned")) return true; 1839 if (!strcmp(data_state, "scrubbed")) return true; 1840 if (!strcmp(data_state, "purged")) return true; 1841 if (!strcmp(data_state, "error_cleaned")) return true; 1842 if (!strcmp(data_state, "error_scrubbed")) return true; 1843 if (!strcmp(data_state, "error_purged")) return true; 1827 1844 1828 1845 psError(PS_ERR_UNKNOWN, true, "invalid data state: %s", data_state); … … 1844 1861 1845 1862 1846 bool setProcessedImfileDataState(pxConfig *config, ps S64 det_id, psS64 exp_id, const char *class_id, const char *data_state)1863 bool setProcessedImfileDataState(pxConfig *config, psMetadata *where, const char *data_state) 1847 1864 { 1848 1865 PS_ASSERT_PTR_NON_NULL(config, false); 1866 PS_ASSERT_PTR_NON_NULL(where, false); 1849 1867 PS_ASSERT_PTR_NON_NULL(data_state, false); 1850 PS_ASSERT_PTR_NON_NULL(class_id, false);1851 1868 1852 1869 if (!isValidDataState (data_state)) return false; 1853 1870 1854 char *query = "UPDATE detProcessedImfile SET data_state = '%s'" 1855 " WHERE det_id = %" PRId64 1856 " AND exp_id = %" PRId64 1857 " AND class_id = '%s'"; 1858 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, exp_id, class_id)) { 1859 psError(PS_ERR_UNKNOWN, false, 1860 "failed to change state for det_id %" PRId64 ", exp_id %" PRId64 ", class_id %s", 1861 det_id, exp_id, class_id); 1862 return false; 1863 } 1864 1865 return true; 1866 } 1867 1868 bool setProcessedExpDataState(pxConfig *config, psS64 det_id, psS64 exp_id, const char *data_state) 1871 psString query = psStringCopy("UPDATE detProcessedImfile SET data_state = '%s'"); 1872 if (where && psListLength(where->list) > 0) { 1873 psString whereClause = psDBGenerateWhereSQL(where,NULL); 1874 psStringAppend(&query," %s",whereClause); 1875 psFree(whereClause); 1876 } else { 1877 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); 1878 return(false); 1879 } 1880 1881 if (!p_psDBRunQueryF(config->dbh, query, data_state)) { 1882 psFree(query); 1883 psError(PS_ERR_UNKNOWN, false, "database error"); 1884 return(false); 1885 } 1886 psFree(query); 1887 return(true); 1888 } 1889 1890 bool setProcessedExpDataState(pxConfig *config, psMetadata *where, const char *data_state) 1869 1891 { 1870 1892 PS_ASSERT_PTR_NON_NULL(config, false); 1893 PS_ASSERT_PTR_NON_NULL(where, false); 1871 1894 PS_ASSERT_PTR_NON_NULL(data_state, false); 1872 1895 1873 1896 if (!isValidDataState (data_state)) return false; 1874 1897 1875 char *query = "UPDATE detProcessedExp SET data_state = '%s'" 1876 " WHERE det_id = %" PRId64 1877 " AND exp_id = %" PRId64; 1878 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, exp_id)) { 1879 psError(PS_ERR_UNKNOWN, false, 1880 "failed to change state for det_id %" PRId64 ", exp_id %" PRId64, 1881 det_id, exp_id); 1882 return false; 1883 } 1884 1885 return true; 1886 } 1887 1888 1898 psString query = psStringCopy("UPDATE detProcessedExp SET data_state = '%s'"); 1899 if (where && psListLength(where->list) > 0) { 1900 psString whereClause = psDBGenerateWhereSQL(where,NULL); 1901 psStringAppend(&query," %s",whereClause); 1902 psFree(whereClause); 1903 } else { 1904 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); 1905 return(false); 1906 } 1907 1908 if (!p_psDBRunQueryF(config->dbh, query, data_state)) { 1909 psFree(query); 1910 psError(PS_ERR_UNKNOWN, false, "database error"); 1911 return(false); 1912 } 1913 psFree(query); 1914 return(true); 1915 } 1916 1917 bool setResidImfileDataState(pxConfig *config, psMetadata *where, const char *data_state) 1918 { 1919 PS_ASSERT_PTR_NON_NULL(config, false); 1920 PS_ASSERT_PTR_NON_NULL(where,false); 1921 PS_ASSERT_PTR_NON_NULL(data_state, false); 1922 1923 if (!isValidDataState (data_state)) return false; 1924 1925 psString query = psStringCopy("UPDATE detResidImfile SET data_state = '%s'"); 1926 if (where && psListLength(where->list) > 0) { 1927 psString whereClause = psDBGenerateWhereSQL(where,NULL); 1928 psStringAppend(&query," %s",whereClause); 1929 psFree(whereClause); 1930 } else { 1931 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); 1932 return(false); 1933 } 1934 1935 if (!p_psDBRunQueryF(config->dbh, query, data_state)) { 1936 psFree(query); 1937 psError(PS_ERR_UNKNOWN, false, "database error"); 1938 return(false); 1939 } 1940 psFree(query); 1941 return(true); 1942 } 1943 // This function apparently not used anymore. 1944 bool setResidExpDataState(pxConfig *config, psMetadata *where, const char *data_state) 1945 { 1946 PS_ASSERT_PTR_NON_NULL(config, false); 1947 PS_ASSERT_PTR_NON_NULL(where,false); 1948 PS_ASSERT_PTR_NON_NULL(data_state, false); 1949 1950 if (!isValidDataState (data_state)) return false; 1951 1952 psString query = psStringCopy("UPDATE detResidExp SET data_state = '%s'"); 1953 if (where && psListLength(where->list) > 0) { 1954 psString whereClause = psDBGenerateWhereSQL(where,NULL); 1955 psStringAppend(&query," %s",whereClause); 1956 psFree(whereClause); 1957 } else { 1958 psError(PS_ERR_UNKNOWN, true, "search parameters are required"); 1959 return(false); 1960 } 1961 1962 if (!p_psDBRunQueryF(config->dbh, query, data_state)) { 1963 psFree(query); 1964 psError(PS_ERR_UNKNOWN, false, "database error"); 1965 return(false); 1966 } 1967 psFree(query); 1968 return(true); 1969 } 1970 1971 // Not yet updated for cleaning 1889 1972 bool setStackedImfileDataState(pxConfig *config, psS64 det_id, psS32 iteration, const char *class_id, const char *data_state) 1890 1973 { … … 1896 1979 1897 1980 char *query = "UPDATE detStackedImfile SET data_state = '%s'" 1898 " WHERE det_id = %" PRId641899 " AND iteration = %" PRId321900 " AND class_id = %s";1981 " WHERE det_id = %" PRId64 1982 " AND iteration = %" PRId32 1983 " AND class_id = '%s'"; 1901 1984 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration, class_id)) { 1902 1985 psError(PS_ERR_UNKNOWN, false, 1903 "failed to change state for det_id %" PRId64 ", iteration %" PRId32 "class_id %s", 1904 det_id, iteration, class_id);1986 "failed to change state for det_id %" PRId64 ", iteration %" PRId32 "class_id %s", 1987 det_id, iteration, class_id); 1905 1988 return false; 1906 1989 } … … 1918 2001 1919 2002 char *query = "UPDATE detNormalizedStatImfile SET data_state = '%s'" 1920 " WHERE det_id = %" PRId64 1921 " AND iteration = %" PRId32 1922 " AND class_id = %s"; 1923 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration)) { 2003 " WHERE det_id = %" PRId64 2004 " AND iteration = %" PRId32 2005 " AND class_id = '%s'"; 2006 /* fprintf(stderr,"DETTOOL SAYS: %s\n",query); */ 2007 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration,class_id)) { 1924 2008 psError(PS_ERR_UNKNOWN, false, 1925 "failed to change state for det_id %" PRId64 ", iteration %" PRId32, 1926 det_id, iteration);2009 "failed to change state for det_id %" PRId64 ", iteration %" PRId32, 2010 det_id, iteration); 1927 2011 return false; 1928 2012 } … … 1940 2024 1941 2025 char *query = "UPDATE detNormalizedImfile SET data_state = '%s'" 1942 " WHERE det_id = %" PRId641943 " AND iteration = %" PRId321944 " AND class_id = %s";2026 " WHERE det_id = %" PRId64 2027 " AND iteration = %" PRId32 2028 " AND class_id = '%s'"; 1945 2029 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration, class_id)) { 1946 2030 psError(PS_ERR_UNKNOWN, false, 1947 "failed to change state for det_id %" PRId64 ", iteration %" PRId32 " class %s", 1948 det_id, iteration, class_id);2031 "failed to change state for det_id %" PRId64 ", iteration %" PRId32 " class %s", 2032 det_id, iteration, class_id); 1949 2033 return false; 1950 2034 } … … 1961 2045 1962 2046 char *query = "UPDATE detNormalizedExp SET data_state = '%s'" 1963 " WHERE det_id = %" PRId641964 " AND iteration = %" PRId32;2047 " WHERE det_id = %" PRId64 2048 " AND iteration = %" PRId32; 1965 2049 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration)) { 1966 2050 psError(PS_ERR_UNKNOWN, false, 1967 "failed to change state for det_id %" PRId64 ", iteration %" PRId32, 1968 det_id, iteration);2051 "failed to change state for det_id %" PRId64 ", iteration %" PRId32, 2052 det_id, iteration); 1969 2053 return false; 1970 2054 } … … 1972 2056 return true; 1973 2057 } 1974 1975 bool setResidImfileDataState(pxConfig *config, psS64 det_id, psS32 iteration, psS64 exp_id, const char *class_id, const char *data_state) 1976 { 1977 PS_ASSERT_PTR_NON_NULL(config, false); 1978 PS_ASSERT_PTR_NON_NULL(data_state, false); 1979 PS_ASSERT_PTR_NON_NULL(class_id, false); 1980 1981 if (!isValidDataState (data_state)) return false; 1982 1983 char *query = "UPDATE detResidImfile SET data_state = '%s'" 1984 " WHERE det_id = %" PRId64 1985 " AND iteration = %" PRId32 1986 " AND exp_id = %" PRId64 1987 " AND class_id = '%s'"; 1988 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration, exp_id, class_id)) { 1989 psError(PS_ERR_UNKNOWN, false, 1990 "failed to change state for det_id %" PRId64 ", iteration %" PRId32 ", exp_id %" PRId64 ", class_id %s", 1991 det_id, iteration, exp_id, class_id); 1992 return false; 1993 } 1994 1995 return true; 1996 } 1997 1998 bool setResidExpDataState(pxConfig *config, psS64 det_id, psS32 iteration, psS64 exp_id, const char *data_state) 1999 { 2000 PS_ASSERT_PTR_NON_NULL(config, false); 2001 PS_ASSERT_PTR_NON_NULL(data_state, false); 2002 2003 if (!isValidDataState (data_state)) return false; 2004 2005 char *query = "UPDATE detResidExp SET data_state = '%s'" 2006 " WHERE det_id = %" PRId64 2007 " AND iteration = %" PRId32 2008 " AND exp_id = %" PRId64; 2009 if (!p_psDBRunQueryF(config->dbh, query, data_state, det_id, iteration, exp_id)) { 2010 psError(PS_ERR_UNKNOWN, false, 2011 "failed to change state for det_id %" PRId64 ", iteration %" PRId32 ", exp_id %" PRId64, 2012 det_id, iteration, exp_id); 2013 return false; 2014 } 2015 2016 return true; 2017 } 2058 // End not yet modified for cleanup. 2018 2059 2019 2060 bool exportrunMode(pxConfig *config) … … 2023 2064 char sqlFilename[80]; 2024 2065 } ExportTable; 2025 2066 2026 2067 int numExportTables = 12; 2027 2068 … … 2059 2100 psString query = pxDataGet(tables[i].sqlFilename); 2060 2101 if (!query) { 2061 psError(PXTOOLS_ERR_ DATA, false, "failed to retreive SQL statement");2102 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 2062 2103 return false; 2063 2104 } … … 2101 2142 } 2102 2143 psFree(output); 2103 2144 2104 2145 } 2105 2146 … … 2112 2153 { 2113 2154 unsigned int nFail; 2114 2155 2115 2156 int numImportTables = 11; 2116 2157 2117 2158 char tables[11] [80] = {"detInputExp", "detNormalizedExp", 2118 2159 "detNormalizedImfile", "detNormalizedStatImfile", "detProcessedExp", … … 2121 2162 2122 2163 PS_ASSERT_PTR_NON_NULL(config, NULL); 2123 2164 2124 2165 PXOPT_LOOKUP_STR(infile, config->args, "-infile", true, false); 2125 2166 … … 2128 2169 fprintf (stdout, "---- input ----\n"); 2129 2170 psMetadataPrint (stderr, input, 1); 2130 2171 2131 2172 psMetadataItem *item = psMetadataLookup (input, "detRun"); 2132 2173 psAssert (item, "entry not in input?"); … … 2138 2179 detRunRow *detRun = detRunObjectFromMetadata (entry->data.md); 2139 2180 detRunInsertObject (config->dbh, detRun); 2140 2181 2141 2182 // fprintf (stdout, "---- det run ----\n"); 2142 2183 // psMetadataPrint (stderr, entry->data.md, 1); … … 2146 2187 psAssert (item, "entry not in input?"); 2147 2188 psAssert (item->type == PS_DATA_METADATA_MULTI, "entry not multi?"); 2148 2189 2149 2190 switch (i) { 2150 2191 case 0: … … 2160 2201 } 2161 2202 break; 2162 2203 2163 2204 case 1: 2164 2205 for (int i = 0; i < item->data.list->n; i++) { … … 2173 2214 } 2174 2215 break; 2175 2216 2176 2217 case 2: 2177 2218 for (int i = 0; i < item->data.list->n; i++) { … … 2186 2227 } 2187 2228 break; 2188 2229 2189 2230 case 3: 2190 2231 for (int i = 0; i < item->data.list->n; i++) { … … 2199 2240 } 2200 2241 break; 2201 2242 2202 2243 case 4: 2203 2244 for (int i = 0; i < item->data.list->n; i++) { … … 2212 2253 } 2213 2254 break; 2214 2255 2215 2256 case 5: 2216 2257 for (int i = 0; i < item->data.list->n; i++) { … … 2225 2266 } 2226 2267 break; 2227 2268 2228 2269 case 6: 2229 2270 for (int i = 0; i < item->data.list->n; i++) { … … 2238 2279 } 2239 2280 break; 2240 2281 2241 2282 case 7: 2242 2283 for (int i = 0; i < item->data.list->n; i++) { … … 2251 2292 } 2252 2293 break; 2253 2294 2254 2295 case 8: 2255 2296 for (int i = 0; i < item->data.list->n; i++) { … … 2264 2305 } 2265 2306 break; 2266 2307 2267 2308 case 9: 2268 2309 for (int i = 0; i < item->data.list->n; i++) { … … 2277 2318 } 2278 2319 break; 2279 2320 2280 2321 case 10: 2281 2322 for (int i = 0; i < item->data.list->n; i++) {
Note:
See TracChangeset
for help on using the changeset viewer.
