Changeset 27517 for branches/eam_branches/20100225/ippTools/src/pxtools.c
- Timestamp:
- Mar 29, 2010, 3:55:49 PM (16 years ago)
- Location:
- branches/eam_branches/20100225
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippTools/src/pxtools.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20100225
- Property svn:mergeinfo changed
-
branches/eam_branches/20100225/ippTools/src/pxtools.c
r26981 r27517 110 110 111 111 // shared code for updating the various strings for a Run 112 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString table, bool has_dist_group)112 bool pxUpdateRun(pxConfig *config, psMetadata *where, psString *pQuery, psString runTable, psString idColumn, psString fileTable, bool has_dist_group) 113 113 { 114 114 PS_ASSERT_PTR_NON_NULL(config, false); … … 116 116 PS_ASSERT_PTR_NON_NULL(pQuery, false); 117 117 PS_ASSERT_PTR_NON_NULL(*pQuery, false); 118 PS_ASSERT_PTR_NON_NULL(runTable, false); 119 PS_ASSERT_PTR_NON_NULL(idColumn, false); 120 PS_ASSERT_PTR_NON_NULL(fileTable, false); 118 121 119 122 // make sure that -state is not the only selection parameter … … 158 161 } while (0) 159 162 160 addColumn( table, state);161 addColumn( table, data_group);163 addColumn(runTable, state); 164 addColumn(runTable, data_group); 162 165 if (has_dist_group) { 163 addColumn(table, dist_group); 164 } 165 addColumn(table, note); 166 addColumn(table, label); 166 addColumn(runTable, dist_group); 167 } 168 addColumn(runTable, note); 169 addColumn(runTable, label); 170 171 psString joinHook = psStringCopy(""); 172 psString fileWhere = NULL; 173 if (state && !strcmp(state, "update")) { 174 psStringAppend(&joinHook, "\n JOIN %s USING(%s)", fileTable, idColumn); 175 psStringAppend(pQuery, ", %s.data_state = 'update'", fileTable); 176 psStringAppend(&fileWhere, "AND %s.data_state = 'cleaned'", fileTable); 177 } 167 178 168 179 psString whereClause = psDBGenerateWhereSQL(where, NULL); 169 180 psStringAppend(pQuery, " %s", whereClause); 170 181 psFree(whereClause); 171 172 if (!p_psDBRunQuery(config->dbh, *pQuery)) { 182 if (fileWhere) { 183 psStringAppend(pQuery, "%s", fileWhere); 184 } 185 186 bool mdok; // Status of MD lookup 187 if (psMetadataLookupBool(&mdok, config->args, "-pretend")) { 188 psLogMsg("pxtools", PS_LOG_INFO, "Query to run: %s\n", *pQuery); 189 return true; 190 } 191 192 if (!p_psDBRunQueryF(config->dbh, *pQuery, joinHook)) { 173 193 psError(PS_ERR_UNKNOWN, false, "database error"); 174 194 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
