Changeset 25835 for trunk/ippTools/src/pxwarp.c
- Timestamp:
- Oct 14, 2009, 11:06:18 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxwarp.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxwarp.c
r24487 r25835 29 29 #include "pxwarp.h" 30 30 31 bool pxwarpRunSetState(pxConfig *config, psS64 warp_id, const char *state)32 {33 PS_ASSERT_PTR_NON_NULL(config, false);34 PS_ASSERT_PTR_NON_NULL(state, false);35 36 // check that state is a valid string value37 if (!pxIsValidState(state)) {38 psError(PS_ERR_UNKNOWN, false, "invalid warpRun state: %s", state);39 return false;40 }41 42 char *query = "UPDATE warpRun SET state = '%s' WHERE warp_id = %" PRId64;43 if (!p_psDBRunQueryF(config->dbh, query, state, warp_id)) {44 psError(PS_ERR_UNKNOWN, false,45 "failed to change state for warp_id %" PRId64, warp_id);46 return false;47 }48 49 return true;50 }51 52 53 bool pxwarpRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *state)54 {55 PS_ASSERT_PTR_NON_NULL(config, false);56 PS_ASSERT_PTR_NON_NULL(state, false);57 58 // check that state is a valid string value59 if (!pxIsValidState(state)) {60 psError(PS_ERR_UNKNOWN, false, "invalid warpRun state: %s", state);61 return false;62 }63 64 psString query = psStringCopy("UPDATE warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET warpRun.state = '%s'");65 66 if (where) {67 psString whereClause = psDBGenerateWhereSQL(where, NULL);68 if (whereClause && strlen(whereClause) > 0) {69 psStringAppend(&query, " %s", whereClause);70 }71 psFree(whereClause);72 }73 74 if (!p_psDBRunQueryF(config->dbh, query, state)) {75 psFree(query);76 psError(PS_ERR_UNKNOWN, false, "database error");77 return false;78 }79 80 psFree(query);81 82 return true;83 }84 85 86 bool pxwarpRunSetLabel(pxConfig *config, psS64 warp_id, const char *label)87 {88 PS_ASSERT_PTR_NON_NULL(config, false);89 // note label == NULL should be explicitly allowed90 91 char *query = "UPDATE warpRun SET warpRun.label = '%s' WHERE warp_id = %" PRId64;92 if (!p_psDBRunQueryF(config->dbh, query, label, warp_id)) {93 psError(PS_ERR_UNKNOWN, false,94 "failed to change label for warp_id %" PRId64, warp_id);95 return false;96 }97 98 return true;99 }100 101 102 bool pxwarpRunSetLabelByQuery(pxConfig *config, psMetadata *where, const char *label)103 {104 PS_ASSERT_PTR_NON_NULL(config, false);105 // note label == NULL should be explicitly allowed106 107 psString query = psStringCopy("UPDATE warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET warpRun.label = '%s'");108 109 if (where) {110 psString whereClause = psDBGenerateWhereSQL(where, NULL);111 psStringAppend(&query, " %s", whereClause);112 psFree(whereClause);113 }114 115 if (!p_psDBRunQueryF(config->dbh, query, label)) {116 psFree(query);117 psError(PS_ERR_UNKNOWN, false, "database error");118 return false;119 }120 121 psFree(query);122 123 return true;124 }125 126 127 31 bool pxwarpQueueByFakeID(pxConfig *config, 128 32 psS64 fake_id, 129 33 const char *workdir, 130 34 const char *label, 35 const char *data_group, 36 const char *dist_group, 131 37 const char *dvodb, 132 38 const char *tess_id, 133 39 const char *reduction, 134 const char *end_stage) 40 const char *end_stage, 41 const char *note) 135 42 { 136 43 PS_ASSERT_PTR_NON_NULL(config, false); … … 145 52 "dirty", // workdir_state 146 53 label, 54 data_group, 55 dist_group, 147 56 dvodb, 148 57 tess_id, 149 reduction,58 reduction, 150 59 end_stage, 151 60 NULL, // registered 152 0 // magicked zero when created will get updated when warpRun goes to 'full' 61 0, // magicked set to zero when created may get updated when warpRun goes to 'full' 62 NULL // note 153 63 )) { 154 64 psError(PS_ERR_UNKNOWN, false, "database error");
Note:
See TracChangeset
for help on using the changeset viewer.
