Changeset 25835 for trunk/ippTools/src/pxfake.c
- Timestamp:
- Oct 14, 2009, 11:06:18 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/pxfake.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/pxfake.c
r21402 r25835 51 51 } 52 52 53 54 bool pxfakeRunSetStateByQuery(pxConfig *config, psMetadata *where, const char *state)55 {56 PS_ASSERT_PTR_NON_NULL(config, false);57 PS_ASSERT_PTR_NON_NULL(state, false);58 59 // check that state is a valid string value60 if (!pxIsValidState(state)) {61 psError(PS_ERR_UNKNOWN, false,62 "invalid fakeRun state: %s", state);63 return false;64 }65 66 psString query = psStringCopy("UPDATE fakeRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET fakeRun.state = '%s'");67 68 if (where) {69 psString whereClause = psDBGenerateWhereSQL(where, NULL);70 psStringAppend(&query, " %s", whereClause);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 pxfakeRunSetLabel(pxConfig *config, psS64 fake_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 fakeRun SET fakeRun.label = '%s' WHERE fake_id = %" PRId64;92 if (!p_psDBRunQueryF(config->dbh, query, label, fake_id)) {93 psError(PS_ERR_UNKNOWN, false,94 "failed to change state for fake_id %" PRId64, fake_id);95 return false;96 }97 98 return true;99 }100 101 102 bool pxfakeRunSetLabelByQuery(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 fakeRun JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) SET fakeRun.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 53 psS64 pxfakeQueueByCamID(pxConfig *config, 128 54 psS64 cam_id, 129 55 char *workdir, 130 56 char *label, 57 char *data_group, 58 char *dist_group, 131 59 char *reduction, 132 60 char *expgroup, 133 61 char *dvodb, 134 62 char *tess_id, 135 char *end_stage) 63 char *end_stage, 64 char *note) 136 65 { 137 66 PS_ASSERT_PTR_NON_NULL(config, false); … … 157 86 workdir ? workdir : "NULL", 158 87 label ? label : "NULL", 88 data_group ? data_group : "NULL", 89 dist_group ? dist_group : "NULL", 159 90 reduction? reduction: "NULL", 160 91 expgroup ? expgroup : "NULL", … … 162 93 tess_id ? tess_id : "NULL", 163 94 end_stage ? end_stage : "NULL", 95 note ? note : "NULL", 164 96 (long long)cam_id 165 97 )) {
Note:
See TracChangeset
for help on using the changeset viewer.
