Changeset 18571 for trunk/ippTools/src/magictool.c
- Timestamp:
- Jul 15, 2008, 2:41:41 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/magictool.c (modified) (19 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/magictool.c
r18561 r18571 111 111 // create warped skycells temp table 112 112 { 113 psString query = pxDataGet("magictool_create_tmp_warpcomplete.sql");114 if (!query) {115 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");116 return false;117 }118 119 if (!p_psDBRunQuery(config->dbh, query)) {120 psError(PS_ERR_UNKNOWN, false, "database error");121 return false;122 }113 psString query = pxDataGet("magictool_create_tmp_warpcomplete.sql"); 114 if (!query) { 115 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 116 return false; 117 } 118 119 if (!p_psDBRunQuery(config->dbh, query)) { 120 psError(PS_ERR_UNKNOWN, false, "database error"); 121 return false; 122 } 123 123 } 124 124 125 125 // find warped skycells 126 126 { 127 psString query = pxDataGet("magictool_find_complete_warpruns.sql");128 if (!query) {129 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");130 return false;131 }132 133 if (!p_psDBRunQuery(config->dbh, query)) {134 psError(PS_ERR_UNKNOWN, false, "database error");135 psFree(query);136 return false;137 }138 psFree(query);127 psString query = pxDataGet("magictool_find_complete_warpruns.sql"); 128 if (!query) { 129 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 130 return false; 131 } 132 133 if (!p_psDBRunQuery(config->dbh, query)) { 134 psError(PS_ERR_UNKNOWN, false, "database error"); 135 psFree(query); 136 return false; 137 } 138 psFree(query); 139 139 } 140 140 141 141 // find the diff_id's of the warped skycells 142 142 { 143 psString query = pxDataGet("magictool_find_complete_diffed_exposures.sql");144 if (!query) {145 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");146 return false;147 }148 149 if (!p_psDBRunQuery(config->dbh, query)) {150 psError(PS_ERR_UNKNOWN, false, "database error");151 psFree(query);152 return false;153 }154 psFree(query);143 psString query = pxDataGet("magictool_find_complete_diffed_exposures.sql"); 144 if (!query) { 145 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 146 return false; 147 } 148 149 if (!p_psDBRunQuery(config->dbh, query)) { 150 psError(PS_ERR_UNKNOWN, false, "database error"); 151 psFree(query); 152 return false; 153 } 154 psFree(query); 155 155 } 156 156 psArray *output = p_psDBFetchResult(config->dbh); … … 158 158 psErrorCode err = psErrorCodeLast(); 159 159 switch (err) { 160 case PS_ERR_DB_CLIENT:161 psError(PXTOOLS_ERR_SYS, false, "database error");162 case PS_ERR_DB_SERVER:163 psError(PXTOOLS_ERR_PROG, false, "database error");164 default:165 psError(PXTOOLS_ERR_PROG, false, "unknown error");160 case PS_ERR_DB_CLIENT: 161 psError(PXTOOLS_ERR_SYS, false, "database error"); 162 case PS_ERR_DB_SERVER: 163 psError(PXTOOLS_ERR_PROG, false, "database error"); 164 default: 165 psError(PXTOOLS_ERR_PROG, false, "unknown error"); 166 166 } 167 167 … … 211 211 // create a new magicRun for this group 212 212 magicRunRow *run = magicRunRowAlloc( 213 0,// ID214 "reg",// state215 workdir,// workdir216 "dirty",// workdir_state217 label,// label218 dvodb,// dvodb219 registered,// registered220 0// fault221 );213 0, // ID 214 "reg", // state 215 workdir, // workdir 216 "dirty", // workdir_state 217 label, // label 218 dvodb, // dvodb 219 registered, // registered 220 0 // fault 221 ); 222 222 if (!run) { 223 223 psAbort("failed to alloc magicRun object"); … … 248 248 249 249 if (!magicInputSkyfileInsert(config->dbh, 250 magic_id,251 diff_id,252 node)) {250 magic_id, 251 diff_id, 252 node)) { 253 253 psError(PS_ERR_UNKNOWN, false, "database error"); 254 254 psFree(grouped); … … 320 320 321 321 // required 322 PXOPT_LOOKUP_S TR(magic_id, config->args, "-magic_id", true, false);322 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 323 323 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 324 324 325 325 if (state) { 326 326 // set detRun.state to state 327 return setmagicRunState(config, (psS64)atoll(magic_id), state);327 return setmagicRunState(config, magic_id, state); 328 328 } 329 329 … … 337 337 338 338 // required 339 PXOPT_LOOKUP_S TR(magic_id, config->args, "-magic_id", true, false);340 PXOPT_LOOKUP_S TR(diff_id, config->args, "-diff_id", true, false);339 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 340 PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false); 341 341 PXOPT_LOOKUP_STR(node, config->args, "-node", true, false); 342 342 343 343 magicInputSkyfileInsert( 344 344 config->dbh, 345 (psS64)atoll(magic_id),346 (psS64)atoll(diff_id),345 magic_id, 346 diff_id, 347 347 node 348 348 ); … … 357 357 358 358 psMetadata *where = psMetadataAlloc(); 359 PXOPT_COPY_S TR(config->args, where, "-magic_id", "magic_id", "==");360 PXOPT_COPY_S TR(config->args, where, "-diff_id", "diff_id", "==");359 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 360 PXOPT_COPY_S64(config->args, where, "-diff_id", "diff_id", "=="); 361 361 PXOPT_COPY_STR(config->args, where, "-node", "node", "=="); 362 362 … … 431 431 432 432 psMetadata *where = psMetadataAlloc(); 433 PXOPT_COPY_S TR(config->args, where, "-magic_id", "magicRun.magic_id", "==");433 PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "=="); 434 434 435 435 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); … … 503 503 504 504 // required 505 PXOPT_LOOKUP_STR(magic_id, config->args, "-magic_id", true, false); 506 PXOPT_LOOKUP_STR(dep_file, config->args, "-dep_file", true, false); 507 508 if (!parseAndInsertNodeDeps(config, (psS64)atoll(magic_id), dep_file)) { 505 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 506 507 // Optional values 508 PXOPT_LOOKUP_STR(dep_file, config->args, "-dep_file", false, false); 509 510 // default values 511 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 512 513 if (code > 0) { 514 char *query = "UPDATE magicRun SET fault = %d WHERE magic_id = %" PRId64; 515 if (!p_psDBRunQuery(config->dbh, query, code, magic_id)) { 516 psError(PS_ERR_UNKNOWN, false, 517 "failed to set fault for magic_id %" PRId64, magic_id); 518 return false; 519 } 520 return true; 521 } 522 523 if (!parseAndInsertNodeDeps(config, magic_id, dep_file)) { 509 524 psError(PS_ERR_UNKNOWN, false, "failed to parse file"); 510 525 return false; … … 519 534 520 535 psMetadata *where = psMetadataAlloc(); 521 PXOPT_COPY_S TR(config->args, where, "-magic_id", "magic_id", "==");536 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 522 537 PXOPT_COPY_STR(config->args, where, "-node", "node", "=="); 523 538 … … 663 678 664 679 psMetadata *where = psMetadataAlloc(); 665 PXOPT_COPY_S TR(config->args, where, "-magic_id", "magic_id", "==");680 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 666 681 667 682 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); … … 678 693 whereClause = psDBGenerateWhereSQL(where, NULL); 679 694 psStringAppend(&query, " %s", whereClause); 680 psFree(whereClause);695 psFree(whereClause); 681 696 } 682 697 psFree(where); … … 705 720 if (!psArrayLength(output)) { 706 721 psTrace("magictool", PS_LOG_INFO, "no rows found"); 707 // psFree(output);722 // psFree(output); 708 723 // return true; 709 724 } … … 798 813 799 814 // required 800 PXOPT_LOOKUP_S TR(magic_id, config->args, "-magic_id", true, false);815 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 801 816 PXOPT_LOOKUP_STR(node, config->args, "-node", true, false); 802 817 … … 808 823 809 824 if (!magicNodeResultInsert(config->dbh, 810 (psS64)atoll(magic_id),825 magic_id, 811 826 node, 812 827 uri, … … 888 903 889 904 // required 890 PXOPT_LOOKUP_S TR(magic_id, config->args, "-magic_id", true, false);905 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 891 906 892 907 // optional … … 903 918 904 919 if (!magicMaskInsert(config->dbh, 905 (psS64)atoll(magic_id),920 magic_id, 906 921 uri, 907 922 streaks, … … 920 935 921 936 // manually add constraint 922 psStringAppend(&query, " AND magic_id = % s", magic_id);937 psStringAppend(&query, " AND magic_id = %" PRId64, magic_id); 923 938 924 939 if (!p_psDBRunQuery(config->dbh, query)) { … … 943 958 944 959 psMetadata *where = psMetadataAlloc(); 945 PXOPT_COPY_S TR(config->args, where, "-magic_id", "magicRun.magic_id", "==");960 PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "=="); 946 961 947 962 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);
Note:
See TracChangeset
for help on using the changeset viewer.
