Changeset 8665 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Aug 28, 2006, 6:44:34 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (119 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r8543 r8665 1 /* 2 * 3 * This file was generated by glueforge 0.24 4 * 5 * Do NOT directly edit this file. 6 * 7 */ 8 1 9 #include <stdio.h> 2 10 … … 42 50 #define P2PENDINGIMFILE_TABLE_NAME "p2PendingImfile" 43 51 #define P2PENDINGIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 44 #define P2 DONEEXP_TABLE_NAME "p2DoneExp"45 #define P2 DONEEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME46 #define P2 DONEIMFILE_TABLE_NAME "p2DoneImfile"47 #define P2 DONEIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME52 #define P2PROCESSEDEXP_TABLE_NAME "p2ProcessedExp" 53 #define P2PROCESSEDEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 54 #define P2PROCESSEDIMFILE_TABLE_NAME "p2ProcessedImfile" 55 #define P2PROCESSEDIMFILE_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME 48 56 #define P3PENDINGEXP_TABLE_NAME "p3PendingExp" 49 57 #define P3PENDINGEXP_INDEX_NAME IPPDB_DEFAULT_INDEX_NAME … … 562 570 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 563 571 WEATHER_TABLE_NAME, WEATHER_INDEX_NAME, limit) < 0) { 564 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);572 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 565 573 return false; 566 574 } … … 1121 1129 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 1122 1130 SKYP_TRANSPARENCY_TABLE_NAME, SKYP_TRANSPARENCY_INDEX_NAME, limit) < 0) { 1123 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);1131 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 1124 1132 return false; 1125 1133 } … … 1716 1724 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 1717 1725 SKYP_ABSORPTION_TABLE_NAME, SKYP_ABSORPTION_INDEX_NAME, limit) < 0) { 1718 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);1726 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 1719 1727 return false; 1720 1728 } … … 2279 2287 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 2280 2288 SKYP_EMISSION_TABLE_NAME, SKYP_EMISSION_INDEX_NAME, limit) < 0) { 2281 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);2289 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 2282 2290 return false; 2283 2291 } … … 2827 2835 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 2828 2836 DIMM_TABLE_NAME, DIMM_INDEX_NAME, limit) < 0) { 2829 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);2837 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 2830 2838 return false; 2831 2839 } … … 3367 3375 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 3368 3376 SKYP_IR_TABLE_NAME, SKYP_IR_INDEX_NAME, limit) < 0) { 3369 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);3377 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 3370 3378 return false; 3371 3379 } … … 3860 3868 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 3861 3869 DOME_TABLE_NAME, DOME_INDEX_NAME, limit) < 0) { 3862 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);3870 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 3863 3871 return false; 3864 3872 } … … 4350 4358 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 4351 4359 TELESCOPE_TABLE_NAME, TELESCOPE_INDEX_NAME, limit) < 0) { 4352 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);4360 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 4353 4361 return false; 4354 4362 } … … 4855 4863 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 4856 4864 SUMMITEXP_TABLE_NAME, SUMMITEXP_INDEX_NAME, limit) < 0) { 4857 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);4865 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 4858 4866 return false; 4859 4867 } … … 5359 5367 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 5360 5368 PZPENDINGEXP_TABLE_NAME, PZPENDINGEXP_INDEX_NAME, limit) < 0) { 5361 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);5369 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 5362 5370 return false; 5363 5371 } … … 5882 5890 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 5883 5891 PZPENDINGIMFILE_TABLE_NAME, PZPENDINGIMFILE_INDEX_NAME, limit) < 0) { 5884 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);5892 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 5885 5893 return false; 5886 5894 } … … 6397 6405 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 6398 6406 NEWEXP_TABLE_NAME, NEWEXP_INDEX_NAME, limit) < 0) { 6399 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);6407 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 6400 6408 return false; 6401 6409 } … … 6883 6891 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 6884 6892 NEWIMFILE_TABLE_NAME, NEWIMFILE_INDEX_NAME, limit) < 0) { 6885 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);6893 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 6886 6894 return false; 6887 6895 } … … 7593 7601 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 7594 7602 RAWDETRENDEXP_TABLE_NAME, RAWDETRENDEXP_INDEX_NAME, limit) < 0) { 7595 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);7603 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 7596 7604 return false; 7597 7605 } … … 8446 8454 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 8447 8455 RAWSCIENCEEXP_TABLE_NAME, RAWSCIENCEEXP_INDEX_NAME, limit) < 0) { 8448 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);8456 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 8449 8457 return false; 8450 8458 } … … 9300 9308 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 9301 9309 RAWIMFILE_TABLE_NAME, RAWIMFILE_INDEX_NAME, limit) < 0) { 9302 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);9310 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 9303 9311 return false; 9304 9312 } … … 9898 9906 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 9899 9907 P1PENDINGEXP_TABLE_NAME, P1PENDINGEXP_INDEX_NAME, limit) < 0) { 9900 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);9908 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 9901 9909 return false; 9902 9910 } … … 10360 10368 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 10361 10369 P2PENDINGEXP_TABLE_NAME, P2PENDINGEXP_INDEX_NAME, limit) < 0) { 10362 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);10370 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 10363 10371 return false; 10364 10372 } … … 10871 10879 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 10872 10880 P2PENDINGIMFILE_TABLE_NAME, P2PENDINGIMFILE_INDEX_NAME, limit) < 0) { 10873 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);10881 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 10874 10882 return false; 10875 10883 } … … 11099 11107 return true; 11100 11108 } 11101 static void p2 DoneExpRowFree(p2DoneExpRow *object);11102 11103 p2 DoneExpRow *p2DoneExpRowAlloc(const char *exp_id, const char *recipe, psS32 p1_version, psS32 p2_version)11104 { 11105 p2 DoneExpRow*object;11106 11107 object = psAlloc(sizeof(p2 DoneExpRow));11108 psMemSetDeallocator(object, (psFreeFunc)p2 DoneExpRowFree);11109 static void p2ProcessedExpRowFree(p2ProcessedExpRow *object); 11110 11111 p2ProcessedExpRow *p2ProcessedExpRowAlloc(const char *exp_id, psS32 p1_version, psS32 p2_version) 11112 { 11113 p2ProcessedExpRow *object; 11114 11115 object = psAlloc(sizeof(p2ProcessedExpRow)); 11116 psMemSetDeallocator(object, (psFreeFunc)p2ProcessedExpRowFree); 11109 11117 11110 11118 object->exp_id = psStringCopy(exp_id); 11111 object->recipe = psStringCopy(recipe);11112 11119 object->p1_version = p1_version; 11113 11120 object->p2_version = p2_version; … … 11116 11123 } 11117 11124 11118 static void p2 DoneExpRowFree(p2DoneExpRow *object)11125 static void p2ProcessedExpRowFree(p2ProcessedExpRow *object) 11119 11126 { 11120 11127 psFree(object->exp_id); 11121 psFree(object->recipe); 11122 } 11123 11124 bool p2DoneExpCreateTable(psDB *dbh) 11128 } 11129 11130 bool p2ProcessedExpCreateTable(psDB *dbh) 11125 11131 { 11126 11132 psMetadata *md; … … 11128 11134 11129 11135 md = psMetadataAlloc(); 11130 if (!psMetadataAdd(md, PS_LIST_TAIL, P2 DONEEXP_INDEX_NAME, PS_DATA_S32, "AUTO_INCREMENT", 0.0)) {11131 psError(PS_ERR_UNKNOWN, false, "failed to add item %s", P2 DONEEXP_INDEX_NAME);11136 if (!psMetadataAdd(md, PS_LIST_TAIL, P2PROCESSEDEXP_INDEX_NAME, PS_DATA_S32, "AUTO_INCREMENT", 0.0)) { 11137 psError(PS_ERR_UNKNOWN, false, "failed to add item %s", P2PROCESSEDEXP_INDEX_NAME); 11132 11138 psFree(md); 11133 11139 return false; … … 11138 11144 return false; 11139 11145 } 11140 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "64")) {11141 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");11142 psFree(md);11143 return false;11144 }11145 11146 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p1_version", 0, NULL, 0)) { 11146 11147 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); … … 11154 11155 } 11155 11156 11156 status = psDBCreateTable(dbh, P2 DONEEXP_TABLE_NAME, md);11157 status = psDBCreateTable(dbh, P2PROCESSEDEXP_TABLE_NAME, md); 11157 11158 11158 11159 psFree(md); … … 11161 11162 } 11162 11163 11163 bool p2 DoneExpDropTable(psDB *dbh)11164 { 11165 return psDBDropTable(dbh, P2 DONEEXP_TABLE_NAME);11166 } 11167 11168 bool p2 DoneExpInsert(psDB * dbh, const char *exp_id, const char *recipe, psS32 p1_version, psS32 p2_version)11164 bool p2ProcessedExpDropTable(psDB *dbh) 11165 { 11166 return psDBDropTable(dbh, P2PROCESSEDEXP_TABLE_NAME); 11167 } 11168 11169 bool p2ProcessedExpInsert(psDB * dbh, const char *exp_id, psS32 p1_version, psS32 p2_version) 11169 11170 { 11170 11171 psMetadata *md; … … 11177 11178 return false; 11178 11179 } 11179 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, recipe)) {11180 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");11181 psFree(md);11182 return false;11183 }11184 11180 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p1_version", 0, NULL, p1_version)) { 11185 11181 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); … … 11193 11189 } 11194 11190 11195 status = psDBInsertOneRow(dbh, P2 DONEEXP_TABLE_NAME, md);11191 status = psDBInsertOneRow(dbh, P2PROCESSEDEXP_TABLE_NAME, md); 11196 11192 psFree(md); 11197 11193 … … 11199 11195 } 11200 11196 11201 long long p2 DoneExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)11197 long long p2ProcessedExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 11202 11198 { 11203 11199 long long deleted = 0; 11204 11200 11205 long long count = psDBDeleteRows(dbh, P2 DONEEXP_TABLE_NAME, where, limit);11201 long long count = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit); 11206 11202 if (count < 0) { 11207 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2 DoneExp");11203 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedExp"); 11208 11204 return count; 11209 11205 … … 11213 11209 return deleted; 11214 11210 } 11215 bool p2 DoneExpPop(psDB *dbh, char **exp_id, char **recipe, psS32 *p1_version, psS32 *p2_version)11211 bool p2ProcessedExpPop(psDB *dbh, char **exp_id, psS32 *p1_version, psS32 *p2_version) 11216 11212 { 11217 11213 psArray *rowSet; … … 11222 11218 int rowID; 11223 11219 11224 rowSet = psDBSelectRows(dbh, P2 DONEEXP_TABLE_NAME, NULL, 1);11220 rowSet = psDBSelectRows(dbh, P2PROCESSEDEXP_TABLE_NAME, NULL, 1); 11225 11221 if (!rowSet) { 11226 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2 DONEEXP_INDEX_NAME);11222 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2PROCESSEDEXP_INDEX_NAME); 11227 11223 psFree(rowSet); 11228 11224 return NULL; … … 11237 11233 psFree(rowSet); 11238 11234 11239 rowID = psMetadataLookupS32(&status, row, P2 DONEEXP_INDEX_NAME);11240 if (!status) { 11241 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2 DONEEXP_INDEX_NAME);11235 rowID = psMetadataLookupS32(&status, row, P2PROCESSEDEXP_INDEX_NAME); 11236 if (!status) { 11237 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2PROCESSEDEXP_INDEX_NAME); 11242 11238 psFree(row); 11243 11239 return NULL; … … 11245 11241 11246 11242 popped = psMetadataAlloc(); 11247 psMetadataAddS32(popped, PS_LIST_TAIL, P2 DONEEXP_INDEX_NAME, 0, NULL, rowID);11248 11249 deleted = psDBDeleteRows(dbh, P2 DONEEXP_TABLE_NAME, popped, 0);11243 psMetadataAddS32(popped, PS_LIST_TAIL, P2PROCESSEDEXP_INDEX_NAME, 0, NULL, rowID); 11244 11245 deleted = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, popped, 0); 11250 11246 if (deleted != 1) { 11251 11247 psError(PS_ERR_UNKNOWN, false, "database failed to delete row"); … … 11263 11259 return false; 11264 11260 } 11265 *recipe = psMetadataLookupPtr(&status, row, "recipe");11266 if (!status) {11267 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");11268 psFree(row);11269 return false;11270 }11271 11261 *p1_version = psMetadataLookupS32(&status, row, "p1_version"); 11272 11262 if (!status) { … … 11287 11277 } 11288 11278 11289 bool p2 DoneExpInsertObject(psDB *dbh, p2DoneExpRow *object)11290 { 11291 return p2 DoneExpInsert(dbh, object->exp_id, object->recipe, object->p1_version, object->p2_version);11292 } 11293 11294 bool p2 DoneExpInsertObjects(psDB *dbh, psArray *objects)11279 bool p2ProcessedExpInsertObject(psDB *dbh, p2ProcessedExpRow *object) 11280 { 11281 return p2ProcessedExpInsert(dbh, object->exp_id, object->p1_version, object->p2_version); 11282 } 11283 11284 bool p2ProcessedExpInsertObjects(psDB *dbh, psArray *objects) 11295 11285 { 11296 11286 for (long i = 0; i < psArrayLength(objects); i++) { 11297 if (!p2 DoneExpInsertObject(dbh, objects->data[i])) {11287 if (!p2ProcessedExpInsertObject(dbh, objects->data[i])) { 11298 11288 return false; 11299 11289 } … … 11303 11293 } 11304 11294 11305 p2 DoneExpRow *p2DoneExpPopObject(psDB *dbh)11295 p2ProcessedExpRow *p2ProcessedExpPopObject(psDB *dbh) 11306 11296 { 11307 11297 char exp_id[256]; 11308 char recipe[256];11309 11298 psS32 p1_version; 11310 11299 psS32 p2_version; 11311 11300 11312 if (!p2 DoneExpPop(dbh, (char **)&exp_id, (char **)&recipe, &p1_version, &p2_version)) {11301 if (!p2ProcessedExpPop(dbh, (char **)&exp_id, &p1_version, &p2_version)) { 11313 11302 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 11314 11303 return NULL; 11315 11304 } 11316 11305 11317 return p2 DoneExpRowAlloc(exp_id, recipe, p1_version, p2_version);11318 } 11319 11320 bool p2 DoneExpInsertFits(psDB *dbh, const psFits *fits)11306 return p2ProcessedExpRowAlloc(exp_id, p1_version, p2_version); 11307 } 11308 11309 bool p2ProcessedExpInsertFits(psDB *dbh, const psFits *fits) 11321 11310 { 11322 11311 psArray *rowSet; 11323 11312 11324 // move to (the first?) extension named P2 DONEEXP_TABLE_NAME11325 if (!psFitsMoveExtName(fits, P2 DONEEXP_TABLE_NAME)) {11326 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2 DONEEXP_TABLE_NAME);11313 // move to (the first?) extension named P2PROCESSEDEXP_TABLE_NAME 11314 if (!psFitsMoveExtName(fits, P2PROCESSEDEXP_TABLE_NAME)) { 11315 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2PROCESSEDEXP_TABLE_NAME); 11327 11316 return false; 11328 11317 } … … 11342 11331 } 11343 11332 11344 if (!psDBInsertRows(dbh, P2 DONEEXP_TABLE_NAME, rowSet)) {11333 if (!psDBInsertRows(dbh, P2PROCESSEDEXP_TABLE_NAME, rowSet)) { 11345 11334 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 11346 11335 psFree(rowSet); … … 11353 11342 } 11354 11343 11355 bool p2 DoneExpPopFits(psDB *dbh, psFits *fits, unsigned long long limit)11344 bool p2ProcessedExpPopFits(psDB *dbh, psFits *fits, unsigned long long limit) 11356 11345 { 11357 11346 char query[MAX_STRING_LENGTH]; 11358 11347 11359 if (!p2 DoneExpSelectRowsFits(dbh, fits, NULL, limit)) {11348 if (!p2ProcessedExpSelectRowsFits(dbh, fits, NULL, limit)) { 11360 11349 psError(PS_ERR_UNKNOWN, true, "database error or table is empty"); 11361 11350 return false; … … 11365 11354 if (snprintf(query, MAX_STRING_LENGTH, 11366 11355 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 11367 P2 DONEEXP_TABLE_NAME, P2DONEEXP_INDEX_NAME, limit) < 0) {11368 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);11356 P2PROCESSEDEXP_TABLE_NAME, P2PROCESSEDEXP_INDEX_NAME, limit) < 0) { 11357 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 11369 11358 return false; 11370 11359 } … … 11378 11367 } 11379 11368 11380 bool p2 DoneExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)11369 bool p2ProcessedExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 11381 11370 { 11382 11371 psArray *rowSet; 11383 11372 psU64 i; 11384 11373 11385 rowSet = psDBSelectRows(dbh, P2 DONEEXP_TABLE_NAME, where, limit);11374 rowSet = psDBSelectRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit); 11386 11375 if (!rowSet) { 11387 11376 return false; … … 11390 11379 // strip index column 11391 11380 for (i = 0; i < rowSet->n; i++) { 11392 if (!psMetadataRemove((psMetadata *)rowSet->data[i], 0, P2 DONEEXP_INDEX_NAME)) {11393 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2 DONEEXP_INDEX_NAME);11381 if (!psMetadataRemove((psMetadata *)rowSet->data[i], 0, P2PROCESSEDEXP_INDEX_NAME)) { 11382 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2PROCESSEDEXP_INDEX_NAME); 11394 11383 psFree(rowSet); 11395 11384 return false; … … 11398 11387 11399 11388 // output to fits 11400 if (!psFitsWriteTable(fits, NULL, rowSet, P2 DONEEXP_TABLE_NAME)) {11389 if (!psFitsWriteTable(fits, NULL, rowSet, P2PROCESSEDEXP_TABLE_NAME)) { 11401 11390 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 11402 11391 psFree(rowSet); … … 11409 11398 } 11410 11399 11411 psMetadata *p2 DoneExpMetadataFromObject(const p2DoneExpRow *object)11400 psMetadata *p2ProcessedExpMetadataFromObject(const p2ProcessedExpRow *object) 11412 11401 { 11413 11402 psMetadata *md; … … 11419 11408 return NULL; 11420 11409 } 11421 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, object->recipe)) {11422 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");11423 psFree(md);11424 return NULL;11425 }11426 11410 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p1_version", 0, NULL, object->p1_version)) { 11427 11411 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); … … 11438 11422 } 11439 11423 11440 p2 DoneExpRow *p2DoneExpObjectFromMetadata(psMetadata *md)11424 p2ProcessedExpRow *p2ProcessedExpObjectFromMetadata(psMetadata *md) 11441 11425 { 11442 11426 bool status; 11443 11427 char *exp_id; 11444 char *recipe;11445 11428 psS32 p1_version; 11446 11429 psS32 p2_version; … … 11451 11434 return false; 11452 11435 } 11453 recipe = psMetadataLookupPtr(&status, md, "recipe");11454 if (!status) {11455 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");11456 return false;11457 }11458 11436 p1_version = psMetadataLookupS32(&status, md, "p1_version"); 11459 11437 if (!status) { … … 11467 11445 } 11468 11446 11469 return p2 DoneExpRowAlloc(exp_id, recipe, p1_version, p2_version);11470 } 11471 psArray *p2 DoneExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)11447 return p2ProcessedExpRowAlloc(exp_id, p1_version, p2_version); 11448 } 11449 psArray *p2ProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 11472 11450 { 11473 11451 psArray *rowSet; … … 11475 11453 psU64 i; 11476 11454 11477 rowSet = psDBSelectRows(dbh, P2 DONEEXP_TABLE_NAME, where, limit);11455 rowSet = psDBSelectRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit); 11478 11456 if (!rowSet) { 11479 11457 return NULL; … … 11482 11460 // strip index column 11483 11461 for (i = 0; i < rowSet->n; i++) { 11484 if (!psMetadataRemove((psMetadata *)(rowSet->data[i]), 0, P2 DONEEXP_INDEX_NAME)) {11485 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2 DONEEXP_INDEX_NAME);11462 if (!psMetadataRemove((psMetadata *)(rowSet->data[i]), 0, P2PROCESSEDEXP_INDEX_NAME)) { 11463 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2PROCESSEDEXP_INDEX_NAME); 11486 11464 psFree(rowSet); 11487 11465 return false; … … 11495 11473 11496 11474 for (i = 0; i < rowSet->n; i++) { 11497 p2 DoneExpRow *object = p2DoneExpObjectFromMetadata(rowSet->data[i]);11475 p2ProcessedExpRow *object = p2ProcessedExpObjectFromMetadata(rowSet->data[i]); 11498 11476 psArrayAdd(returnSet, 0, object); 11499 11477 psFree(object); … … 11504 11482 return returnSet; 11505 11483 } 11506 bool p2 DoneExpDeleteObject(psDB *dbh, const p2DoneExpRow *object)11507 { 11508 psMetadata *where = p2 DoneExpMetadataFromObject(object);11509 long long count = psDBDeleteRows(dbh, P2 DONEEXP_TABLE_NAME, where, 0);11484 bool p2ProcessedExpDeleteObject(psDB *dbh, const p2ProcessedExpRow *object) 11485 { 11486 psMetadata *where = p2ProcessedExpMetadataFromObject(object); 11487 long long count = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, 0); 11510 11488 psFree(where) 11511 11489 if (count < 0) { 11512 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2 DoneExp");11490 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedExp"); 11513 11491 return false; 11514 11492 } … … 11516 11494 // XXX should this be a psAbort() instead? It is possible that 11517 11495 // having an object match multiple rows was by design. 11518 psError(PS_ERR_UNKNOWN, true, "p2 DoneExpRow object matched more then one row. Check your database schema");11519 return false; 11520 } 11521 11522 return true; 11523 } 11524 long long p2 DoneExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)11496 psError(PS_ERR_UNKNOWN, true, "p2ProcessedExpRow object matched more then one row. Check your database schema"); 11497 return false; 11498 } 11499 11500 return true; 11501 } 11502 long long p2ProcessedExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 11525 11503 { 11526 11504 long long deleted = 0; 11527 11505 11528 11506 for (long long i = 0; i < objects->n; i++) { 11529 p2 DoneExpRow *object = objects->data[i];11530 psMetadata *where = p2 DoneExpMetadataFromObject(object);11531 long long count = psDBDeleteRows(dbh, P2 DONEEXP_TABLE_NAME, where, limit);11507 p2ProcessedExpRow *object = objects->data[i]; 11508 psMetadata *where = p2ProcessedExpMetadataFromObject(object); 11509 long long count = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit); 11532 11510 psFree(where) 11533 11511 if (count < 0) { 11534 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2 DoneExp");11512 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedExp"); 11535 11513 return count; 11536 11514 } … … 11541 11519 return deleted; 11542 11520 } 11543 bool p2 DoneExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)11521 bool p2ProcessedExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 11544 11522 { 11545 11523 PS_ASSERT_PTR_NON_NULL(objects, false); … … 11547 11525 psMetadata *output = psMetadataAlloc(); 11548 11526 for (long i = 0; i < psArrayLength(objects); i++) { 11549 psMetadata *md = p2 DoneExpMetadataFromObject(objects->data[i]);11527 psMetadata *md = p2ProcessedExpMetadataFromObject(objects->data[i]); 11550 11528 if (!psMetadataAddMetadata( 11551 11529 output, 11552 11530 PS_LIST_TAIL, 11553 P2 DONEEXP_TABLE_NAME,11531 P2PROCESSEDEXP_TABLE_NAME, 11554 11532 PS_META_DUPLICATE_OK, 11555 11533 NULL, … … 11572 11550 return true; 11573 11551 } 11574 static void p2 DoneImfileRowFree(p2DoneImfileRow *object);11575 11576 p2 DoneImfileRow *p2DoneImfileRowAlloc(const char *exp_id, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version)11577 { 11578 p2 DoneImfileRow *object;11579 11580 object = psAlloc(sizeof(p2 DoneImfileRow));11581 psMemSetDeallocator(object, (psFreeFunc)p2 DoneImfileRowFree);11552 static void p2ProcessedImfileRowFree(p2ProcessedImfileRow *object); 11553 11554 p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(const char *exp_id, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version) 11555 { 11556 p2ProcessedImfileRow *object; 11557 11558 object = psAlloc(sizeof(p2ProcessedImfileRow)); 11559 psMemSetDeallocator(object, (psFreeFunc)p2ProcessedImfileRowFree); 11582 11560 11583 11561 object->exp_id = psStringCopy(exp_id); … … 11585 11563 object->uri = psStringCopy(uri); 11586 11564 object->recipe = psStringCopy(recipe); 11565 object->bg = bg; 11566 object->bg_stdev = bg_stdev; 11567 object->bg_mean_stdev = bg_mean_stdev; 11568 object->b1_uri = psStringCopy(b1_uri); 11569 object->b2_uri = psStringCopy(b2_uri); 11587 11570 object->p1_version = p1_version; 11588 11571 object->p2_version = p2_version; … … 11591 11574 } 11592 11575 11593 static void p2 DoneImfileRowFree(p2DoneImfileRow *object)11576 static void p2ProcessedImfileRowFree(p2ProcessedImfileRow *object) 11594 11577 { 11595 11578 psFree(object->exp_id); … … 11597 11580 psFree(object->uri); 11598 11581 psFree(object->recipe); 11599 } 11600 11601 bool p2DoneImfileCreateTable(psDB *dbh) 11582 psFree(object->b1_uri); 11583 psFree(object->b2_uri); 11584 } 11585 11586 bool p2ProcessedImfileCreateTable(psDB *dbh) 11602 11587 { 11603 11588 psMetadata *md; … … 11605 11590 11606 11591 md = psMetadataAlloc(); 11607 if (!psMetadataAdd(md, PS_LIST_TAIL, P2 DONEIMFILE_INDEX_NAME, PS_DATA_S32, "AUTO_INCREMENT", 0.0)) {11608 psError(PS_ERR_UNKNOWN, false, "failed to add item %s", P2 DONEIMFILE_INDEX_NAME);11592 if (!psMetadataAdd(md, PS_LIST_TAIL, P2PROCESSEDIMFILE_INDEX_NAME, PS_DATA_S32, "AUTO_INCREMENT", 0.0)) { 11593 psError(PS_ERR_UNKNOWN, false, "failed to add item %s", P2PROCESSEDIMFILE_INDEX_NAME); 11609 11594 psFree(md); 11610 11595 return false; … … 11630 11615 return false; 11631 11616 } 11617 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, 0.0)) { 11618 psError(PS_ERR_UNKNOWN, false, "failed to add item bg"); 11619 psFree(md); 11620 return false; 11621 } 11622 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, 0.0)) { 11623 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_stdev"); 11624 psFree(md); 11625 return false; 11626 } 11627 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, 0.0)) { 11628 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 11629 psFree(md); 11630 return false; 11631 } 11632 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, "64")) { 11633 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 11634 psFree(md); 11635 return false; 11636 } 11637 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, "64")) { 11638 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 11639 psFree(md); 11640 return false; 11641 } 11632 11642 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p1_version", 0, NULL, 0)) { 11633 11643 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); … … 11641 11651 } 11642 11652 11643 status = psDBCreateTable(dbh, P2 DONEIMFILE_TABLE_NAME, md);11653 status = psDBCreateTable(dbh, P2PROCESSEDIMFILE_TABLE_NAME, md); 11644 11654 11645 11655 psFree(md); … … 11648 11658 } 11649 11659 11650 bool p2 DoneImfileDropTable(psDB *dbh)11651 { 11652 return psDBDropTable(dbh, P2 DONEIMFILE_TABLE_NAME);11653 } 11654 11655 bool p2 DoneImfileInsert(psDB * dbh, const char *exp_id, const char *class_id, const char *uri, const char *recipe, psS32 p1_version, psS32 p2_version)11660 bool p2ProcessedImfileDropTable(psDB *dbh) 11661 { 11662 return psDBDropTable(dbh, P2PROCESSEDIMFILE_TABLE_NAME); 11663 } 11664 11665 bool p2ProcessedImfileInsert(psDB * dbh, const char *exp_id, const char *class_id, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS32 p1_version, psS32 p2_version) 11656 11666 { 11657 11667 psMetadata *md; … … 11679 11689 return false; 11680 11690 } 11691 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, bg)) { 11692 psError(PS_ERR_UNKNOWN, false, "failed to add item bg"); 11693 psFree(md); 11694 return false; 11695 } 11696 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, bg_stdev)) { 11697 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_stdev"); 11698 psFree(md); 11699 return false; 11700 } 11701 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, bg_mean_stdev)) { 11702 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 11703 psFree(md); 11704 return false; 11705 } 11706 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, b1_uri)) { 11707 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 11708 psFree(md); 11709 return false; 11710 } 11711 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, b2_uri)) { 11712 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 11713 psFree(md); 11714 return false; 11715 } 11681 11716 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p1_version", 0, NULL, p1_version)) { 11682 11717 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); … … 11690 11725 } 11691 11726 11692 status = psDBInsertOneRow(dbh, P2 DONEIMFILE_TABLE_NAME, md);11727 status = psDBInsertOneRow(dbh, P2PROCESSEDIMFILE_TABLE_NAME, md); 11693 11728 psFree(md); 11694 11729 … … 11696 11731 } 11697 11732 11698 long long p2 DoneImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)11733 long long p2ProcessedImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 11699 11734 { 11700 11735 long long deleted = 0; 11701 11736 11702 long long count = psDBDeleteRows(dbh, P2 DONEIMFILE_TABLE_NAME, where, limit);11737 long long count = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit); 11703 11738 if (count < 0) { 11704 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2 DoneImfile");11739 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedImfile"); 11705 11740 return count; 11706 11741 … … 11710 11745 return deleted; 11711 11746 } 11712 bool p2 DoneImfilePop(psDB *dbh, char **exp_id, char **class_id, char **uri, char **recipe, psS32 *p1_version, psS32 *p2_version)11747 bool p2ProcessedImfilePop(psDB *dbh, char **exp_id, char **class_id, char **uri, char **recipe, psF64 *bg, psF64 *bg_stdev, psF64 *bg_mean_stdev, char **b1_uri, char **b2_uri, psS32 *p1_version, psS32 *p2_version) 11713 11748 { 11714 11749 psArray *rowSet; … … 11719 11754 int rowID; 11720 11755 11721 rowSet = psDBSelectRows(dbh, P2 DONEIMFILE_TABLE_NAME, NULL, 1);11756 rowSet = psDBSelectRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, NULL, 1); 11722 11757 if (!rowSet) { 11723 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2 DONEIMFILE_INDEX_NAME);11758 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2PROCESSEDIMFILE_INDEX_NAME); 11724 11759 psFree(rowSet); 11725 11760 return NULL; … … 11734 11769 psFree(rowSet); 11735 11770 11736 rowID = psMetadataLookupS32(&status, row, P2 DONEIMFILE_INDEX_NAME);11737 if (!status) { 11738 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2 DONEIMFILE_INDEX_NAME);11771 rowID = psMetadataLookupS32(&status, row, P2PROCESSEDIMFILE_INDEX_NAME); 11772 if (!status) { 11773 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item %s", P2PROCESSEDIMFILE_INDEX_NAME); 11739 11774 psFree(row); 11740 11775 return NULL; … … 11742 11777 11743 11778 popped = psMetadataAlloc(); 11744 psMetadataAddS32(popped, PS_LIST_TAIL, P2 DONEIMFILE_INDEX_NAME, 0, NULL, rowID);11745 11746 deleted = psDBDeleteRows(dbh, P2 DONEIMFILE_TABLE_NAME, popped, 0);11779 psMetadataAddS32(popped, PS_LIST_TAIL, P2PROCESSEDIMFILE_INDEX_NAME, 0, NULL, rowID); 11780 11781 deleted = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, popped, 0); 11747 11782 if (deleted != 1) { 11748 11783 psError(PS_ERR_UNKNOWN, false, "database failed to delete row"); … … 11778 11813 return false; 11779 11814 } 11815 *bg = psMetadataLookupF64(&status, row, "bg"); 11816 if (!status) { 11817 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg"); 11818 psFree(row); 11819 return false; 11820 } 11821 *bg_stdev = psMetadataLookupF64(&status, row, "bg_stdev"); 11822 if (!status) { 11823 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_stdev"); 11824 psFree(row); 11825 return false; 11826 } 11827 *bg_mean_stdev = psMetadataLookupF64(&status, row, "bg_mean_stdev"); 11828 if (!status) { 11829 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_mean_stdev"); 11830 psFree(row); 11831 return false; 11832 } 11833 *b1_uri = psMetadataLookupPtr(&status, row, "b1_uri"); 11834 if (!status) { 11835 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri"); 11836 psFree(row); 11837 return false; 11838 } 11839 *b2_uri = psMetadataLookupPtr(&status, row, "b2_uri"); 11840 if (!status) { 11841 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri"); 11842 psFree(row); 11843 return false; 11844 } 11780 11845 *p1_version = psMetadataLookupS32(&status, row, "p1_version"); 11781 11846 if (!status) { … … 11796 11861 } 11797 11862 11798 bool p2 DoneImfileInsertObject(psDB *dbh, p2DoneImfileRow *object)11799 { 11800 return p2 DoneImfileInsert(dbh, object->exp_id, object->class_id, object->uri, object->recipe, object->p1_version, object->p2_version);11801 } 11802 11803 bool p2 DoneImfileInsertObjects(psDB *dbh, psArray *objects)11863 bool p2ProcessedImfileInsertObject(psDB *dbh, p2ProcessedImfileRow *object) 11864 { 11865 return p2ProcessedImfileInsert(dbh, object->exp_id, object->class_id, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->p1_version, object->p2_version); 11866 } 11867 11868 bool p2ProcessedImfileInsertObjects(psDB *dbh, psArray *objects) 11804 11869 { 11805 11870 for (long i = 0; i < psArrayLength(objects); i++) { 11806 if (!p2 DoneImfileInsertObject(dbh, objects->data[i])) {11871 if (!p2ProcessedImfileInsertObject(dbh, objects->data[i])) { 11807 11872 return false; 11808 11873 } … … 11812 11877 } 11813 11878 11814 p2 DoneImfileRow *p2DoneImfilePopObject(psDB *dbh)11879 p2ProcessedImfileRow *p2ProcessedImfilePopObject(psDB *dbh) 11815 11880 { 11816 11881 char exp_id[256]; … … 11818 11883 char uri[256]; 11819 11884 char recipe[256]; 11885 psF64 bg; 11886 psF64 bg_stdev; 11887 psF64 bg_mean_stdev; 11888 char b1_uri[256]; 11889 char b2_uri[256]; 11820 11890 psS32 p1_version; 11821 11891 psS32 p2_version; 11822 11892 11823 if (!p2 DoneImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri, (char **)&recipe, &p1_version, &p2_version)) {11893 if (!p2ProcessedImfilePop(dbh, (char **)&exp_id, (char **)&class_id, (char **)&uri, (char **)&recipe, &bg, &bg_stdev, &bg_mean_stdev, (char **)&b1_uri, (char **)&b2_uri, &p1_version, &p2_version)) { 11824 11894 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 11825 11895 return NULL; 11826 11896 } 11827 11897 11828 return p2 DoneImfileRowAlloc(exp_id, class_id, uri, recipe, p1_version, p2_version);11829 } 11830 11831 bool p2 DoneImfileInsertFits(psDB *dbh, const psFits *fits)11898 return p2ProcessedImfileRowAlloc(exp_id, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, p1_version, p2_version); 11899 } 11900 11901 bool p2ProcessedImfileInsertFits(psDB *dbh, const psFits *fits) 11832 11902 { 11833 11903 psArray *rowSet; 11834 11904 11835 // move to (the first?) extension named P2 DONEIMFILE_TABLE_NAME11836 if (!psFitsMoveExtName(fits, P2 DONEIMFILE_TABLE_NAME)) {11837 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2 DONEIMFILE_TABLE_NAME);11905 // move to (the first?) extension named P2PROCESSEDIMFILE_TABLE_NAME 11906 if (!psFitsMoveExtName(fits, P2PROCESSEDIMFILE_TABLE_NAME)) { 11907 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2PROCESSEDIMFILE_TABLE_NAME); 11838 11908 return false; 11839 11909 } … … 11853 11923 } 11854 11924 11855 if (!psDBInsertRows(dbh, P2 DONEIMFILE_TABLE_NAME, rowSet)) {11925 if (!psDBInsertRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, rowSet)) { 11856 11926 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 11857 11927 psFree(rowSet); … … 11864 11934 } 11865 11935 11866 bool p2 DoneImfilePopFits(psDB *dbh, psFits *fits, unsigned long long limit)11936 bool p2ProcessedImfilePopFits(psDB *dbh, psFits *fits, unsigned long long limit) 11867 11937 { 11868 11938 char query[MAX_STRING_LENGTH]; 11869 11939 11870 if (!p2 DoneImfileSelectRowsFits(dbh, fits, NULL, limit)) {11940 if (!p2ProcessedImfileSelectRowsFits(dbh, fits, NULL, limit)) { 11871 11941 psError(PS_ERR_UNKNOWN, true, "database error or table is empty"); 11872 11942 return false; … … 11876 11946 if (snprintf(query, MAX_STRING_LENGTH, 11877 11947 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 11878 P2 DONEIMFILE_TABLE_NAME, P2DONEIMFILE_INDEX_NAME, limit) < 0) {11879 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);11948 P2PROCESSEDIMFILE_TABLE_NAME, P2PROCESSEDIMFILE_INDEX_NAME, limit) < 0) { 11949 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 11880 11950 return false; 11881 11951 } … … 11889 11959 } 11890 11960 11891 bool p2 DoneImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)11961 bool p2ProcessedImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 11892 11962 { 11893 11963 psArray *rowSet; 11894 11964 psU64 i; 11895 11965 11896 rowSet = psDBSelectRows(dbh, P2 DONEIMFILE_TABLE_NAME, where, limit);11966 rowSet = psDBSelectRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit); 11897 11967 if (!rowSet) { 11898 11968 return false; … … 11901 11971 // strip index column 11902 11972 for (i = 0; i < rowSet->n; i++) { 11903 if (!psMetadataRemove((psMetadata *)rowSet->data[i], 0, P2 DONEIMFILE_INDEX_NAME)) {11904 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2 DONEIMFILE_INDEX_NAME);11973 if (!psMetadataRemove((psMetadata *)rowSet->data[i], 0, P2PROCESSEDIMFILE_INDEX_NAME)) { 11974 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2PROCESSEDIMFILE_INDEX_NAME); 11905 11975 psFree(rowSet); 11906 11976 return false; … … 11909 11979 11910 11980 // output to fits 11911 if (!psFitsWriteTable(fits, NULL, rowSet, P2 DONEIMFILE_TABLE_NAME)) {11981 if (!psFitsWriteTable(fits, NULL, rowSet, P2PROCESSEDIMFILE_TABLE_NAME)) { 11912 11982 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 11913 11983 psFree(rowSet); … … 11920 11990 } 11921 11991 11922 psMetadata *p2 DoneImfileMetadataFromObject(const p2DoneImfileRow *object)11992 psMetadata *p2ProcessedImfileMetadataFromObject(const p2ProcessedImfileRow *object) 11923 11993 { 11924 11994 psMetadata *md; … … 11945 12015 return NULL; 11946 12016 } 12017 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, object->bg)) { 12018 psError(PS_ERR_UNKNOWN, false, "failed to add item bg"); 12019 psFree(md); 12020 return NULL; 12021 } 12022 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_stdev", 0, NULL, object->bg_stdev)) { 12023 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_stdev"); 12024 psFree(md); 12025 return NULL; 12026 } 12027 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, object->bg_mean_stdev)) { 12028 psError(PS_ERR_UNKNOWN, false, "failed to add item bg_mean_stdev"); 12029 psFree(md); 12030 return NULL; 12031 } 12032 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b1_uri", 0, NULL, object->b1_uri)) { 12033 psError(PS_ERR_UNKNOWN, false, "failed to add item b1_uri"); 12034 psFree(md); 12035 return NULL; 12036 } 12037 if (!psMetadataAddStr(md, PS_LIST_TAIL, "b2_uri", 0, NULL, object->b2_uri)) { 12038 psError(PS_ERR_UNKNOWN, false, "failed to add item b2_uri"); 12039 psFree(md); 12040 return NULL; 12041 } 11947 12042 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p1_version", 0, NULL, object->p1_version)) { 11948 12043 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version"); … … 11959 12054 } 11960 12055 11961 p2 DoneImfileRow *p2DoneImfileObjectFromMetadata(psMetadata *md)12056 p2ProcessedImfileRow *p2ProcessedImfileObjectFromMetadata(psMetadata *md) 11962 12057 { 11963 12058 bool status; … … 11966 12061 char *uri; 11967 12062 char *recipe; 12063 psF64 bg; 12064 psF64 bg_stdev; 12065 psF64 bg_mean_stdev; 12066 char *b1_uri; 12067 char *b2_uri; 11968 12068 psS32 p1_version; 11969 12069 psS32 p2_version; … … 11989 12089 return false; 11990 12090 } 12091 bg = psMetadataLookupF64(&status, md, "bg"); 12092 if (!status) { 12093 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg"); 12094 return false; 12095 } 12096 bg_stdev = psMetadataLookupF64(&status, md, "bg_stdev"); 12097 if (!status) { 12098 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_stdev"); 12099 return false; 12100 } 12101 bg_mean_stdev = psMetadataLookupF64(&status, md, "bg_mean_stdev"); 12102 if (!status) { 12103 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item bg_mean_stdev"); 12104 return false; 12105 } 12106 b1_uri = psMetadataLookupPtr(&status, md, "b1_uri"); 12107 if (!status) { 12108 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b1_uri"); 12109 return false; 12110 } 12111 b2_uri = psMetadataLookupPtr(&status, md, "b2_uri"); 12112 if (!status) { 12113 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item b2_uri"); 12114 return false; 12115 } 11991 12116 p1_version = psMetadataLookupS32(&status, md, "p1_version"); 11992 12117 if (!status) { … … 12000 12125 } 12001 12126 12002 return p2 DoneImfileRowAlloc(exp_id, class_id, uri, recipe, p1_version, p2_version);12003 } 12004 psArray *p2 DoneImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)12127 return p2ProcessedImfileRowAlloc(exp_id, class_id, uri, recipe, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, p1_version, p2_version); 12128 } 12129 psArray *p2ProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 12005 12130 { 12006 12131 psArray *rowSet; … … 12008 12133 psU64 i; 12009 12134 12010 rowSet = psDBSelectRows(dbh, P2 DONEIMFILE_TABLE_NAME, where, limit);12135 rowSet = psDBSelectRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit); 12011 12136 if (!rowSet) { 12012 12137 return NULL; … … 12015 12140 // strip index column 12016 12141 for (i = 0; i < rowSet->n; i++) { 12017 if (!psMetadataRemove((psMetadata *)(rowSet->data[i]), 0, P2 DONEIMFILE_INDEX_NAME)) {12018 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2 DONEIMFILE_INDEX_NAME);12142 if (!psMetadataRemove((psMetadata *)(rowSet->data[i]), 0, P2PROCESSEDIMFILE_INDEX_NAME)) { 12143 psError(PS_ERR_UNKNOWN, true, "failed to remove item %s", P2PROCESSEDIMFILE_INDEX_NAME); 12019 12144 psFree(rowSet); 12020 12145 return false; … … 12028 12153 12029 12154 for (i = 0; i < rowSet->n; i++) { 12030 p2 DoneImfileRow *object = p2DoneImfileObjectFromMetadata(rowSet->data[i]);12155 p2ProcessedImfileRow *object = p2ProcessedImfileObjectFromMetadata(rowSet->data[i]); 12031 12156 psArrayAdd(returnSet, 0, object); 12032 12157 psFree(object); … … 12037 12162 return returnSet; 12038 12163 } 12039 bool p2 DoneImfileDeleteObject(psDB *dbh, const p2DoneImfileRow *object)12040 { 12041 psMetadata *where = p2 DoneImfileMetadataFromObject(object);12042 long long count = psDBDeleteRows(dbh, P2 DONEIMFILE_TABLE_NAME, where, 0);12164 bool p2ProcessedImfileDeleteObject(psDB *dbh, const p2ProcessedImfileRow *object) 12165 { 12166 psMetadata *where = p2ProcessedImfileMetadataFromObject(object); 12167 long long count = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, 0); 12043 12168 psFree(where) 12044 12169 if (count < 0) { 12045 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2 DoneImfile");12170 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedImfile"); 12046 12171 return false; 12047 12172 } … … 12049 12174 // XXX should this be a psAbort() instead? It is possible that 12050 12175 // having an object match multiple rows was by design. 12051 psError(PS_ERR_UNKNOWN, true, "p2 DoneImfileRow object matched more then one row. Check your database schema");12052 return false; 12053 } 12054 12055 return true; 12056 } 12057 long long p2 DoneImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)12176 psError(PS_ERR_UNKNOWN, true, "p2ProcessedImfileRow object matched more then one row. Check your database schema"); 12177 return false; 12178 } 12179 12180 return true; 12181 } 12182 long long p2ProcessedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 12058 12183 { 12059 12184 long long deleted = 0; 12060 12185 12061 12186 for (long long i = 0; i < objects->n; i++) { 12062 p2 DoneImfileRow *object = objects->data[i];12063 psMetadata *where = p2 DoneImfileMetadataFromObject(object);12064 long long count = psDBDeleteRows(dbh, P2 DONEIMFILE_TABLE_NAME, where, limit);12187 p2ProcessedImfileRow *object = objects->data[i]; 12188 psMetadata *where = p2ProcessedImfileMetadataFromObject(object); 12189 long long count = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit); 12065 12190 psFree(where) 12066 12191 if (count < 0) { 12067 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2 DoneImfile");12192 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedImfile"); 12068 12193 return count; 12069 12194 } … … 12074 12199 return deleted; 12075 12200 } 12076 bool p2 DoneImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)12201 bool p2ProcessedImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 12077 12202 { 12078 12203 PS_ASSERT_PTR_NON_NULL(objects, false); … … 12080 12205 psMetadata *output = psMetadataAlloc(); 12081 12206 for (long i = 0; i < psArrayLength(objects); i++) { 12082 psMetadata *md = p2 DoneImfileMetadataFromObject(objects->data[i]);12207 psMetadata *md = p2ProcessedImfileMetadataFromObject(objects->data[i]); 12083 12208 if (!psMetadataAddMetadata( 12084 12209 output, 12085 12210 PS_LIST_TAIL, 12086 P2 DONEIMFILE_TABLE_NAME,12211 P2PROCESSEDIMFILE_TABLE_NAME, 12087 12212 PS_META_DUPLICATE_OK, 12088 12213 NULL, … … 12107 12232 static void p3PendingExpRowFree(p3PendingExpRow *object); 12108 12233 12109 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_id, const char *recipe,psS32 p2_version, psS32 p3_version)12234 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_id, psS32 p2_version, psS32 p3_version) 12110 12235 { 12111 12236 p3PendingExpRow *object; … … 12115 12240 12116 12241 object->exp_id = psStringCopy(exp_id); 12117 object->recipe = psStringCopy(recipe);12118 12242 object->p2_version = p2_version; 12119 12243 object->p3_version = p3_version; … … 12125 12249 { 12126 12250 psFree(object->exp_id); 12127 psFree(object->recipe);12128 12251 } 12129 12252 … … 12144 12267 return false; 12145 12268 } 12146 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, "64")) {12147 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");12148 psFree(md);12149 return false;12150 }12151 12269 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p2_version", 0, NULL, 0)) { 12152 12270 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version"); … … 12172 12290 } 12173 12291 12174 bool p3PendingExpInsert(psDB * dbh, const char *exp_id, const char *recipe,psS32 p2_version, psS32 p3_version)12292 bool p3PendingExpInsert(psDB * dbh, const char *exp_id, psS32 p2_version, psS32 p3_version) 12175 12293 { 12176 12294 psMetadata *md; … … 12180 12298 if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_id", 0, NULL, exp_id)) { 12181 12299 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 12182 psFree(md);12183 return false;12184 }12185 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, recipe)) {12186 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");12187 12300 psFree(md); 12188 12301 return false; … … 12219 12332 return deleted; 12220 12333 } 12221 bool p3PendingExpPop(psDB *dbh, char **exp_id, char **recipe,psS32 *p2_version, psS32 *p3_version)12334 bool p3PendingExpPop(psDB *dbh, char **exp_id, psS32 *p2_version, psS32 *p3_version) 12222 12335 { 12223 12336 psArray *rowSet; … … 12269 12382 return false; 12270 12383 } 12271 *recipe = psMetadataLookupPtr(&status, row, "recipe");12272 if (!status) {12273 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");12274 psFree(row);12275 return false;12276 }12277 12384 *p2_version = psMetadataLookupS32(&status, row, "p2_version"); 12278 12385 if (!status) { … … 12295 12402 bool p3PendingExpInsertObject(psDB *dbh, p3PendingExpRow *object) 12296 12403 { 12297 return p3PendingExpInsert(dbh, object->exp_id, object-> recipe, object->p2_version, object->p3_version);12404 return p3PendingExpInsert(dbh, object->exp_id, object->p2_version, object->p3_version); 12298 12405 } 12299 12406 … … 12312 12419 { 12313 12420 char exp_id[256]; 12314 char recipe[256];12315 12421 psS32 p2_version; 12316 12422 psS32 p3_version; 12317 12423 12318 if (!p3PendingExpPop(dbh, (char **)&exp_id, (char **)&recipe,&p2_version, &p3_version)) {12424 if (!p3PendingExpPop(dbh, (char **)&exp_id, &p2_version, &p3_version)) { 12319 12425 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 12320 12426 return NULL; 12321 12427 } 12322 12428 12323 return p3PendingExpRowAlloc(exp_id, recipe,p2_version, p3_version);12429 return p3PendingExpRowAlloc(exp_id, p2_version, p3_version); 12324 12430 } 12325 12431 … … 12372 12478 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 12373 12479 P3PENDINGEXP_TABLE_NAME, P3PENDINGEXP_INDEX_NAME, limit) < 0) { 12374 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);12480 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 12375 12481 return false; 12376 12482 } … … 12425 12531 return NULL; 12426 12532 } 12427 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, object->recipe)) {12428 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe");12429 psFree(md);12430 return NULL;12431 }12432 12533 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p2_version", 0, NULL, object->p2_version)) { 12433 12534 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version"); … … 12448 12549 bool status; 12449 12550 char *exp_id; 12450 char *recipe;12451 12551 psS32 p2_version; 12452 12552 psS32 p3_version; … … 12457 12557 return false; 12458 12558 } 12459 recipe = psMetadataLookupPtr(&status, md, "recipe");12460 if (!status) {12461 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item recipe");12462 return false;12463 }12464 12559 p2_version = psMetadataLookupS32(&status, md, "p2_version"); 12465 12560 if (!status) { … … 12473 12568 } 12474 12569 12475 return p3PendingExpRowAlloc(exp_id, recipe,p2_version, p3_version);12570 return p3PendingExpRowAlloc(exp_id, p2_version, p3_version); 12476 12571 } 12477 12572 psArray *p3PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 12808 12903 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 12809 12904 DETRUN_TABLE_NAME, DETRUN_INDEX_NAME, limit) < 0) { 12810 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);12905 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 12811 12906 return false; 12812 12907 } … … 13258 13353 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 13259 13354 DETINPUTEXP_TABLE_NAME, DETINPUTEXP_INDEX_NAME, limit) < 0) { 13260 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);13355 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 13261 13356 return false; 13262 13357 } … … 13805 13900 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 13806 13901 DETPROCESSEDIMFILE_TABLE_NAME, DETPROCESSEDIMFILE_INDEX_NAME, limit) < 0) { 13807 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);13902 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 13808 13903 return false; 13809 13904 } … … 14413 14508 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 14414 14509 DETSTACKEDIMFILE_TABLE_NAME, DETSTACKEDIMFILE_INDEX_NAME, limit) < 0) { 14415 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);14510 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 14416 14511 return false; 14417 14512 } … … 14940 15035 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 14941 15036 DETNORMALIZEDSTATIMFILE_TABLE_NAME, DETNORMALIZEDSTATIMFILE_INDEX_NAME, limit) < 0) { 14942 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);15037 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 14943 15038 return false; 14944 15039 } … … 15413 15508 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 15414 15509 DETNORMALIZEDIMFILE_TABLE_NAME, DETNORMALIZEDIMFILE_INDEX_NAME, limit) < 0) { 15415 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);15510 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 15416 15511 return false; 15417 15512 } … … 15867 15962 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 15868 15963 DETMASTERFRAME_TABLE_NAME, DETMASTERFRAME_INDEX_NAME, limit) < 0) { 15869 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);15964 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 15870 15965 return false; 15871 15966 } … … 16330 16425 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 16331 16426 DETMASTERIMFILE_TABLE_NAME, DETMASTERIMFILE_INDEX_NAME, limit) < 0) { 16332 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);16427 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 16333 16428 return false; 16334 16429 } … … 16933 17028 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 16934 17029 DETRESIDIMFILE_TABLE_NAME, DETRESIDIMFILE_INDEX_NAME, limit) < 0) { 16935 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);17030 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 16936 17031 return false; 16937 17032 } … … 17593 17688 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 17594 17689 DETRESIDEXP_TABLE_NAME, DETRESIDEXP_INDEX_NAME, limit) < 0) { 17595 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);17690 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 17596 17691 return false; 17597 17692 } … … 18166 18261 "DELETE FROM %s ORDER BY %s DESC LIMIT %lld", 18167 18262 DETRUNSUMMARY_TABLE_NAME, DETRUNSUMMARY_INDEX_NAME, limit) < 0) { 18168 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed % sbytes", MAX_STRING_LENGTH);18263 psError(PS_ERR_UNKNOWN, true, "query value attempted to exceed %d bytes", MAX_STRING_LENGTH); 18169 18264 return false; 18170 18265 }
Note:
See TracChangeset
for help on using the changeset viewer.
