Changeset 26949
- Timestamp:
- Feb 14, 2010, 4:21:40 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/difftool.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/difftool.c
r26945 r26949 90 90 MODECASE(DIFFTOOL_MODE_DEFINEWARPSTACK, definewarpstackMode); 91 91 MODECASE(DIFFTOOL_MODE_DEFINEWARPWARP, definewarpwarpMode); 92 MODECASE(DIFFTOOL_MODE_DEFINESTACKSTACK, definestackstackMode);92 MODECASE(DIFFTOOL_MODE_DEFINESTACKSTACK, definestackstackMode); 93 93 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); 94 94 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPSKYFILE, pendingcleanupskyfileMode); … … 1849 1849 PXOPT_COPY_F32(config->args, stack1Where, "-good_frac", "stackSumSkyfile.good_frac", ">="); 1850 1850 PXOPT_COPY_F32(config->args, stack2Where, "-good_frac", "stackSumSkyfile.good_frac", ">="); 1851 1851 1852 1852 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", true, false); // required option 1853 1853 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); // option … … 1857 1857 PXOPT_LOOKUP_STR(dist_group, config->args, "-set_dist_group", false, false); 1858 1858 PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false); 1859 1859 1860 1860 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 1861 1861 PXOPT_LOOKUP_BOOL(reRun, config->args, "-rerun", false); … … 1868 1868 PXOPT_LOOKUP_STR(label,config->args, "-input_label",true,false); 1869 1869 } 1870 1870 1871 1871 // Organize the config information into queries. 1872 1872 psString stack1Query = NULL; … … 1905 1905 return(false); 1906 1906 } 1907 1907 1908 1908 if (!psDBTransaction(config->dbh)) { 1909 1909 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1970 1970 psString this_dist_group = psMetadataLookupStr(&mdok,row,"INPUT_dist_group"); 1971 1971 psString this_label = psMetadataLookupStr(&mdok,row,"INPUT_label"); 1972 1972 1973 1973 psString this_stack1Query = psStringCopy(stack1Query); 1974 1974 1975 1975 psString thisWhere = psDBGenerateWhereConditionSQL(row,NULL); 1976 1976 psStringSubstitute(&thisWhere,"stackRun.","INPUT_"); 1977 1977 psStringAppend(&this_stack1Query,"\n AND %s", thisWhere); 1978 1978 psFree(thisWhere); 1979 1979 1980 1980 /* psTrace("difftool",1, query,stack2Query,diffQuery,this_stack1Query,this_stack1Query); */ 1981 1981 if (!psDBTransaction(config->dbh)) { … … 1983 1983 return(false); 1984 1984 } 1985 1985 1986 1986 if (!p_psDBRunQueryF(config->dbh, query, stack2Query, diffQuery, this_stack1Query, this_stack1Query)) { 1987 1987 psError(PS_ERR_UNKNOWN, false, "database error"); 1988 1988 psFree(query); 1989 1989 if (!psDBRollback(config->dbh)) { 1990 psError(PS_ERR_UNKNOWN, false, "database error");1990 psError(PS_ERR_UNKNOWN, false, "database error"); 1991 1991 } 1992 1992 return false; 1993 1993 } 1994 1994 psFree(this_stack1Query); 1995 1995 1996 1996 psArray *diff_id_output = p_psDBFetchResult(config->dbh); 1997 1997 if (!diff_id_output) { … … 1999 1999 switch (err) { 2000 2000 case PS_ERR_DB_CLIENT: 2001 psError(PXTOOLS_ERR_SYS, false, "database error");2002 break;2001 psError(PXTOOLS_ERR_SYS, false, "database error"); 2002 break; 2003 2003 case PS_ERR_DB_SERVER: 2004 psError(PXTOOLS_ERR_PROG, false, "database error");2005 break;2004 psError(PXTOOLS_ERR_PROG, false, "database error"); 2005 break; 2006 2006 default: 2007 psError(PXTOOLS_ERR_PROG, false, "unknown error");2008 break;2007 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 2008 break; 2009 2009 } 2010 2010 if (!psDBRollback(config->dbh)) { 2011 psError(PS_ERR_UNKNOWN, false, "database error");2011 psError(PS_ERR_UNKNOWN, false, "database error"); 2012 2012 } 2013 2013 return false; … … 2017 2017 psFree(diff_id_output); 2018 2018 if (!psDBCommit(config->dbh)) { 2019 psError(PS_ERR_UNKNOWN, false, "database error");2020 return false;2019 psError(PS_ERR_UNKNOWN, false, "database error"); 2020 return false; 2021 2021 } 2022 2022 return true; 2023 2023 } 2024 2024 2025 2025 // ok we've got one create the diffRun 2026 2026 diffRunRow *run = diffRunRowAlloc( 2027 0, // ID2028 "reg", // state2029 workdir,2030 label ? label : this_label,2031 data_group ? data_group : this_data_group,2032 dist_group ? dist_group : this_dist_group,2033 reduction,2034 NULL, // dvodb2035 registered,2036 tess_id,2037 false, // bothways2038 false, // exposure2039 0, // magicked2040 note2041 );2027 0, // ID 2028 "reg", // state 2029 workdir, 2030 label ? label : this_label, 2031 data_group ? data_group : this_data_group, 2032 dist_group ? dist_group : this_dist_group, 2033 reduction, 2034 NULL, // dvodb 2035 registered, 2036 tess_id, 2037 false, // bothways 2038 false, // exposure 2039 0, // magicked 2040 note 2041 ); 2042 2042 // Commit to database 2043 2043 if (!diffRunInsertObject(config->dbh, run)) { … … 2045 2045 psFree(run); 2046 2046 if (!psDBRollback(config->dbh)) { 2047 psError(PS_ERR_UNKNOWN, false, "database error");2047 psError(PS_ERR_UNKNOWN, false, "database error"); 2048 2048 } 2049 2049 return false; … … 2060 2060 psTrace("difftool",1,"%s %ld %ld %s\n",in_skycell_id,in_input_stack_id,in_template_stack_id,in_tess_id); 2061 2061 diffInputSkyfileRow *input = diffInputSkyfileRowAlloc( 2062 run->diff_id, // ID2063 in_skycell_id,2064 NULL, // warp1_id 2065 in_input_stack_id, // stack1 2066 NULL, // warp2_id 2067 in_template_stack_id, // stack22068 in_tess_id,2069 0 // diff_skyfile_id2070 );2062 run->diff_id, // ID 2063 in_skycell_id, 2064 PS_MAX_S64, // warp1_id -> NULL 2065 in_input_stack_id, // stack1 2066 PS_MAX_S64, // warp2_id -> NULL 2067 in_template_stack_id, // stack2 2068 in_tess_id, 2069 0 // diff_skyfile_id 2070 ); 2071 2071 // Commit to database the input 2072 2072 if (!diffInputSkyfileInsertObject(config->dbh, input)) { 2073 psError(PS_ERR_UNKNOWN, false, "database error");2074 psFree(input);2075 if (!psDBRollback(config->dbh)) {2076 psError(PS_ERR_UNKNOWN, false, "database error");2077 }2078 return false;2073 psError(PS_ERR_UNKNOWN, false, "database error"); 2074 psFree(input); 2075 if (!psDBRollback(config->dbh)) { 2076 psError(PS_ERR_UNKNOWN, false, "database error"); 2077 } 2078 return false; 2079 2079 } 2080 2080 2081 // diffInputSkyfilePrintObject(stdout,input,1); 2081 2082 psFree(input); 2082 2083 } 2084 2085 if (!setdiffRunState(config, run->diff_id, "new", false)) { 2086 psError(PS_ERR_UNKNOWN, false, "failed to change diffRun.state for diff_id: %" PRId64, run->diff_id); 2087 psFree(stack1Query); 2088 psFree(stack2Query); 2089 psFree(diffQuery); 2090 psFree(run); 2091 if (!psDBRollback(config->dbh)) { 2092 psError(PS_ERR_UNKNOWN, false, "database error"); 2093 } 2094 return false; 2095 } 2096 2083 2097 psFree(run); 2084 2098 } … … 2088 2102 psFree(diffQuery); 2089 2103 psFree(output); 2090 2104 2091 2105 return(true); 2092 2106 } … … 2111 2125 psFree(query); 2112 2126 query = queryCopy; 2113 2127 2114 2128 if (where && psListLength(where->list)) { 2115 2129 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 2116 psStringAppend(&whereClause, " AND ");2117 psStringSubstitute(&query,whereClause,"@INNERCONSTRAINT@");2130 psStringAppend(&whereClause, " AND "); 2131 psStringSubstitute(&query,whereClause,"@INNERCONSTRAINT@"); 2118 2132 psFree(whereClause); 2119 2133 } … … 2317 2331 PXOPT_LOOKUP_S64(set_magicked, config->args, "-magicked", 0, false); 2318 2332 magicked = set_magicked; 2319 } 2333 } 2320 2334 2321 2335 psString query = pxDataGet("difftool_change_skyfile_data_state.sql");
Note:
See TracChangeset
for help on using the changeset viewer.
