Changeset 12026
- Timestamp:
- Feb 23, 2007, 4:28:07 PM (19 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 15 edited
-
Makefile.am (modified) (2 diffs)
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (446 diffs)
-
src/ippdb.h (modified) (269 diffs)
-
tests/alloc.c (modified) (19 diffs)
-
tests/createtable.c (modified) (2 diffs)
-
tests/dbcleanup.c (modified) (2 diffs)
-
tests/dbsetup.c (modified) (2 diffs)
-
tests/droptable.c (modified) (2 diffs)
-
tests/insert.c (modified) (2 diffs)
-
tests/insertfits.c (modified) (2 diffs)
-
tests/insertobject.c (modified) (2 diffs)
-
tests/metadatafromobject.c (modified) (27 diffs)
-
tests/objectfrommetadata.c (modified) (54 diffs)
-
tests/selectrowsfits.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/Makefile.am
r11988 r12026 21 21 $(top_builddir)/docs/man/man3/rawExpRow.3 \ 22 22 $(top_builddir)/docs/man/man3/rawImfileRow.3 \ 23 $(top_builddir)/docs/man/man3/ p1PendingExpRow.3 \24 $(top_builddir)/docs/man/man3/ p2PendingExpRow.3 \25 $(top_builddir)/docs/man/man3/ p2PendingImfileRow.3 \26 $(top_builddir)/docs/man/man3/ p2ProcessedExpRow.3 \27 $(top_builddir)/docs/man/man3/ p2MaskRow.3 \28 $(top_builddir)/docs/man/man3/ p2ProcessedImfileRow.3 \29 $(top_builddir)/docs/man/man3/ p3PendingExpRow.3 \30 $(top_builddir)/docs/man/man3/ p3ProcessedExpRow.3 \31 $(top_builddir)/docs/man/man3/ p3MaskRow.3 \23 $(top_builddir)/docs/man/man3/guidePendingExpRow.3 \ 24 $(top_builddir)/docs/man/man3/chipPendingExpRow.3 \ 25 $(top_builddir)/docs/man/man3/chipPendingImfileRow.3 \ 26 $(top_builddir)/docs/man/man3/chipProcessedExpRow.3 \ 27 $(top_builddir)/docs/man/man3/chipMaskRow.3 \ 28 $(top_builddir)/docs/man/man3/chipProcessedImfileRow.3 \ 29 $(top_builddir)/docs/man/man3/camPendingExpRow.3 \ 30 $(top_builddir)/docs/man/man3/camProcessedExpRow.3 \ 31 $(top_builddir)/docs/man/man3/camMaskRow.3 \ 32 32 $(top_builddir)/docs/man/man3/detRunRow.3 \ 33 33 $(top_builddir)/docs/man/man3/detInputExpRow.3 \ … … 41 41 $(top_builddir)/docs/man/man3/detResidExpRow.3 \ 42 42 $(top_builddir)/docs/man/man3/detRunSummaryRow.3 \ 43 $(top_builddir)/docs/man/man3/ p4RunRow.3 \44 $(top_builddir)/docs/man/man3/ p4InputExpRow.3 \45 $(top_builddir)/docs/man/man3/ p4SkyCellMapRow.3 \46 $(top_builddir)/docs/man/man3/ p4SkyfileRow.3 \47 $(top_builddir)/docs/man/man3/ p5RunRow.3 \48 $(top_builddir)/docs/man/man3/ p5InputSkyfileRow.3 \49 $(top_builddir)/docs/man/man3/ p5DiffSkyfileRow.3 \50 $(top_builddir)/docs/man/man3/ p6RunRow.3 \51 $(top_builddir)/docs/man/man3/ p6InputSkyfileRow.3 \52 $(top_builddir)/docs/man/man3/ p6SumSkyfileRow.343 $(top_builddir)/docs/man/man3/warpRunRow.3 \ 44 $(top_builddir)/docs/man/man3/warpInputExpRow.3 \ 45 $(top_builddir)/docs/man/man3/warpSkyCellMapRow.3 \ 46 $(top_builddir)/docs/man/man3/warpSkyfileRow.3 \ 47 $(top_builddir)/docs/man/man3/diffRunRow.3 \ 48 $(top_builddir)/docs/man/man3/diffInputSkyfileRow.3 \ 49 $(top_builddir)/docs/man/man3/diffSkyfileRow.3 \ 50 $(top_builddir)/docs/man/man3/stackRunRow.3 \ 51 $(top_builddir)/docs/man/man3/stackInputSkyfileRow.3 \ 52 $(top_builddir)/docs/man/man3/stackSumSkyfileRow.3 53 53 54 54 55 docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/ p1PendingExpRow.3 docs/man/man3/p2PendingExpRow.3 docs/man/man3/p2PendingImfileRow.3 docs/man/man3/p2ProcessedExpRow.3 docs/man/man3/p2MaskRow.3 docs/man/man3/p2ProcessedImfileRow.3 docs/man/man3/p3PendingExpRow.3 docs/man/man3/p3ProcessedExpRow.3 docs/man/man3/p3MaskRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/p4RunRow.3 docs/man/man3/p4InputExpRow.3 docs/man/man3/p4SkyCellMapRow.3 docs/man/man3/p4SkyfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputSkyfileRow.3 docs/man/man3/p5DiffSkyfileRow.3 docs/man/man3/p6RunRow.3 docs/man/man3/p6InputSkyfileRow.3 docs/man/man3/p6SumSkyfileRow.3:55 docs/man/man3/ippdb.3 docs/man/man3/expTagCounterRow.3 docs/man/man3/summitExpRow.3 docs/man/man3/summitImfileRow.3 docs/man/man3/pzPendingExpRow.3 docs/man/man3/pzPendingImfileRow.3 docs/man/man3/pzDoneExpRow.3 docs/man/man3/pzDoneImfileRow.3 docs/man/man3/newExpRow.3 docs/man/man3/newImfileRow.3 docs/man/man3/rawExpRow.3 docs/man/man3/rawImfileRow.3 docs/man/man3/guidePendingExpRow.3 docs/man/man3/chipPendingExpRow.3 docs/man/man3/chipPendingImfileRow.3 docs/man/man3/chipProcessedExpRow.3 docs/man/man3/chipMaskRow.3 docs/man/man3/chipProcessedImfileRow.3 docs/man/man3/camPendingExpRow.3 docs/man/man3/camProcessedExpRow.3 docs/man/man3/camMaskRow.3 docs/man/man3/detRunRow.3 docs/man/man3/detInputExpRow.3 docs/man/man3/detProcessedImfileRow.3 docs/man/man3/detProcessedExpRow.3 docs/man/man3/detStackedImfileRow.3 docs/man/man3/detNormalizedStatImfileRow.3 docs/man/man3/detNormalizedImfileRow.3 docs/man/man3/detNormalizedExpRow.3 docs/man/man3/detResidImfileRow.3 docs/man/man3/detResidExpRow.3 docs/man/man3/detRunSummaryRow.3 docs/man/man3/warpRunRow.3 docs/man/man3/warpInputExpRow.3 docs/man/man3/warpSkyCellMapRow.3 docs/man/man3/warpSkyfileRow.3 docs/man/man3/diffRunRow.3 docs/man/man3/diffInputSkyfileRow.3 docs/man/man3/diffSkyfileRow.3 docs/man/man3/stackRunRow.3 docs/man/man3/stackInputSkyfileRow.3 docs/man/man3/stackSumSkyfileRow.3: 56 56 $(DOXYGEN) 57 57 -
trunk/ippdb/configure.ac
r11988 r12026 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [1.1.1 0], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [1.1.11], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r11988 r12026 42 42 #define RAWEXP_TABLE_NAME "rawExp" 43 43 #define RAWIMFILE_TABLE_NAME "rawImfile" 44 #define P1PENDINGEXP_TABLE_NAME "p1PendingExp"45 #define P2PENDINGEXP_TABLE_NAME "p2PendingExp"46 #define P2PENDINGIMFILE_TABLE_NAME "p2PendingImfile"47 #define P2PROCESSEDEXP_TABLE_NAME "p2ProcessedExp"48 #define P2MASK_TABLE_NAME "p2Mask"49 #define P2PROCESSEDIMFILE_TABLE_NAME "p2ProcessedImfile"50 #define P3PENDINGEXP_TABLE_NAME "p3PendingExp"51 #define P3PROCESSEDEXP_TABLE_NAME "p3ProcessedExp"52 #define P3MASK_TABLE_NAME "p3Mask"44 #define GUIDEPENDINGEXP_TABLE_NAME "guidePendingExp" 45 #define CHIPPENDINGEXP_TABLE_NAME "chipPendingExp" 46 #define CHIPPENDINGIMFILE_TABLE_NAME "chipPendingImfile" 47 #define CHIPPROCESSEDEXP_TABLE_NAME "chipProcessedExp" 48 #define CHIPMASK_TABLE_NAME "chipMask" 49 #define CHIPPROCESSEDIMFILE_TABLE_NAME "chipProcessedImfile" 50 #define CAMPENDINGEXP_TABLE_NAME "camPendingExp" 51 #define CAMPROCESSEDEXP_TABLE_NAME "camProcessedExp" 52 #define CAMMASK_TABLE_NAME "camMask" 53 53 #define DETRUN_TABLE_NAME "detRun" 54 54 #define DETINPUTEXP_TABLE_NAME "detInputExp" … … 62 62 #define DETRESIDEXP_TABLE_NAME "detResidExp" 63 63 #define DETRUNSUMMARY_TABLE_NAME "detRunSummary" 64 #define P4RUN_TABLE_NAME "p4Run"65 #define P4INPUTEXP_TABLE_NAME "p4InputExp"66 #define P4SKYCELLMAP_TABLE_NAME "p4SkyCellMap"67 #define P4SKYFILE_TABLE_NAME "p4Skyfile"68 #define P5RUN_TABLE_NAME "p5Run"69 #define P5INPUTSKYFILE_TABLE_NAME "p5InputSkyfile"70 #define P5DIFFSKYFILE_TABLE_NAME "p5DiffSkyfile"71 #define P6RUN_TABLE_NAME "p6Run"72 #define P6INPUTSKYFILE_TABLE_NAME "p6InputSkyfile"73 #define P6SUMSKYFILE_TABLE_NAME "p6SumSkyfile"64 #define WARPRUN_TABLE_NAME "warpRun" 65 #define WARPINPUTEXP_TABLE_NAME "warpInputExp" 66 #define WARPSKYCELLMAP_TABLE_NAME "warpSkyCellMap" 67 #define WARPSKYFILE_TABLE_NAME "warpSkyfile" 68 #define DIFFRUN_TABLE_NAME "diffRun" 69 #define DIFFINPUTSKYFILE_TABLE_NAME "diffInputSkyfile" 70 #define DIFFSKYFILE_TABLE_NAME "diffSkyfile" 71 #define STACKRUN_TABLE_NAME "stackRun" 72 #define STACKINPUTSKYFILE_TABLE_NAME "stackInputSkyfile" 73 #define STACKSUMSKYFILE_TABLE_NAME "stackSumSkyfile" 74 74 #define MAX_STRING_LENGTH 1024 75 75 … … 4948 4948 return true; 4949 4949 } 4950 static void p1PendingExpRowFree(p1PendingExpRow *object);4951 4952 p1PendingExpRow *p1PendingExpRowAlloc(const char *exp_tag, psS32 p1_version, const char *recipe)4953 { 4954 p1PendingExpRow *_object;4955 4956 _object = psAlloc(sizeof( p1PendingExpRow));4957 psMemSetDeallocator(_object, (psFreeFunc) p1PendingExpRowFree);4950 static void guidePendingExpRowFree(guidePendingExpRow *object); 4951 4952 guidePendingExpRow *guidePendingExpRowAlloc(const char *exp_tag, psS32 guide_version, const char *recipe) 4953 { 4954 guidePendingExpRow *_object; 4955 4956 _object = psAlloc(sizeof(guidePendingExpRow)); 4957 psMemSetDeallocator(_object, (psFreeFunc)guidePendingExpRowFree); 4958 4958 4959 4959 _object->exp_tag = psStringCopy(exp_tag); 4960 _object-> p1_version = p1_version;4960 _object->guide_version = guide_version; 4961 4961 _object->recipe = psStringCopy(recipe); 4962 4962 … … 4964 4964 } 4965 4965 4966 static void p1PendingExpRowFree(p1PendingExpRow *object)4966 static void guidePendingExpRowFree(guidePendingExpRow *object) 4967 4967 { 4968 4968 psFree(object->exp_tag); … … 4970 4970 } 4971 4971 4972 bool p1PendingExpCreateTable(psDB *dbh)4972 bool guidePendingExpCreateTable(psDB *dbh) 4973 4973 { 4974 4974 psMetadata *md = psMetadataAlloc(); … … 4978 4978 return false; 4979 4979 } 4980 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, "Primary Key", 0)) {4981 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");4980 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, "Primary Key", 0)) { 4981 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 4982 4982 psFree(md); 4983 4983 return false; … … 4989 4989 } 4990 4990 4991 bool status = psDBCreateTable(dbh, P1PENDINGEXP_TABLE_NAME, md);4991 bool status = psDBCreateTable(dbh, GUIDEPENDINGEXP_TABLE_NAME, md); 4992 4992 4993 4993 psFree(md); … … 4996 4996 } 4997 4997 4998 bool p1PendingExpDropTable(psDB *dbh)4999 { 5000 return psDBDropTable(dbh, P1PENDINGEXP_TABLE_NAME);5001 } 5002 5003 bool p1PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p1_version, const char *recipe)4998 bool guidePendingExpDropTable(psDB *dbh) 4999 { 5000 return psDBDropTable(dbh, GUIDEPENDINGEXP_TABLE_NAME); 5001 } 5002 5003 bool guidePendingExpInsert(psDB * dbh, const char *exp_tag, psS32 guide_version, const char *recipe) 5004 5004 { 5005 5005 psMetadata *md = psMetadataAlloc(); … … 5009 5009 return false; 5010 5010 } 5011 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, p1_version)) {5012 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5011 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, guide_version)) { 5012 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5013 5013 psFree(md); 5014 5014 return false; … … 5020 5020 } 5021 5021 5022 bool status = psDBInsertOneRow(dbh, P1PENDINGEXP_TABLE_NAME, md);5022 bool status = psDBInsertOneRow(dbh, GUIDEPENDINGEXP_TABLE_NAME, md); 5023 5023 psFree(md); 5024 5024 … … 5026 5026 } 5027 5027 5028 long long p1PendingExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)5028 long long guidePendingExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 5029 5029 { 5030 5030 long long deleted = 0; 5031 5031 5032 long long count = psDBDeleteRows(dbh, P1PENDINGEXP_TABLE_NAME, where, limit);5032 long long count = psDBDeleteRows(dbh, GUIDEPENDINGEXP_TABLE_NAME, where, limit); 5033 5033 if (count < 0) { 5034 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p1PendingExp");5034 psError(PS_ERR_UNKNOWN, true, "failed to delete row from guidePendingExp"); 5035 5035 return count; 5036 5036 … … 5040 5040 return deleted; 5041 5041 } 5042 bool p1PendingExpInsertObject(psDB *dbh, p1PendingExpRow *object)5043 { 5044 return p1PendingExpInsert(dbh, object->exp_tag, object->p1_version, object->recipe);5045 } 5046 5047 bool p1PendingExpInsertObjects(psDB *dbh, psArray *objects)5042 bool guidePendingExpInsertObject(psDB *dbh, guidePendingExpRow *object) 5043 { 5044 return guidePendingExpInsert(dbh, object->exp_tag, object->guide_version, object->recipe); 5045 } 5046 5047 bool guidePendingExpInsertObjects(psDB *dbh, psArray *objects) 5048 5048 { 5049 5049 for (long i = 0; i < psArrayLength(objects); i++) { 5050 if (! p1PendingExpInsertObject(dbh, objects->data[i])) {5050 if (!guidePendingExpInsertObject(dbh, objects->data[i])) { 5051 5051 return false; 5052 5052 } … … 5056 5056 } 5057 5057 5058 bool p1PendingExpInsertFits(psDB *dbh, const psFits *fits)5058 bool guidePendingExpInsertFits(psDB *dbh, const psFits *fits) 5059 5059 { 5060 5060 psArray *rowSet; 5061 5061 5062 // move to (the first?) extension named P1PENDINGEXP_TABLE_NAME5063 if (!psFitsMoveExtName(fits, P1PENDINGEXP_TABLE_NAME)) {5064 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P1PENDINGEXP_TABLE_NAME);5062 // move to (the first?) extension named GUIDEPENDINGEXP_TABLE_NAME 5063 if (!psFitsMoveExtName(fits, GUIDEPENDINGEXP_TABLE_NAME)) { 5064 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", GUIDEPENDINGEXP_TABLE_NAME); 5065 5065 return false; 5066 5066 } … … 5080 5080 } 5081 5081 5082 if (!psDBInsertRows(dbh, P1PENDINGEXP_TABLE_NAME, rowSet)) {5082 if (!psDBInsertRows(dbh, GUIDEPENDINGEXP_TABLE_NAME, rowSet)) { 5083 5083 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 5084 5084 psFree(rowSet); … … 5091 5091 } 5092 5092 5093 bool p1PendingExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)5093 bool guidePendingExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 5094 5094 { 5095 5095 psArray *rowSet; 5096 5096 5097 rowSet = psDBSelectRows(dbh, P1PENDINGEXP_TABLE_NAME, where, limit);5097 rowSet = psDBSelectRows(dbh, GUIDEPENDINGEXP_TABLE_NAME, where, limit); 5098 5098 if (!rowSet) { 5099 5099 return false; … … 5101 5101 5102 5102 // output to fits 5103 if (!psFitsWriteTable(fits, NULL, rowSet, P1PENDINGEXP_TABLE_NAME)) {5103 if (!psFitsWriteTable(fits, NULL, rowSet, GUIDEPENDINGEXP_TABLE_NAME)) { 5104 5104 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 5105 5105 psFree(rowSet); … … 5112 5112 } 5113 5113 5114 psMetadata * p1PendingExpMetadataFromObject(const p1PendingExpRow *object)5114 psMetadata *guidePendingExpMetadataFromObject(const guidePendingExpRow *object) 5115 5115 { 5116 5116 psMetadata *md = psMetadataAlloc(); … … 5120 5120 return false; 5121 5121 } 5122 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, object->p1_version)) {5123 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5122 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, object->guide_version)) { 5123 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5124 5124 psFree(md); 5125 5125 return false; … … 5135 5135 } 5136 5136 5137 p1PendingExpRow *p1PendingExpObjectFromMetadata(psMetadata *md)5137 guidePendingExpRow *guidePendingExpObjectFromMetadata(psMetadata *md) 5138 5138 { 5139 5139 … … 5144 5144 return false; 5145 5145 } 5146 psS32 p1_version = psMetadataLookupS32(&status, md, "p1_version");5147 if (!status) { 5148 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p1_version");5146 psS32 guide_version = psMetadataLookupS32(&status, md, "guide_version"); 5147 if (!status) { 5148 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item guide_version"); 5149 5149 return false; 5150 5150 } … … 5155 5155 } 5156 5156 5157 return p1PendingExpRowAlloc(exp_tag, p1_version, recipe);5158 } 5159 psArray * p1PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)5157 return guidePendingExpRowAlloc(exp_tag, guide_version, recipe); 5158 } 5159 psArray *guidePendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 5160 5160 { 5161 5161 psArray *rowSet; … … 5163 5163 psU64 i; 5164 5164 5165 rowSet = psDBSelectRows(dbh, P1PENDINGEXP_TABLE_NAME, where, limit);5165 rowSet = psDBSelectRows(dbh, GUIDEPENDINGEXP_TABLE_NAME, where, limit); 5166 5166 if (!rowSet) { 5167 5167 return NULL; … … 5173 5173 5174 5174 for (i = 0; i < rowSet->n; i++) { 5175 p1PendingExpRow *object = p1PendingExpObjectFromMetadata(rowSet->data[i]);5175 guidePendingExpRow *object = guidePendingExpObjectFromMetadata(rowSet->data[i]); 5176 5176 psArrayAdd(returnSet, 0, object); 5177 5177 psFree(object); … … 5182 5182 return returnSet; 5183 5183 } 5184 bool p1PendingExpDeleteObject(psDB *dbh, const p1PendingExpRow *object)5185 { 5186 psMetadata *where = p1PendingExpMetadataFromObject(object);5187 long long count = psDBDeleteRows(dbh, P1PENDINGEXP_TABLE_NAME, where, 0);5184 bool guidePendingExpDeleteObject(psDB *dbh, const guidePendingExpRow *object) 5185 { 5186 psMetadata *where = guidePendingExpMetadataFromObject(object); 5187 long long count = psDBDeleteRows(dbh, GUIDEPENDINGEXP_TABLE_NAME, where, 0); 5188 5188 psFree(where); 5189 5189 if (count < 0) { 5190 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p1PendingExp");5190 psError(PS_ERR_UNKNOWN, true, "failed to delete row from guidePendingExp"); 5191 5191 return false; 5192 5192 } … … 5194 5194 // XXX should this be a psAbort() instead? It is possible that 5195 5195 // having an object match multiple rows was by design. 5196 psError(PS_ERR_UNKNOWN, true, " p1PendingExpRow object matched more then one row. Check your database schema");5197 return false; 5198 } 5199 5200 return true; 5201 } 5202 long long p1PendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)5196 psError(PS_ERR_UNKNOWN, true, "guidePendingExpRow object matched more then one row. Check your database schema"); 5197 return false; 5198 } 5199 5200 return true; 5201 } 5202 long long guidePendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 5203 5203 { 5204 5204 long long deleted = 0; 5205 5205 5206 5206 for (long long i = 0; i < objects->n; i++) { 5207 p1PendingExpRow *object = objects->data[i];5208 psMetadata *where = p1PendingExpMetadataFromObject(object);5209 long long count = psDBDeleteRows(dbh, P1PENDINGEXP_TABLE_NAME, where, limit);5207 guidePendingExpRow *object = objects->data[i]; 5208 psMetadata *where = guidePendingExpMetadataFromObject(object); 5209 long long count = psDBDeleteRows(dbh, GUIDEPENDINGEXP_TABLE_NAME, where, limit); 5210 5210 psFree(where); 5211 5211 if (count < 0) { 5212 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p1PendingExp");5212 psError(PS_ERR_UNKNOWN, true, "failed to delete row from guidePendingExp"); 5213 5213 return count; 5214 5214 } … … 5219 5219 return deleted; 5220 5220 } 5221 bool p1PendingExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)5221 bool guidePendingExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 5222 5222 { 5223 5223 PS_ASSERT_PTR_NON_NULL(objects, false); … … 5225 5225 psMetadata *output = psMetadataAlloc(); 5226 5226 for (long i = 0; i < psArrayLength(objects); i++) { 5227 psMetadata *md = p1PendingExpMetadataFromObject(objects->data[i]);5227 psMetadata *md = guidePendingExpMetadataFromObject(objects->data[i]); 5228 5228 if (!psMetadataAddMetadata( 5229 5229 output, 5230 5230 PS_LIST_TAIL, 5231 P1PENDINGEXP_TABLE_NAME,5231 GUIDEPENDINGEXP_TABLE_NAME, 5232 5232 PS_META_DUPLICATE_OK, 5233 5233 NULL, … … 5250 5250 return true; 5251 5251 } 5252 bool p1PendingExpPrintObject(FILE *stream, p1PendingExpRow *object, bool mdcf)5252 bool guidePendingExpPrintObject(FILE *stream, guidePendingExpRow *object, bool mdcf) 5253 5253 { 5254 5254 PS_ASSERT_PTR_NON_NULL(object, false); 5255 5255 5256 psMetadata *md = p1PendingExpMetadataFromObject(object);5256 psMetadata *md = guidePendingExpMetadataFromObject(object); 5257 5257 5258 5258 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 5265 5265 return true; 5266 5266 } 5267 static void p2PendingExpRowFree(p2PendingExpRow *object);5268 5269 p2PendingExpRow *p2PendingExpRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *label, const char *recipe, const char *expgroup, const char *dvodb)5270 { 5271 p2PendingExpRow *_object;5272 5273 _object = psAlloc(sizeof( p2PendingExpRow));5274 psMemSetDeallocator(_object, (psFreeFunc) p2PendingExpRowFree);5267 static void chipPendingExpRowFree(chipPendingExpRow *object); 5268 5269 chipPendingExpRow *chipPendingExpRowAlloc(const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *label, const char *recipe, const char *expgroup, const char *dvodb) 5270 { 5271 chipPendingExpRow *_object; 5272 5273 _object = psAlloc(sizeof(chipPendingExpRow)); 5274 psMemSetDeallocator(_object, (psFreeFunc)chipPendingExpRowFree); 5275 5275 5276 5276 _object->exp_tag = psStringCopy(exp_tag); 5277 _object-> p2_version = p2_version;5278 _object-> p1_version = p1_version;5277 _object->chip_version = chip_version; 5278 _object->guide_version = guide_version; 5279 5279 _object->label = psStringCopy(label); 5280 5280 _object->recipe = psStringCopy(recipe); … … 5285 5285 } 5286 5286 5287 static void p2PendingExpRowFree(p2PendingExpRow *object)5287 static void chipPendingExpRowFree(chipPendingExpRow *object) 5288 5288 { 5289 5289 psFree(object->exp_tag); … … 5294 5294 } 5295 5295 5296 bool p2PendingExpCreateTable(psDB *dbh)5296 bool chipPendingExpCreateTable(psDB *dbh) 5297 5297 { 5298 5298 psMetadata *md = psMetadataAlloc(); … … 5302 5302 return false; 5303 5303 } 5304 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, "Primary Key", 0)) {5305 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");5306 psFree(md); 5307 return false; 5308 } 5309 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, 0)) {5310 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5304 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, "Primary Key", 0)) { 5305 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 5306 psFree(md); 5307 return false; 5308 } 5309 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, 0)) { 5310 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5311 5311 psFree(md); 5312 5312 return false; … … 5333 5333 } 5334 5334 5335 bool status = psDBCreateTable(dbh, P2PENDINGEXP_TABLE_NAME, md);5335 bool status = psDBCreateTable(dbh, CHIPPENDINGEXP_TABLE_NAME, md); 5336 5336 5337 5337 psFree(md); … … 5340 5340 } 5341 5341 5342 bool p2PendingExpDropTable(psDB *dbh)5343 { 5344 return psDBDropTable(dbh, P2PENDINGEXP_TABLE_NAME);5345 } 5346 5347 bool p2PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *label, const char *recipe, const char *expgroup, const char *dvodb)5342 bool chipPendingExpDropTable(psDB *dbh) 5343 { 5344 return psDBDropTable(dbh, CHIPPENDINGEXP_TABLE_NAME); 5345 } 5346 5347 bool chipPendingExpInsert(psDB * dbh, const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *label, const char *recipe, const char *expgroup, const char *dvodb) 5348 5348 { 5349 5349 psMetadata *md = psMetadataAlloc(); … … 5353 5353 return false; 5354 5354 } 5355 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, p2_version)) {5356 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");5357 psFree(md); 5358 return false; 5359 } 5360 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, p1_version)) {5361 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5355 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, chip_version)) { 5356 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 5357 psFree(md); 5358 return false; 5359 } 5360 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, guide_version)) { 5361 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5362 5362 psFree(md); 5363 5363 return false; … … 5384 5384 } 5385 5385 5386 bool status = psDBInsertOneRow(dbh, P2PENDINGEXP_TABLE_NAME, md);5386 bool status = psDBInsertOneRow(dbh, CHIPPENDINGEXP_TABLE_NAME, md); 5387 5387 psFree(md); 5388 5388 … … 5390 5390 } 5391 5391 5392 long long p2PendingExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)5392 long long chipPendingExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 5393 5393 { 5394 5394 long long deleted = 0; 5395 5395 5396 long long count = psDBDeleteRows(dbh, P2PENDINGEXP_TABLE_NAME, where, limit);5396 long long count = psDBDeleteRows(dbh, CHIPPENDINGEXP_TABLE_NAME, where, limit); 5397 5397 if (count < 0) { 5398 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingExp");5398 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipPendingExp"); 5399 5399 return count; 5400 5400 … … 5404 5404 return deleted; 5405 5405 } 5406 bool p2PendingExpInsertObject(psDB *dbh, p2PendingExpRow *object)5407 { 5408 return p2PendingExpInsert(dbh, object->exp_tag, object->p2_version, object->p1_version, object->label, object->recipe, object->expgroup, object->dvodb);5409 } 5410 5411 bool p2PendingExpInsertObjects(psDB *dbh, psArray *objects)5406 bool chipPendingExpInsertObject(psDB *dbh, chipPendingExpRow *object) 5407 { 5408 return chipPendingExpInsert(dbh, object->exp_tag, object->chip_version, object->guide_version, object->label, object->recipe, object->expgroup, object->dvodb); 5409 } 5410 5411 bool chipPendingExpInsertObjects(psDB *dbh, psArray *objects) 5412 5412 { 5413 5413 for (long i = 0; i < psArrayLength(objects); i++) { 5414 if (! p2PendingExpInsertObject(dbh, objects->data[i])) {5414 if (!chipPendingExpInsertObject(dbh, objects->data[i])) { 5415 5415 return false; 5416 5416 } … … 5420 5420 } 5421 5421 5422 bool p2PendingExpInsertFits(psDB *dbh, const psFits *fits)5422 bool chipPendingExpInsertFits(psDB *dbh, const psFits *fits) 5423 5423 { 5424 5424 psArray *rowSet; 5425 5425 5426 // move to (the first?) extension named P2PENDINGEXP_TABLE_NAME5427 if (!psFitsMoveExtName(fits, P2PENDINGEXP_TABLE_NAME)) {5428 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2PENDINGEXP_TABLE_NAME);5426 // move to (the first?) extension named CHIPPENDINGEXP_TABLE_NAME 5427 if (!psFitsMoveExtName(fits, CHIPPENDINGEXP_TABLE_NAME)) { 5428 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CHIPPENDINGEXP_TABLE_NAME); 5429 5429 return false; 5430 5430 } … … 5444 5444 } 5445 5445 5446 if (!psDBInsertRows(dbh, P2PENDINGEXP_TABLE_NAME, rowSet)) {5446 if (!psDBInsertRows(dbh, CHIPPENDINGEXP_TABLE_NAME, rowSet)) { 5447 5447 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 5448 5448 psFree(rowSet); … … 5455 5455 } 5456 5456 5457 bool p2PendingExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)5457 bool chipPendingExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 5458 5458 { 5459 5459 psArray *rowSet; 5460 5460 5461 rowSet = psDBSelectRows(dbh, P2PENDINGEXP_TABLE_NAME, where, limit);5461 rowSet = psDBSelectRows(dbh, CHIPPENDINGEXP_TABLE_NAME, where, limit); 5462 5462 if (!rowSet) { 5463 5463 return false; … … 5465 5465 5466 5466 // output to fits 5467 if (!psFitsWriteTable(fits, NULL, rowSet, P2PENDINGEXP_TABLE_NAME)) {5467 if (!psFitsWriteTable(fits, NULL, rowSet, CHIPPENDINGEXP_TABLE_NAME)) { 5468 5468 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 5469 5469 psFree(rowSet); … … 5476 5476 } 5477 5477 5478 psMetadata * p2PendingExpMetadataFromObject(const p2PendingExpRow *object)5478 psMetadata *chipPendingExpMetadataFromObject(const chipPendingExpRow *object) 5479 5479 { 5480 5480 psMetadata *md = psMetadataAlloc(); … … 5484 5484 return false; 5485 5485 } 5486 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, object->p2_version)) {5487 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");5488 psFree(md); 5489 return false; 5490 } 5491 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, object->p1_version)) {5492 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5486 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, object->chip_version)) { 5487 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 5488 psFree(md); 5489 return false; 5490 } 5491 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, object->guide_version)) { 5492 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5493 5493 psFree(md); 5494 5494 return false; … … 5519 5519 } 5520 5520 5521 p2PendingExpRow *p2PendingExpObjectFromMetadata(psMetadata *md)5521 chipPendingExpRow *chipPendingExpObjectFromMetadata(psMetadata *md) 5522 5522 { 5523 5523 … … 5528 5528 return false; 5529 5529 } 5530 psS32 p2_version = psMetadataLookupS32(&status, md, "p2_version");5531 if (!status) { 5532 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p2_version");5533 return false; 5534 } 5535 psS32 p1_version = psMetadataLookupS32(&status, md, "p1_version");5536 if (!status) { 5537 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p1_version");5530 psS32 chip_version = psMetadataLookupS32(&status, md, "chip_version"); 5531 if (!status) { 5532 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_version"); 5533 return false; 5534 } 5535 psS32 guide_version = psMetadataLookupS32(&status, md, "guide_version"); 5536 if (!status) { 5537 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item guide_version"); 5538 5538 return false; 5539 5539 } … … 5559 5559 } 5560 5560 5561 return p2PendingExpRowAlloc(exp_tag, p2_version, p1_version, label, recipe, expgroup, dvodb);5562 } 5563 psArray * p2PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)5561 return chipPendingExpRowAlloc(exp_tag, chip_version, guide_version, label, recipe, expgroup, dvodb); 5562 } 5563 psArray *chipPendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 5564 5564 { 5565 5565 psArray *rowSet; … … 5567 5567 psU64 i; 5568 5568 5569 rowSet = psDBSelectRows(dbh, P2PENDINGEXP_TABLE_NAME, where, limit);5569 rowSet = psDBSelectRows(dbh, CHIPPENDINGEXP_TABLE_NAME, where, limit); 5570 5570 if (!rowSet) { 5571 5571 return NULL; … … 5577 5577 5578 5578 for (i = 0; i < rowSet->n; i++) { 5579 p2PendingExpRow *object = p2PendingExpObjectFromMetadata(rowSet->data[i]);5579 chipPendingExpRow *object = chipPendingExpObjectFromMetadata(rowSet->data[i]); 5580 5580 psArrayAdd(returnSet, 0, object); 5581 5581 psFree(object); … … 5586 5586 return returnSet; 5587 5587 } 5588 bool p2PendingExpDeleteObject(psDB *dbh, const p2PendingExpRow *object)5589 { 5590 psMetadata *where = p2PendingExpMetadataFromObject(object);5591 long long count = psDBDeleteRows(dbh, P2PENDINGEXP_TABLE_NAME, where, 0);5588 bool chipPendingExpDeleteObject(psDB *dbh, const chipPendingExpRow *object) 5589 { 5590 psMetadata *where = chipPendingExpMetadataFromObject(object); 5591 long long count = psDBDeleteRows(dbh, CHIPPENDINGEXP_TABLE_NAME, where, 0); 5592 5592 psFree(where); 5593 5593 if (count < 0) { 5594 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingExp");5594 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipPendingExp"); 5595 5595 return false; 5596 5596 } … … 5598 5598 // XXX should this be a psAbort() instead? It is possible that 5599 5599 // having an object match multiple rows was by design. 5600 psError(PS_ERR_UNKNOWN, true, " p2PendingExpRow object matched more then one row. Check your database schema");5601 return false; 5602 } 5603 5604 return true; 5605 } 5606 long long p2PendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)5600 psError(PS_ERR_UNKNOWN, true, "chipPendingExpRow object matched more then one row. Check your database schema"); 5601 return false; 5602 } 5603 5604 return true; 5605 } 5606 long long chipPendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 5607 5607 { 5608 5608 long long deleted = 0; 5609 5609 5610 5610 for (long long i = 0; i < objects->n; i++) { 5611 p2PendingExpRow *object = objects->data[i];5612 psMetadata *where = p2PendingExpMetadataFromObject(object);5613 long long count = psDBDeleteRows(dbh, P2PENDINGEXP_TABLE_NAME, where, limit);5611 chipPendingExpRow *object = objects->data[i]; 5612 psMetadata *where = chipPendingExpMetadataFromObject(object); 5613 long long count = psDBDeleteRows(dbh, CHIPPENDINGEXP_TABLE_NAME, where, limit); 5614 5614 psFree(where); 5615 5615 if (count < 0) { 5616 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingExp");5616 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipPendingExp"); 5617 5617 return count; 5618 5618 } … … 5623 5623 return deleted; 5624 5624 } 5625 bool p2PendingExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)5625 bool chipPendingExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 5626 5626 { 5627 5627 PS_ASSERT_PTR_NON_NULL(objects, false); … … 5629 5629 psMetadata *output = psMetadataAlloc(); 5630 5630 for (long i = 0; i < psArrayLength(objects); i++) { 5631 psMetadata *md = p2PendingExpMetadataFromObject(objects->data[i]);5631 psMetadata *md = chipPendingExpMetadataFromObject(objects->data[i]); 5632 5632 if (!psMetadataAddMetadata( 5633 5633 output, 5634 5634 PS_LIST_TAIL, 5635 P2PENDINGEXP_TABLE_NAME,5635 CHIPPENDINGEXP_TABLE_NAME, 5636 5636 PS_META_DUPLICATE_OK, 5637 5637 NULL, … … 5654 5654 return true; 5655 5655 } 5656 bool p2PendingExpPrintObject(FILE *stream, p2PendingExpRow *object, bool mdcf)5656 bool chipPendingExpPrintObject(FILE *stream, chipPendingExpRow *object, bool mdcf) 5657 5657 { 5658 5658 PS_ASSERT_PTR_NON_NULL(object, false); 5659 5659 5660 psMetadata *md = p2PendingExpMetadataFromObject(object);5660 psMetadata *md = chipPendingExpMetadataFromObject(object); 5661 5661 5662 5662 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 5669 5669 return true; 5670 5670 } 5671 static void p2PendingImfileRowFree(p2PendingImfileRow *object);5672 5673 p2PendingImfileRow *p2PendingImfileRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *class_id, const char *recipe, const char *uri)5674 { 5675 p2PendingImfileRow *_object;5676 5677 _object = psAlloc(sizeof( p2PendingImfileRow));5678 psMemSetDeallocator(_object, (psFreeFunc) p2PendingImfileRowFree);5671 static void chipPendingImfileRowFree(chipPendingImfileRow *object); 5672 5673 chipPendingImfileRow *chipPendingImfileRowAlloc(const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *class_id, const char *recipe, const char *uri) 5674 { 5675 chipPendingImfileRow *_object; 5676 5677 _object = psAlloc(sizeof(chipPendingImfileRow)); 5678 psMemSetDeallocator(_object, (psFreeFunc)chipPendingImfileRowFree); 5679 5679 5680 5680 _object->exp_tag = psStringCopy(exp_tag); 5681 _object-> p2_version = p2_version;5682 _object-> p1_version = p1_version;5681 _object->chip_version = chip_version; 5682 _object->guide_version = guide_version; 5683 5683 _object->class_id = psStringCopy(class_id); 5684 5684 _object->recipe = psStringCopy(recipe); … … 5688 5688 } 5689 5689 5690 static void p2PendingImfileRowFree(p2PendingImfileRow *object)5690 static void chipPendingImfileRowFree(chipPendingImfileRow *object) 5691 5691 { 5692 5692 psFree(object->exp_tag); … … 5696 5696 } 5697 5697 5698 bool p2PendingImfileCreateTable(psDB *dbh)5698 bool chipPendingImfileCreateTable(psDB *dbh) 5699 5699 { 5700 5700 psMetadata *md = psMetadataAlloc(); … … 5704 5704 return false; 5705 5705 } 5706 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, "Primary Key", 0)) {5707 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");5708 psFree(md); 5709 return false; 5710 } 5711 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, 0)) {5712 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5706 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, "Primary Key", 0)) { 5707 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 5708 psFree(md); 5709 return false; 5710 } 5711 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, 0)) { 5712 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5713 5713 psFree(md); 5714 5714 return false; … … 5730 5730 } 5731 5731 5732 bool status = psDBCreateTable(dbh, P2PENDINGIMFILE_TABLE_NAME, md);5732 bool status = psDBCreateTable(dbh, CHIPPENDINGIMFILE_TABLE_NAME, md); 5733 5733 5734 5734 psFree(md); … … 5737 5737 } 5738 5738 5739 bool p2PendingImfileDropTable(psDB *dbh)5740 { 5741 return psDBDropTable(dbh, P2PENDINGIMFILE_TABLE_NAME);5742 } 5743 5744 bool p2PendingImfileInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *class_id, const char *recipe, const char *uri)5739 bool chipPendingImfileDropTable(psDB *dbh) 5740 { 5741 return psDBDropTable(dbh, CHIPPENDINGIMFILE_TABLE_NAME); 5742 } 5743 5744 bool chipPendingImfileInsert(psDB * dbh, const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *class_id, const char *recipe, const char *uri) 5745 5745 { 5746 5746 psMetadata *md = psMetadataAlloc(); … … 5750 5750 return false; 5751 5751 } 5752 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, p2_version)) {5753 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");5754 psFree(md); 5755 return false; 5756 } 5757 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, p1_version)) {5758 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5752 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, chip_version)) { 5753 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 5754 psFree(md); 5755 return false; 5756 } 5757 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, guide_version)) { 5758 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5759 5759 psFree(md); 5760 5760 return false; … … 5776 5776 } 5777 5777 5778 bool status = psDBInsertOneRow(dbh, P2PENDINGIMFILE_TABLE_NAME, md);5778 bool status = psDBInsertOneRow(dbh, CHIPPENDINGIMFILE_TABLE_NAME, md); 5779 5779 psFree(md); 5780 5780 … … 5782 5782 } 5783 5783 5784 long long p2PendingImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)5784 long long chipPendingImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 5785 5785 { 5786 5786 long long deleted = 0; 5787 5787 5788 long long count = psDBDeleteRows(dbh, P2PENDINGIMFILE_TABLE_NAME, where, limit);5788 long long count = psDBDeleteRows(dbh, CHIPPENDINGIMFILE_TABLE_NAME, where, limit); 5789 5789 if (count < 0) { 5790 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingImfile");5790 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipPendingImfile"); 5791 5791 return count; 5792 5792 … … 5796 5796 return deleted; 5797 5797 } 5798 bool p2PendingImfileInsertObject(psDB *dbh, p2PendingImfileRow *object)5799 { 5800 return p2PendingImfileInsert(dbh, object->exp_tag, object->p2_version, object->p1_version, object->class_id, object->recipe, object->uri);5801 } 5802 5803 bool p2PendingImfileInsertObjects(psDB *dbh, psArray *objects)5798 bool chipPendingImfileInsertObject(psDB *dbh, chipPendingImfileRow *object) 5799 { 5800 return chipPendingImfileInsert(dbh, object->exp_tag, object->chip_version, object->guide_version, object->class_id, object->recipe, object->uri); 5801 } 5802 5803 bool chipPendingImfileInsertObjects(psDB *dbh, psArray *objects) 5804 5804 { 5805 5805 for (long i = 0; i < psArrayLength(objects); i++) { 5806 if (! p2PendingImfileInsertObject(dbh, objects->data[i])) {5806 if (!chipPendingImfileInsertObject(dbh, objects->data[i])) { 5807 5807 return false; 5808 5808 } … … 5812 5812 } 5813 5813 5814 bool p2PendingImfileInsertFits(psDB *dbh, const psFits *fits)5814 bool chipPendingImfileInsertFits(psDB *dbh, const psFits *fits) 5815 5815 { 5816 5816 psArray *rowSet; 5817 5817 5818 // move to (the first?) extension named P2PENDINGIMFILE_TABLE_NAME5819 if (!psFitsMoveExtName(fits, P2PENDINGIMFILE_TABLE_NAME)) {5820 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2PENDINGIMFILE_TABLE_NAME);5818 // move to (the first?) extension named CHIPPENDINGIMFILE_TABLE_NAME 5819 if (!psFitsMoveExtName(fits, CHIPPENDINGIMFILE_TABLE_NAME)) { 5820 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CHIPPENDINGIMFILE_TABLE_NAME); 5821 5821 return false; 5822 5822 } … … 5836 5836 } 5837 5837 5838 if (!psDBInsertRows(dbh, P2PENDINGIMFILE_TABLE_NAME, rowSet)) {5838 if (!psDBInsertRows(dbh, CHIPPENDINGIMFILE_TABLE_NAME, rowSet)) { 5839 5839 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 5840 5840 psFree(rowSet); … … 5847 5847 } 5848 5848 5849 bool p2PendingImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)5849 bool chipPendingImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 5850 5850 { 5851 5851 psArray *rowSet; 5852 5852 5853 rowSet = psDBSelectRows(dbh, P2PENDINGIMFILE_TABLE_NAME, where, limit);5853 rowSet = psDBSelectRows(dbh, CHIPPENDINGIMFILE_TABLE_NAME, where, limit); 5854 5854 if (!rowSet) { 5855 5855 return false; … … 5857 5857 5858 5858 // output to fits 5859 if (!psFitsWriteTable(fits, NULL, rowSet, P2PENDINGIMFILE_TABLE_NAME)) {5859 if (!psFitsWriteTable(fits, NULL, rowSet, CHIPPENDINGIMFILE_TABLE_NAME)) { 5860 5860 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 5861 5861 psFree(rowSet); … … 5868 5868 } 5869 5869 5870 psMetadata * p2PendingImfileMetadataFromObject(const p2PendingImfileRow *object)5870 psMetadata *chipPendingImfileMetadataFromObject(const chipPendingImfileRow *object) 5871 5871 { 5872 5872 psMetadata *md = psMetadataAlloc(); … … 5876 5876 return false; 5877 5877 } 5878 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, object->p2_version)) {5879 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");5880 psFree(md); 5881 return false; 5882 } 5883 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, object->p1_version)) {5884 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");5878 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, object->chip_version)) { 5879 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 5880 psFree(md); 5881 return false; 5882 } 5883 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, object->guide_version)) { 5884 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 5885 5885 psFree(md); 5886 5886 return false; … … 5906 5906 } 5907 5907 5908 p2PendingImfileRow *p2PendingImfileObjectFromMetadata(psMetadata *md)5908 chipPendingImfileRow *chipPendingImfileObjectFromMetadata(psMetadata *md) 5909 5909 { 5910 5910 … … 5915 5915 return false; 5916 5916 } 5917 psS32 p2_version = psMetadataLookupS32(&status, md, "p2_version");5918 if (!status) { 5919 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p2_version");5920 return false; 5921 } 5922 psS32 p1_version = psMetadataLookupS32(&status, md, "p1_version");5923 if (!status) { 5924 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p1_version");5917 psS32 chip_version = psMetadataLookupS32(&status, md, "chip_version"); 5918 if (!status) { 5919 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_version"); 5920 return false; 5921 } 5922 psS32 guide_version = psMetadataLookupS32(&status, md, "guide_version"); 5923 if (!status) { 5924 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item guide_version"); 5925 5925 return false; 5926 5926 } … … 5941 5941 } 5942 5942 5943 return p2PendingImfileRowAlloc(exp_tag, p2_version, p1_version, class_id, recipe, uri);5944 } 5945 psArray * p2PendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)5943 return chipPendingImfileRowAlloc(exp_tag, chip_version, guide_version, class_id, recipe, uri); 5944 } 5945 psArray *chipPendingImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 5946 5946 { 5947 5947 psArray *rowSet; … … 5949 5949 psU64 i; 5950 5950 5951 rowSet = psDBSelectRows(dbh, P2PENDINGIMFILE_TABLE_NAME, where, limit);5951 rowSet = psDBSelectRows(dbh, CHIPPENDINGIMFILE_TABLE_NAME, where, limit); 5952 5952 if (!rowSet) { 5953 5953 return NULL; … … 5959 5959 5960 5960 for (i = 0; i < rowSet->n; i++) { 5961 p2PendingImfileRow *object = p2PendingImfileObjectFromMetadata(rowSet->data[i]);5961 chipPendingImfileRow *object = chipPendingImfileObjectFromMetadata(rowSet->data[i]); 5962 5962 psArrayAdd(returnSet, 0, object); 5963 5963 psFree(object); … … 5968 5968 return returnSet; 5969 5969 } 5970 bool p2PendingImfileDeleteObject(psDB *dbh, const p2PendingImfileRow *object)5971 { 5972 psMetadata *where = p2PendingImfileMetadataFromObject(object);5973 long long count = psDBDeleteRows(dbh, P2PENDINGIMFILE_TABLE_NAME, where, 0);5970 bool chipPendingImfileDeleteObject(psDB *dbh, const chipPendingImfileRow *object) 5971 { 5972 psMetadata *where = chipPendingImfileMetadataFromObject(object); 5973 long long count = psDBDeleteRows(dbh, CHIPPENDINGIMFILE_TABLE_NAME, where, 0); 5974 5974 psFree(where); 5975 5975 if (count < 0) { 5976 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingImfile");5976 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipPendingImfile"); 5977 5977 return false; 5978 5978 } … … 5980 5980 // XXX should this be a psAbort() instead? It is possible that 5981 5981 // having an object match multiple rows was by design. 5982 psError(PS_ERR_UNKNOWN, true, " p2PendingImfileRow object matched more then one row. Check your database schema");5983 return false; 5984 } 5985 5986 return true; 5987 } 5988 long long p2PendingImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)5982 psError(PS_ERR_UNKNOWN, true, "chipPendingImfileRow object matched more then one row. Check your database schema"); 5983 return false; 5984 } 5985 5986 return true; 5987 } 5988 long long chipPendingImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 5989 5989 { 5990 5990 long long deleted = 0; 5991 5991 5992 5992 for (long long i = 0; i < objects->n; i++) { 5993 p2PendingImfileRow *object = objects->data[i];5994 psMetadata *where = p2PendingImfileMetadataFromObject(object);5995 long long count = psDBDeleteRows(dbh, P2PENDINGIMFILE_TABLE_NAME, where, limit);5993 chipPendingImfileRow *object = objects->data[i]; 5994 psMetadata *where = chipPendingImfileMetadataFromObject(object); 5995 long long count = psDBDeleteRows(dbh, CHIPPENDINGIMFILE_TABLE_NAME, where, limit); 5996 5996 psFree(where); 5997 5997 if (count < 0) { 5998 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingImfile");5998 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipPendingImfile"); 5999 5999 return count; 6000 6000 } … … 6005 6005 return deleted; 6006 6006 } 6007 bool p2PendingImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)6007 bool chipPendingImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 6008 6008 { 6009 6009 PS_ASSERT_PTR_NON_NULL(objects, false); … … 6011 6011 psMetadata *output = psMetadataAlloc(); 6012 6012 for (long i = 0; i < psArrayLength(objects); i++) { 6013 psMetadata *md = p2PendingImfileMetadataFromObject(objects->data[i]);6013 psMetadata *md = chipPendingImfileMetadataFromObject(objects->data[i]); 6014 6014 if (!psMetadataAddMetadata( 6015 6015 output, 6016 6016 PS_LIST_TAIL, 6017 P2PENDINGIMFILE_TABLE_NAME,6017 CHIPPENDINGIMFILE_TABLE_NAME, 6018 6018 PS_META_DUPLICATE_OK, 6019 6019 NULL, … … 6036 6036 return true; 6037 6037 } 6038 bool p2PendingImfilePrintObject(FILE *stream, p2PendingImfileRow *object, bool mdcf)6038 bool chipPendingImfilePrintObject(FILE *stream, chipPendingImfileRow *object, bool mdcf) 6039 6039 { 6040 6040 PS_ASSERT_PTR_NON_NULL(object, false); 6041 6041 6042 psMetadata *md = p2PendingImfileMetadataFromObject(object);6042 psMetadata *md = chipPendingImfileMetadataFromObject(object); 6043 6043 6044 6044 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 6051 6051 return true; 6052 6052 } 6053 static void p2ProcessedExpRowFree(p2ProcessedExpRow *object);6054 6055 p2ProcessedExpRow *p2ProcessedExpRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *label, const char *expgroup, const char *dvodb)6056 { 6057 p2ProcessedExpRow *_object;6058 6059 _object = psAlloc(sizeof( p2ProcessedExpRow));6060 psMemSetDeallocator(_object, (psFreeFunc) p2ProcessedExpRowFree);6053 static void chipProcessedExpRowFree(chipProcessedExpRow *object); 6054 6055 chipProcessedExpRow *chipProcessedExpRowAlloc(const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *label, const char *expgroup, const char *dvodb) 6056 { 6057 chipProcessedExpRow *_object; 6058 6059 _object = psAlloc(sizeof(chipProcessedExpRow)); 6060 psMemSetDeallocator(_object, (psFreeFunc)chipProcessedExpRowFree); 6061 6061 6062 6062 _object->exp_tag = psStringCopy(exp_tag); 6063 _object-> p2_version = p2_version;6064 _object-> p1_version = p1_version;6063 _object->chip_version = chip_version; 6064 _object->guide_version = guide_version; 6065 6065 _object->label = psStringCopy(label); 6066 6066 _object->expgroup = psStringCopy(expgroup); … … 6070 6070 } 6071 6071 6072 static void p2ProcessedExpRowFree(p2ProcessedExpRow *object)6072 static void chipProcessedExpRowFree(chipProcessedExpRow *object) 6073 6073 { 6074 6074 psFree(object->exp_tag); … … 6078 6078 } 6079 6079 6080 bool p2ProcessedExpCreateTable(psDB *dbh)6080 bool chipProcessedExpCreateTable(psDB *dbh) 6081 6081 { 6082 6082 psMetadata *md = psMetadataAlloc(); … … 6086 6086 return false; 6087 6087 } 6088 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, "Primary Key", 0)) {6089 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");6090 psFree(md); 6091 return false; 6092 } 6093 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, 0)) {6094 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");6088 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, "Primary Key", 0)) { 6089 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 6090 psFree(md); 6091 return false; 6092 } 6093 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, 0)) { 6094 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 6095 6095 psFree(md); 6096 6096 return false; … … 6112 6112 } 6113 6113 6114 bool status = psDBCreateTable(dbh, P2PROCESSEDEXP_TABLE_NAME, md);6114 bool status = psDBCreateTable(dbh, CHIPPROCESSEDEXP_TABLE_NAME, md); 6115 6115 6116 6116 psFree(md); … … 6119 6119 } 6120 6120 6121 bool p2ProcessedExpDropTable(psDB *dbh)6122 { 6123 return psDBDropTable(dbh, P2PROCESSEDEXP_TABLE_NAME);6124 } 6125 6126 bool p2ProcessedExpInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *label, const char *expgroup, const char *dvodb)6121 bool chipProcessedExpDropTable(psDB *dbh) 6122 { 6123 return psDBDropTable(dbh, CHIPPROCESSEDEXP_TABLE_NAME); 6124 } 6125 6126 bool chipProcessedExpInsert(psDB * dbh, const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *label, const char *expgroup, const char *dvodb) 6127 6127 { 6128 6128 psMetadata *md = psMetadataAlloc(); … … 6132 6132 return false; 6133 6133 } 6134 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, p2_version)) {6135 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");6136 psFree(md); 6137 return false; 6138 } 6139 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, p1_version)) {6140 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");6134 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, chip_version)) { 6135 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 6136 psFree(md); 6137 return false; 6138 } 6139 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, guide_version)) { 6140 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 6141 6141 psFree(md); 6142 6142 return false; … … 6158 6158 } 6159 6159 6160 bool status = psDBInsertOneRow(dbh, P2PROCESSEDEXP_TABLE_NAME, md);6160 bool status = psDBInsertOneRow(dbh, CHIPPROCESSEDEXP_TABLE_NAME, md); 6161 6161 psFree(md); 6162 6162 … … 6164 6164 } 6165 6165 6166 long long p2ProcessedExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)6166 long long chipProcessedExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 6167 6167 { 6168 6168 long long deleted = 0; 6169 6169 6170 long long count = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit);6170 long long count = psDBDeleteRows(dbh, CHIPPROCESSEDEXP_TABLE_NAME, where, limit); 6171 6171 if (count < 0) { 6172 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedExp");6172 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipProcessedExp"); 6173 6173 return count; 6174 6174 … … 6178 6178 return deleted; 6179 6179 } 6180 bool p2ProcessedExpInsertObject(psDB *dbh, p2ProcessedExpRow *object)6181 { 6182 return p2ProcessedExpInsert(dbh, object->exp_tag, object->p2_version, object->p1_version, object->label, object->expgroup, object->dvodb);6183 } 6184 6185 bool p2ProcessedExpInsertObjects(psDB *dbh, psArray *objects)6180 bool chipProcessedExpInsertObject(psDB *dbh, chipProcessedExpRow *object) 6181 { 6182 return chipProcessedExpInsert(dbh, object->exp_tag, object->chip_version, object->guide_version, object->label, object->expgroup, object->dvodb); 6183 } 6184 6185 bool chipProcessedExpInsertObjects(psDB *dbh, psArray *objects) 6186 6186 { 6187 6187 for (long i = 0; i < psArrayLength(objects); i++) { 6188 if (! p2ProcessedExpInsertObject(dbh, objects->data[i])) {6188 if (!chipProcessedExpInsertObject(dbh, objects->data[i])) { 6189 6189 return false; 6190 6190 } … … 6194 6194 } 6195 6195 6196 bool p2ProcessedExpInsertFits(psDB *dbh, const psFits *fits)6196 bool chipProcessedExpInsertFits(psDB *dbh, const psFits *fits) 6197 6197 { 6198 6198 psArray *rowSet; 6199 6199 6200 // move to (the first?) extension named P2PROCESSEDEXP_TABLE_NAME6201 if (!psFitsMoveExtName(fits, P2PROCESSEDEXP_TABLE_NAME)) {6202 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2PROCESSEDEXP_TABLE_NAME);6200 // move to (the first?) extension named CHIPPROCESSEDEXP_TABLE_NAME 6201 if (!psFitsMoveExtName(fits, CHIPPROCESSEDEXP_TABLE_NAME)) { 6202 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CHIPPROCESSEDEXP_TABLE_NAME); 6203 6203 return false; 6204 6204 } … … 6218 6218 } 6219 6219 6220 if (!psDBInsertRows(dbh, P2PROCESSEDEXP_TABLE_NAME, rowSet)) {6220 if (!psDBInsertRows(dbh, CHIPPROCESSEDEXP_TABLE_NAME, rowSet)) { 6221 6221 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 6222 6222 psFree(rowSet); … … 6229 6229 } 6230 6230 6231 bool p2ProcessedExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)6231 bool chipProcessedExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 6232 6232 { 6233 6233 psArray *rowSet; 6234 6234 6235 rowSet = psDBSelectRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit);6235 rowSet = psDBSelectRows(dbh, CHIPPROCESSEDEXP_TABLE_NAME, where, limit); 6236 6236 if (!rowSet) { 6237 6237 return false; … … 6239 6239 6240 6240 // output to fits 6241 if (!psFitsWriteTable(fits, NULL, rowSet, P2PROCESSEDEXP_TABLE_NAME)) {6241 if (!psFitsWriteTable(fits, NULL, rowSet, CHIPPROCESSEDEXP_TABLE_NAME)) { 6242 6242 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 6243 6243 psFree(rowSet); … … 6250 6250 } 6251 6251 6252 psMetadata * p2ProcessedExpMetadataFromObject(const p2ProcessedExpRow *object)6252 psMetadata *chipProcessedExpMetadataFromObject(const chipProcessedExpRow *object) 6253 6253 { 6254 6254 psMetadata *md = psMetadataAlloc(); … … 6258 6258 return false; 6259 6259 } 6260 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, object->p2_version)) {6261 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");6262 psFree(md); 6263 return false; 6264 } 6265 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, object->p1_version)) {6266 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");6260 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, object->chip_version)) { 6261 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 6262 psFree(md); 6263 return false; 6264 } 6265 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, object->guide_version)) { 6266 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 6267 6267 psFree(md); 6268 6268 return false; … … 6288 6288 } 6289 6289 6290 p2ProcessedExpRow *p2ProcessedExpObjectFromMetadata(psMetadata *md)6290 chipProcessedExpRow *chipProcessedExpObjectFromMetadata(psMetadata *md) 6291 6291 { 6292 6292 … … 6297 6297 return false; 6298 6298 } 6299 psS32 p2_version = psMetadataLookupS32(&status, md, "p2_version");6300 if (!status) { 6301 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p2_version");6302 return false; 6303 } 6304 psS32 p1_version = psMetadataLookupS32(&status, md, "p1_version");6305 if (!status) { 6306 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p1_version");6299 psS32 chip_version = psMetadataLookupS32(&status, md, "chip_version"); 6300 if (!status) { 6301 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_version"); 6302 return false; 6303 } 6304 psS32 guide_version = psMetadataLookupS32(&status, md, "guide_version"); 6305 if (!status) { 6306 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item guide_version"); 6307 6307 return false; 6308 6308 } … … 6323 6323 } 6324 6324 6325 return p2ProcessedExpRowAlloc(exp_tag, p2_version, p1_version, label, expgroup, dvodb);6326 } 6327 psArray * p2ProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)6325 return chipProcessedExpRowAlloc(exp_tag, chip_version, guide_version, label, expgroup, dvodb); 6326 } 6327 psArray *chipProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 6328 6328 { 6329 6329 psArray *rowSet; … … 6331 6331 psU64 i; 6332 6332 6333 rowSet = psDBSelectRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit);6333 rowSet = psDBSelectRows(dbh, CHIPPROCESSEDEXP_TABLE_NAME, where, limit); 6334 6334 if (!rowSet) { 6335 6335 return NULL; … … 6341 6341 6342 6342 for (i = 0; i < rowSet->n; i++) { 6343 p2ProcessedExpRow *object = p2ProcessedExpObjectFromMetadata(rowSet->data[i]);6343 chipProcessedExpRow *object = chipProcessedExpObjectFromMetadata(rowSet->data[i]); 6344 6344 psArrayAdd(returnSet, 0, object); 6345 6345 psFree(object); … … 6350 6350 return returnSet; 6351 6351 } 6352 bool p2ProcessedExpDeleteObject(psDB *dbh, const p2ProcessedExpRow *object)6353 { 6354 psMetadata *where = p2ProcessedExpMetadataFromObject(object);6355 long long count = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, 0);6352 bool chipProcessedExpDeleteObject(psDB *dbh, const chipProcessedExpRow *object) 6353 { 6354 psMetadata *where = chipProcessedExpMetadataFromObject(object); 6355 long long count = psDBDeleteRows(dbh, CHIPPROCESSEDEXP_TABLE_NAME, where, 0); 6356 6356 psFree(where); 6357 6357 if (count < 0) { 6358 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedExp");6358 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipProcessedExp"); 6359 6359 return false; 6360 6360 } … … 6362 6362 // XXX should this be a psAbort() instead? It is possible that 6363 6363 // having an object match multiple rows was by design. 6364 psError(PS_ERR_UNKNOWN, true, " p2ProcessedExpRow object matched more then one row. Check your database schema");6365 return false; 6366 } 6367 6368 return true; 6369 } 6370 long long p2ProcessedExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)6364 psError(PS_ERR_UNKNOWN, true, "chipProcessedExpRow object matched more then one row. Check your database schema"); 6365 return false; 6366 } 6367 6368 return true; 6369 } 6370 long long chipProcessedExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 6371 6371 { 6372 6372 long long deleted = 0; 6373 6373 6374 6374 for (long long i = 0; i < objects->n; i++) { 6375 p2ProcessedExpRow *object = objects->data[i];6376 psMetadata *where = p2ProcessedExpMetadataFromObject(object);6377 long long count = psDBDeleteRows(dbh, P2PROCESSEDEXP_TABLE_NAME, where, limit);6375 chipProcessedExpRow *object = objects->data[i]; 6376 psMetadata *where = chipProcessedExpMetadataFromObject(object); 6377 long long count = psDBDeleteRows(dbh, CHIPPROCESSEDEXP_TABLE_NAME, where, limit); 6378 6378 psFree(where); 6379 6379 if (count < 0) { 6380 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedExp");6380 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipProcessedExp"); 6381 6381 return count; 6382 6382 } … … 6387 6387 return deleted; 6388 6388 } 6389 bool p2ProcessedExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)6389 bool chipProcessedExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 6390 6390 { 6391 6391 PS_ASSERT_PTR_NON_NULL(objects, false); … … 6393 6393 psMetadata *output = psMetadataAlloc(); 6394 6394 for (long i = 0; i < psArrayLength(objects); i++) { 6395 psMetadata *md = p2ProcessedExpMetadataFromObject(objects->data[i]);6395 psMetadata *md = chipProcessedExpMetadataFromObject(objects->data[i]); 6396 6396 if (!psMetadataAddMetadata( 6397 6397 output, 6398 6398 PS_LIST_TAIL, 6399 P2PROCESSEDEXP_TABLE_NAME,6399 CHIPPROCESSEDEXP_TABLE_NAME, 6400 6400 PS_META_DUPLICATE_OK, 6401 6401 NULL, … … 6418 6418 return true; 6419 6419 } 6420 bool p2ProcessedExpPrintObject(FILE *stream, p2ProcessedExpRow *object, bool mdcf)6420 bool chipProcessedExpPrintObject(FILE *stream, chipProcessedExpRow *object, bool mdcf) 6421 6421 { 6422 6422 PS_ASSERT_PTR_NON_NULL(object, false); 6423 6423 6424 psMetadata *md = p2ProcessedExpMetadataFromObject(object);6424 psMetadata *md = chipProcessedExpMetadataFromObject(object); 6425 6425 6426 6426 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 6433 6433 return true; 6434 6434 } 6435 static void p2MaskRowFree(p2MaskRow *object);6436 6437 p2MaskRow *p2MaskRowAlloc(const char *label)6438 { 6439 p2MaskRow*_object;6440 6441 _object = psAlloc(sizeof( p2MaskRow));6442 psMemSetDeallocator(_object, (psFreeFunc) p2MaskRowFree);6435 static void chipMaskRowFree(chipMaskRow *object); 6436 6437 chipMaskRow *chipMaskRowAlloc(const char *label) 6438 { 6439 chipMaskRow *_object; 6440 6441 _object = psAlloc(sizeof(chipMaskRow)); 6442 psMemSetDeallocator(_object, (psFreeFunc)chipMaskRowFree); 6443 6443 6444 6444 _object->label = psStringCopy(label); … … 6447 6447 } 6448 6448 6449 static void p2MaskRowFree(p2MaskRow *object)6449 static void chipMaskRowFree(chipMaskRow *object) 6450 6450 { 6451 6451 psFree(object->label); 6452 6452 } 6453 6453 6454 bool p2MaskCreateTable(psDB *dbh)6454 bool chipMaskCreateTable(psDB *dbh) 6455 6455 { 6456 6456 psMetadata *md = psMetadataAlloc(); … … 6461 6461 } 6462 6462 6463 bool status = psDBCreateTable(dbh, P2MASK_TABLE_NAME, md);6463 bool status = psDBCreateTable(dbh, CHIPMASK_TABLE_NAME, md); 6464 6464 6465 6465 psFree(md); … … 6468 6468 } 6469 6469 6470 bool p2MaskDropTable(psDB *dbh)6471 { 6472 return psDBDropTable(dbh, P2MASK_TABLE_NAME);6473 } 6474 6475 bool p2MaskInsert(psDB * dbh, const char *label)6470 bool chipMaskDropTable(psDB *dbh) 6471 { 6472 return psDBDropTable(dbh, CHIPMASK_TABLE_NAME); 6473 } 6474 6475 bool chipMaskInsert(psDB * dbh, const char *label) 6476 6476 { 6477 6477 psMetadata *md = psMetadataAlloc(); … … 6482 6482 } 6483 6483 6484 bool status = psDBInsertOneRow(dbh, P2MASK_TABLE_NAME, md);6484 bool status = psDBInsertOneRow(dbh, CHIPMASK_TABLE_NAME, md); 6485 6485 psFree(md); 6486 6486 … … 6488 6488 } 6489 6489 6490 long long p2MaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)6490 long long chipMaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 6491 6491 { 6492 6492 long long deleted = 0; 6493 6493 6494 long long count = psDBDeleteRows(dbh, P2MASK_TABLE_NAME, where, limit);6494 long long count = psDBDeleteRows(dbh, CHIPMASK_TABLE_NAME, where, limit); 6495 6495 if (count < 0) { 6496 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2Mask");6496 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipMask"); 6497 6497 return count; 6498 6498 … … 6502 6502 return deleted; 6503 6503 } 6504 bool p2MaskInsertObject(psDB *dbh, p2MaskRow *object)6505 { 6506 return p2MaskInsert(dbh, object->label);6507 } 6508 6509 bool p2MaskInsertObjects(psDB *dbh, psArray *objects)6504 bool chipMaskInsertObject(psDB *dbh, chipMaskRow *object) 6505 { 6506 return chipMaskInsert(dbh, object->label); 6507 } 6508 6509 bool chipMaskInsertObjects(psDB *dbh, psArray *objects) 6510 6510 { 6511 6511 for (long i = 0; i < psArrayLength(objects); i++) { 6512 if (! p2MaskInsertObject(dbh, objects->data[i])) {6512 if (!chipMaskInsertObject(dbh, objects->data[i])) { 6513 6513 return false; 6514 6514 } … … 6518 6518 } 6519 6519 6520 bool p2MaskInsertFits(psDB *dbh, const psFits *fits)6520 bool chipMaskInsertFits(psDB *dbh, const psFits *fits) 6521 6521 { 6522 6522 psArray *rowSet; 6523 6523 6524 // move to (the first?) extension named P2MASK_TABLE_NAME6525 if (!psFitsMoveExtName(fits, P2MASK_TABLE_NAME)) {6526 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2MASK_TABLE_NAME);6524 // move to (the first?) extension named CHIPMASK_TABLE_NAME 6525 if (!psFitsMoveExtName(fits, CHIPMASK_TABLE_NAME)) { 6526 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CHIPMASK_TABLE_NAME); 6527 6527 return false; 6528 6528 } … … 6542 6542 } 6543 6543 6544 if (!psDBInsertRows(dbh, P2MASK_TABLE_NAME, rowSet)) {6544 if (!psDBInsertRows(dbh, CHIPMASK_TABLE_NAME, rowSet)) { 6545 6545 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 6546 6546 psFree(rowSet); … … 6553 6553 } 6554 6554 6555 bool p2MaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)6555 bool chipMaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 6556 6556 { 6557 6557 psArray *rowSet; 6558 6558 6559 rowSet = psDBSelectRows(dbh, P2MASK_TABLE_NAME, where, limit);6559 rowSet = psDBSelectRows(dbh, CHIPMASK_TABLE_NAME, where, limit); 6560 6560 if (!rowSet) { 6561 6561 return false; … … 6563 6563 6564 6564 // output to fits 6565 if (!psFitsWriteTable(fits, NULL, rowSet, P2MASK_TABLE_NAME)) {6565 if (!psFitsWriteTable(fits, NULL, rowSet, CHIPMASK_TABLE_NAME)) { 6566 6566 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 6567 6567 psFree(rowSet); … … 6574 6574 } 6575 6575 6576 psMetadata * p2MaskMetadataFromObject(const p2MaskRow *object)6576 psMetadata *chipMaskMetadataFromObject(const chipMaskRow *object) 6577 6577 { 6578 6578 psMetadata *md = psMetadataAlloc(); … … 6587 6587 } 6588 6588 6589 p2MaskRow *p2MaskObjectFromMetadata(psMetadata *md)6589 chipMaskRow *chipMaskObjectFromMetadata(psMetadata *md) 6590 6590 { 6591 6591 … … 6597 6597 } 6598 6598 6599 return p2MaskRowAlloc(label);6600 } 6601 psArray * p2MaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)6599 return chipMaskRowAlloc(label); 6600 } 6601 psArray *chipMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 6602 6602 { 6603 6603 psArray *rowSet; … … 6605 6605 psU64 i; 6606 6606 6607 rowSet = psDBSelectRows(dbh, P2MASK_TABLE_NAME, where, limit);6607 rowSet = psDBSelectRows(dbh, CHIPMASK_TABLE_NAME, where, limit); 6608 6608 if (!rowSet) { 6609 6609 return NULL; … … 6615 6615 6616 6616 for (i = 0; i < rowSet->n; i++) { 6617 p2MaskRow *object = p2MaskObjectFromMetadata(rowSet->data[i]);6617 chipMaskRow *object = chipMaskObjectFromMetadata(rowSet->data[i]); 6618 6618 psArrayAdd(returnSet, 0, object); 6619 6619 psFree(object); … … 6624 6624 return returnSet; 6625 6625 } 6626 bool p2MaskDeleteObject(psDB *dbh, const p2MaskRow *object)6627 { 6628 psMetadata *where = p2MaskMetadataFromObject(object);6629 long long count = psDBDeleteRows(dbh, P2MASK_TABLE_NAME, where, 0);6626 bool chipMaskDeleteObject(psDB *dbh, const chipMaskRow *object) 6627 { 6628 psMetadata *where = chipMaskMetadataFromObject(object); 6629 long long count = psDBDeleteRows(dbh, CHIPMASK_TABLE_NAME, where, 0); 6630 6630 psFree(where); 6631 6631 if (count < 0) { 6632 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2Mask");6632 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipMask"); 6633 6633 return false; 6634 6634 } … … 6636 6636 // XXX should this be a psAbort() instead? It is possible that 6637 6637 // having an object match multiple rows was by design. 6638 psError(PS_ERR_UNKNOWN, true, " p2MaskRow object matched more then one row. Check your database schema");6639 return false; 6640 } 6641 6642 return true; 6643 } 6644 long long p2MaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)6638 psError(PS_ERR_UNKNOWN, true, "chipMaskRow object matched more then one row. Check your database schema"); 6639 return false; 6640 } 6641 6642 return true; 6643 } 6644 long long chipMaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 6645 6645 { 6646 6646 long long deleted = 0; 6647 6647 6648 6648 for (long long i = 0; i < objects->n; i++) { 6649 p2MaskRow *object = objects->data[i];6650 psMetadata *where = p2MaskMetadataFromObject(object);6651 long long count = psDBDeleteRows(dbh, P2MASK_TABLE_NAME, where, limit);6649 chipMaskRow *object = objects->data[i]; 6650 psMetadata *where = chipMaskMetadataFromObject(object); 6651 long long count = psDBDeleteRows(dbh, CHIPMASK_TABLE_NAME, where, limit); 6652 6652 psFree(where); 6653 6653 if (count < 0) { 6654 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2Mask");6654 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipMask"); 6655 6655 return count; 6656 6656 } … … 6661 6661 return deleted; 6662 6662 } 6663 bool p2MaskPrintObjects(FILE *stream, psArray *objects, bool mdcf)6663 bool chipMaskPrintObjects(FILE *stream, psArray *objects, bool mdcf) 6664 6664 { 6665 6665 PS_ASSERT_PTR_NON_NULL(objects, false); … … 6667 6667 psMetadata *output = psMetadataAlloc(); 6668 6668 for (long i = 0; i < psArrayLength(objects); i++) { 6669 psMetadata *md = p2MaskMetadataFromObject(objects->data[i]);6669 psMetadata *md = chipMaskMetadataFromObject(objects->data[i]); 6670 6670 if (!psMetadataAddMetadata( 6671 6671 output, 6672 6672 PS_LIST_TAIL, 6673 P2MASK_TABLE_NAME,6673 CHIPMASK_TABLE_NAME, 6674 6674 PS_META_DUPLICATE_OK, 6675 6675 NULL, … … 6692 6692 return true; 6693 6693 } 6694 bool p2MaskPrintObject(FILE *stream, p2MaskRow *object, bool mdcf)6694 bool chipMaskPrintObject(FILE *stream, chipMaskRow *object, bool mdcf) 6695 6695 { 6696 6696 PS_ASSERT_PTR_NON_NULL(object, false); 6697 6697 6698 psMetadata *md = p2MaskMetadataFromObject(object);6698 psMetadata *md = chipMaskMetadataFromObject(object); 6699 6699 6700 6700 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 6707 6707 return true; 6708 6708 } 6709 static void p2ProcessedImfileRowFree(p2ProcessedImfileRow *object);6710 6711 p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *class_id, const char *recipe, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault)6712 { 6713 p2ProcessedImfileRow *_object;6714 6715 _object = psAlloc(sizeof( p2ProcessedImfileRow));6716 psMemSetDeallocator(_object, (psFreeFunc) p2ProcessedImfileRowFree);6709 static void chipProcessedImfileRowFree(chipProcessedImfileRow *object); 6710 6711 chipProcessedImfileRow *chipProcessedImfileRowAlloc(const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *class_id, const char *recipe, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 6712 { 6713 chipProcessedImfileRow *_object; 6714 6715 _object = psAlloc(sizeof(chipProcessedImfileRow)); 6716 psMemSetDeallocator(_object, (psFreeFunc)chipProcessedImfileRowFree); 6717 6717 6718 6718 _object->exp_tag = psStringCopy(exp_tag); 6719 _object-> p2_version = p2_version;6720 _object-> p1_version = p1_version;6719 _object->chip_version = chip_version; 6720 _object->guide_version = guide_version; 6721 6721 _object->class_id = psStringCopy(class_id); 6722 6722 _object->recipe = psStringCopy(recipe); … … 6732 6732 } 6733 6733 6734 static void p2ProcessedImfileRowFree(p2ProcessedImfileRow *object)6734 static void chipProcessedImfileRowFree(chipProcessedImfileRow *object) 6735 6735 { 6736 6736 psFree(object->exp_tag); … … 6742 6742 } 6743 6743 6744 bool p2ProcessedImfileCreateTable(psDB *dbh)6744 bool chipProcessedImfileCreateTable(psDB *dbh) 6745 6745 { 6746 6746 psMetadata *md = psMetadataAlloc(); … … 6750 6750 return false; 6751 6751 } 6752 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, "Primary Key", 0)) {6753 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");6754 psFree(md); 6755 return false; 6756 } 6757 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, 0)) {6758 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");6752 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, "Primary Key", 0)) { 6753 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 6754 psFree(md); 6755 return false; 6756 } 6757 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, 0)) { 6758 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 6759 6759 psFree(md); 6760 6760 return false; … … 6806 6806 } 6807 6807 6808 bool status = psDBCreateTable(dbh, P2PROCESSEDIMFILE_TABLE_NAME, md);6808 bool status = psDBCreateTable(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, md); 6809 6809 6810 6810 psFree(md); … … 6813 6813 } 6814 6814 6815 bool p2ProcessedImfileDropTable(psDB *dbh)6816 { 6817 return psDBDropTable(dbh, P2PROCESSEDIMFILE_TABLE_NAME);6818 } 6819 6820 bool p2ProcessedImfileInsert(psDB * dbh, const char *exp_tag, psS32 p2_version, psS32 p1_version, const char *class_id, const char *recipe, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault)6815 bool chipProcessedImfileDropTable(psDB *dbh) 6816 { 6817 return psDBDropTable(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME); 6818 } 6819 6820 bool chipProcessedImfileInsert(psDB * dbh, const char *exp_tag, psS32 chip_version, psS32 guide_version, const char *class_id, const char *recipe, const char *uri, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, const char *b1_uri, const char *b2_uri, psS16 fault) 6821 6821 { 6822 6822 psMetadata *md = psMetadataAlloc(); … … 6826 6826 return false; 6827 6827 } 6828 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, p2_version)) {6829 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");6830 psFree(md); 6831 return false; 6832 } 6833 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, p1_version)) {6834 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");6828 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, chip_version)) { 6829 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 6830 psFree(md); 6831 return false; 6832 } 6833 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, guide_version)) { 6834 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 6835 6835 psFree(md); 6836 6836 return false; … … 6882 6882 } 6883 6883 6884 bool status = psDBInsertOneRow(dbh, P2PROCESSEDIMFILE_TABLE_NAME, md);6884 bool status = psDBInsertOneRow(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, md); 6885 6885 psFree(md); 6886 6886 … … 6888 6888 } 6889 6889 6890 long long p2ProcessedImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)6890 long long chipProcessedImfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 6891 6891 { 6892 6892 long long deleted = 0; 6893 6893 6894 long long count = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit);6894 long long count = psDBDeleteRows(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, where, limit); 6895 6895 if (count < 0) { 6896 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedImfile");6896 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipProcessedImfile"); 6897 6897 return count; 6898 6898 … … 6902 6902 return deleted; 6903 6903 } 6904 bool p2ProcessedImfileInsertObject(psDB *dbh, p2ProcessedImfileRow *object)6905 { 6906 return p2ProcessedImfileInsert(dbh, object->exp_tag, object->p2_version, object->p1_version, object->class_id, object->recipe, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault);6907 } 6908 6909 bool p2ProcessedImfileInsertObjects(psDB *dbh, psArray *objects)6904 bool chipProcessedImfileInsertObject(psDB *dbh, chipProcessedImfileRow *object) 6905 { 6906 return chipProcessedImfileInsert(dbh, object->exp_tag, object->chip_version, object->guide_version, object->class_id, object->recipe, object->uri, object->bg, object->bg_stdev, object->bg_mean_stdev, object->b1_uri, object->b2_uri, object->fault); 6907 } 6908 6909 bool chipProcessedImfileInsertObjects(psDB *dbh, psArray *objects) 6910 6910 { 6911 6911 for (long i = 0; i < psArrayLength(objects); i++) { 6912 if (! p2ProcessedImfileInsertObject(dbh, objects->data[i])) {6912 if (!chipProcessedImfileInsertObject(dbh, objects->data[i])) { 6913 6913 return false; 6914 6914 } … … 6918 6918 } 6919 6919 6920 bool p2ProcessedImfileInsertFits(psDB *dbh, const psFits *fits)6920 bool chipProcessedImfileInsertFits(psDB *dbh, const psFits *fits) 6921 6921 { 6922 6922 psArray *rowSet; 6923 6923 6924 // move to (the first?) extension named P2PROCESSEDIMFILE_TABLE_NAME6925 if (!psFitsMoveExtName(fits, P2PROCESSEDIMFILE_TABLE_NAME)) {6926 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P2PROCESSEDIMFILE_TABLE_NAME);6924 // move to (the first?) extension named CHIPPROCESSEDIMFILE_TABLE_NAME 6925 if (!psFitsMoveExtName(fits, CHIPPROCESSEDIMFILE_TABLE_NAME)) { 6926 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CHIPPROCESSEDIMFILE_TABLE_NAME); 6927 6927 return false; 6928 6928 } … … 6942 6942 } 6943 6943 6944 if (!psDBInsertRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, rowSet)) {6944 if (!psDBInsertRows(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, rowSet)) { 6945 6945 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 6946 6946 psFree(rowSet); … … 6953 6953 } 6954 6954 6955 bool p2ProcessedImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)6955 bool chipProcessedImfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 6956 6956 { 6957 6957 psArray *rowSet; 6958 6958 6959 rowSet = psDBSelectRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit);6959 rowSet = psDBSelectRows(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, where, limit); 6960 6960 if (!rowSet) { 6961 6961 return false; … … 6963 6963 6964 6964 // output to fits 6965 if (!psFitsWriteTable(fits, NULL, rowSet, P2PROCESSEDIMFILE_TABLE_NAME)) {6965 if (!psFitsWriteTable(fits, NULL, rowSet, CHIPPROCESSEDIMFILE_TABLE_NAME)) { 6966 6966 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 6967 6967 psFree(rowSet); … … 6974 6974 } 6975 6975 6976 psMetadata * p2ProcessedImfileMetadataFromObject(const p2ProcessedImfileRow *object)6976 psMetadata *chipProcessedImfileMetadataFromObject(const chipProcessedImfileRow *object) 6977 6977 { 6978 6978 psMetadata *md = psMetadataAlloc(); … … 6982 6982 return false; 6983 6983 } 6984 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, object->p2_version)) {6985 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");6986 psFree(md); 6987 return false; 6988 } 6989 if (!psMetadataAdd(md, PS_LIST_TAIL, " p1_version", PS_DATA_S32, NULL, object->p1_version)) {6990 psError(PS_ERR_UNKNOWN, false, "failed to add item p1_version");6984 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, object->chip_version)) { 6985 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 6986 psFree(md); 6987 return false; 6988 } 6989 if (!psMetadataAdd(md, PS_LIST_TAIL, "guide_version", PS_DATA_S32, NULL, object->guide_version)) { 6990 psError(PS_ERR_UNKNOWN, false, "failed to add item guide_version"); 6991 6991 psFree(md); 6992 6992 return false; … … 7042 7042 } 7043 7043 7044 p2ProcessedImfileRow *p2ProcessedImfileObjectFromMetadata(psMetadata *md)7044 chipProcessedImfileRow *chipProcessedImfileObjectFromMetadata(psMetadata *md) 7045 7045 { 7046 7046 … … 7051 7051 return false; 7052 7052 } 7053 psS32 p2_version = psMetadataLookupS32(&status, md, "p2_version");7054 if (!status) { 7055 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p2_version");7056 return false; 7057 } 7058 psS32 p1_version = psMetadataLookupS32(&status, md, "p1_version");7059 if (!status) { 7060 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p1_version");7053 psS32 chip_version = psMetadataLookupS32(&status, md, "chip_version"); 7054 if (!status) { 7055 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_version"); 7056 return false; 7057 } 7058 psS32 guide_version = psMetadataLookupS32(&status, md, "guide_version"); 7059 if (!status) { 7060 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item guide_version"); 7061 7061 return false; 7062 7062 } … … 7107 7107 } 7108 7108 7109 return p2ProcessedImfileRowAlloc(exp_tag, p2_version, p1_version, class_id, recipe, uri, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault);7110 } 7111 psArray * p2ProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)7109 return chipProcessedImfileRowAlloc(exp_tag, chip_version, guide_version, class_id, recipe, uri, bg, bg_stdev, bg_mean_stdev, b1_uri, b2_uri, fault); 7110 } 7111 psArray *chipProcessedImfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 7112 7112 { 7113 7113 psArray *rowSet; … … 7115 7115 psU64 i; 7116 7116 7117 rowSet = psDBSelectRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit);7117 rowSet = psDBSelectRows(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, where, limit); 7118 7118 if (!rowSet) { 7119 7119 return NULL; … … 7125 7125 7126 7126 for (i = 0; i < rowSet->n; i++) { 7127 p2ProcessedImfileRow *object = p2ProcessedImfileObjectFromMetadata(rowSet->data[i]);7127 chipProcessedImfileRow *object = chipProcessedImfileObjectFromMetadata(rowSet->data[i]); 7128 7128 psArrayAdd(returnSet, 0, object); 7129 7129 psFree(object); … … 7134 7134 return returnSet; 7135 7135 } 7136 bool p2ProcessedImfileDeleteObject(psDB *dbh, const p2ProcessedImfileRow *object)7137 { 7138 psMetadata *where = p2ProcessedImfileMetadataFromObject(object);7139 long long count = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, 0);7136 bool chipProcessedImfileDeleteObject(psDB *dbh, const chipProcessedImfileRow *object) 7137 { 7138 psMetadata *where = chipProcessedImfileMetadataFromObject(object); 7139 long long count = psDBDeleteRows(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, where, 0); 7140 7140 psFree(where); 7141 7141 if (count < 0) { 7142 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedImfile");7142 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipProcessedImfile"); 7143 7143 return false; 7144 7144 } … … 7146 7146 // XXX should this be a psAbort() instead? It is possible that 7147 7147 // having an object match multiple rows was by design. 7148 psError(PS_ERR_UNKNOWN, true, " p2ProcessedImfileRow object matched more then one row. Check your database schema");7149 return false; 7150 } 7151 7152 return true; 7153 } 7154 long long p2ProcessedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)7148 psError(PS_ERR_UNKNOWN, true, "chipProcessedImfileRow object matched more then one row. Check your database schema"); 7149 return false; 7150 } 7151 7152 return true; 7153 } 7154 long long chipProcessedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 7155 7155 { 7156 7156 long long deleted = 0; 7157 7157 7158 7158 for (long long i = 0; i < objects->n; i++) { 7159 p2ProcessedImfileRow *object = objects->data[i];7160 psMetadata *where = p2ProcessedImfileMetadataFromObject(object);7161 long long count = psDBDeleteRows(dbh, P2PROCESSEDIMFILE_TABLE_NAME, where, limit);7159 chipProcessedImfileRow *object = objects->data[i]; 7160 psMetadata *where = chipProcessedImfileMetadataFromObject(object); 7161 long long count = psDBDeleteRows(dbh, CHIPPROCESSEDIMFILE_TABLE_NAME, where, limit); 7162 7162 psFree(where); 7163 7163 if (count < 0) { 7164 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2ProcessedImfile");7164 psError(PS_ERR_UNKNOWN, true, "failed to delete row from chipProcessedImfile"); 7165 7165 return count; 7166 7166 } … … 7171 7171 return deleted; 7172 7172 } 7173 bool p2ProcessedImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)7173 bool chipProcessedImfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 7174 7174 { 7175 7175 PS_ASSERT_PTR_NON_NULL(objects, false); … … 7177 7177 psMetadata *output = psMetadataAlloc(); 7178 7178 for (long i = 0; i < psArrayLength(objects); i++) { 7179 psMetadata *md = p2ProcessedImfileMetadataFromObject(objects->data[i]);7179 psMetadata *md = chipProcessedImfileMetadataFromObject(objects->data[i]); 7180 7180 if (!psMetadataAddMetadata( 7181 7181 output, 7182 7182 PS_LIST_TAIL, 7183 P2PROCESSEDIMFILE_TABLE_NAME,7183 CHIPPROCESSEDIMFILE_TABLE_NAME, 7184 7184 PS_META_DUPLICATE_OK, 7185 7185 NULL, … … 7202 7202 return true; 7203 7203 } 7204 bool p2ProcessedImfilePrintObject(FILE *stream, p2ProcessedImfileRow *object, bool mdcf)7204 bool chipProcessedImfilePrintObject(FILE *stream, chipProcessedImfileRow *object, bool mdcf) 7205 7205 { 7206 7206 PS_ASSERT_PTR_NON_NULL(object, false); 7207 7207 7208 psMetadata *md = p2ProcessedImfileMetadataFromObject(object);7208 psMetadata *md = chipProcessedImfileMetadataFromObject(object); 7209 7209 7210 7210 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 7217 7217 return true; 7218 7218 } 7219 static void p3PendingExpRowFree(p3PendingExpRow *object);7220 7221 p3PendingExpRow *p3PendingExpRowAlloc(const char *exp_tag, psS32 p3_version, psS32 p2_version, const char *label, const char *expgroup, const char *dvodb)7222 { 7223 p3PendingExpRow *_object;7224 7225 _object = psAlloc(sizeof( p3PendingExpRow));7226 psMemSetDeallocator(_object, (psFreeFunc) p3PendingExpRowFree);7219 static void camPendingExpRowFree(camPendingExpRow *object); 7220 7221 camPendingExpRow *camPendingExpRowAlloc(const char *exp_tag, psS32 cam_version, psS32 chip_version, const char *label, const char *expgroup, const char *dvodb) 7222 { 7223 camPendingExpRow *_object; 7224 7225 _object = psAlloc(sizeof(camPendingExpRow)); 7226 psMemSetDeallocator(_object, (psFreeFunc)camPendingExpRowFree); 7227 7227 7228 7228 _object->exp_tag = psStringCopy(exp_tag); 7229 _object-> p3_version = p3_version;7230 _object-> p2_version = p2_version;7229 _object->cam_version = cam_version; 7230 _object->chip_version = chip_version; 7231 7231 _object->label = psStringCopy(label); 7232 7232 _object->expgroup = psStringCopy(expgroup); … … 7236 7236 } 7237 7237 7238 static void p3PendingExpRowFree(p3PendingExpRow *object)7238 static void camPendingExpRowFree(camPendingExpRow *object) 7239 7239 { 7240 7240 psFree(object->exp_tag); … … 7244 7244 } 7245 7245 7246 bool p3PendingExpCreateTable(psDB *dbh)7246 bool camPendingExpCreateTable(psDB *dbh) 7247 7247 { 7248 7248 psMetadata *md = psMetadataAlloc(); … … 7252 7252 return false; 7253 7253 } 7254 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, "Primary Key", 0)) {7255 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");7256 psFree(md); 7257 return false; 7258 } 7259 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, 0)) {7260 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");7254 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, "Primary Key", 0)) { 7255 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 7256 psFree(md); 7257 return false; 7258 } 7259 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, 0)) { 7260 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 7261 7261 psFree(md); 7262 7262 return false; … … 7278 7278 } 7279 7279 7280 bool status = psDBCreateTable(dbh, P3PENDINGEXP_TABLE_NAME, md);7280 bool status = psDBCreateTable(dbh, CAMPENDINGEXP_TABLE_NAME, md); 7281 7281 7282 7282 psFree(md); … … 7285 7285 } 7286 7286 7287 bool p3PendingExpDropTable(psDB *dbh)7288 { 7289 return psDBDropTable(dbh, P3PENDINGEXP_TABLE_NAME);7290 } 7291 7292 bool p3PendingExpInsert(psDB * dbh, const char *exp_tag, psS32 p3_version, psS32 p2_version, const char *label, const char *expgroup, const char *dvodb)7287 bool camPendingExpDropTable(psDB *dbh) 7288 { 7289 return psDBDropTable(dbh, CAMPENDINGEXP_TABLE_NAME); 7290 } 7291 7292 bool camPendingExpInsert(psDB * dbh, const char *exp_tag, psS32 cam_version, psS32 chip_version, const char *label, const char *expgroup, const char *dvodb) 7293 7293 { 7294 7294 psMetadata *md = psMetadataAlloc(); … … 7298 7298 return false; 7299 7299 } 7300 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, p3_version)) {7301 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");7302 psFree(md); 7303 return false; 7304 } 7305 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, p2_version)) {7306 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");7300 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, cam_version)) { 7301 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 7302 psFree(md); 7303 return false; 7304 } 7305 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, chip_version)) { 7306 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 7307 7307 psFree(md); 7308 7308 return false; … … 7324 7324 } 7325 7325 7326 bool status = psDBInsertOneRow(dbh, P3PENDINGEXP_TABLE_NAME, md);7326 bool status = psDBInsertOneRow(dbh, CAMPENDINGEXP_TABLE_NAME, md); 7327 7327 psFree(md); 7328 7328 … … 7330 7330 } 7331 7331 7332 long long p3PendingExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)7332 long long camPendingExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 7333 7333 { 7334 7334 long long deleted = 0; 7335 7335 7336 long long count = psDBDeleteRows(dbh, P3PENDINGEXP_TABLE_NAME, where, limit);7336 long long count = psDBDeleteRows(dbh, CAMPENDINGEXP_TABLE_NAME, where, limit); 7337 7337 if (count < 0) { 7338 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3PendingExp");7338 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camPendingExp"); 7339 7339 return count; 7340 7340 … … 7344 7344 return deleted; 7345 7345 } 7346 bool p3PendingExpInsertObject(psDB *dbh, p3PendingExpRow *object)7347 { 7348 return p3PendingExpInsert(dbh, object->exp_tag, object->p3_version, object->p2_version, object->label, object->expgroup, object->dvodb);7349 } 7350 7351 bool p3PendingExpInsertObjects(psDB *dbh, psArray *objects)7346 bool camPendingExpInsertObject(psDB *dbh, camPendingExpRow *object) 7347 { 7348 return camPendingExpInsert(dbh, object->exp_tag, object->cam_version, object->chip_version, object->label, object->expgroup, object->dvodb); 7349 } 7350 7351 bool camPendingExpInsertObjects(psDB *dbh, psArray *objects) 7352 7352 { 7353 7353 for (long i = 0; i < psArrayLength(objects); i++) { 7354 if (! p3PendingExpInsertObject(dbh, objects->data[i])) {7354 if (!camPendingExpInsertObject(dbh, objects->data[i])) { 7355 7355 return false; 7356 7356 } … … 7360 7360 } 7361 7361 7362 bool p3PendingExpInsertFits(psDB *dbh, const psFits *fits)7362 bool camPendingExpInsertFits(psDB *dbh, const psFits *fits) 7363 7363 { 7364 7364 psArray *rowSet; 7365 7365 7366 // move to (the first?) extension named P3PENDINGEXP_TABLE_NAME7367 if (!psFitsMoveExtName(fits, P3PENDINGEXP_TABLE_NAME)) {7368 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P3PENDINGEXP_TABLE_NAME);7366 // move to (the first?) extension named CAMPENDINGEXP_TABLE_NAME 7367 if (!psFitsMoveExtName(fits, CAMPENDINGEXP_TABLE_NAME)) { 7368 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CAMPENDINGEXP_TABLE_NAME); 7369 7369 return false; 7370 7370 } … … 7384 7384 } 7385 7385 7386 if (!psDBInsertRows(dbh, P3PENDINGEXP_TABLE_NAME, rowSet)) {7386 if (!psDBInsertRows(dbh, CAMPENDINGEXP_TABLE_NAME, rowSet)) { 7387 7387 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 7388 7388 psFree(rowSet); … … 7395 7395 } 7396 7396 7397 bool p3PendingExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)7397 bool camPendingExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 7398 7398 { 7399 7399 psArray *rowSet; 7400 7400 7401 rowSet = psDBSelectRows(dbh, P3PENDINGEXP_TABLE_NAME, where, limit);7401 rowSet = psDBSelectRows(dbh, CAMPENDINGEXP_TABLE_NAME, where, limit); 7402 7402 if (!rowSet) { 7403 7403 return false; … … 7405 7405 7406 7406 // output to fits 7407 if (!psFitsWriteTable(fits, NULL, rowSet, P3PENDINGEXP_TABLE_NAME)) {7407 if (!psFitsWriteTable(fits, NULL, rowSet, CAMPENDINGEXP_TABLE_NAME)) { 7408 7408 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 7409 7409 psFree(rowSet); … … 7416 7416 } 7417 7417 7418 psMetadata * p3PendingExpMetadataFromObject(const p3PendingExpRow *object)7418 psMetadata *camPendingExpMetadataFromObject(const camPendingExpRow *object) 7419 7419 { 7420 7420 psMetadata *md = psMetadataAlloc(); … … 7424 7424 return false; 7425 7425 } 7426 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, object->p3_version)) {7427 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");7428 psFree(md); 7429 return false; 7430 } 7431 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, object->p2_version)) {7432 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");7426 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, object->cam_version)) { 7427 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 7428 psFree(md); 7429 return false; 7430 } 7431 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, object->chip_version)) { 7432 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 7433 7433 psFree(md); 7434 7434 return false; … … 7454 7454 } 7455 7455 7456 p3PendingExpRow *p3PendingExpObjectFromMetadata(psMetadata *md)7456 camPendingExpRow *camPendingExpObjectFromMetadata(psMetadata *md) 7457 7457 { 7458 7458 … … 7463 7463 return false; 7464 7464 } 7465 psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");7466 if (!status) { 7467 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");7468 return false; 7469 } 7470 psS32 p2_version = psMetadataLookupS32(&status, md, "p2_version");7471 if (!status) { 7472 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p2_version");7465 psS32 cam_version = psMetadataLookupS32(&status, md, "cam_version"); 7466 if (!status) { 7467 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_version"); 7468 return false; 7469 } 7470 psS32 chip_version = psMetadataLookupS32(&status, md, "chip_version"); 7471 if (!status) { 7472 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_version"); 7473 7473 return false; 7474 7474 } … … 7489 7489 } 7490 7490 7491 return p3PendingExpRowAlloc(exp_tag, p3_version, p2_version, label, expgroup, dvodb);7492 } 7493 psArray * p3PendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)7491 return camPendingExpRowAlloc(exp_tag, cam_version, chip_version, label, expgroup, dvodb); 7492 } 7493 psArray *camPendingExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 7494 7494 { 7495 7495 psArray *rowSet; … … 7497 7497 psU64 i; 7498 7498 7499 rowSet = psDBSelectRows(dbh, P3PENDINGEXP_TABLE_NAME, where, limit);7499 rowSet = psDBSelectRows(dbh, CAMPENDINGEXP_TABLE_NAME, where, limit); 7500 7500 if (!rowSet) { 7501 7501 return NULL; … … 7507 7507 7508 7508 for (i = 0; i < rowSet->n; i++) { 7509 p3PendingExpRow *object = p3PendingExpObjectFromMetadata(rowSet->data[i]);7509 camPendingExpRow *object = camPendingExpObjectFromMetadata(rowSet->data[i]); 7510 7510 psArrayAdd(returnSet, 0, object); 7511 7511 psFree(object); … … 7516 7516 return returnSet; 7517 7517 } 7518 bool p3PendingExpDeleteObject(psDB *dbh, const p3PendingExpRow *object)7519 { 7520 psMetadata *where = p3PendingExpMetadataFromObject(object);7521 long long count = psDBDeleteRows(dbh, P3PENDINGEXP_TABLE_NAME, where, 0);7518 bool camPendingExpDeleteObject(psDB *dbh, const camPendingExpRow *object) 7519 { 7520 psMetadata *where = camPendingExpMetadataFromObject(object); 7521 long long count = psDBDeleteRows(dbh, CAMPENDINGEXP_TABLE_NAME, where, 0); 7522 7522 psFree(where); 7523 7523 if (count < 0) { 7524 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3PendingExp");7524 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camPendingExp"); 7525 7525 return false; 7526 7526 } … … 7528 7528 // XXX should this be a psAbort() instead? It is possible that 7529 7529 // having an object match multiple rows was by design. 7530 psError(PS_ERR_UNKNOWN, true, " p3PendingExpRow object matched more then one row. Check your database schema");7531 return false; 7532 } 7533 7534 return true; 7535 } 7536 long long p3PendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)7530 psError(PS_ERR_UNKNOWN, true, "camPendingExpRow object matched more then one row. Check your database schema"); 7531 return false; 7532 } 7533 7534 return true; 7535 } 7536 long long camPendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 7537 7537 { 7538 7538 long long deleted = 0; 7539 7539 7540 7540 for (long long i = 0; i < objects->n; i++) { 7541 p3PendingExpRow *object = objects->data[i];7542 psMetadata *where = p3PendingExpMetadataFromObject(object);7543 long long count = psDBDeleteRows(dbh, P3PENDINGEXP_TABLE_NAME, where, limit);7541 camPendingExpRow *object = objects->data[i]; 7542 psMetadata *where = camPendingExpMetadataFromObject(object); 7543 long long count = psDBDeleteRows(dbh, CAMPENDINGEXP_TABLE_NAME, where, limit); 7544 7544 psFree(where); 7545 7545 if (count < 0) { 7546 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3PendingExp");7546 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camPendingExp"); 7547 7547 return count; 7548 7548 } … … 7553 7553 return deleted; 7554 7554 } 7555 bool p3PendingExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)7555 bool camPendingExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 7556 7556 { 7557 7557 PS_ASSERT_PTR_NON_NULL(objects, false); … … 7559 7559 psMetadata *output = psMetadataAlloc(); 7560 7560 for (long i = 0; i < psArrayLength(objects); i++) { 7561 psMetadata *md = p3PendingExpMetadataFromObject(objects->data[i]);7561 psMetadata *md = camPendingExpMetadataFromObject(objects->data[i]); 7562 7562 if (!psMetadataAddMetadata( 7563 7563 output, 7564 7564 PS_LIST_TAIL, 7565 P3PENDINGEXP_TABLE_NAME,7565 CAMPENDINGEXP_TABLE_NAME, 7566 7566 PS_META_DUPLICATE_OK, 7567 7567 NULL, … … 7584 7584 return true; 7585 7585 } 7586 bool p3PendingExpPrintObject(FILE *stream, p3PendingExpRow *object, bool mdcf)7586 bool camPendingExpPrintObject(FILE *stream, camPendingExpRow *object, bool mdcf) 7587 7587 { 7588 7588 PS_ASSERT_PTR_NON_NULL(object, false); 7589 7589 7590 psMetadata *md = p3PendingExpMetadataFromObject(object);7590 psMetadata *md = camPendingExpMetadataFromObject(object); 7591 7591 7592 7592 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 7599 7599 return true; 7600 7600 } 7601 static void p3ProcessedExpRowFree(p3ProcessedExpRow *object);7602 7603 p3ProcessedExpRow *p3ProcessedExpRowAlloc(const char *exp_tag, psS32 p3_version, psS32 p2_version, const char *label, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS16 fault, const char *expgroup, const char *dvodb)7604 { 7605 p3ProcessedExpRow *_object;7606 7607 _object = psAlloc(sizeof( p3ProcessedExpRow));7608 psMemSetDeallocator(_object, (psFreeFunc) p3ProcessedExpRowFree);7601 static void camProcessedExpRowFree(camProcessedExpRow *object); 7602 7603 camProcessedExpRow *camProcessedExpRowAlloc(const char *exp_tag, psS32 cam_version, psS32 chip_version, const char *label, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS16 fault, const char *expgroup, const char *dvodb) 7604 { 7605 camProcessedExpRow *_object; 7606 7607 _object = psAlloc(sizeof(camProcessedExpRow)); 7608 psMemSetDeallocator(_object, (psFreeFunc)camProcessedExpRowFree); 7609 7609 7610 7610 _object->exp_tag = psStringCopy(exp_tag); 7611 _object-> p3_version = p3_version;7612 _object-> p2_version = p2_version;7611 _object->cam_version = cam_version; 7612 _object->chip_version = chip_version; 7613 7613 _object->label = psStringCopy(label); 7614 7614 _object->uri = psStringCopy(uri); … … 7631 7631 } 7632 7632 7633 static void p3ProcessedExpRowFree(p3ProcessedExpRow *object)7633 static void camProcessedExpRowFree(camProcessedExpRow *object) 7634 7634 { 7635 7635 psFree(object->exp_tag); … … 7643 7643 } 7644 7644 7645 bool p3ProcessedExpCreateTable(psDB *dbh)7645 bool camProcessedExpCreateTable(psDB *dbh) 7646 7646 { 7647 7647 psMetadata *md = psMetadataAlloc(); … … 7651 7651 return false; 7652 7652 } 7653 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, "Primary Key", 0)) {7654 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");7655 psFree(md); 7656 return false; 7657 } 7658 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, 0)) {7659 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");7653 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, "Primary Key", 0)) { 7654 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 7655 psFree(md); 7656 return false; 7657 } 7658 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, 0)) { 7659 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 7660 7660 psFree(md); 7661 7661 return false; … … 7742 7742 } 7743 7743 7744 bool status = psDBCreateTable(dbh, P3PROCESSEDEXP_TABLE_NAME, md);7744 bool status = psDBCreateTable(dbh, CAMPROCESSEDEXP_TABLE_NAME, md); 7745 7745 7746 7746 psFree(md); … … 7749 7749 } 7750 7750 7751 bool p3ProcessedExpDropTable(psDB *dbh)7752 { 7753 return psDBDropTable(dbh, P3PROCESSEDEXP_TABLE_NAME);7754 } 7755 7756 bool p3ProcessedExpInsert(psDB * dbh, const char *exp_tag, psS32 p3_version, psS32 p2_version, const char *label, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS16 fault, const char *expgroup, const char *dvodb)7751 bool camProcessedExpDropTable(psDB *dbh) 7752 { 7753 return psDBDropTable(dbh, CAMPROCESSEDEXP_TABLE_NAME); 7754 } 7755 7756 bool camProcessedExpInsert(psDB * dbh, const char *exp_tag, psS32 cam_version, psS32 chip_version, const char *label, const char *uri, const char *recipe, psF64 bg, psF64 bg_stdev, psF64 bg_mean_stdev, psF32 sigma_ra, psF32 sigma_dec, psS32 nastro, const char *b1_uri, const char *b2_uri, psF32 zp_mean, psF32 zp_stdev, psS16 fault, const char *expgroup, const char *dvodb) 7757 7757 { 7758 7758 psMetadata *md = psMetadataAlloc(); … … 7762 7762 return false; 7763 7763 } 7764 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, p3_version)) {7765 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");7766 psFree(md); 7767 return false; 7768 } 7769 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, p2_version)) {7770 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");7764 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, cam_version)) { 7765 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 7766 psFree(md); 7767 return false; 7768 } 7769 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, chip_version)) { 7770 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 7771 7771 psFree(md); 7772 7772 return false; … … 7853 7853 } 7854 7854 7855 bool status = psDBInsertOneRow(dbh, P3PROCESSEDEXP_TABLE_NAME, md);7855 bool status = psDBInsertOneRow(dbh, CAMPROCESSEDEXP_TABLE_NAME, md); 7856 7856 psFree(md); 7857 7857 … … 7859 7859 } 7860 7860 7861 long long p3ProcessedExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)7861 long long camProcessedExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 7862 7862 { 7863 7863 long long deleted = 0; 7864 7864 7865 long long count = psDBDeleteRows(dbh, P3PROCESSEDEXP_TABLE_NAME, where, limit);7865 long long count = psDBDeleteRows(dbh, CAMPROCESSEDEXP_TABLE_NAME, where, limit); 7866 7866 if (count < 0) { 7867 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3ProcessedExp");7867 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camProcessedExp"); 7868 7868 return count; 7869 7869 … … 7873 7873 return deleted; 7874 7874 } 7875 bool p3ProcessedExpInsertObject(psDB *dbh, p3ProcessedExpRow *object)7876 { 7877 return p3ProcessedExpInsert(dbh, object->exp_tag, object->p3_version, object->p2_version, object->label, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->fault, object->expgroup, object->dvodb);7878 } 7879 7880 bool p3ProcessedExpInsertObjects(psDB *dbh, psArray *objects)7875 bool camProcessedExpInsertObject(psDB *dbh, camProcessedExpRow *object) 7876 { 7877 return camProcessedExpInsert(dbh, object->exp_tag, object->cam_version, object->chip_version, object->label, object->uri, object->recipe, object->bg, object->bg_stdev, object->bg_mean_stdev, object->sigma_ra, object->sigma_dec, object->nastro, object->b1_uri, object->b2_uri, object->zp_mean, object->zp_stdev, object->fault, object->expgroup, object->dvodb); 7878 } 7879 7880 bool camProcessedExpInsertObjects(psDB *dbh, psArray *objects) 7881 7881 { 7882 7882 for (long i = 0; i < psArrayLength(objects); i++) { 7883 if (! p3ProcessedExpInsertObject(dbh, objects->data[i])) {7883 if (!camProcessedExpInsertObject(dbh, objects->data[i])) { 7884 7884 return false; 7885 7885 } … … 7889 7889 } 7890 7890 7891 bool p3ProcessedExpInsertFits(psDB *dbh, const psFits *fits)7891 bool camProcessedExpInsertFits(psDB *dbh, const psFits *fits) 7892 7892 { 7893 7893 psArray *rowSet; 7894 7894 7895 // move to (the first?) extension named P3PROCESSEDEXP_TABLE_NAME7896 if (!psFitsMoveExtName(fits, P3PROCESSEDEXP_TABLE_NAME)) {7897 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P3PROCESSEDEXP_TABLE_NAME);7895 // move to (the first?) extension named CAMPROCESSEDEXP_TABLE_NAME 7896 if (!psFitsMoveExtName(fits, CAMPROCESSEDEXP_TABLE_NAME)) { 7897 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CAMPROCESSEDEXP_TABLE_NAME); 7898 7898 return false; 7899 7899 } … … 7913 7913 } 7914 7914 7915 if (!psDBInsertRows(dbh, P3PROCESSEDEXP_TABLE_NAME, rowSet)) {7915 if (!psDBInsertRows(dbh, CAMPROCESSEDEXP_TABLE_NAME, rowSet)) { 7916 7916 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 7917 7917 psFree(rowSet); … … 7924 7924 } 7925 7925 7926 bool p3ProcessedExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)7926 bool camProcessedExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 7927 7927 { 7928 7928 psArray *rowSet; 7929 7929 7930 rowSet = psDBSelectRows(dbh, P3PROCESSEDEXP_TABLE_NAME, where, limit);7930 rowSet = psDBSelectRows(dbh, CAMPROCESSEDEXP_TABLE_NAME, where, limit); 7931 7931 if (!rowSet) { 7932 7932 return false; … … 7934 7934 7935 7935 // output to fits 7936 if (!psFitsWriteTable(fits, NULL, rowSet, P3PROCESSEDEXP_TABLE_NAME)) {7936 if (!psFitsWriteTable(fits, NULL, rowSet, CAMPROCESSEDEXP_TABLE_NAME)) { 7937 7937 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 7938 7938 psFree(rowSet); … … 7945 7945 } 7946 7946 7947 psMetadata * p3ProcessedExpMetadataFromObject(const p3ProcessedExpRow *object)7947 psMetadata *camProcessedExpMetadataFromObject(const camProcessedExpRow *object) 7948 7948 { 7949 7949 psMetadata *md = psMetadataAlloc(); … … 7953 7953 return false; 7954 7954 } 7955 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, object->p3_version)) {7956 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");7957 psFree(md); 7958 return false; 7959 } 7960 if (!psMetadataAdd(md, PS_LIST_TAIL, " p2_version", PS_DATA_S32, NULL, object->p2_version)) {7961 psError(PS_ERR_UNKNOWN, false, "failed to add item p2_version");7955 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, object->cam_version)) { 7956 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 7957 psFree(md); 7958 return false; 7959 } 7960 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_version", PS_DATA_S32, NULL, object->chip_version)) { 7961 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_version"); 7962 7962 psFree(md); 7963 7963 return false; … … 8048 8048 } 8049 8049 8050 p3ProcessedExpRow *p3ProcessedExpObjectFromMetadata(psMetadata *md)8050 camProcessedExpRow *camProcessedExpObjectFromMetadata(psMetadata *md) 8051 8051 { 8052 8052 … … 8057 8057 return false; 8058 8058 } 8059 psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");8060 if (!status) { 8061 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");8062 return false; 8063 } 8064 psS32 p2_version = psMetadataLookupS32(&status, md, "p2_version");8065 if (!status) { 8066 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p2_version");8059 psS32 cam_version = psMetadataLookupS32(&status, md, "cam_version"); 8060 if (!status) { 8061 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_version"); 8062 return false; 8063 } 8064 psS32 chip_version = psMetadataLookupS32(&status, md, "chip_version"); 8065 if (!status) { 8066 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item chip_version"); 8067 8067 return false; 8068 8068 } … … 8148 8148 } 8149 8149 8150 return p3ProcessedExpRowAlloc(exp_tag, p3_version, p2_version, label, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, fault, expgroup, dvodb);8151 } 8152 psArray * p3ProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)8150 return camProcessedExpRowAlloc(exp_tag, cam_version, chip_version, label, uri, recipe, bg, bg_stdev, bg_mean_stdev, sigma_ra, sigma_dec, nastro, b1_uri, b2_uri, zp_mean, zp_stdev, fault, expgroup, dvodb); 8151 } 8152 psArray *camProcessedExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 8153 8153 { 8154 8154 psArray *rowSet; … … 8156 8156 psU64 i; 8157 8157 8158 rowSet = psDBSelectRows(dbh, P3PROCESSEDEXP_TABLE_NAME, where, limit);8158 rowSet = psDBSelectRows(dbh, CAMPROCESSEDEXP_TABLE_NAME, where, limit); 8159 8159 if (!rowSet) { 8160 8160 return NULL; … … 8166 8166 8167 8167 for (i = 0; i < rowSet->n; i++) { 8168 p3ProcessedExpRow *object = p3ProcessedExpObjectFromMetadata(rowSet->data[i]);8168 camProcessedExpRow *object = camProcessedExpObjectFromMetadata(rowSet->data[i]); 8169 8169 psArrayAdd(returnSet, 0, object); 8170 8170 psFree(object); … … 8175 8175 return returnSet; 8176 8176 } 8177 bool p3ProcessedExpDeleteObject(psDB *dbh, const p3ProcessedExpRow *object)8178 { 8179 psMetadata *where = p3ProcessedExpMetadataFromObject(object);8180 long long count = psDBDeleteRows(dbh, P3PROCESSEDEXP_TABLE_NAME, where, 0);8177 bool camProcessedExpDeleteObject(psDB *dbh, const camProcessedExpRow *object) 8178 { 8179 psMetadata *where = camProcessedExpMetadataFromObject(object); 8180 long long count = psDBDeleteRows(dbh, CAMPROCESSEDEXP_TABLE_NAME, where, 0); 8181 8181 psFree(where); 8182 8182 if (count < 0) { 8183 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3ProcessedExp");8183 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camProcessedExp"); 8184 8184 return false; 8185 8185 } … … 8187 8187 // XXX should this be a psAbort() instead? It is possible that 8188 8188 // having an object match multiple rows was by design. 8189 psError(PS_ERR_UNKNOWN, true, " p3ProcessedExpRow object matched more then one row. Check your database schema");8190 return false; 8191 } 8192 8193 return true; 8194 } 8195 long long p3ProcessedExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)8189 psError(PS_ERR_UNKNOWN, true, "camProcessedExpRow object matched more then one row. Check your database schema"); 8190 return false; 8191 } 8192 8193 return true; 8194 } 8195 long long camProcessedExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 8196 8196 { 8197 8197 long long deleted = 0; 8198 8198 8199 8199 for (long long i = 0; i < objects->n; i++) { 8200 p3ProcessedExpRow *object = objects->data[i];8201 psMetadata *where = p3ProcessedExpMetadataFromObject(object);8202 long long count = psDBDeleteRows(dbh, P3PROCESSEDEXP_TABLE_NAME, where, limit);8200 camProcessedExpRow *object = objects->data[i]; 8201 psMetadata *where = camProcessedExpMetadataFromObject(object); 8202 long long count = psDBDeleteRows(dbh, CAMPROCESSEDEXP_TABLE_NAME, where, limit); 8203 8203 psFree(where); 8204 8204 if (count < 0) { 8205 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3ProcessedExp");8205 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camProcessedExp"); 8206 8206 return count; 8207 8207 } … … 8212 8212 return deleted; 8213 8213 } 8214 bool p3ProcessedExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)8214 bool camProcessedExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 8215 8215 { 8216 8216 PS_ASSERT_PTR_NON_NULL(objects, false); … … 8218 8218 psMetadata *output = psMetadataAlloc(); 8219 8219 for (long i = 0; i < psArrayLength(objects); i++) { 8220 psMetadata *md = p3ProcessedExpMetadataFromObject(objects->data[i]);8220 psMetadata *md = camProcessedExpMetadataFromObject(objects->data[i]); 8221 8221 if (!psMetadataAddMetadata( 8222 8222 output, 8223 8223 PS_LIST_TAIL, 8224 P3PROCESSEDEXP_TABLE_NAME,8224 CAMPROCESSEDEXP_TABLE_NAME, 8225 8225 PS_META_DUPLICATE_OK, 8226 8226 NULL, … … 8243 8243 return true; 8244 8244 } 8245 bool p3ProcessedExpPrintObject(FILE *stream, p3ProcessedExpRow *object, bool mdcf)8245 bool camProcessedExpPrintObject(FILE *stream, camProcessedExpRow *object, bool mdcf) 8246 8246 { 8247 8247 PS_ASSERT_PTR_NON_NULL(object, false); 8248 8248 8249 psMetadata *md = p3ProcessedExpMetadataFromObject(object);8249 psMetadata *md = camProcessedExpMetadataFromObject(object); 8250 8250 8251 8251 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 8258 8258 return true; 8259 8259 } 8260 static void p3MaskRowFree(p3MaskRow *object);8261 8262 p3MaskRow *p3MaskRowAlloc(const char *label)8263 { 8264 p3MaskRow*_object;8265 8266 _object = psAlloc(sizeof( p3MaskRow));8267 psMemSetDeallocator(_object, (psFreeFunc) p3MaskRowFree);8260 static void camMaskRowFree(camMaskRow *object); 8261 8262 camMaskRow *camMaskRowAlloc(const char *label) 8263 { 8264 camMaskRow *_object; 8265 8266 _object = psAlloc(sizeof(camMaskRow)); 8267 psMemSetDeallocator(_object, (psFreeFunc)camMaskRowFree); 8268 8268 8269 8269 _object->label = psStringCopy(label); … … 8272 8272 } 8273 8273 8274 static void p3MaskRowFree(p3MaskRow *object)8274 static void camMaskRowFree(camMaskRow *object) 8275 8275 { 8276 8276 psFree(object->label); 8277 8277 } 8278 8278 8279 bool p3MaskCreateTable(psDB *dbh)8279 bool camMaskCreateTable(psDB *dbh) 8280 8280 { 8281 8281 psMetadata *md = psMetadataAlloc(); … … 8286 8286 } 8287 8287 8288 bool status = psDBCreateTable(dbh, P3MASK_TABLE_NAME, md);8288 bool status = psDBCreateTable(dbh, CAMMASK_TABLE_NAME, md); 8289 8289 8290 8290 psFree(md); … … 8293 8293 } 8294 8294 8295 bool p3MaskDropTable(psDB *dbh)8296 { 8297 return psDBDropTable(dbh, P3MASK_TABLE_NAME);8298 } 8299 8300 bool p3MaskInsert(psDB * dbh, const char *label)8295 bool camMaskDropTable(psDB *dbh) 8296 { 8297 return psDBDropTable(dbh, CAMMASK_TABLE_NAME); 8298 } 8299 8300 bool camMaskInsert(psDB * dbh, const char *label) 8301 8301 { 8302 8302 psMetadata *md = psMetadataAlloc(); … … 8307 8307 } 8308 8308 8309 bool status = psDBInsertOneRow(dbh, P3MASK_TABLE_NAME, md);8309 bool status = psDBInsertOneRow(dbh, CAMMASK_TABLE_NAME, md); 8310 8310 psFree(md); 8311 8311 … … 8313 8313 } 8314 8314 8315 long long p3MaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)8315 long long camMaskDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 8316 8316 { 8317 8317 long long deleted = 0; 8318 8318 8319 long long count = psDBDeleteRows(dbh, P3MASK_TABLE_NAME, where, limit);8319 long long count = psDBDeleteRows(dbh, CAMMASK_TABLE_NAME, where, limit); 8320 8320 if (count < 0) { 8321 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3Mask");8321 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camMask"); 8322 8322 return count; 8323 8323 … … 8327 8327 return deleted; 8328 8328 } 8329 bool p3MaskInsertObject(psDB *dbh, p3MaskRow *object)8330 { 8331 return p3MaskInsert(dbh, object->label);8332 } 8333 8334 bool p3MaskInsertObjects(psDB *dbh, psArray *objects)8329 bool camMaskInsertObject(psDB *dbh, camMaskRow *object) 8330 { 8331 return camMaskInsert(dbh, object->label); 8332 } 8333 8334 bool camMaskInsertObjects(psDB *dbh, psArray *objects) 8335 8335 { 8336 8336 for (long i = 0; i < psArrayLength(objects); i++) { 8337 if (! p3MaskInsertObject(dbh, objects->data[i])) {8337 if (!camMaskInsertObject(dbh, objects->data[i])) { 8338 8338 return false; 8339 8339 } … … 8343 8343 } 8344 8344 8345 bool p3MaskInsertFits(psDB *dbh, const psFits *fits)8345 bool camMaskInsertFits(psDB *dbh, const psFits *fits) 8346 8346 { 8347 8347 psArray *rowSet; 8348 8348 8349 // move to (the first?) extension named P3MASK_TABLE_NAME8350 if (!psFitsMoveExtName(fits, P3MASK_TABLE_NAME)) {8351 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P3MASK_TABLE_NAME);8349 // move to (the first?) extension named CAMMASK_TABLE_NAME 8350 if (!psFitsMoveExtName(fits, CAMMASK_TABLE_NAME)) { 8351 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", CAMMASK_TABLE_NAME); 8352 8352 return false; 8353 8353 } … … 8367 8367 } 8368 8368 8369 if (!psDBInsertRows(dbh, P3MASK_TABLE_NAME, rowSet)) {8369 if (!psDBInsertRows(dbh, CAMMASK_TABLE_NAME, rowSet)) { 8370 8370 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 8371 8371 psFree(rowSet); … … 8378 8378 } 8379 8379 8380 bool p3MaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)8380 bool camMaskSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 8381 8381 { 8382 8382 psArray *rowSet; 8383 8383 8384 rowSet = psDBSelectRows(dbh, P3MASK_TABLE_NAME, where, limit);8384 rowSet = psDBSelectRows(dbh, CAMMASK_TABLE_NAME, where, limit); 8385 8385 if (!rowSet) { 8386 8386 return false; … … 8388 8388 8389 8389 // output to fits 8390 if (!psFitsWriteTable(fits, NULL, rowSet, P3MASK_TABLE_NAME)) {8390 if (!psFitsWriteTable(fits, NULL, rowSet, CAMMASK_TABLE_NAME)) { 8391 8391 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 8392 8392 psFree(rowSet); … … 8399 8399 } 8400 8400 8401 psMetadata * p3MaskMetadataFromObject(const p3MaskRow *object)8401 psMetadata *camMaskMetadataFromObject(const camMaskRow *object) 8402 8402 { 8403 8403 psMetadata *md = psMetadataAlloc(); … … 8412 8412 } 8413 8413 8414 p3MaskRow *p3MaskObjectFromMetadata(psMetadata *md)8414 camMaskRow *camMaskObjectFromMetadata(psMetadata *md) 8415 8415 { 8416 8416 … … 8422 8422 } 8423 8423 8424 return p3MaskRowAlloc(label);8425 } 8426 psArray * p3MaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)8424 return camMaskRowAlloc(label); 8425 } 8426 psArray *camMaskSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 8427 8427 { 8428 8428 psArray *rowSet; … … 8430 8430 psU64 i; 8431 8431 8432 rowSet = psDBSelectRows(dbh, P3MASK_TABLE_NAME, where, limit);8432 rowSet = psDBSelectRows(dbh, CAMMASK_TABLE_NAME, where, limit); 8433 8433 if (!rowSet) { 8434 8434 return NULL; … … 8440 8440 8441 8441 for (i = 0; i < rowSet->n; i++) { 8442 p3MaskRow *object = p3MaskObjectFromMetadata(rowSet->data[i]);8442 camMaskRow *object = camMaskObjectFromMetadata(rowSet->data[i]); 8443 8443 psArrayAdd(returnSet, 0, object); 8444 8444 psFree(object); … … 8449 8449 return returnSet; 8450 8450 } 8451 bool p3MaskDeleteObject(psDB *dbh, const p3MaskRow *object)8452 { 8453 psMetadata *where = p3MaskMetadataFromObject(object);8454 long long count = psDBDeleteRows(dbh, P3MASK_TABLE_NAME, where, 0);8451 bool camMaskDeleteObject(psDB *dbh, const camMaskRow *object) 8452 { 8453 psMetadata *where = camMaskMetadataFromObject(object); 8454 long long count = psDBDeleteRows(dbh, CAMMASK_TABLE_NAME, where, 0); 8455 8455 psFree(where); 8456 8456 if (count < 0) { 8457 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3Mask");8457 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camMask"); 8458 8458 return false; 8459 8459 } … … 8461 8461 // XXX should this be a psAbort() instead? It is possible that 8462 8462 // having an object match multiple rows was by design. 8463 psError(PS_ERR_UNKNOWN, true, " p3MaskRow object matched more then one row. Check your database schema");8464 return false; 8465 } 8466 8467 return true; 8468 } 8469 long long p3MaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)8463 psError(PS_ERR_UNKNOWN, true, "camMaskRow object matched more then one row. Check your database schema"); 8464 return false; 8465 } 8466 8467 return true; 8468 } 8469 long long camMaskDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 8470 8470 { 8471 8471 long long deleted = 0; 8472 8472 8473 8473 for (long long i = 0; i < objects->n; i++) { 8474 p3MaskRow *object = objects->data[i];8475 psMetadata *where = p3MaskMetadataFromObject(object);8476 long long count = psDBDeleteRows(dbh, P3MASK_TABLE_NAME, where, limit);8474 camMaskRow *object = objects->data[i]; 8475 psMetadata *where = camMaskMetadataFromObject(object); 8476 long long count = psDBDeleteRows(dbh, CAMMASK_TABLE_NAME, where, limit); 8477 8477 psFree(where); 8478 8478 if (count < 0) { 8479 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3Mask");8479 psError(PS_ERR_UNKNOWN, true, "failed to delete row from camMask"); 8480 8480 return count; 8481 8481 } … … 8486 8486 return deleted; 8487 8487 } 8488 bool p3MaskPrintObjects(FILE *stream, psArray *objects, bool mdcf)8488 bool camMaskPrintObjects(FILE *stream, psArray *objects, bool mdcf) 8489 8489 { 8490 8490 PS_ASSERT_PTR_NON_NULL(objects, false); … … 8492 8492 psMetadata *output = psMetadataAlloc(); 8493 8493 for (long i = 0; i < psArrayLength(objects); i++) { 8494 psMetadata *md = p3MaskMetadataFromObject(objects->data[i]);8494 psMetadata *md = camMaskMetadataFromObject(objects->data[i]); 8495 8495 if (!psMetadataAddMetadata( 8496 8496 output, 8497 8497 PS_LIST_TAIL, 8498 P3MASK_TABLE_NAME,8498 CAMMASK_TABLE_NAME, 8499 8499 PS_META_DUPLICATE_OK, 8500 8500 NULL, … … 8517 8517 return true; 8518 8518 } 8519 bool p3MaskPrintObject(FILE *stream, p3MaskRow *object, bool mdcf)8519 bool camMaskPrintObject(FILE *stream, camMaskRow *object, bool mdcf) 8520 8520 { 8521 8521 PS_ASSERT_PTR_NON_NULL(object, false); 8522 8522 8523 psMetadata *md = p3MaskMetadataFromObject(object);8523 psMetadata *md = camMaskMetadataFromObject(object); 8524 8524 8525 8525 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 13744 13744 return true; 13745 13745 } 13746 static void p4RunRowFree(p4RunRow *object);13747 13748 p4RunRow *p4RunRowAlloc(psS32 p4_id, const char *mode, const char *state, const char *workdir, const char *dvodb, psTime* registered)13749 { 13750 p4RunRow*_object;13751 13752 _object = psAlloc(sizeof( p4RunRow));13753 psMemSetDeallocator(_object, (psFreeFunc) p4RunRowFree);13754 13755 _object-> p4_id = p4_id;13746 static void warpRunRowFree(warpRunRow *object); 13747 13748 warpRunRow *warpRunRowAlloc(psS32 warp_id, const char *mode, const char *state, const char *workdir, const char *dvodb, psTime* registered) 13749 { 13750 warpRunRow *_object; 13751 13752 _object = psAlloc(sizeof(warpRunRow)); 13753 psMemSetDeallocator(_object, (psFreeFunc)warpRunRowFree); 13754 13755 _object->warp_id = warp_id; 13756 13756 _object->mode = psStringCopy(mode); 13757 13757 _object->state = psStringCopy(state); … … 13763 13763 } 13764 13764 13765 static void p4RunRowFree(p4RunRow *object)13765 static void warpRunRowFree(warpRunRow *object) 13766 13766 { 13767 13767 psFree(object->mode); … … 13772 13772 } 13773 13773 13774 bool p4RunCreateTable(psDB *dbh)13774 bool warpRunCreateTable(psDB *dbh) 13775 13775 { 13776 13776 psMetadata *md = psMetadataAlloc(); 13777 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) {13778 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");13777 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) { 13778 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 13779 13779 psFree(md); 13780 13780 return false; … … 13806 13806 } 13807 13807 13808 bool status = psDBCreateTable(dbh, P4RUN_TABLE_NAME, md);13808 bool status = psDBCreateTable(dbh, WARPRUN_TABLE_NAME, md); 13809 13809 13810 13810 psFree(md); … … 13813 13813 } 13814 13814 13815 bool p4RunDropTable(psDB *dbh)13816 { 13817 return psDBDropTable(dbh, P4RUN_TABLE_NAME);13818 } 13819 13820 bool p4RunInsert(psDB * dbh, psS32 p4_id, const char *mode, const char *state, const char *workdir, const char *dvodb, psTime* registered)13815 bool warpRunDropTable(psDB *dbh) 13816 { 13817 return psDBDropTable(dbh, WARPRUN_TABLE_NAME); 13818 } 13819 13820 bool warpRunInsert(psDB * dbh, psS32 warp_id, const char *mode, const char *state, const char *workdir, const char *dvodb, psTime* registered) 13821 13821 { 13822 13822 psMetadata *md = psMetadataAlloc(); 13823 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, p4_id)) {13824 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");13823 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, warp_id)) { 13824 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 13825 13825 psFree(md); 13826 13826 return false; … … 13852 13852 } 13853 13853 13854 bool status = psDBInsertOneRow(dbh, P4RUN_TABLE_NAME, md);13854 bool status = psDBInsertOneRow(dbh, WARPRUN_TABLE_NAME, md); 13855 13855 psFree(md); 13856 13856 … … 13858 13858 } 13859 13859 13860 long long p4RunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)13860 long long warpRunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 13861 13861 { 13862 13862 long long deleted = 0; 13863 13863 13864 long long count = psDBDeleteRows(dbh, P4RUN_TABLE_NAME, where, limit);13864 long long count = psDBDeleteRows(dbh, WARPRUN_TABLE_NAME, where, limit); 13865 13865 if (count < 0) { 13866 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Run");13866 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpRun"); 13867 13867 return count; 13868 13868 … … 13872 13872 return deleted; 13873 13873 } 13874 bool p4RunInsertObject(psDB *dbh, p4RunRow *object)13875 { 13876 return p4RunInsert(dbh, object->p4_id, object->mode, object->state, object->workdir, object->dvodb, object->registered);13877 } 13878 13879 bool p4RunInsertObjects(psDB *dbh, psArray *objects)13874 bool warpRunInsertObject(psDB *dbh, warpRunRow *object) 13875 { 13876 return warpRunInsert(dbh, object->warp_id, object->mode, object->state, object->workdir, object->dvodb, object->registered); 13877 } 13878 13879 bool warpRunInsertObjects(psDB *dbh, psArray *objects) 13880 13880 { 13881 13881 for (long i = 0; i < psArrayLength(objects); i++) { 13882 if (! p4RunInsertObject(dbh, objects->data[i])) {13882 if (!warpRunInsertObject(dbh, objects->data[i])) { 13883 13883 return false; 13884 13884 } … … 13888 13888 } 13889 13889 13890 bool p4RunInsertFits(psDB *dbh, const psFits *fits)13890 bool warpRunInsertFits(psDB *dbh, const psFits *fits) 13891 13891 { 13892 13892 psArray *rowSet; 13893 13893 13894 // move to (the first?) extension named P4RUN_TABLE_NAME13895 if (!psFitsMoveExtName(fits, P4RUN_TABLE_NAME)) {13896 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P4RUN_TABLE_NAME);13894 // move to (the first?) extension named WARPRUN_TABLE_NAME 13895 if (!psFitsMoveExtName(fits, WARPRUN_TABLE_NAME)) { 13896 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", WARPRUN_TABLE_NAME); 13897 13897 return false; 13898 13898 } … … 13912 13912 } 13913 13913 13914 if (!psDBInsertRows(dbh, P4RUN_TABLE_NAME, rowSet)) {13914 if (!psDBInsertRows(dbh, WARPRUN_TABLE_NAME, rowSet)) { 13915 13915 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 13916 13916 psFree(rowSet); … … 13923 13923 } 13924 13924 13925 bool p4RunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)13925 bool warpRunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 13926 13926 { 13927 13927 psArray *rowSet; 13928 13928 13929 rowSet = psDBSelectRows(dbh, P4RUN_TABLE_NAME, where, limit);13929 rowSet = psDBSelectRows(dbh, WARPRUN_TABLE_NAME, where, limit); 13930 13930 if (!rowSet) { 13931 13931 return false; … … 13933 13933 13934 13934 // output to fits 13935 if (!psFitsWriteTable(fits, NULL, rowSet, P4RUN_TABLE_NAME)) {13935 if (!psFitsWriteTable(fits, NULL, rowSet, WARPRUN_TABLE_NAME)) { 13936 13936 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 13937 13937 psFree(rowSet); … … 13944 13944 } 13945 13945 13946 psMetadata * p4RunMetadataFromObject(const p4RunRow *object)13946 psMetadata *warpRunMetadataFromObject(const warpRunRow *object) 13947 13947 { 13948 13948 psMetadata *md = psMetadataAlloc(); 13949 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, object->p4_id)) {13950 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");13949 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, object->warp_id)) { 13950 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 13951 13951 psFree(md); 13952 13952 return false; … … 13982 13982 } 13983 13983 13984 p4RunRow *p4RunObjectFromMetadata(psMetadata *md)13984 warpRunRow *warpRunObjectFromMetadata(psMetadata *md) 13985 13985 { 13986 13986 13987 13987 bool status = false; 13988 psS32 p4_id = psMetadataLookupS32(&status, md, "p4_id");13989 if (!status) { 13990 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p4_id");13988 psS32 warp_id = psMetadataLookupS32(&status, md, "warp_id"); 13989 if (!status) { 13990 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id"); 13991 13991 return false; 13992 13992 } … … 14017 14017 } 14018 14018 14019 return p4RunRowAlloc(p4_id, mode, state, workdir, dvodb, registered);14020 } 14021 psArray * p4RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)14019 return warpRunRowAlloc(warp_id, mode, state, workdir, dvodb, registered); 14020 } 14021 psArray *warpRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 14022 14022 { 14023 14023 psArray *rowSet; … … 14025 14025 psU64 i; 14026 14026 14027 rowSet = psDBSelectRows(dbh, P4RUN_TABLE_NAME, where, limit);14027 rowSet = psDBSelectRows(dbh, WARPRUN_TABLE_NAME, where, limit); 14028 14028 if (!rowSet) { 14029 14029 return NULL; … … 14035 14035 14036 14036 for (i = 0; i < rowSet->n; i++) { 14037 p4RunRow *object = p4RunObjectFromMetadata(rowSet->data[i]);14037 warpRunRow *object = warpRunObjectFromMetadata(rowSet->data[i]); 14038 14038 psArrayAdd(returnSet, 0, object); 14039 14039 psFree(object); … … 14044 14044 return returnSet; 14045 14045 } 14046 bool p4RunDeleteObject(psDB *dbh, const p4RunRow *object)14047 { 14048 psMetadata *where = p4RunMetadataFromObject(object);14049 long long count = psDBDeleteRows(dbh, P4RUN_TABLE_NAME, where, 0);14046 bool warpRunDeleteObject(psDB *dbh, const warpRunRow *object) 14047 { 14048 psMetadata *where = warpRunMetadataFromObject(object); 14049 long long count = psDBDeleteRows(dbh, WARPRUN_TABLE_NAME, where, 0); 14050 14050 psFree(where); 14051 14051 if (count < 0) { 14052 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Run");14052 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpRun"); 14053 14053 return false; 14054 14054 } … … 14056 14056 // XXX should this be a psAbort() instead? It is possible that 14057 14057 // having an object match multiple rows was by design. 14058 psError(PS_ERR_UNKNOWN, true, " p4RunRow object matched more then one row. Check your database schema");14059 return false; 14060 } 14061 14062 return true; 14063 } 14064 long long p4RunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)14058 psError(PS_ERR_UNKNOWN, true, "warpRunRow object matched more then one row. Check your database schema"); 14059 return false; 14060 } 14061 14062 return true; 14063 } 14064 long long warpRunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 14065 14065 { 14066 14066 long long deleted = 0; 14067 14067 14068 14068 for (long long i = 0; i < objects->n; i++) { 14069 p4RunRow *object = objects->data[i];14070 psMetadata *where = p4RunMetadataFromObject(object);14071 long long count = psDBDeleteRows(dbh, P4RUN_TABLE_NAME, where, limit);14069 warpRunRow *object = objects->data[i]; 14070 psMetadata *where = warpRunMetadataFromObject(object); 14071 long long count = psDBDeleteRows(dbh, WARPRUN_TABLE_NAME, where, limit); 14072 14072 psFree(where); 14073 14073 if (count < 0) { 14074 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Run");14074 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpRun"); 14075 14075 return count; 14076 14076 } … … 14081 14081 return deleted; 14082 14082 } 14083 bool p4RunPrintObjects(FILE *stream, psArray *objects, bool mdcf)14083 bool warpRunPrintObjects(FILE *stream, psArray *objects, bool mdcf) 14084 14084 { 14085 14085 PS_ASSERT_PTR_NON_NULL(objects, false); … … 14087 14087 psMetadata *output = psMetadataAlloc(); 14088 14088 for (long i = 0; i < psArrayLength(objects); i++) { 14089 psMetadata *md = p4RunMetadataFromObject(objects->data[i]);14089 psMetadata *md = warpRunMetadataFromObject(objects->data[i]); 14090 14090 if (!psMetadataAddMetadata( 14091 14091 output, 14092 14092 PS_LIST_TAIL, 14093 P4RUN_TABLE_NAME,14093 WARPRUN_TABLE_NAME, 14094 14094 PS_META_DUPLICATE_OK, 14095 14095 NULL, … … 14112 14112 return true; 14113 14113 } 14114 bool p4RunPrintObject(FILE *stream, p4RunRow *object, bool mdcf)14114 bool warpRunPrintObject(FILE *stream, warpRunRow *object, bool mdcf) 14115 14115 { 14116 14116 PS_ASSERT_PTR_NON_NULL(object, false); 14117 14117 14118 psMetadata *md = p4RunMetadataFromObject(object);14118 psMetadata *md = warpRunMetadataFromObject(object); 14119 14119 14120 14120 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 14127 14127 return true; 14128 14128 } 14129 static void p4InputExpRowFree(p4InputExpRow *object);14130 14131 p4InputExpRow *p4InputExpRowAlloc(psS32 p4_id, const char *exp_tag, psS32 p3_version, bool magiced)14132 { 14133 p4InputExpRow*_object;14134 14135 _object = psAlloc(sizeof( p4InputExpRow));14136 psMemSetDeallocator(_object, (psFreeFunc) p4InputExpRowFree);14137 14138 _object-> p4_id = p4_id;14129 static void warpInputExpRowFree(warpInputExpRow *object); 14130 14131 warpInputExpRow *warpInputExpRowAlloc(psS32 warp_id, const char *exp_tag, psS32 cam_version, bool magiced) 14132 { 14133 warpInputExpRow *_object; 14134 14135 _object = psAlloc(sizeof(warpInputExpRow)); 14136 psMemSetDeallocator(_object, (psFreeFunc)warpInputExpRowFree); 14137 14138 _object->warp_id = warp_id; 14139 14139 _object->exp_tag = psStringCopy(exp_tag); 14140 _object-> p3_version = p3_version;14140 _object->cam_version = cam_version; 14141 14141 _object->magiced = magiced; 14142 14142 … … 14144 14144 } 14145 14145 14146 static void p4InputExpRowFree(p4InputExpRow *object)14146 static void warpInputExpRowFree(warpInputExpRow *object) 14147 14147 { 14148 14148 psFree(object->exp_tag); 14149 14149 } 14150 14150 14151 bool p4InputExpCreateTable(psDB *dbh)14151 bool warpInputExpCreateTable(psDB *dbh) 14152 14152 { 14153 14153 psMetadata *md = psMetadataAlloc(); 14154 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, "Primary Key", 0)) {14155 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14154 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, "Primary Key", 0)) { 14155 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14156 14156 psFree(md); 14157 14157 return false; … … 14162 14162 return false; 14163 14163 } 14164 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, "Key", 0)) {14165 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14164 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, "Key", 0)) { 14165 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 14166 14166 psFree(md); 14167 14167 return false; … … 14173 14173 } 14174 14174 14175 bool status = psDBCreateTable(dbh, P4INPUTEXP_TABLE_NAME, md);14175 bool status = psDBCreateTable(dbh, WARPINPUTEXP_TABLE_NAME, md); 14176 14176 14177 14177 psFree(md); … … 14180 14180 } 14181 14181 14182 bool p4InputExpDropTable(psDB *dbh)14183 { 14184 return psDBDropTable(dbh, P4INPUTEXP_TABLE_NAME);14185 } 14186 14187 bool p4InputExpInsert(psDB * dbh, psS32 p4_id, const char *exp_tag, psS32 p3_version, bool magiced)14182 bool warpInputExpDropTable(psDB *dbh) 14183 { 14184 return psDBDropTable(dbh, WARPINPUTEXP_TABLE_NAME); 14185 } 14186 14187 bool warpInputExpInsert(psDB * dbh, psS32 warp_id, const char *exp_tag, psS32 cam_version, bool magiced) 14188 14188 { 14189 14189 psMetadata *md = psMetadataAlloc(); 14190 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, p4_id)) {14191 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14190 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, warp_id)) { 14191 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14192 14192 psFree(md); 14193 14193 return false; … … 14198 14198 return false; 14199 14199 } 14200 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, p3_version)) {14201 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14200 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, cam_version)) { 14201 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 14202 14202 psFree(md); 14203 14203 return false; … … 14209 14209 } 14210 14210 14211 bool status = psDBInsertOneRow(dbh, P4INPUTEXP_TABLE_NAME, md);14211 bool status = psDBInsertOneRow(dbh, WARPINPUTEXP_TABLE_NAME, md); 14212 14212 psFree(md); 14213 14213 … … 14215 14215 } 14216 14216 14217 long long p4InputExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)14217 long long warpInputExpDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 14218 14218 { 14219 14219 long long deleted = 0; 14220 14220 14221 long long count = psDBDeleteRows(dbh, P4INPUTEXP_TABLE_NAME, where, limit);14221 long long count = psDBDeleteRows(dbh, WARPINPUTEXP_TABLE_NAME, where, limit); 14222 14222 if (count < 0) { 14223 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4InputExp");14223 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpInputExp"); 14224 14224 return count; 14225 14225 … … 14229 14229 return deleted; 14230 14230 } 14231 bool p4InputExpInsertObject(psDB *dbh, p4InputExpRow *object)14232 { 14233 return p4InputExpInsert(dbh, object->p4_id, object->exp_tag, object->p3_version, object->magiced);14234 } 14235 14236 bool p4InputExpInsertObjects(psDB *dbh, psArray *objects)14231 bool warpInputExpInsertObject(psDB *dbh, warpInputExpRow *object) 14232 { 14233 return warpInputExpInsert(dbh, object->warp_id, object->exp_tag, object->cam_version, object->magiced); 14234 } 14235 14236 bool warpInputExpInsertObjects(psDB *dbh, psArray *objects) 14237 14237 { 14238 14238 for (long i = 0; i < psArrayLength(objects); i++) { 14239 if (! p4InputExpInsertObject(dbh, objects->data[i])) {14239 if (!warpInputExpInsertObject(dbh, objects->data[i])) { 14240 14240 return false; 14241 14241 } … … 14245 14245 } 14246 14246 14247 bool p4InputExpInsertFits(psDB *dbh, const psFits *fits)14247 bool warpInputExpInsertFits(psDB *dbh, const psFits *fits) 14248 14248 { 14249 14249 psArray *rowSet; 14250 14250 14251 // move to (the first?) extension named P4INPUTEXP_TABLE_NAME14252 if (!psFitsMoveExtName(fits, P4INPUTEXP_TABLE_NAME)) {14253 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P4INPUTEXP_TABLE_NAME);14251 // move to (the first?) extension named WARPINPUTEXP_TABLE_NAME 14252 if (!psFitsMoveExtName(fits, WARPINPUTEXP_TABLE_NAME)) { 14253 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", WARPINPUTEXP_TABLE_NAME); 14254 14254 return false; 14255 14255 } … … 14269 14269 } 14270 14270 14271 if (!psDBInsertRows(dbh, P4INPUTEXP_TABLE_NAME, rowSet)) {14271 if (!psDBInsertRows(dbh, WARPINPUTEXP_TABLE_NAME, rowSet)) { 14272 14272 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 14273 14273 psFree(rowSet); … … 14280 14280 } 14281 14281 14282 bool p4InputExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)14282 bool warpInputExpSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 14283 14283 { 14284 14284 psArray *rowSet; 14285 14285 14286 rowSet = psDBSelectRows(dbh, P4INPUTEXP_TABLE_NAME, where, limit);14286 rowSet = psDBSelectRows(dbh, WARPINPUTEXP_TABLE_NAME, where, limit); 14287 14287 if (!rowSet) { 14288 14288 return false; … … 14290 14290 14291 14291 // output to fits 14292 if (!psFitsWriteTable(fits, NULL, rowSet, P4INPUTEXP_TABLE_NAME)) {14292 if (!psFitsWriteTable(fits, NULL, rowSet, WARPINPUTEXP_TABLE_NAME)) { 14293 14293 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 14294 14294 psFree(rowSet); … … 14301 14301 } 14302 14302 14303 psMetadata * p4InputExpMetadataFromObject(const p4InputExpRow *object)14303 psMetadata *warpInputExpMetadataFromObject(const warpInputExpRow *object) 14304 14304 { 14305 14305 psMetadata *md = psMetadataAlloc(); 14306 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, object->p4_id)) {14307 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14306 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, object->warp_id)) { 14307 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14308 14308 psFree(md); 14309 14309 return false; … … 14314 14314 return false; 14315 14315 } 14316 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, object->p3_version)) {14317 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14316 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, object->cam_version)) { 14317 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 14318 14318 psFree(md); 14319 14319 return false; … … 14329 14329 } 14330 14330 14331 p4InputExpRow *p4InputExpObjectFromMetadata(psMetadata *md)14331 warpInputExpRow *warpInputExpObjectFromMetadata(psMetadata *md) 14332 14332 { 14333 14333 14334 14334 bool status = false; 14335 psS32 p4_id = psMetadataLookupS32(&status, md, "p4_id");14336 if (!status) { 14337 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p4_id");14335 psS32 warp_id = psMetadataLookupS32(&status, md, "warp_id"); 14336 if (!status) { 14337 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id"); 14338 14338 return false; 14339 14339 } … … 14343 14343 return false; 14344 14344 } 14345 psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");14346 if (!status) { 14347 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");14345 psS32 cam_version = psMetadataLookupS32(&status, md, "cam_version"); 14346 if (!status) { 14347 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_version"); 14348 14348 return false; 14349 14349 } … … 14354 14354 } 14355 14355 14356 return p4InputExpRowAlloc(p4_id, exp_tag, p3_version, magiced);14357 } 14358 psArray * p4InputExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)14356 return warpInputExpRowAlloc(warp_id, exp_tag, cam_version, magiced); 14357 } 14358 psArray *warpInputExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 14359 14359 { 14360 14360 psArray *rowSet; … … 14362 14362 psU64 i; 14363 14363 14364 rowSet = psDBSelectRows(dbh, P4INPUTEXP_TABLE_NAME, where, limit);14364 rowSet = psDBSelectRows(dbh, WARPINPUTEXP_TABLE_NAME, where, limit); 14365 14365 if (!rowSet) { 14366 14366 return NULL; … … 14372 14372 14373 14373 for (i = 0; i < rowSet->n; i++) { 14374 p4InputExpRow *object = p4InputExpObjectFromMetadata(rowSet->data[i]);14374 warpInputExpRow *object = warpInputExpObjectFromMetadata(rowSet->data[i]); 14375 14375 psArrayAdd(returnSet, 0, object); 14376 14376 psFree(object); … … 14381 14381 return returnSet; 14382 14382 } 14383 bool p4InputExpDeleteObject(psDB *dbh, const p4InputExpRow *object)14384 { 14385 psMetadata *where = p4InputExpMetadataFromObject(object);14386 long long count = psDBDeleteRows(dbh, P4INPUTEXP_TABLE_NAME, where, 0);14383 bool warpInputExpDeleteObject(psDB *dbh, const warpInputExpRow *object) 14384 { 14385 psMetadata *where = warpInputExpMetadataFromObject(object); 14386 long long count = psDBDeleteRows(dbh, WARPINPUTEXP_TABLE_NAME, where, 0); 14387 14387 psFree(where); 14388 14388 if (count < 0) { 14389 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4InputExp");14389 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpInputExp"); 14390 14390 return false; 14391 14391 } … … 14393 14393 // XXX should this be a psAbort() instead? It is possible that 14394 14394 // having an object match multiple rows was by design. 14395 psError(PS_ERR_UNKNOWN, true, " p4InputExpRow object matched more then one row. Check your database schema");14396 return false; 14397 } 14398 14399 return true; 14400 } 14401 long long p4InputExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)14395 psError(PS_ERR_UNKNOWN, true, "warpInputExpRow object matched more then one row. Check your database schema"); 14396 return false; 14397 } 14398 14399 return true; 14400 } 14401 long long warpInputExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 14402 14402 { 14403 14403 long long deleted = 0; 14404 14404 14405 14405 for (long long i = 0; i < objects->n; i++) { 14406 p4InputExpRow *object = objects->data[i];14407 psMetadata *where = p4InputExpMetadataFromObject(object);14408 long long count = psDBDeleteRows(dbh, P4INPUTEXP_TABLE_NAME, where, limit);14406 warpInputExpRow *object = objects->data[i]; 14407 psMetadata *where = warpInputExpMetadataFromObject(object); 14408 long long count = psDBDeleteRows(dbh, WARPINPUTEXP_TABLE_NAME, where, limit); 14409 14409 psFree(where); 14410 14410 if (count < 0) { 14411 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4InputExp");14411 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpInputExp"); 14412 14412 return count; 14413 14413 } … … 14418 14418 return deleted; 14419 14419 } 14420 bool p4InputExpPrintObjects(FILE *stream, psArray *objects, bool mdcf)14420 bool warpInputExpPrintObjects(FILE *stream, psArray *objects, bool mdcf) 14421 14421 { 14422 14422 PS_ASSERT_PTR_NON_NULL(objects, false); … … 14424 14424 psMetadata *output = psMetadataAlloc(); 14425 14425 for (long i = 0; i < psArrayLength(objects); i++) { 14426 psMetadata *md = p4InputExpMetadataFromObject(objects->data[i]);14426 psMetadata *md = warpInputExpMetadataFromObject(objects->data[i]); 14427 14427 if (!psMetadataAddMetadata( 14428 14428 output, 14429 14429 PS_LIST_TAIL, 14430 P4INPUTEXP_TABLE_NAME,14430 WARPINPUTEXP_TABLE_NAME, 14431 14431 PS_META_DUPLICATE_OK, 14432 14432 NULL, … … 14449 14449 return true; 14450 14450 } 14451 bool p4InputExpPrintObject(FILE *stream, p4InputExpRow *object, bool mdcf)14451 bool warpInputExpPrintObject(FILE *stream, warpInputExpRow *object, bool mdcf) 14452 14452 { 14453 14453 PS_ASSERT_PTR_NON_NULL(object, false); 14454 14454 14455 psMetadata *md = p4InputExpMetadataFromObject(object);14455 psMetadata *md = warpInputExpMetadataFromObject(object); 14456 14456 14457 14457 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 14464 14464 return true; 14465 14465 } 14466 static void p4SkyCellMapRowFree(p4SkyCellMapRow *object);14467 14468 p4SkyCellMapRow *p4SkyCellMapRowAlloc(psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *class_id)14469 { 14470 p4SkyCellMapRow *_object;14471 14472 _object = psAlloc(sizeof( p4SkyCellMapRow));14473 psMemSetDeallocator(_object, (psFreeFunc) p4SkyCellMapRowFree);14474 14475 _object-> p4_id = p4_id;14466 static void warpSkyCellMapRowFree(warpSkyCellMapRow *object); 14467 14468 warpSkyCellMapRow *warpSkyCellMapRowAlloc(psS32 warp_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 cam_version, const char *class_id) 14469 { 14470 warpSkyCellMapRow *_object; 14471 14472 _object = psAlloc(sizeof(warpSkyCellMapRow)); 14473 psMemSetDeallocator(_object, (psFreeFunc)warpSkyCellMapRowFree); 14474 14475 _object->warp_id = warp_id; 14476 14476 _object->skycell_id = psStringCopy(skycell_id); 14477 14477 _object->tess_id = psStringCopy(tess_id); 14478 14478 _object->exp_tag = psStringCopy(exp_tag); 14479 _object-> p3_version = p3_version;14479 _object->cam_version = cam_version; 14480 14480 _object->class_id = psStringCopy(class_id); 14481 14481 … … 14483 14483 } 14484 14484 14485 static void p4SkyCellMapRowFree(p4SkyCellMapRow *object)14485 static void warpSkyCellMapRowFree(warpSkyCellMapRow *object) 14486 14486 { 14487 14487 psFree(object->skycell_id); … … 14491 14491 } 14492 14492 14493 bool p4SkyCellMapCreateTable(psDB *dbh)14493 bool warpSkyCellMapCreateTable(psDB *dbh) 14494 14494 { 14495 14495 psMetadata *md = psMetadataAlloc(); 14496 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, "Primary Key", 0)) {14497 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14496 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, "Primary Key", 0)) { 14497 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14498 14498 psFree(md); 14499 14499 return false; … … 14514 14514 return false; 14515 14515 } 14516 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, "Primary Key", 0)) {14517 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14516 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, "Primary Key", 0)) { 14517 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 14518 14518 psFree(md); 14519 14519 return false; … … 14525 14525 } 14526 14526 14527 bool status = psDBCreateTable(dbh, P4SKYCELLMAP_TABLE_NAME, md);14527 bool status = psDBCreateTable(dbh, WARPSKYCELLMAP_TABLE_NAME, md); 14528 14528 14529 14529 psFree(md); … … 14532 14532 } 14533 14533 14534 bool p4SkyCellMapDropTable(psDB *dbh)14535 { 14536 return psDBDropTable(dbh, P4SKYCELLMAP_TABLE_NAME);14537 } 14538 14539 bool p4SkyCellMapInsert(psDB * dbh, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *class_id)14534 bool warpSkyCellMapDropTable(psDB *dbh) 14535 { 14536 return psDBDropTable(dbh, WARPSKYCELLMAP_TABLE_NAME); 14537 } 14538 14539 bool warpSkyCellMapInsert(psDB * dbh, psS32 warp_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 cam_version, const char *class_id) 14540 14540 { 14541 14541 psMetadata *md = psMetadataAlloc(); 14542 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, p4_id)) {14543 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14542 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, warp_id)) { 14543 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14544 14544 psFree(md); 14545 14545 return false; … … 14560 14560 return false; 14561 14561 } 14562 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, p3_version)) {14563 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14562 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, cam_version)) { 14563 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 14564 14564 psFree(md); 14565 14565 return false; … … 14571 14571 } 14572 14572 14573 bool status = psDBInsertOneRow(dbh, P4SKYCELLMAP_TABLE_NAME, md);14573 bool status = psDBInsertOneRow(dbh, WARPSKYCELLMAP_TABLE_NAME, md); 14574 14574 psFree(md); 14575 14575 … … 14577 14577 } 14578 14578 14579 long long p4SkyCellMapDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)14579 long long warpSkyCellMapDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 14580 14580 { 14581 14581 long long deleted = 0; 14582 14582 14583 long long count = psDBDeleteRows(dbh, P4SKYCELLMAP_TABLE_NAME, where, limit);14583 long long count = psDBDeleteRows(dbh, WARPSKYCELLMAP_TABLE_NAME, where, limit); 14584 14584 if (count < 0) { 14585 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4SkyCellMap");14585 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpSkyCellMap"); 14586 14586 return count; 14587 14587 … … 14591 14591 return deleted; 14592 14592 } 14593 bool p4SkyCellMapInsertObject(psDB *dbh, p4SkyCellMapRow *object)14594 { 14595 return p4SkyCellMapInsert(dbh, object->p4_id, object->skycell_id, object->tess_id, object->exp_tag, object->p3_version, object->class_id);14596 } 14597 14598 bool p4SkyCellMapInsertObjects(psDB *dbh, psArray *objects)14593 bool warpSkyCellMapInsertObject(psDB *dbh, warpSkyCellMapRow *object) 14594 { 14595 return warpSkyCellMapInsert(dbh, object->warp_id, object->skycell_id, object->tess_id, object->exp_tag, object->cam_version, object->class_id); 14596 } 14597 14598 bool warpSkyCellMapInsertObjects(psDB *dbh, psArray *objects) 14599 14599 { 14600 14600 for (long i = 0; i < psArrayLength(objects); i++) { 14601 if (! p4SkyCellMapInsertObject(dbh, objects->data[i])) {14601 if (!warpSkyCellMapInsertObject(dbh, objects->data[i])) { 14602 14602 return false; 14603 14603 } … … 14607 14607 } 14608 14608 14609 bool p4SkyCellMapInsertFits(psDB *dbh, const psFits *fits)14609 bool warpSkyCellMapInsertFits(psDB *dbh, const psFits *fits) 14610 14610 { 14611 14611 psArray *rowSet; 14612 14612 14613 // move to (the first?) extension named P4SKYCELLMAP_TABLE_NAME14614 if (!psFitsMoveExtName(fits, P4SKYCELLMAP_TABLE_NAME)) {14615 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P4SKYCELLMAP_TABLE_NAME);14613 // move to (the first?) extension named WARPSKYCELLMAP_TABLE_NAME 14614 if (!psFitsMoveExtName(fits, WARPSKYCELLMAP_TABLE_NAME)) { 14615 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", WARPSKYCELLMAP_TABLE_NAME); 14616 14616 return false; 14617 14617 } … … 14631 14631 } 14632 14632 14633 if (!psDBInsertRows(dbh, P4SKYCELLMAP_TABLE_NAME, rowSet)) {14633 if (!psDBInsertRows(dbh, WARPSKYCELLMAP_TABLE_NAME, rowSet)) { 14634 14634 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 14635 14635 psFree(rowSet); … … 14642 14642 } 14643 14643 14644 bool p4SkyCellMapSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)14644 bool warpSkyCellMapSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 14645 14645 { 14646 14646 psArray *rowSet; 14647 14647 14648 rowSet = psDBSelectRows(dbh, P4SKYCELLMAP_TABLE_NAME, where, limit);14648 rowSet = psDBSelectRows(dbh, WARPSKYCELLMAP_TABLE_NAME, where, limit); 14649 14649 if (!rowSet) { 14650 14650 return false; … … 14652 14652 14653 14653 // output to fits 14654 if (!psFitsWriteTable(fits, NULL, rowSet, P4SKYCELLMAP_TABLE_NAME)) {14654 if (!psFitsWriteTable(fits, NULL, rowSet, WARPSKYCELLMAP_TABLE_NAME)) { 14655 14655 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 14656 14656 psFree(rowSet); … … 14663 14663 } 14664 14664 14665 psMetadata * p4SkyCellMapMetadataFromObject(const p4SkyCellMapRow *object)14665 psMetadata *warpSkyCellMapMetadataFromObject(const warpSkyCellMapRow *object) 14666 14666 { 14667 14667 psMetadata *md = psMetadataAlloc(); 14668 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, object->p4_id)) {14669 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14668 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, object->warp_id)) { 14669 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14670 14670 psFree(md); 14671 14671 return false; … … 14686 14686 return false; 14687 14687 } 14688 if (!psMetadataAdd(md, PS_LIST_TAIL, " p3_version", PS_DATA_S32, NULL, object->p3_version)) {14689 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14688 if (!psMetadataAdd(md, PS_LIST_TAIL, "cam_version", PS_DATA_S32, NULL, object->cam_version)) { 14689 psError(PS_ERR_UNKNOWN, false, "failed to add item cam_version"); 14690 14690 psFree(md); 14691 14691 return false; … … 14701 14701 } 14702 14702 14703 p4SkyCellMapRow *p4SkyCellMapObjectFromMetadata(psMetadata *md)14703 warpSkyCellMapRow *warpSkyCellMapObjectFromMetadata(psMetadata *md) 14704 14704 { 14705 14705 14706 14706 bool status = false; 14707 psS32 p4_id = psMetadataLookupS32(&status, md, "p4_id");14708 if (!status) { 14709 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p4_id");14707 psS32 warp_id = psMetadataLookupS32(&status, md, "warp_id"); 14708 if (!status) { 14709 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id"); 14710 14710 return false; 14711 14711 } … … 14725 14725 return false; 14726 14726 } 14727 psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");14728 if (!status) { 14729 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");14727 psS32 cam_version = psMetadataLookupS32(&status, md, "cam_version"); 14728 if (!status) { 14729 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item cam_version"); 14730 14730 return false; 14731 14731 } … … 14736 14736 } 14737 14737 14738 return p4SkyCellMapRowAlloc(p4_id, skycell_id, tess_id, exp_tag, p3_version, class_id);14739 } 14740 psArray * p4SkyCellMapSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)14738 return warpSkyCellMapRowAlloc(warp_id, skycell_id, tess_id, exp_tag, cam_version, class_id); 14739 } 14740 psArray *warpSkyCellMapSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 14741 14741 { 14742 14742 psArray *rowSet; … … 14744 14744 psU64 i; 14745 14745 14746 rowSet = psDBSelectRows(dbh, P4SKYCELLMAP_TABLE_NAME, where, limit);14746 rowSet = psDBSelectRows(dbh, WARPSKYCELLMAP_TABLE_NAME, where, limit); 14747 14747 if (!rowSet) { 14748 14748 return NULL; … … 14754 14754 14755 14755 for (i = 0; i < rowSet->n; i++) { 14756 p4SkyCellMapRow *object = p4SkyCellMapObjectFromMetadata(rowSet->data[i]);14756 warpSkyCellMapRow *object = warpSkyCellMapObjectFromMetadata(rowSet->data[i]); 14757 14757 psArrayAdd(returnSet, 0, object); 14758 14758 psFree(object); … … 14763 14763 return returnSet; 14764 14764 } 14765 bool p4SkyCellMapDeleteObject(psDB *dbh, const p4SkyCellMapRow *object)14766 { 14767 psMetadata *where = p4SkyCellMapMetadataFromObject(object);14768 long long count = psDBDeleteRows(dbh, P4SKYCELLMAP_TABLE_NAME, where, 0);14765 bool warpSkyCellMapDeleteObject(psDB *dbh, const warpSkyCellMapRow *object) 14766 { 14767 psMetadata *where = warpSkyCellMapMetadataFromObject(object); 14768 long long count = psDBDeleteRows(dbh, WARPSKYCELLMAP_TABLE_NAME, where, 0); 14769 14769 psFree(where); 14770 14770 if (count < 0) { 14771 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4SkyCellMap");14771 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpSkyCellMap"); 14772 14772 return false; 14773 14773 } … … 14775 14775 // XXX should this be a psAbort() instead? It is possible that 14776 14776 // having an object match multiple rows was by design. 14777 psError(PS_ERR_UNKNOWN, true, " p4SkyCellMapRow object matched more then one row. Check your database schema");14778 return false; 14779 } 14780 14781 return true; 14782 } 14783 long long p4SkyCellMapDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)14777 psError(PS_ERR_UNKNOWN, true, "warpSkyCellMapRow object matched more then one row. Check your database schema"); 14778 return false; 14779 } 14780 14781 return true; 14782 } 14783 long long warpSkyCellMapDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 14784 14784 { 14785 14785 long long deleted = 0; 14786 14786 14787 14787 for (long long i = 0; i < objects->n; i++) { 14788 p4SkyCellMapRow *object = objects->data[i];14789 psMetadata *where = p4SkyCellMapMetadataFromObject(object);14790 long long count = psDBDeleteRows(dbh, P4SKYCELLMAP_TABLE_NAME, where, limit);14788 warpSkyCellMapRow *object = objects->data[i]; 14789 psMetadata *where = warpSkyCellMapMetadataFromObject(object); 14790 long long count = psDBDeleteRows(dbh, WARPSKYCELLMAP_TABLE_NAME, where, limit); 14791 14791 psFree(where); 14792 14792 if (count < 0) { 14793 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4SkyCellMap");14793 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpSkyCellMap"); 14794 14794 return count; 14795 14795 } … … 14800 14800 return deleted; 14801 14801 } 14802 bool p4SkyCellMapPrintObjects(FILE *stream, psArray *objects, bool mdcf)14802 bool warpSkyCellMapPrintObjects(FILE *stream, psArray *objects, bool mdcf) 14803 14803 { 14804 14804 PS_ASSERT_PTR_NON_NULL(objects, false); … … 14806 14806 psMetadata *output = psMetadataAlloc(); 14807 14807 for (long i = 0; i < psArrayLength(objects); i++) { 14808 psMetadata *md = p4SkyCellMapMetadataFromObject(objects->data[i]);14808 psMetadata *md = warpSkyCellMapMetadataFromObject(objects->data[i]); 14809 14809 if (!psMetadataAddMetadata( 14810 14810 output, 14811 14811 PS_LIST_TAIL, 14812 P4SKYCELLMAP_TABLE_NAME,14812 WARPSKYCELLMAP_TABLE_NAME, 14813 14813 PS_META_DUPLICATE_OK, 14814 14814 NULL, … … 14831 14831 return true; 14832 14832 } 14833 bool p4SkyCellMapPrintObject(FILE *stream, p4SkyCellMapRow *object, bool mdcf)14833 bool warpSkyCellMapPrintObject(FILE *stream, warpSkyCellMapRow *object, bool mdcf) 14834 14834 { 14835 14835 PS_ASSERT_PTR_NON_NULL(object, false); 14836 14836 14837 psMetadata *md = p4SkyCellMapMetadataFromObject(object);14837 psMetadata *md = warpSkyCellMapMetadataFromObject(object); 14838 14838 14839 14839 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 14846 14846 return true; 14847 14847 } 14848 static void p4SkyfileRowFree(p4SkyfileRow *object);14849 14850 p4SkyfileRow *p4SkyfileRowAlloc(psS32 p4_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)14851 { 14852 p4SkyfileRow*_object;14853 14854 _object = psAlloc(sizeof( p4SkyfileRow));14855 psMemSetDeallocator(_object, (psFreeFunc) p4SkyfileRowFree);14856 14857 _object-> p4_id = p4_id;14848 static void warpSkyfileRowFree(warpSkyfileRow *object); 14849 14850 warpSkyfileRow *warpSkyfileRowAlloc(psS32 warp_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev) 14851 { 14852 warpSkyfileRow *_object; 14853 14854 _object = psAlloc(sizeof(warpSkyfileRow)); 14855 psMemSetDeallocator(_object, (psFreeFunc)warpSkyfileRowFree); 14856 14857 _object->warp_id = warp_id; 14858 14858 _object->skycell_id = psStringCopy(skycell_id); 14859 14859 _object->tess_id = psStringCopy(tess_id); … … 14865 14865 } 14866 14866 14867 static void p4SkyfileRowFree(p4SkyfileRow *object)14867 static void warpSkyfileRowFree(warpSkyfileRow *object) 14868 14868 { 14869 14869 psFree(object->skycell_id); … … 14872 14872 } 14873 14873 14874 bool p4SkyfileCreateTable(psDB *dbh)14874 bool warpSkyfileCreateTable(psDB *dbh) 14875 14875 { 14876 14876 psMetadata *md = psMetadataAlloc(); 14877 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, "Primary Key", 0)) {14878 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14877 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, "Primary Key", 0)) { 14878 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14879 14879 psFree(md); 14880 14880 return false; … … 14906 14906 } 14907 14907 14908 bool status = psDBCreateTable(dbh, P4SKYFILE_TABLE_NAME, md);14908 bool status = psDBCreateTable(dbh, WARPSKYFILE_TABLE_NAME, md); 14909 14909 14910 14910 psFree(md); … … 14913 14913 } 14914 14914 14915 bool p4SkyfileDropTable(psDB *dbh)14916 { 14917 return psDBDropTable(dbh, P4SKYFILE_TABLE_NAME);14918 } 14919 14920 bool p4SkyfileInsert(psDB * dbh, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)14915 bool warpSkyfileDropTable(psDB *dbh) 14916 { 14917 return psDBDropTable(dbh, WARPSKYFILE_TABLE_NAME); 14918 } 14919 14920 bool warpSkyfileInsert(psDB * dbh, psS32 warp_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev) 14921 14921 { 14922 14922 psMetadata *md = psMetadataAlloc(); 14923 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, p4_id)) {14924 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");14923 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, warp_id)) { 14924 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 14925 14925 psFree(md); 14926 14926 return false; … … 14952 14952 } 14953 14953 14954 bool status = psDBInsertOneRow(dbh, P4SKYFILE_TABLE_NAME, md);14954 bool status = psDBInsertOneRow(dbh, WARPSKYFILE_TABLE_NAME, md); 14955 14955 psFree(md); 14956 14956 … … 14958 14958 } 14959 14959 14960 long long p4SkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)14960 long long warpSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 14961 14961 { 14962 14962 long long deleted = 0; 14963 14963 14964 long long count = psDBDeleteRows(dbh, P4SKYFILE_TABLE_NAME, where, limit);14964 long long count = psDBDeleteRows(dbh, WARPSKYFILE_TABLE_NAME, where, limit); 14965 14965 if (count < 0) { 14966 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Skyfile");14966 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpSkyfile"); 14967 14967 return count; 14968 14968 … … 14972 14972 return deleted; 14973 14973 } 14974 bool p4SkyfileInsertObject(psDB *dbh, p4SkyfileRow *object)14975 { 14976 return p4SkyfileInsert(dbh, object->p4_id, object->skycell_id, object->tess_id, object->uri, object->bg, object->bg_mean_stdev);14977 } 14978 14979 bool p4SkyfileInsertObjects(psDB *dbh, psArray *objects)14974 bool warpSkyfileInsertObject(psDB *dbh, warpSkyfileRow *object) 14975 { 14976 return warpSkyfileInsert(dbh, object->warp_id, object->skycell_id, object->tess_id, object->uri, object->bg, object->bg_mean_stdev); 14977 } 14978 14979 bool warpSkyfileInsertObjects(psDB *dbh, psArray *objects) 14980 14980 { 14981 14981 for (long i = 0; i < psArrayLength(objects); i++) { 14982 if (! p4SkyfileInsertObject(dbh, objects->data[i])) {14982 if (!warpSkyfileInsertObject(dbh, objects->data[i])) { 14983 14983 return false; 14984 14984 } … … 14988 14988 } 14989 14989 14990 bool p4SkyfileInsertFits(psDB *dbh, const psFits *fits)14990 bool warpSkyfileInsertFits(psDB *dbh, const psFits *fits) 14991 14991 { 14992 14992 psArray *rowSet; 14993 14993 14994 // move to (the first?) extension named P4SKYFILE_TABLE_NAME14995 if (!psFitsMoveExtName(fits, P4SKYFILE_TABLE_NAME)) {14996 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P4SKYFILE_TABLE_NAME);14994 // move to (the first?) extension named WARPSKYFILE_TABLE_NAME 14995 if (!psFitsMoveExtName(fits, WARPSKYFILE_TABLE_NAME)) { 14996 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", WARPSKYFILE_TABLE_NAME); 14997 14997 return false; 14998 14998 } … … 15012 15012 } 15013 15013 15014 if (!psDBInsertRows(dbh, P4SKYFILE_TABLE_NAME, rowSet)) {15014 if (!psDBInsertRows(dbh, WARPSKYFILE_TABLE_NAME, rowSet)) { 15015 15015 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 15016 15016 psFree(rowSet); … … 15023 15023 } 15024 15024 15025 bool p4SkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)15025 bool warpSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 15026 15026 { 15027 15027 psArray *rowSet; 15028 15028 15029 rowSet = psDBSelectRows(dbh, P4SKYFILE_TABLE_NAME, where, limit);15029 rowSet = psDBSelectRows(dbh, WARPSKYFILE_TABLE_NAME, where, limit); 15030 15030 if (!rowSet) { 15031 15031 return false; … … 15033 15033 15034 15034 // output to fits 15035 if (!psFitsWriteTable(fits, NULL, rowSet, P4SKYFILE_TABLE_NAME)) {15035 if (!psFitsWriteTable(fits, NULL, rowSet, WARPSKYFILE_TABLE_NAME)) { 15036 15036 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 15037 15037 psFree(rowSet); … … 15044 15044 } 15045 15045 15046 psMetadata * p4SkyfileMetadataFromObject(const p4SkyfileRow *object)15046 psMetadata *warpSkyfileMetadataFromObject(const warpSkyfileRow *object) 15047 15047 { 15048 15048 psMetadata *md = psMetadataAlloc(); 15049 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, object->p4_id)) {15050 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");15049 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, object->warp_id)) { 15050 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 15051 15051 psFree(md); 15052 15052 return false; … … 15082 15082 } 15083 15083 15084 p4SkyfileRow *p4SkyfileObjectFromMetadata(psMetadata *md)15084 warpSkyfileRow *warpSkyfileObjectFromMetadata(psMetadata *md) 15085 15085 { 15086 15086 15087 15087 bool status = false; 15088 psS32 p4_id = psMetadataLookupS32(&status, md, "p4_id");15089 if (!status) { 15090 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p4_id");15088 psS32 warp_id = psMetadataLookupS32(&status, md, "warp_id"); 15089 if (!status) { 15090 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id"); 15091 15091 return false; 15092 15092 } … … 15117 15117 } 15118 15118 15119 return p4SkyfileRowAlloc(p4_id, skycell_id, tess_id, uri, bg, bg_mean_stdev);15120 } 15121 psArray * p4SkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)15119 return warpSkyfileRowAlloc(warp_id, skycell_id, tess_id, uri, bg, bg_mean_stdev); 15120 } 15121 psArray *warpSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 15122 15122 { 15123 15123 psArray *rowSet; … … 15125 15125 psU64 i; 15126 15126 15127 rowSet = psDBSelectRows(dbh, P4SKYFILE_TABLE_NAME, where, limit);15127 rowSet = psDBSelectRows(dbh, WARPSKYFILE_TABLE_NAME, where, limit); 15128 15128 if (!rowSet) { 15129 15129 return NULL; … … 15135 15135 15136 15136 for (i = 0; i < rowSet->n; i++) { 15137 p4SkyfileRow *object = p4SkyfileObjectFromMetadata(rowSet->data[i]);15137 warpSkyfileRow *object = warpSkyfileObjectFromMetadata(rowSet->data[i]); 15138 15138 psArrayAdd(returnSet, 0, object); 15139 15139 psFree(object); … … 15144 15144 return returnSet; 15145 15145 } 15146 bool p4SkyfileDeleteObject(psDB *dbh, const p4SkyfileRow *object)15147 { 15148 psMetadata *where = p4SkyfileMetadataFromObject(object);15149 long long count = psDBDeleteRows(dbh, P4SKYFILE_TABLE_NAME, where, 0);15146 bool warpSkyfileDeleteObject(psDB *dbh, const warpSkyfileRow *object) 15147 { 15148 psMetadata *where = warpSkyfileMetadataFromObject(object); 15149 long long count = psDBDeleteRows(dbh, WARPSKYFILE_TABLE_NAME, where, 0); 15150 15150 psFree(where); 15151 15151 if (count < 0) { 15152 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Skyfile");15152 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpSkyfile"); 15153 15153 return false; 15154 15154 } … … 15156 15156 // XXX should this be a psAbort() instead? It is possible that 15157 15157 // having an object match multiple rows was by design. 15158 psError(PS_ERR_UNKNOWN, true, " p4SkyfileRow object matched more then one row. Check your database schema");15159 return false; 15160 } 15161 15162 return true; 15163 } 15164 long long p4SkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)15158 psError(PS_ERR_UNKNOWN, true, "warpSkyfileRow object matched more then one row. Check your database schema"); 15159 return false; 15160 } 15161 15162 return true; 15163 } 15164 long long warpSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 15165 15165 { 15166 15166 long long deleted = 0; 15167 15167 15168 15168 for (long long i = 0; i < objects->n; i++) { 15169 p4SkyfileRow *object = objects->data[i];15170 psMetadata *where = p4SkyfileMetadataFromObject(object);15171 long long count = psDBDeleteRows(dbh, P4SKYFILE_TABLE_NAME, where, limit);15169 warpSkyfileRow *object = objects->data[i]; 15170 psMetadata *where = warpSkyfileMetadataFromObject(object); 15171 long long count = psDBDeleteRows(dbh, WARPSKYFILE_TABLE_NAME, where, limit); 15172 15172 psFree(where); 15173 15173 if (count < 0) { 15174 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Skyfile");15174 psError(PS_ERR_UNKNOWN, true, "failed to delete row from warpSkyfile"); 15175 15175 return count; 15176 15176 } … … 15181 15181 return deleted; 15182 15182 } 15183 bool p4SkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)15183 bool warpSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 15184 15184 { 15185 15185 PS_ASSERT_PTR_NON_NULL(objects, false); … … 15187 15187 psMetadata *output = psMetadataAlloc(); 15188 15188 for (long i = 0; i < psArrayLength(objects); i++) { 15189 psMetadata *md = p4SkyfileMetadataFromObject(objects->data[i]);15189 psMetadata *md = warpSkyfileMetadataFromObject(objects->data[i]); 15190 15190 if (!psMetadataAddMetadata( 15191 15191 output, 15192 15192 PS_LIST_TAIL, 15193 P4SKYFILE_TABLE_NAME,15193 WARPSKYFILE_TABLE_NAME, 15194 15194 PS_META_DUPLICATE_OK, 15195 15195 NULL, … … 15212 15212 return true; 15213 15213 } 15214 bool p4SkyfilePrintObject(FILE *stream, p4SkyfileRow *object, bool mdcf)15214 bool warpSkyfilePrintObject(FILE *stream, warpSkyfileRow *object, bool mdcf) 15215 15215 { 15216 15216 PS_ASSERT_PTR_NON_NULL(object, false); 15217 15217 15218 psMetadata *md = p4SkyfileMetadataFromObject(object);15218 psMetadata *md = warpSkyfileMetadataFromObject(object); 15219 15219 15220 15220 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 15227 15227 return true; 15228 15228 } 15229 static void p5RunRowFree(p5RunRow *object);15230 15231 p5RunRow *p5RunRowAlloc(psS32 p5_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id)15232 { 15233 p5RunRow*_object;15234 15235 _object = psAlloc(sizeof( p5RunRow));15236 psMemSetDeallocator(_object, (psFreeFunc) p5RunRowFree);15237 15238 _object-> p5_id = p5_id;15229 static void diffRunRowFree(diffRunRow *object); 15230 15231 diffRunRow *diffRunRowAlloc(psS32 diff_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id) 15232 { 15233 diffRunRow *_object; 15234 15235 _object = psAlloc(sizeof(diffRunRow)); 15236 psMemSetDeallocator(_object, (psFreeFunc)diffRunRowFree); 15237 15238 _object->diff_id = diff_id; 15239 15239 _object->state = psStringCopy(state); 15240 15240 _object->workdir = psStringCopy(workdir); … … 15247 15247 } 15248 15248 15249 static void p5RunRowFree(p5RunRow *object)15249 static void diffRunRowFree(diffRunRow *object) 15250 15250 { 15251 15251 psFree(object->state); … … 15257 15257 } 15258 15258 15259 bool p5RunCreateTable(psDB *dbh)15259 bool diffRunCreateTable(psDB *dbh) 15260 15260 { 15261 15261 psMetadata *md = psMetadataAlloc(); 15262 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) {15263 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");15262 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) { 15263 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 15264 15264 psFree(md); 15265 15265 return false; … … 15296 15296 } 15297 15297 15298 bool status = psDBCreateTable(dbh, P5RUN_TABLE_NAME, md);15298 bool status = psDBCreateTable(dbh, DIFFRUN_TABLE_NAME, md); 15299 15299 15300 15300 psFree(md); … … 15303 15303 } 15304 15304 15305 bool p5RunDropTable(psDB *dbh)15306 { 15307 return psDBDropTable(dbh, P5RUN_TABLE_NAME);15308 } 15309 15310 bool p5RunInsert(psDB * dbh, psS32 p5_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id)15305 bool diffRunDropTable(psDB *dbh) 15306 { 15307 return psDBDropTable(dbh, DIFFRUN_TABLE_NAME); 15308 } 15309 15310 bool diffRunInsert(psDB * dbh, psS32 diff_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id) 15311 15311 { 15312 15312 psMetadata *md = psMetadataAlloc(); 15313 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, NULL, p5_id)) {15314 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");15313 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, NULL, diff_id)) { 15314 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 15315 15315 psFree(md); 15316 15316 return false; … … 15347 15347 } 15348 15348 15349 bool status = psDBInsertOneRow(dbh, P5RUN_TABLE_NAME, md);15349 bool status = psDBInsertOneRow(dbh, DIFFRUN_TABLE_NAME, md); 15350 15350 psFree(md); 15351 15351 … … 15353 15353 } 15354 15354 15355 long long p5RunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)15355 long long diffRunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 15356 15356 { 15357 15357 long long deleted = 0; 15358 15358 15359 long long count = psDBDeleteRows(dbh, P5RUN_TABLE_NAME, where, limit);15359 long long count = psDBDeleteRows(dbh, DIFFRUN_TABLE_NAME, where, limit); 15360 15360 if (count < 0) { 15361 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5Run");15361 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffRun"); 15362 15362 return count; 15363 15363 … … 15367 15367 return deleted; 15368 15368 } 15369 bool p5RunInsertObject(psDB *dbh, p5RunRow *object)15370 { 15371 return p5RunInsert(dbh, object->p5_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id);15372 } 15373 15374 bool p5RunInsertObjects(psDB *dbh, psArray *objects)15369 bool diffRunInsertObject(psDB *dbh, diffRunRow *object) 15370 { 15371 return diffRunInsert(dbh, object->diff_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id); 15372 } 15373 15374 bool diffRunInsertObjects(psDB *dbh, psArray *objects) 15375 15375 { 15376 15376 for (long i = 0; i < psArrayLength(objects); i++) { 15377 if (! p5RunInsertObject(dbh, objects->data[i])) {15377 if (!diffRunInsertObject(dbh, objects->data[i])) { 15378 15378 return false; 15379 15379 } … … 15383 15383 } 15384 15384 15385 bool p5RunInsertFits(psDB *dbh, const psFits *fits)15385 bool diffRunInsertFits(psDB *dbh, const psFits *fits) 15386 15386 { 15387 15387 psArray *rowSet; 15388 15388 15389 // move to (the first?) extension named P5RUN_TABLE_NAME15390 if (!psFitsMoveExtName(fits, P5RUN_TABLE_NAME)) {15391 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5RUN_TABLE_NAME);15389 // move to (the first?) extension named DIFFRUN_TABLE_NAME 15390 if (!psFitsMoveExtName(fits, DIFFRUN_TABLE_NAME)) { 15391 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", DIFFRUN_TABLE_NAME); 15392 15392 return false; 15393 15393 } … … 15407 15407 } 15408 15408 15409 if (!psDBInsertRows(dbh, P5RUN_TABLE_NAME, rowSet)) {15409 if (!psDBInsertRows(dbh, DIFFRUN_TABLE_NAME, rowSet)) { 15410 15410 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 15411 15411 psFree(rowSet); … … 15418 15418 } 15419 15419 15420 bool p5RunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)15420 bool diffRunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 15421 15421 { 15422 15422 psArray *rowSet; 15423 15423 15424 rowSet = psDBSelectRows(dbh, P5RUN_TABLE_NAME, where, limit);15424 rowSet = psDBSelectRows(dbh, DIFFRUN_TABLE_NAME, where, limit); 15425 15425 if (!rowSet) { 15426 15426 return false; … … 15428 15428 15429 15429 // output to fits 15430 if (!psFitsWriteTable(fits, NULL, rowSet, P5RUN_TABLE_NAME)) {15430 if (!psFitsWriteTable(fits, NULL, rowSet, DIFFRUN_TABLE_NAME)) { 15431 15431 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 15432 15432 psFree(rowSet); … … 15439 15439 } 15440 15440 15441 psMetadata * p5RunMetadataFromObject(const p5RunRow *object)15441 psMetadata *diffRunMetadataFromObject(const diffRunRow *object) 15442 15442 { 15443 15443 psMetadata *md = psMetadataAlloc(); 15444 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, NULL, object->p5_id)) {15445 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");15444 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, NULL, object->diff_id)) { 15445 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 15446 15446 psFree(md); 15447 15447 return false; … … 15482 15482 } 15483 15483 15484 p5RunRow *p5RunObjectFromMetadata(psMetadata *md)15484 diffRunRow *diffRunObjectFromMetadata(psMetadata *md) 15485 15485 { 15486 15486 15487 15487 bool status = false; 15488 psS32 p5_id = psMetadataLookupS32(&status, md, "p5_id");15489 if (!status) { 15490 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p5_id");15488 psS32 diff_id = psMetadataLookupS32(&status, md, "diff_id"); 15489 if (!status) { 15490 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item diff_id"); 15491 15491 return false; 15492 15492 } … … 15522 15522 } 15523 15523 15524 return p5RunRowAlloc(p5_id, state, workdir, dvodb, registered, skycell_id, tess_id);15525 } 15526 psArray * p5RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)15524 return diffRunRowAlloc(diff_id, state, workdir, dvodb, registered, skycell_id, tess_id); 15525 } 15526 psArray *diffRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 15527 15527 { 15528 15528 psArray *rowSet; … … 15530 15530 psU64 i; 15531 15531 15532 rowSet = psDBSelectRows(dbh, P5RUN_TABLE_NAME, where, limit);15532 rowSet = psDBSelectRows(dbh, DIFFRUN_TABLE_NAME, where, limit); 15533 15533 if (!rowSet) { 15534 15534 return NULL; … … 15540 15540 15541 15541 for (i = 0; i < rowSet->n; i++) { 15542 p5RunRow *object = p5RunObjectFromMetadata(rowSet->data[i]);15542 diffRunRow *object = diffRunObjectFromMetadata(rowSet->data[i]); 15543 15543 psArrayAdd(returnSet, 0, object); 15544 15544 psFree(object); … … 15549 15549 return returnSet; 15550 15550 } 15551 bool p5RunDeleteObject(psDB *dbh, const p5RunRow *object)15552 { 15553 psMetadata *where = p5RunMetadataFromObject(object);15554 long long count = psDBDeleteRows(dbh, P5RUN_TABLE_NAME, where, 0);15551 bool diffRunDeleteObject(psDB *dbh, const diffRunRow *object) 15552 { 15553 psMetadata *where = diffRunMetadataFromObject(object); 15554 long long count = psDBDeleteRows(dbh, DIFFRUN_TABLE_NAME, where, 0); 15555 15555 psFree(where); 15556 15556 if (count < 0) { 15557 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5Run");15557 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffRun"); 15558 15558 return false; 15559 15559 } … … 15561 15561 // XXX should this be a psAbort() instead? It is possible that 15562 15562 // having an object match multiple rows was by design. 15563 psError(PS_ERR_UNKNOWN, true, " p5RunRow object matched more then one row. Check your database schema");15564 return false; 15565 } 15566 15567 return true; 15568 } 15569 long long p5RunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)15563 psError(PS_ERR_UNKNOWN, true, "diffRunRow object matched more then one row. Check your database schema"); 15564 return false; 15565 } 15566 15567 return true; 15568 } 15569 long long diffRunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 15570 15570 { 15571 15571 long long deleted = 0; 15572 15572 15573 15573 for (long long i = 0; i < objects->n; i++) { 15574 p5RunRow *object = objects->data[i];15575 psMetadata *where = p5RunMetadataFromObject(object);15576 long long count = psDBDeleteRows(dbh, P5RUN_TABLE_NAME, where, limit);15574 diffRunRow *object = objects->data[i]; 15575 psMetadata *where = diffRunMetadataFromObject(object); 15576 long long count = psDBDeleteRows(dbh, DIFFRUN_TABLE_NAME, where, limit); 15577 15577 psFree(where); 15578 15578 if (count < 0) { 15579 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5Run");15579 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffRun"); 15580 15580 return count; 15581 15581 } … … 15586 15586 return deleted; 15587 15587 } 15588 bool p5RunPrintObjects(FILE *stream, psArray *objects, bool mdcf)15588 bool diffRunPrintObjects(FILE *stream, psArray *objects, bool mdcf) 15589 15589 { 15590 15590 PS_ASSERT_PTR_NON_NULL(objects, false); … … 15592 15592 psMetadata *output = psMetadataAlloc(); 15593 15593 for (long i = 0; i < psArrayLength(objects); i++) { 15594 psMetadata *md = p5RunMetadataFromObject(objects->data[i]);15594 psMetadata *md = diffRunMetadataFromObject(objects->data[i]); 15595 15595 if (!psMetadataAddMetadata( 15596 15596 output, 15597 15597 PS_LIST_TAIL, 15598 P5RUN_TABLE_NAME,15598 DIFFRUN_TABLE_NAME, 15599 15599 PS_META_DUPLICATE_OK, 15600 15600 NULL, … … 15617 15617 return true; 15618 15618 } 15619 bool p5RunPrintObject(FILE *stream, p5RunRow *object, bool mdcf)15619 bool diffRunPrintObject(FILE *stream, diffRunRow *object, bool mdcf) 15620 15620 { 15621 15621 PS_ASSERT_PTR_NON_NULL(object, false); 15622 15622 15623 psMetadata *md = p5RunMetadataFromObject(object);15623 psMetadata *md = diffRunMetadataFromObject(object); 15624 15624 15625 15625 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 15632 15632 return true; 15633 15633 } 15634 static void p5InputSkyfileRowFree(p5InputSkyfileRow *object);15635 15636 p5InputSkyfileRow *p5InputSkyfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)15637 { 15638 p5InputSkyfileRow *_object;15639 15640 _object = psAlloc(sizeof( p5InputSkyfileRow));15641 psMemSetDeallocator(_object, (psFreeFunc) p5InputSkyfileRowFree);15642 15643 _object-> p5_id = p5_id;15644 _object-> p4_id = p4_id;15634 static void diffInputSkyfileRowFree(diffInputSkyfileRow *object); 15635 15636 diffInputSkyfileRow *diffInputSkyfileRowAlloc(psS32 diff_id, psS32 warp_id, const char *skycell_id, const char *tess_id, const char *kind, bool template) 15637 { 15638 diffInputSkyfileRow *_object; 15639 15640 _object = psAlloc(sizeof(diffInputSkyfileRow)); 15641 psMemSetDeallocator(_object, (psFreeFunc)diffInputSkyfileRowFree); 15642 15643 _object->diff_id = diff_id; 15644 _object->warp_id = warp_id; 15645 15645 _object->skycell_id = psStringCopy(skycell_id); 15646 15646 _object->tess_id = psStringCopy(tess_id); … … 15651 15651 } 15652 15652 15653 static void p5InputSkyfileRowFree(p5InputSkyfileRow *object)15653 static void diffInputSkyfileRowFree(diffInputSkyfileRow *object) 15654 15654 { 15655 15655 psFree(object->skycell_id); … … 15658 15658 } 15659 15659 15660 bool p5InputSkyfileCreateTable(psDB *dbh)15660 bool diffInputSkyfileCreateTable(psDB *dbh) 15661 15661 { 15662 15662 psMetadata *md = psMetadataAlloc(); 15663 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, "Primary Key", 0)) {15664 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");15665 psFree(md); 15666 return false; 15667 } 15668 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, "Primary Key", 0)) {15669 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");15663 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, "Primary Key", 0)) { 15664 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 15665 psFree(md); 15666 return false; 15667 } 15668 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, "Primary Key", 0)) { 15669 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 15670 15670 psFree(md); 15671 15671 return false; … … 15692 15692 } 15693 15693 15694 bool status = psDBCreateTable(dbh, P5INPUTSKYFILE_TABLE_NAME, md);15694 bool status = psDBCreateTable(dbh, DIFFINPUTSKYFILE_TABLE_NAME, md); 15695 15695 15696 15696 psFree(md); … … 15699 15699 } 15700 15700 15701 bool p5InputSkyfileDropTable(psDB *dbh)15702 { 15703 return psDBDropTable(dbh, P5INPUTSKYFILE_TABLE_NAME);15704 } 15705 15706 bool p5InputSkyfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)15701 bool diffInputSkyfileDropTable(psDB *dbh) 15702 { 15703 return psDBDropTable(dbh, DIFFINPUTSKYFILE_TABLE_NAME); 15704 } 15705 15706 bool diffInputSkyfileInsert(psDB * dbh, psS32 diff_id, psS32 warp_id, const char *skycell_id, const char *tess_id, const char *kind, bool template) 15707 15707 { 15708 15708 psMetadata *md = psMetadataAlloc(); 15709 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, NULL, p5_id)) {15710 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");15711 psFree(md); 15712 return false; 15713 } 15714 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, p4_id)) {15715 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");15709 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, NULL, diff_id)) { 15710 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 15711 psFree(md); 15712 return false; 15713 } 15714 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, warp_id)) { 15715 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 15716 15716 psFree(md); 15717 15717 return false; … … 15738 15738 } 15739 15739 15740 bool status = psDBInsertOneRow(dbh, P5INPUTSKYFILE_TABLE_NAME, md);15740 bool status = psDBInsertOneRow(dbh, DIFFINPUTSKYFILE_TABLE_NAME, md); 15741 15741 psFree(md); 15742 15742 … … 15744 15744 } 15745 15745 15746 long long p5InputSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)15746 long long diffInputSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 15747 15747 { 15748 15748 long long deleted = 0; 15749 15749 15750 long long count = psDBDeleteRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit);15750 long long count = psDBDeleteRows(dbh, DIFFINPUTSKYFILE_TABLE_NAME, where, limit); 15751 15751 if (count < 0) { 15752 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputSkyfile");15752 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffInputSkyfile"); 15753 15753 return count; 15754 15754 … … 15758 15758 return deleted; 15759 15759 } 15760 bool p5InputSkyfileInsertObject(psDB *dbh, p5InputSkyfileRow *object)15761 { 15762 return p5InputSkyfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->kind, object->template);15763 } 15764 15765 bool p5InputSkyfileInsertObjects(psDB *dbh, psArray *objects)15760 bool diffInputSkyfileInsertObject(psDB *dbh, diffInputSkyfileRow *object) 15761 { 15762 return diffInputSkyfileInsert(dbh, object->diff_id, object->warp_id, object->skycell_id, object->tess_id, object->kind, object->template); 15763 } 15764 15765 bool diffInputSkyfileInsertObjects(psDB *dbh, psArray *objects) 15766 15766 { 15767 15767 for (long i = 0; i < psArrayLength(objects); i++) { 15768 if (! p5InputSkyfileInsertObject(dbh, objects->data[i])) {15768 if (!diffInputSkyfileInsertObject(dbh, objects->data[i])) { 15769 15769 return false; 15770 15770 } … … 15774 15774 } 15775 15775 15776 bool p5InputSkyfileInsertFits(psDB *dbh, const psFits *fits)15776 bool diffInputSkyfileInsertFits(psDB *dbh, const psFits *fits) 15777 15777 { 15778 15778 psArray *rowSet; 15779 15779 15780 // move to (the first?) extension named P5INPUTSKYFILE_TABLE_NAME15781 if (!psFitsMoveExtName(fits, P5INPUTSKYFILE_TABLE_NAME)) {15782 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5INPUTSKYFILE_TABLE_NAME);15780 // move to (the first?) extension named DIFFINPUTSKYFILE_TABLE_NAME 15781 if (!psFitsMoveExtName(fits, DIFFINPUTSKYFILE_TABLE_NAME)) { 15782 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", DIFFINPUTSKYFILE_TABLE_NAME); 15783 15783 return false; 15784 15784 } … … 15798 15798 } 15799 15799 15800 if (!psDBInsertRows(dbh, P5INPUTSKYFILE_TABLE_NAME, rowSet)) {15800 if (!psDBInsertRows(dbh, DIFFINPUTSKYFILE_TABLE_NAME, rowSet)) { 15801 15801 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 15802 15802 psFree(rowSet); … … 15809 15809 } 15810 15810 15811 bool p5InputSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)15811 bool diffInputSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 15812 15812 { 15813 15813 psArray *rowSet; 15814 15814 15815 rowSet = psDBSelectRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit);15815 rowSet = psDBSelectRows(dbh, DIFFINPUTSKYFILE_TABLE_NAME, where, limit); 15816 15816 if (!rowSet) { 15817 15817 return false; … … 15819 15819 15820 15820 // output to fits 15821 if (!psFitsWriteTable(fits, NULL, rowSet, P5INPUTSKYFILE_TABLE_NAME)) {15821 if (!psFitsWriteTable(fits, NULL, rowSet, DIFFINPUTSKYFILE_TABLE_NAME)) { 15822 15822 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 15823 15823 psFree(rowSet); … … 15830 15830 } 15831 15831 15832 psMetadata * p5InputSkyfileMetadataFromObject(const p5InputSkyfileRow *object)15832 psMetadata *diffInputSkyfileMetadataFromObject(const diffInputSkyfileRow *object) 15833 15833 { 15834 15834 psMetadata *md = psMetadataAlloc(); 15835 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, NULL, object->p5_id)) {15836 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");15837 psFree(md); 15838 return false; 15839 } 15840 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, object->p4_id)) {15841 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");15835 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, NULL, object->diff_id)) { 15836 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 15837 psFree(md); 15838 return false; 15839 } 15840 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, object->warp_id)) { 15841 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 15842 15842 psFree(md); 15843 15843 return false; … … 15868 15868 } 15869 15869 15870 p5InputSkyfileRow *p5InputSkyfileObjectFromMetadata(psMetadata *md)15870 diffInputSkyfileRow *diffInputSkyfileObjectFromMetadata(psMetadata *md) 15871 15871 { 15872 15872 15873 15873 bool status = false; 15874 psS32 p5_id = psMetadataLookupS32(&status, md, "p5_id");15875 if (!status) { 15876 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p5_id");15877 return false; 15878 } 15879 psS32 p4_id = psMetadataLookupS32(&status, md, "p4_id");15880 if (!status) { 15881 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p4_id");15874 psS32 diff_id = psMetadataLookupS32(&status, md, "diff_id"); 15875 if (!status) { 15876 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item diff_id"); 15877 return false; 15878 } 15879 psS32 warp_id = psMetadataLookupS32(&status, md, "warp_id"); 15880 if (!status) { 15881 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id"); 15882 15882 return false; 15883 15883 } … … 15903 15903 } 15904 15904 15905 return p5InputSkyfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, kind, template);15906 } 15907 psArray * p5InputSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)15905 return diffInputSkyfileRowAlloc(diff_id, warp_id, skycell_id, tess_id, kind, template); 15906 } 15907 psArray *diffInputSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 15908 15908 { 15909 15909 psArray *rowSet; … … 15911 15911 psU64 i; 15912 15912 15913 rowSet = psDBSelectRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit);15913 rowSet = psDBSelectRows(dbh, DIFFINPUTSKYFILE_TABLE_NAME, where, limit); 15914 15914 if (!rowSet) { 15915 15915 return NULL; … … 15921 15921 15922 15922 for (i = 0; i < rowSet->n; i++) { 15923 p5InputSkyfileRow *object = p5InputSkyfileObjectFromMetadata(rowSet->data[i]);15923 diffInputSkyfileRow *object = diffInputSkyfileObjectFromMetadata(rowSet->data[i]); 15924 15924 psArrayAdd(returnSet, 0, object); 15925 15925 psFree(object); … … 15930 15930 return returnSet; 15931 15931 } 15932 bool p5InputSkyfileDeleteObject(psDB *dbh, const p5InputSkyfileRow *object)15933 { 15934 psMetadata *where = p5InputSkyfileMetadataFromObject(object);15935 long long count = psDBDeleteRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, 0);15932 bool diffInputSkyfileDeleteObject(psDB *dbh, const diffInputSkyfileRow *object) 15933 { 15934 psMetadata *where = diffInputSkyfileMetadataFromObject(object); 15935 long long count = psDBDeleteRows(dbh, DIFFINPUTSKYFILE_TABLE_NAME, where, 0); 15936 15936 psFree(where); 15937 15937 if (count < 0) { 15938 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputSkyfile");15938 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffInputSkyfile"); 15939 15939 return false; 15940 15940 } … … 15942 15942 // XXX should this be a psAbort() instead? It is possible that 15943 15943 // having an object match multiple rows was by design. 15944 psError(PS_ERR_UNKNOWN, true, " p5InputSkyfileRow object matched more then one row. Check your database schema");15945 return false; 15946 } 15947 15948 return true; 15949 } 15950 long long p5InputSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)15944 psError(PS_ERR_UNKNOWN, true, "diffInputSkyfileRow object matched more then one row. Check your database schema"); 15945 return false; 15946 } 15947 15948 return true; 15949 } 15950 long long diffInputSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 15951 15951 { 15952 15952 long long deleted = 0; 15953 15953 15954 15954 for (long long i = 0; i < objects->n; i++) { 15955 p5InputSkyfileRow *object = objects->data[i];15956 psMetadata *where = p5InputSkyfileMetadataFromObject(object);15957 long long count = psDBDeleteRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit);15955 diffInputSkyfileRow *object = objects->data[i]; 15956 psMetadata *where = diffInputSkyfileMetadataFromObject(object); 15957 long long count = psDBDeleteRows(dbh, DIFFINPUTSKYFILE_TABLE_NAME, where, limit); 15958 15958 psFree(where); 15959 15959 if (count < 0) { 15960 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputSkyfile");15960 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffInputSkyfile"); 15961 15961 return count; 15962 15962 } … … 15967 15967 return deleted; 15968 15968 } 15969 bool p5InputSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)15969 bool diffInputSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 15970 15970 { 15971 15971 PS_ASSERT_PTR_NON_NULL(objects, false); … … 15973 15973 psMetadata *output = psMetadataAlloc(); 15974 15974 for (long i = 0; i < psArrayLength(objects); i++) { 15975 psMetadata *md = p5InputSkyfileMetadataFromObject(objects->data[i]);15975 psMetadata *md = diffInputSkyfileMetadataFromObject(objects->data[i]); 15976 15976 if (!psMetadataAddMetadata( 15977 15977 output, 15978 15978 PS_LIST_TAIL, 15979 P5INPUTSKYFILE_TABLE_NAME,15979 DIFFINPUTSKYFILE_TABLE_NAME, 15980 15980 PS_META_DUPLICATE_OK, 15981 15981 NULL, … … 15998 15998 return true; 15999 15999 } 16000 bool p5InputSkyfilePrintObject(FILE *stream, p5InputSkyfileRow *object, bool mdcf)16000 bool diffInputSkyfilePrintObject(FILE *stream, diffInputSkyfileRow *object, bool mdcf) 16001 16001 { 16002 16002 PS_ASSERT_PTR_NON_NULL(object, false); 16003 16003 16004 psMetadata *md = p5InputSkyfileMetadataFromObject(object);16004 psMetadata *md = diffInputSkyfileMetadataFromObject(object); 16005 16005 16006 16006 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 16013 16013 return true; 16014 16014 } 16015 static void p5DiffSkyfileRowFree(p5DiffSkyfileRow *object);16016 16017 p5DiffSkyfileRow *p5DiffSkyfileRowAlloc(psS32 p5_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)16018 { 16019 p5DiffSkyfileRow*_object;16020 16021 _object = psAlloc(sizeof( p5DiffSkyfileRow));16022 psMemSetDeallocator(_object, (psFreeFunc) p5DiffSkyfileRowFree);16023 16024 _object-> p5_id = p5_id;16015 static void diffSkyfileRowFree(diffSkyfileRow *object); 16016 16017 diffSkyfileRow *diffSkyfileRowAlloc(psS32 diff_id, const char *uri, psF64 bg, psF64 bg_mean_stdev) 16018 { 16019 diffSkyfileRow *_object; 16020 16021 _object = psAlloc(sizeof(diffSkyfileRow)); 16022 psMemSetDeallocator(_object, (psFreeFunc)diffSkyfileRowFree); 16023 16024 _object->diff_id = diff_id; 16025 16025 _object->uri = psStringCopy(uri); 16026 16026 _object->bg = bg; … … 16030 16030 } 16031 16031 16032 static void p5DiffSkyfileRowFree(p5DiffSkyfileRow *object)16032 static void diffSkyfileRowFree(diffSkyfileRow *object) 16033 16033 { 16034 16034 psFree(object->uri); 16035 16035 } 16036 16036 16037 bool p5DiffSkyfileCreateTable(psDB *dbh)16037 bool diffSkyfileCreateTable(psDB *dbh) 16038 16038 { 16039 16039 psMetadata *md = psMetadataAlloc(); 16040 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, "Primary Key", 0)) {16041 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");16040 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, "Primary Key", 0)) { 16041 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 16042 16042 psFree(md); 16043 16043 return false; … … 16059 16059 } 16060 16060 16061 bool status = psDBCreateTable(dbh, P5DIFFSKYFILE_TABLE_NAME, md);16061 bool status = psDBCreateTable(dbh, DIFFSKYFILE_TABLE_NAME, md); 16062 16062 16063 16063 psFree(md); … … 16066 16066 } 16067 16067 16068 bool p5DiffSkyfileDropTable(psDB *dbh)16069 { 16070 return psDBDropTable(dbh, P5DIFFSKYFILE_TABLE_NAME);16071 } 16072 16073 bool p5DiffSkyfileInsert(psDB * dbh, psS32 p5_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)16068 bool diffSkyfileDropTable(psDB *dbh) 16069 { 16070 return psDBDropTable(dbh, DIFFSKYFILE_TABLE_NAME); 16071 } 16072 16073 bool diffSkyfileInsert(psDB * dbh, psS32 diff_id, const char *uri, psF64 bg, psF64 bg_mean_stdev) 16074 16074 { 16075 16075 psMetadata *md = psMetadataAlloc(); 16076 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, NULL, p5_id)) {16077 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");16076 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, NULL, diff_id)) { 16077 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 16078 16078 psFree(md); 16079 16079 return false; … … 16095 16095 } 16096 16096 16097 bool status = psDBInsertOneRow(dbh, P5DIFFSKYFILE_TABLE_NAME, md);16097 bool status = psDBInsertOneRow(dbh, DIFFSKYFILE_TABLE_NAME, md); 16098 16098 psFree(md); 16099 16099 … … 16101 16101 } 16102 16102 16103 long long p5DiffSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)16103 long long diffSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 16104 16104 { 16105 16105 long long deleted = 0; 16106 16106 16107 long long count = psDBDeleteRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit);16107 long long count = psDBDeleteRows(dbh, DIFFSKYFILE_TABLE_NAME, where, limit); 16108 16108 if (count < 0) { 16109 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffSkyfile");16109 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffSkyfile"); 16110 16110 return count; 16111 16111 … … 16115 16115 return deleted; 16116 16116 } 16117 bool p5DiffSkyfileInsertObject(psDB *dbh, p5DiffSkyfileRow *object)16118 { 16119 return p5DiffSkyfileInsert(dbh, object->p5_id, object->uri, object->bg, object->bg_mean_stdev);16120 } 16121 16122 bool p5DiffSkyfileInsertObjects(psDB *dbh, psArray *objects)16117 bool diffSkyfileInsertObject(psDB *dbh, diffSkyfileRow *object) 16118 { 16119 return diffSkyfileInsert(dbh, object->diff_id, object->uri, object->bg, object->bg_mean_stdev); 16120 } 16121 16122 bool diffSkyfileInsertObjects(psDB *dbh, psArray *objects) 16123 16123 { 16124 16124 for (long i = 0; i < psArrayLength(objects); i++) { 16125 if (! p5DiffSkyfileInsertObject(dbh, objects->data[i])) {16125 if (!diffSkyfileInsertObject(dbh, objects->data[i])) { 16126 16126 return false; 16127 16127 } … … 16131 16131 } 16132 16132 16133 bool p5DiffSkyfileInsertFits(psDB *dbh, const psFits *fits)16133 bool diffSkyfileInsertFits(psDB *dbh, const psFits *fits) 16134 16134 { 16135 16135 psArray *rowSet; 16136 16136 16137 // move to (the first?) extension named P5DIFFSKYFILE_TABLE_NAME16138 if (!psFitsMoveExtName(fits, P5DIFFSKYFILE_TABLE_NAME)) {16139 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5DIFFSKYFILE_TABLE_NAME);16137 // move to (the first?) extension named DIFFSKYFILE_TABLE_NAME 16138 if (!psFitsMoveExtName(fits, DIFFSKYFILE_TABLE_NAME)) { 16139 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", DIFFSKYFILE_TABLE_NAME); 16140 16140 return false; 16141 16141 } … … 16155 16155 } 16156 16156 16157 if (!psDBInsertRows(dbh, P5DIFFSKYFILE_TABLE_NAME, rowSet)) {16157 if (!psDBInsertRows(dbh, DIFFSKYFILE_TABLE_NAME, rowSet)) { 16158 16158 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 16159 16159 psFree(rowSet); … … 16166 16166 } 16167 16167 16168 bool p5DiffSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)16168 bool diffSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 16169 16169 { 16170 16170 psArray *rowSet; 16171 16171 16172 rowSet = psDBSelectRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit);16172 rowSet = psDBSelectRows(dbh, DIFFSKYFILE_TABLE_NAME, where, limit); 16173 16173 if (!rowSet) { 16174 16174 return false; … … 16176 16176 16177 16177 // output to fits 16178 if (!psFitsWriteTable(fits, NULL, rowSet, P5DIFFSKYFILE_TABLE_NAME)) {16178 if (!psFitsWriteTable(fits, NULL, rowSet, DIFFSKYFILE_TABLE_NAME)) { 16179 16179 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 16180 16180 psFree(rowSet); … … 16187 16187 } 16188 16188 16189 psMetadata * p5DiffSkyfileMetadataFromObject(const p5DiffSkyfileRow *object)16189 psMetadata *diffSkyfileMetadataFromObject(const diffSkyfileRow *object) 16190 16190 { 16191 16191 psMetadata *md = psMetadataAlloc(); 16192 if (!psMetadataAdd(md, PS_LIST_TAIL, " p5_id", PS_DATA_S32, NULL, object->p5_id)) {16193 psError(PS_ERR_UNKNOWN, false, "failed to add item p5_id");16192 if (!psMetadataAdd(md, PS_LIST_TAIL, "diff_id", PS_DATA_S32, NULL, object->diff_id)) { 16193 psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id"); 16194 16194 psFree(md); 16195 16195 return false; … … 16215 16215 } 16216 16216 16217 p5DiffSkyfileRow *p5DiffSkyfileObjectFromMetadata(psMetadata *md)16217 diffSkyfileRow *diffSkyfileObjectFromMetadata(psMetadata *md) 16218 16218 { 16219 16219 16220 16220 bool status = false; 16221 psS32 p5_id = psMetadataLookupS32(&status, md, "p5_id");16222 if (!status) { 16223 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p5_id");16221 psS32 diff_id = psMetadataLookupS32(&status, md, "diff_id"); 16222 if (!status) { 16223 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item diff_id"); 16224 16224 return false; 16225 16225 } … … 16240 16240 } 16241 16241 16242 return p5DiffSkyfileRowAlloc(p5_id, uri, bg, bg_mean_stdev);16243 } 16244 psArray * p5DiffSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)16242 return diffSkyfileRowAlloc(diff_id, uri, bg, bg_mean_stdev); 16243 } 16244 psArray *diffSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16245 16245 { 16246 16246 psArray *rowSet; … … 16248 16248 psU64 i; 16249 16249 16250 rowSet = psDBSelectRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit);16250 rowSet = psDBSelectRows(dbh, DIFFSKYFILE_TABLE_NAME, where, limit); 16251 16251 if (!rowSet) { 16252 16252 return NULL; … … 16258 16258 16259 16259 for (i = 0; i < rowSet->n; i++) { 16260 p5DiffSkyfileRow *object = p5DiffSkyfileObjectFromMetadata(rowSet->data[i]);16260 diffSkyfileRow *object = diffSkyfileObjectFromMetadata(rowSet->data[i]); 16261 16261 psArrayAdd(returnSet, 0, object); 16262 16262 psFree(object); … … 16267 16267 return returnSet; 16268 16268 } 16269 bool p5DiffSkyfileDeleteObject(psDB *dbh, const p5DiffSkyfileRow *object)16270 { 16271 psMetadata *where = p5DiffSkyfileMetadataFromObject(object);16272 long long count = psDBDeleteRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, 0);16269 bool diffSkyfileDeleteObject(psDB *dbh, const diffSkyfileRow *object) 16270 { 16271 psMetadata *where = diffSkyfileMetadataFromObject(object); 16272 long long count = psDBDeleteRows(dbh, DIFFSKYFILE_TABLE_NAME, where, 0); 16273 16273 psFree(where); 16274 16274 if (count < 0) { 16275 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffSkyfile");16275 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffSkyfile"); 16276 16276 return false; 16277 16277 } … … 16279 16279 // XXX should this be a psAbort() instead? It is possible that 16280 16280 // having an object match multiple rows was by design. 16281 psError(PS_ERR_UNKNOWN, true, " p5DiffSkyfileRow object matched more then one row. Check your database schema");16282 return false; 16283 } 16284 16285 return true; 16286 } 16287 long long p5DiffSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)16281 psError(PS_ERR_UNKNOWN, true, "diffSkyfileRow object matched more then one row. Check your database schema"); 16282 return false; 16283 } 16284 16285 return true; 16286 } 16287 long long diffSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 16288 16288 { 16289 16289 long long deleted = 0; 16290 16290 16291 16291 for (long long i = 0; i < objects->n; i++) { 16292 p5DiffSkyfileRow *object = objects->data[i];16293 psMetadata *where = p5DiffSkyfileMetadataFromObject(object);16294 long long count = psDBDeleteRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit);16292 diffSkyfileRow *object = objects->data[i]; 16293 psMetadata *where = diffSkyfileMetadataFromObject(object); 16294 long long count = psDBDeleteRows(dbh, DIFFSKYFILE_TABLE_NAME, where, limit); 16295 16295 psFree(where); 16296 16296 if (count < 0) { 16297 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffSkyfile");16297 psError(PS_ERR_UNKNOWN, true, "failed to delete row from diffSkyfile"); 16298 16298 return count; 16299 16299 } … … 16304 16304 return deleted; 16305 16305 } 16306 bool p5DiffSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)16306 bool diffSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 16307 16307 { 16308 16308 PS_ASSERT_PTR_NON_NULL(objects, false); … … 16310 16310 psMetadata *output = psMetadataAlloc(); 16311 16311 for (long i = 0; i < psArrayLength(objects); i++) { 16312 psMetadata *md = p5DiffSkyfileMetadataFromObject(objects->data[i]);16312 psMetadata *md = diffSkyfileMetadataFromObject(objects->data[i]); 16313 16313 if (!psMetadataAddMetadata( 16314 16314 output, 16315 16315 PS_LIST_TAIL, 16316 P5DIFFSKYFILE_TABLE_NAME,16316 DIFFSKYFILE_TABLE_NAME, 16317 16317 PS_META_DUPLICATE_OK, 16318 16318 NULL, … … 16335 16335 return true; 16336 16336 } 16337 bool p5DiffSkyfilePrintObject(FILE *stream, p5DiffSkyfileRow *object, bool mdcf)16337 bool diffSkyfilePrintObject(FILE *stream, diffSkyfileRow *object, bool mdcf) 16338 16338 { 16339 16339 PS_ASSERT_PTR_NON_NULL(object, false); 16340 16340 16341 psMetadata *md = p5DiffSkyfileMetadataFromObject(object);16341 psMetadata *md = diffSkyfileMetadataFromObject(object); 16342 16342 16343 16343 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 16350 16350 return true; 16351 16351 } 16352 static void p6RunRowFree(p6RunRow *object);16353 16354 p6RunRow *p6RunRowAlloc(psS32 p6_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id)16355 { 16356 p6RunRow*_object;16357 16358 _object = psAlloc(sizeof( p6RunRow));16359 psMemSetDeallocator(_object, (psFreeFunc) p6RunRowFree);16360 16361 _object-> p6_id = p6_id;16352 static void stackRunRowFree(stackRunRow *object); 16353 16354 stackRunRow *stackRunRowAlloc(psS32 stack_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id) 16355 { 16356 stackRunRow *_object; 16357 16358 _object = psAlloc(sizeof(stackRunRow)); 16359 psMemSetDeallocator(_object, (psFreeFunc)stackRunRowFree); 16360 16361 _object->stack_id = stack_id; 16362 16362 _object->state = psStringCopy(state); 16363 16363 _object->workdir = psStringCopy(workdir); … … 16370 16370 } 16371 16371 16372 static void p6RunRowFree(p6RunRow *object)16372 static void stackRunRowFree(stackRunRow *object) 16373 16373 { 16374 16374 psFree(object->state); … … 16380 16380 } 16381 16381 16382 bool p6RunCreateTable(psDB *dbh)16382 bool stackRunCreateTable(psDB *dbh) 16383 16383 { 16384 16384 psMetadata *md = psMetadataAlloc(); 16385 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) {16386 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");16385 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, "Primary Key AUTO_INCREMENT", 0)) { 16386 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 16387 16387 psFree(md); 16388 16388 return false; … … 16419 16419 } 16420 16420 16421 bool status = psDBCreateTable(dbh, P6RUN_TABLE_NAME, md);16421 bool status = psDBCreateTable(dbh, STACKRUN_TABLE_NAME, md); 16422 16422 16423 16423 psFree(md); … … 16426 16426 } 16427 16427 16428 bool p6RunDropTable(psDB *dbh)16429 { 16430 return psDBDropTable(dbh, P6RUN_TABLE_NAME);16431 } 16432 16433 bool p6RunInsert(psDB * dbh, psS32 p6_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id)16428 bool stackRunDropTable(psDB *dbh) 16429 { 16430 return psDBDropTable(dbh, STACKRUN_TABLE_NAME); 16431 } 16432 16433 bool stackRunInsert(psDB * dbh, psS32 stack_id, const char *state, const char *workdir, const char *dvodb, psTime* registered, const char *skycell_id, const char *tess_id) 16434 16434 { 16435 16435 psMetadata *md = psMetadataAlloc(); 16436 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, NULL, p6_id)) {16437 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");16436 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, NULL, stack_id)) { 16437 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 16438 16438 psFree(md); 16439 16439 return false; … … 16470 16470 } 16471 16471 16472 bool status = psDBInsertOneRow(dbh, P6RUN_TABLE_NAME, md);16472 bool status = psDBInsertOneRow(dbh, STACKRUN_TABLE_NAME, md); 16473 16473 psFree(md); 16474 16474 … … 16476 16476 } 16477 16477 16478 long long p6RunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)16478 long long stackRunDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 16479 16479 { 16480 16480 long long deleted = 0; 16481 16481 16482 long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit);16482 long long count = psDBDeleteRows(dbh, STACKRUN_TABLE_NAME, where, limit); 16483 16483 if (count < 0) { 16484 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");16484 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackRun"); 16485 16485 return count; 16486 16486 … … 16490 16490 return deleted; 16491 16491 } 16492 bool p6RunInsertObject(psDB *dbh, p6RunRow *object)16493 { 16494 return p6RunInsert(dbh, object->p6_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id);16495 } 16496 16497 bool p6RunInsertObjects(psDB *dbh, psArray *objects)16492 bool stackRunInsertObject(psDB *dbh, stackRunRow *object) 16493 { 16494 return stackRunInsert(dbh, object->stack_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id); 16495 } 16496 16497 bool stackRunInsertObjects(psDB *dbh, psArray *objects) 16498 16498 { 16499 16499 for (long i = 0; i < psArrayLength(objects); i++) { 16500 if (! p6RunInsertObject(dbh, objects->data[i])) {16500 if (!stackRunInsertObject(dbh, objects->data[i])) { 16501 16501 return false; 16502 16502 } … … 16506 16506 } 16507 16507 16508 bool p6RunInsertFits(psDB *dbh, const psFits *fits)16508 bool stackRunInsertFits(psDB *dbh, const psFits *fits) 16509 16509 { 16510 16510 psArray *rowSet; 16511 16511 16512 // move to (the first?) extension named P6RUN_TABLE_NAME16513 if (!psFitsMoveExtName(fits, P6RUN_TABLE_NAME)) {16514 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6RUN_TABLE_NAME);16512 // move to (the first?) extension named STACKRUN_TABLE_NAME 16513 if (!psFitsMoveExtName(fits, STACKRUN_TABLE_NAME)) { 16514 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", STACKRUN_TABLE_NAME); 16515 16515 return false; 16516 16516 } … … 16530 16530 } 16531 16531 16532 if (!psDBInsertRows(dbh, P6RUN_TABLE_NAME, rowSet)) {16532 if (!psDBInsertRows(dbh, STACKRUN_TABLE_NAME, rowSet)) { 16533 16533 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 16534 16534 psFree(rowSet); … … 16541 16541 } 16542 16542 16543 bool p6RunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)16543 bool stackRunSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 16544 16544 { 16545 16545 psArray *rowSet; 16546 16546 16547 rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit);16547 rowSet = psDBSelectRows(dbh, STACKRUN_TABLE_NAME, where, limit); 16548 16548 if (!rowSet) { 16549 16549 return false; … … 16551 16551 16552 16552 // output to fits 16553 if (!psFitsWriteTable(fits, NULL, rowSet, P6RUN_TABLE_NAME)) {16553 if (!psFitsWriteTable(fits, NULL, rowSet, STACKRUN_TABLE_NAME)) { 16554 16554 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 16555 16555 psFree(rowSet); … … 16562 16562 } 16563 16563 16564 psMetadata * p6RunMetadataFromObject(const p6RunRow *object)16564 psMetadata *stackRunMetadataFromObject(const stackRunRow *object) 16565 16565 { 16566 16566 psMetadata *md = psMetadataAlloc(); 16567 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, NULL, object->p6_id)) {16568 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");16567 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, NULL, object->stack_id)) { 16568 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 16569 16569 psFree(md); 16570 16570 return false; … … 16605 16605 } 16606 16606 16607 p6RunRow *p6RunObjectFromMetadata(psMetadata *md)16607 stackRunRow *stackRunObjectFromMetadata(psMetadata *md) 16608 16608 { 16609 16609 16610 16610 bool status = false; 16611 psS32 p6_id = psMetadataLookupS32(&status, md, "p6_id");16612 if (!status) { 16613 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p6_id");16611 psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id"); 16612 if (!status) { 16613 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id"); 16614 16614 return false; 16615 16615 } … … 16645 16645 } 16646 16646 16647 return p6RunRowAlloc(p6_id, state, workdir, dvodb, registered, skycell_id, tess_id);16648 } 16649 psArray * p6RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)16647 return stackRunRowAlloc(stack_id, state, workdir, dvodb, registered, skycell_id, tess_id); 16648 } 16649 psArray *stackRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16650 16650 { 16651 16651 psArray *rowSet; … … 16653 16653 psU64 i; 16654 16654 16655 rowSet = psDBSelectRows(dbh, P6RUN_TABLE_NAME, where, limit);16655 rowSet = psDBSelectRows(dbh, STACKRUN_TABLE_NAME, where, limit); 16656 16656 if (!rowSet) { 16657 16657 return NULL; … … 16663 16663 16664 16664 for (i = 0; i < rowSet->n; i++) { 16665 p6RunRow *object = p6RunObjectFromMetadata(rowSet->data[i]);16665 stackRunRow *object = stackRunObjectFromMetadata(rowSet->data[i]); 16666 16666 psArrayAdd(returnSet, 0, object); 16667 16667 psFree(object); … … 16672 16672 return returnSet; 16673 16673 } 16674 bool p6RunDeleteObject(psDB *dbh, const p6RunRow *object)16675 { 16676 psMetadata *where = p6RunMetadataFromObject(object);16677 long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, 0);16674 bool stackRunDeleteObject(psDB *dbh, const stackRunRow *object) 16675 { 16676 psMetadata *where = stackRunMetadataFromObject(object); 16677 long long count = psDBDeleteRows(dbh, STACKRUN_TABLE_NAME, where, 0); 16678 16678 psFree(where); 16679 16679 if (count < 0) { 16680 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");16680 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackRun"); 16681 16681 return false; 16682 16682 } … … 16684 16684 // XXX should this be a psAbort() instead? It is possible that 16685 16685 // having an object match multiple rows was by design. 16686 psError(PS_ERR_UNKNOWN, true, " p6RunRow object matched more then one row. Check your database schema");16687 return false; 16688 } 16689 16690 return true; 16691 } 16692 long long p6RunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)16686 psError(PS_ERR_UNKNOWN, true, "stackRunRow object matched more then one row. Check your database schema"); 16687 return false; 16688 } 16689 16690 return true; 16691 } 16692 long long stackRunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 16693 16693 { 16694 16694 long long deleted = 0; 16695 16695 16696 16696 for (long long i = 0; i < objects->n; i++) { 16697 p6RunRow *object = objects->data[i];16698 psMetadata *where = p6RunMetadataFromObject(object);16699 long long count = psDBDeleteRows(dbh, P6RUN_TABLE_NAME, where, limit);16697 stackRunRow *object = objects->data[i]; 16698 psMetadata *where = stackRunMetadataFromObject(object); 16699 long long count = psDBDeleteRows(dbh, STACKRUN_TABLE_NAME, where, limit); 16700 16700 psFree(where); 16701 16701 if (count < 0) { 16702 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6Run");16702 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackRun"); 16703 16703 return count; 16704 16704 } … … 16709 16709 return deleted; 16710 16710 } 16711 bool p6RunPrintObjects(FILE *stream, psArray *objects, bool mdcf)16711 bool stackRunPrintObjects(FILE *stream, psArray *objects, bool mdcf) 16712 16712 { 16713 16713 PS_ASSERT_PTR_NON_NULL(objects, false); … … 16715 16715 psMetadata *output = psMetadataAlloc(); 16716 16716 for (long i = 0; i < psArrayLength(objects); i++) { 16717 psMetadata *md = p6RunMetadataFromObject(objects->data[i]);16717 psMetadata *md = stackRunMetadataFromObject(objects->data[i]); 16718 16718 if (!psMetadataAddMetadata( 16719 16719 output, 16720 16720 PS_LIST_TAIL, 16721 P6RUN_TABLE_NAME,16721 STACKRUN_TABLE_NAME, 16722 16722 PS_META_DUPLICATE_OK, 16723 16723 NULL, … … 16740 16740 return true; 16741 16741 } 16742 bool p6RunPrintObject(FILE *stream, p6RunRow *object, bool mdcf)16742 bool stackRunPrintObject(FILE *stream, stackRunRow *object, bool mdcf) 16743 16743 { 16744 16744 PS_ASSERT_PTR_NON_NULL(object, false); 16745 16745 16746 psMetadata *md = p6RunMetadataFromObject(object);16746 psMetadata *md = stackRunMetadataFromObject(object); 16747 16747 16748 16748 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 16755 16755 return true; 16756 16756 } 16757 static void p6InputSkyfileRowFree(p6InputSkyfileRow *object);16758 16759 p6InputSkyfileRow *p6InputSkyfileRowAlloc(psS32 p6_id, psS32 p4_id)16760 { 16761 p6InputSkyfileRow *_object;16762 16763 _object = psAlloc(sizeof( p6InputSkyfileRow));16764 psMemSetDeallocator(_object, (psFreeFunc) p6InputSkyfileRowFree);16765 16766 _object-> p6_id = p6_id;16767 _object-> p4_id = p4_id;16757 static void stackInputSkyfileRowFree(stackInputSkyfileRow *object); 16758 16759 stackInputSkyfileRow *stackInputSkyfileRowAlloc(psS32 stack_id, psS32 warp_id) 16760 { 16761 stackInputSkyfileRow *_object; 16762 16763 _object = psAlloc(sizeof(stackInputSkyfileRow)); 16764 psMemSetDeallocator(_object, (psFreeFunc)stackInputSkyfileRowFree); 16765 16766 _object->stack_id = stack_id; 16767 _object->warp_id = warp_id; 16768 16768 16769 16769 return _object; 16770 16770 } 16771 16771 16772 static void p6InputSkyfileRowFree(p6InputSkyfileRow *object)16773 { 16774 } 16775 16776 bool p6InputSkyfileCreateTable(psDB *dbh)16772 static void stackInputSkyfileRowFree(stackInputSkyfileRow *object) 16773 { 16774 } 16775 16776 bool stackInputSkyfileCreateTable(psDB *dbh) 16777 16777 { 16778 16778 psMetadata *md = psMetadataAlloc(); 16779 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, "Primary Key", 0)) {16780 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");16781 psFree(md); 16782 return false; 16783 } 16784 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, "Primary Key", 0)) {16785 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");16786 psFree(md); 16787 return false; 16788 } 16789 16790 bool status = psDBCreateTable(dbh, P6INPUTSKYFILE_TABLE_NAME, md);16779 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, "Primary Key", 0)) { 16780 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 16781 psFree(md); 16782 return false; 16783 } 16784 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, "Primary Key", 0)) { 16785 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 16786 psFree(md); 16787 return false; 16788 } 16789 16790 bool status = psDBCreateTable(dbh, STACKINPUTSKYFILE_TABLE_NAME, md); 16791 16791 16792 16792 psFree(md); … … 16795 16795 } 16796 16796 16797 bool p6InputSkyfileDropTable(psDB *dbh)16798 { 16799 return psDBDropTable(dbh, P6INPUTSKYFILE_TABLE_NAME);16800 } 16801 16802 bool p6InputSkyfileInsert(psDB * dbh, psS32 p6_id, psS32 p4_id)16797 bool stackInputSkyfileDropTable(psDB *dbh) 16798 { 16799 return psDBDropTable(dbh, STACKINPUTSKYFILE_TABLE_NAME); 16800 } 16801 16802 bool stackInputSkyfileInsert(psDB * dbh, psS32 stack_id, psS32 warp_id) 16803 16803 { 16804 16804 psMetadata *md = psMetadataAlloc(); 16805 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, NULL, p6_id)) {16806 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");16807 psFree(md); 16808 return false; 16809 } 16810 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, p4_id)) {16811 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");16812 psFree(md); 16813 return false; 16814 } 16815 16816 bool status = psDBInsertOneRow(dbh, P6INPUTSKYFILE_TABLE_NAME, md);16805 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, NULL, stack_id)) { 16806 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 16807 psFree(md); 16808 return false; 16809 } 16810 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, warp_id)) { 16811 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 16812 psFree(md); 16813 return false; 16814 } 16815 16816 bool status = psDBInsertOneRow(dbh, STACKINPUTSKYFILE_TABLE_NAME, md); 16817 16817 psFree(md); 16818 16818 … … 16820 16820 } 16821 16821 16822 long long p6InputSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)16822 long long stackInputSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 16823 16823 { 16824 16824 long long deleted = 0; 16825 16825 16826 long long count = psDBDeleteRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit);16826 long long count = psDBDeleteRows(dbh, STACKINPUTSKYFILE_TABLE_NAME, where, limit); 16827 16827 if (count < 0) { 16828 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputSkyfile");16828 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackInputSkyfile"); 16829 16829 return count; 16830 16830 … … 16834 16834 return deleted; 16835 16835 } 16836 bool p6InputSkyfileInsertObject(psDB *dbh, p6InputSkyfileRow *object)16837 { 16838 return p6InputSkyfileInsert(dbh, object->p6_id, object->p4_id);16839 } 16840 16841 bool p6InputSkyfileInsertObjects(psDB *dbh, psArray *objects)16836 bool stackInputSkyfileInsertObject(psDB *dbh, stackInputSkyfileRow *object) 16837 { 16838 return stackInputSkyfileInsert(dbh, object->stack_id, object->warp_id); 16839 } 16840 16841 bool stackInputSkyfileInsertObjects(psDB *dbh, psArray *objects) 16842 16842 { 16843 16843 for (long i = 0; i < psArrayLength(objects); i++) { 16844 if (! p6InputSkyfileInsertObject(dbh, objects->data[i])) {16844 if (!stackInputSkyfileInsertObject(dbh, objects->data[i])) { 16845 16845 return false; 16846 16846 } … … 16850 16850 } 16851 16851 16852 bool p6InputSkyfileInsertFits(psDB *dbh, const psFits *fits)16852 bool stackInputSkyfileInsertFits(psDB *dbh, const psFits *fits) 16853 16853 { 16854 16854 psArray *rowSet; 16855 16855 16856 // move to (the first?) extension named P6INPUTSKYFILE_TABLE_NAME16857 if (!psFitsMoveExtName(fits, P6INPUTSKYFILE_TABLE_NAME)) {16858 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6INPUTSKYFILE_TABLE_NAME);16856 // move to (the first?) extension named STACKINPUTSKYFILE_TABLE_NAME 16857 if (!psFitsMoveExtName(fits, STACKINPUTSKYFILE_TABLE_NAME)) { 16858 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", STACKINPUTSKYFILE_TABLE_NAME); 16859 16859 return false; 16860 16860 } … … 16874 16874 } 16875 16875 16876 if (!psDBInsertRows(dbh, P6INPUTSKYFILE_TABLE_NAME, rowSet)) {16876 if (!psDBInsertRows(dbh, STACKINPUTSKYFILE_TABLE_NAME, rowSet)) { 16877 16877 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 16878 16878 psFree(rowSet); … … 16885 16885 } 16886 16886 16887 bool p6InputSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)16887 bool stackInputSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 16888 16888 { 16889 16889 psArray *rowSet; 16890 16890 16891 rowSet = psDBSelectRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit);16891 rowSet = psDBSelectRows(dbh, STACKINPUTSKYFILE_TABLE_NAME, where, limit); 16892 16892 if (!rowSet) { 16893 16893 return false; … … 16895 16895 16896 16896 // output to fits 16897 if (!psFitsWriteTable(fits, NULL, rowSet, P6INPUTSKYFILE_TABLE_NAME)) {16897 if (!psFitsWriteTable(fits, NULL, rowSet, STACKINPUTSKYFILE_TABLE_NAME)) { 16898 16898 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 16899 16899 psFree(rowSet); … … 16906 16906 } 16907 16907 16908 psMetadata * p6InputSkyfileMetadataFromObject(const p6InputSkyfileRow *object)16908 psMetadata *stackInputSkyfileMetadataFromObject(const stackInputSkyfileRow *object) 16909 16909 { 16910 16910 psMetadata *md = psMetadataAlloc(); 16911 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, NULL, object->p6_id)) {16912 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");16913 psFree(md); 16914 return false; 16915 } 16916 if (!psMetadataAdd(md, PS_LIST_TAIL, " p4_id", PS_DATA_S32, NULL, object->p4_id)) {16917 psError(PS_ERR_UNKNOWN, false, "failed to add item p4_id");16911 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, NULL, object->stack_id)) { 16912 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 16913 psFree(md); 16914 return false; 16915 } 16916 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S32, NULL, object->warp_id)) { 16917 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 16918 16918 psFree(md); 16919 16919 return false; … … 16924 16924 } 16925 16925 16926 p6InputSkyfileRow *p6InputSkyfileObjectFromMetadata(psMetadata *md)16926 stackInputSkyfileRow *stackInputSkyfileObjectFromMetadata(psMetadata *md) 16927 16927 { 16928 16928 16929 16929 bool status = false; 16930 psS32 p6_id = psMetadataLookupS32(&status, md, "p6_id");16931 if (!status) { 16932 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p6_id");16933 return false; 16934 } 16935 psS32 p4_id = psMetadataLookupS32(&status, md, "p4_id");16936 if (!status) { 16937 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p4_id");16938 return false; 16939 } 16940 16941 return p6InputSkyfileRowAlloc(p6_id, p4_id);16942 } 16943 psArray * p6InputSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)16930 psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id"); 16931 if (!status) { 16932 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id"); 16933 return false; 16934 } 16935 psS32 warp_id = psMetadataLookupS32(&status, md, "warp_id"); 16936 if (!status) { 16937 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item warp_id"); 16938 return false; 16939 } 16940 16941 return stackInputSkyfileRowAlloc(stack_id, warp_id); 16942 } 16943 psArray *stackInputSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16944 16944 { 16945 16945 psArray *rowSet; … … 16947 16947 psU64 i; 16948 16948 16949 rowSet = psDBSelectRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit);16949 rowSet = psDBSelectRows(dbh, STACKINPUTSKYFILE_TABLE_NAME, where, limit); 16950 16950 if (!rowSet) { 16951 16951 return NULL; … … 16957 16957 16958 16958 for (i = 0; i < rowSet->n; i++) { 16959 p6InputSkyfileRow *object = p6InputSkyfileObjectFromMetadata(rowSet->data[i]);16959 stackInputSkyfileRow *object = stackInputSkyfileObjectFromMetadata(rowSet->data[i]); 16960 16960 psArrayAdd(returnSet, 0, object); 16961 16961 psFree(object); … … 16966 16966 return returnSet; 16967 16967 } 16968 bool p6InputSkyfileDeleteObject(psDB *dbh, const p6InputSkyfileRow *object)16969 { 16970 psMetadata *where = p6InputSkyfileMetadataFromObject(object);16971 long long count = psDBDeleteRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, 0);16968 bool stackInputSkyfileDeleteObject(psDB *dbh, const stackInputSkyfileRow *object) 16969 { 16970 psMetadata *where = stackInputSkyfileMetadataFromObject(object); 16971 long long count = psDBDeleteRows(dbh, STACKINPUTSKYFILE_TABLE_NAME, where, 0); 16972 16972 psFree(where); 16973 16973 if (count < 0) { 16974 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputSkyfile");16974 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackInputSkyfile"); 16975 16975 return false; 16976 16976 } … … 16978 16978 // XXX should this be a psAbort() instead? It is possible that 16979 16979 // having an object match multiple rows was by design. 16980 psError(PS_ERR_UNKNOWN, true, " p6InputSkyfileRow object matched more then one row. Check your database schema");16981 return false; 16982 } 16983 16984 return true; 16985 } 16986 long long p6InputSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)16980 psError(PS_ERR_UNKNOWN, true, "stackInputSkyfileRow object matched more then one row. Check your database schema"); 16981 return false; 16982 } 16983 16984 return true; 16985 } 16986 long long stackInputSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 16987 16987 { 16988 16988 long long deleted = 0; 16989 16989 16990 16990 for (long long i = 0; i < objects->n; i++) { 16991 p6InputSkyfileRow *object = objects->data[i];16992 psMetadata *where = p6InputSkyfileMetadataFromObject(object);16993 long long count = psDBDeleteRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit);16991 stackInputSkyfileRow *object = objects->data[i]; 16992 psMetadata *where = stackInputSkyfileMetadataFromObject(object); 16993 long long count = psDBDeleteRows(dbh, STACKINPUTSKYFILE_TABLE_NAME, where, limit); 16994 16994 psFree(where); 16995 16995 if (count < 0) { 16996 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputSkyfile");16996 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackInputSkyfile"); 16997 16997 return count; 16998 16998 } … … 17003 17003 return deleted; 17004 17004 } 17005 bool p6InputSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)17005 bool stackInputSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 17006 17006 { 17007 17007 PS_ASSERT_PTR_NON_NULL(objects, false); … … 17009 17009 psMetadata *output = psMetadataAlloc(); 17010 17010 for (long i = 0; i < psArrayLength(objects); i++) { 17011 psMetadata *md = p6InputSkyfileMetadataFromObject(objects->data[i]);17011 psMetadata *md = stackInputSkyfileMetadataFromObject(objects->data[i]); 17012 17012 if (!psMetadataAddMetadata( 17013 17013 output, 17014 17014 PS_LIST_TAIL, 17015 P6INPUTSKYFILE_TABLE_NAME,17015 STACKINPUTSKYFILE_TABLE_NAME, 17016 17016 PS_META_DUPLICATE_OK, 17017 17017 NULL, … … 17034 17034 return true; 17035 17035 } 17036 bool p6InputSkyfilePrintObject(FILE *stream, p6InputSkyfileRow *object, bool mdcf)17036 bool stackInputSkyfilePrintObject(FILE *stream, stackInputSkyfileRow *object, bool mdcf) 17037 17037 { 17038 17038 PS_ASSERT_PTR_NON_NULL(object, false); 17039 17039 17040 psMetadata *md = p6InputSkyfileMetadataFromObject(object);17040 psMetadata *md = stackInputSkyfileMetadataFromObject(object); 17041 17041 17042 17042 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 17049 17049 return true; 17050 17050 } 17051 static void p6SumSkyfileRowFree(p6SumSkyfileRow *object);17052 17053 p6SumSkyfileRow *p6SumSkyfileRowAlloc(psS32 p6_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)17054 { 17055 p6SumSkyfileRow *_object;17056 17057 _object = psAlloc(sizeof( p6SumSkyfileRow));17058 psMemSetDeallocator(_object, (psFreeFunc) p6SumSkyfileRowFree);17059 17060 _object-> p6_id = p6_id;17051 static void stackSumSkyfileRowFree(stackSumSkyfileRow *object); 17052 17053 stackSumSkyfileRow *stackSumSkyfileRowAlloc(psS32 stack_id, const char *uri, psF64 bg, psF64 bg_mean_stdev) 17054 { 17055 stackSumSkyfileRow *_object; 17056 17057 _object = psAlloc(sizeof(stackSumSkyfileRow)); 17058 psMemSetDeallocator(_object, (psFreeFunc)stackSumSkyfileRowFree); 17059 17060 _object->stack_id = stack_id; 17061 17061 _object->uri = psStringCopy(uri); 17062 17062 _object->bg = bg; … … 17066 17066 } 17067 17067 17068 static void p6SumSkyfileRowFree(p6SumSkyfileRow *object)17068 static void stackSumSkyfileRowFree(stackSumSkyfileRow *object) 17069 17069 { 17070 17070 psFree(object->uri); 17071 17071 } 17072 17072 17073 bool p6SumSkyfileCreateTable(psDB *dbh)17073 bool stackSumSkyfileCreateTable(psDB *dbh) 17074 17074 { 17075 17075 psMetadata *md = psMetadataAlloc(); 17076 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, "Primary Key", 0)) {17077 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");17076 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, "Primary Key", 0)) { 17077 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 17078 17078 psFree(md); 17079 17079 return false; … … 17095 17095 } 17096 17096 17097 bool status = psDBCreateTable(dbh, P6SUMSKYFILE_TABLE_NAME, md);17097 bool status = psDBCreateTable(dbh, STACKSUMSKYFILE_TABLE_NAME, md); 17098 17098 17099 17099 psFree(md); … … 17102 17102 } 17103 17103 17104 bool p6SumSkyfileDropTable(psDB *dbh)17105 { 17106 return psDBDropTable(dbh, P6SUMSKYFILE_TABLE_NAME);17107 } 17108 17109 bool p6SumSkyfileInsert(psDB * dbh, psS32 p6_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)17104 bool stackSumSkyfileDropTable(psDB *dbh) 17105 { 17106 return psDBDropTable(dbh, STACKSUMSKYFILE_TABLE_NAME); 17107 } 17108 17109 bool stackSumSkyfileInsert(psDB * dbh, psS32 stack_id, const char *uri, psF64 bg, psF64 bg_mean_stdev) 17110 17110 { 17111 17111 psMetadata *md = psMetadataAlloc(); 17112 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, NULL, p6_id)) {17113 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");17112 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, NULL, stack_id)) { 17113 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 17114 17114 psFree(md); 17115 17115 return false; … … 17131 17131 } 17132 17132 17133 bool status = psDBInsertOneRow(dbh, P6SUMSKYFILE_TABLE_NAME, md);17133 bool status = psDBInsertOneRow(dbh, STACKSUMSKYFILE_TABLE_NAME, md); 17134 17134 psFree(md); 17135 17135 … … 17137 17137 } 17138 17138 17139 long long p6SumSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)17139 long long stackSumSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 17140 17140 { 17141 17141 long long deleted = 0; 17142 17142 17143 long long count = psDBDeleteRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit);17143 long long count = psDBDeleteRows(dbh, STACKSUMSKYFILE_TABLE_NAME, where, limit); 17144 17144 if (count < 0) { 17145 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumSkyfile");17145 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackSumSkyfile"); 17146 17146 return count; 17147 17147 … … 17151 17151 return deleted; 17152 17152 } 17153 bool p6SumSkyfileInsertObject(psDB *dbh, p6SumSkyfileRow *object)17154 { 17155 return p6SumSkyfileInsert(dbh, object->p6_id, object->uri, object->bg, object->bg_mean_stdev);17156 } 17157 17158 bool p6SumSkyfileInsertObjects(psDB *dbh, psArray *objects)17153 bool stackSumSkyfileInsertObject(psDB *dbh, stackSumSkyfileRow *object) 17154 { 17155 return stackSumSkyfileInsert(dbh, object->stack_id, object->uri, object->bg, object->bg_mean_stdev); 17156 } 17157 17158 bool stackSumSkyfileInsertObjects(psDB *dbh, psArray *objects) 17159 17159 { 17160 17160 for (long i = 0; i < psArrayLength(objects); i++) { 17161 if (! p6SumSkyfileInsertObject(dbh, objects->data[i])) {17161 if (!stackSumSkyfileInsertObject(dbh, objects->data[i])) { 17162 17162 return false; 17163 17163 } … … 17167 17167 } 17168 17168 17169 bool p6SumSkyfileInsertFits(psDB *dbh, const psFits *fits)17169 bool stackSumSkyfileInsertFits(psDB *dbh, const psFits *fits) 17170 17170 { 17171 17171 psArray *rowSet; 17172 17172 17173 // move to (the first?) extension named P6SUMSKYFILE_TABLE_NAME17174 if (!psFitsMoveExtName(fits, P6SUMSKYFILE_TABLE_NAME)) {17175 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6SUMSKYFILE_TABLE_NAME);17173 // move to (the first?) extension named STACKSUMSKYFILE_TABLE_NAME 17174 if (!psFitsMoveExtName(fits, STACKSUMSKYFILE_TABLE_NAME)) { 17175 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", STACKSUMSKYFILE_TABLE_NAME); 17176 17176 return false; 17177 17177 } … … 17191 17191 } 17192 17192 17193 if (!psDBInsertRows(dbh, P6SUMSKYFILE_TABLE_NAME, rowSet)) {17193 if (!psDBInsertRows(dbh, STACKSUMSKYFILE_TABLE_NAME, rowSet)) { 17194 17194 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 17195 17195 psFree(rowSet); … … 17202 17202 } 17203 17203 17204 bool p6SumSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)17204 bool stackSumSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 17205 17205 { 17206 17206 psArray *rowSet; 17207 17207 17208 rowSet = psDBSelectRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit);17208 rowSet = psDBSelectRows(dbh, STACKSUMSKYFILE_TABLE_NAME, where, limit); 17209 17209 if (!rowSet) { 17210 17210 return false; … … 17212 17212 17213 17213 // output to fits 17214 if (!psFitsWriteTable(fits, NULL, rowSet, P6SUMSKYFILE_TABLE_NAME)) {17214 if (!psFitsWriteTable(fits, NULL, rowSet, STACKSUMSKYFILE_TABLE_NAME)) { 17215 17215 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 17216 17216 psFree(rowSet); … … 17223 17223 } 17224 17224 17225 psMetadata * p6SumSkyfileMetadataFromObject(const p6SumSkyfileRow *object)17225 psMetadata *stackSumSkyfileMetadataFromObject(const stackSumSkyfileRow *object) 17226 17226 { 17227 17227 psMetadata *md = psMetadataAlloc(); 17228 if (!psMetadataAdd(md, PS_LIST_TAIL, " p6_id", PS_DATA_S32, NULL, object->p6_id)) {17229 psError(PS_ERR_UNKNOWN, false, "failed to add item p6_id");17228 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S32, NULL, object->stack_id)) { 17229 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 17230 17230 psFree(md); 17231 17231 return false; … … 17251 17251 } 17252 17252 17253 p6SumSkyfileRow *p6SumSkyfileObjectFromMetadata(psMetadata *md)17253 stackSumSkyfileRow *stackSumSkyfileObjectFromMetadata(psMetadata *md) 17254 17254 { 17255 17255 17256 17256 bool status = false; 17257 psS32 p6_id = psMetadataLookupS32(&status, md, "p6_id");17258 if (!status) { 17259 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p6_id");17257 psS32 stack_id = psMetadataLookupS32(&status, md, "stack_id"); 17258 if (!status) { 17259 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id"); 17260 17260 return false; 17261 17261 } … … 17276 17276 } 17277 17277 17278 return p6SumSkyfileRowAlloc(p6_id, uri, bg, bg_mean_stdev);17279 } 17280 psArray * p6SumSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)17278 return stackSumSkyfileRowAlloc(stack_id, uri, bg, bg_mean_stdev); 17279 } 17280 psArray *stackSumSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 17281 17281 { 17282 17282 psArray *rowSet; … … 17284 17284 psU64 i; 17285 17285 17286 rowSet = psDBSelectRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit);17286 rowSet = psDBSelectRows(dbh, STACKSUMSKYFILE_TABLE_NAME, where, limit); 17287 17287 if (!rowSet) { 17288 17288 return NULL; … … 17294 17294 17295 17295 for (i = 0; i < rowSet->n; i++) { 17296 p6SumSkyfileRow *object = p6SumSkyfileObjectFromMetadata(rowSet->data[i]);17296 stackSumSkyfileRow *object = stackSumSkyfileObjectFromMetadata(rowSet->data[i]); 17297 17297 psArrayAdd(returnSet, 0, object); 17298 17298 psFree(object); … … 17303 17303 return returnSet; 17304 17304 } 17305 bool p6SumSkyfileDeleteObject(psDB *dbh, const p6SumSkyfileRow *object)17306 { 17307 psMetadata *where = p6SumSkyfileMetadataFromObject(object);17308 long long count = psDBDeleteRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, 0);17305 bool stackSumSkyfileDeleteObject(psDB *dbh, const stackSumSkyfileRow *object) 17306 { 17307 psMetadata *where = stackSumSkyfileMetadataFromObject(object); 17308 long long count = psDBDeleteRows(dbh, STACKSUMSKYFILE_TABLE_NAME, where, 0); 17309 17309 psFree(where); 17310 17310 if (count < 0) { 17311 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumSkyfile");17311 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackSumSkyfile"); 17312 17312 return false; 17313 17313 } … … 17315 17315 // XXX should this be a psAbort() instead? It is possible that 17316 17316 // having an object match multiple rows was by design. 17317 psError(PS_ERR_UNKNOWN, true, " p6SumSkyfileRow object matched more then one row. Check your database schema");17318 return false; 17319 } 17320 17321 return true; 17322 } 17323 long long p6SumSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)17317 psError(PS_ERR_UNKNOWN, true, "stackSumSkyfileRow object matched more then one row. Check your database schema"); 17318 return false; 17319 } 17320 17321 return true; 17322 } 17323 long long stackSumSkyfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 17324 17324 { 17325 17325 long long deleted = 0; 17326 17326 17327 17327 for (long long i = 0; i < objects->n; i++) { 17328 p6SumSkyfileRow *object = objects->data[i];17329 psMetadata *where = p6SumSkyfileMetadataFromObject(object);17330 long long count = psDBDeleteRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit);17328 stackSumSkyfileRow *object = objects->data[i]; 17329 psMetadata *where = stackSumSkyfileMetadataFromObject(object); 17330 long long count = psDBDeleteRows(dbh, STACKSUMSKYFILE_TABLE_NAME, where, limit); 17331 17331 psFree(where); 17332 17332 if (count < 0) { 17333 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumSkyfile");17333 psError(PS_ERR_UNKNOWN, true, "failed to delete row from stackSumSkyfile"); 17334 17334 return count; 17335 17335 } … … 17340 17340 return deleted; 17341 17341 } 17342 bool p6SumSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)17342 bool stackSumSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 17343 17343 { 17344 17344 PS_ASSERT_PTR_NON_NULL(objects, false); … … 17346 17346 psMetadata *output = psMetadataAlloc(); 17347 17347 for (long i = 0; i < psArrayLength(objects); i++) { 17348 psMetadata *md = p6SumSkyfileMetadataFromObject(objects->data[i]);17348 psMetadata *md = stackSumSkyfileMetadataFromObject(objects->data[i]); 17349 17349 if (!psMetadataAddMetadata( 17350 17350 output, 17351 17351 PS_LIST_TAIL, 17352 P6SUMSKYFILE_TABLE_NAME,17352 STACKSUMSKYFILE_TABLE_NAME, 17353 17353 PS_META_DUPLICATE_OK, 17354 17354 NULL, … … 17371 17371 return true; 17372 17372 } 17373 bool p6SumSkyfilePrintObject(FILE *stream, p6SumSkyfileRow *object, bool mdcf)17373 bool stackSumSkyfilePrintObject(FILE *stream, stackSumSkyfileRow *object, bool mdcf) 17374 17374 { 17375 17375 PS_ASSERT_PTR_NON_NULL(object, false); 17376 17376 17377 psMetadata *md = p6SumSkyfileMetadataFromObject(object);17377 psMetadata *md = stackSumSkyfileMetadataFromObject(object); 17378 17378 17379 17379 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { -
trunk/ippdb/src/ippdb.h
r11988 r12026 2504 2504 bool mdcf ///< format as mdconfig or simple 2505 2505 ); 2506 /** p1PendingExpRow data structure2507 * 2508 * Structure for representing a single row of p1PendingExp table data.2506 /** guidePendingExpRow data structure 2507 * 2508 * Structure for representing a single row of guidePendingExp table data. 2509 2509 */ 2510 2510 2511 2511 typedef struct { 2512 2512 char *exp_tag; 2513 psS32 p1_version;2513 psS32 guide_version; 2514 2514 char *recipe; 2515 } p1PendingExpRow;2516 2517 /** Creates a new p1PendingExpRow object2518 * 2519 * @return A new p1PendingExpRow object or NULL on failure.2520 */ 2521 2522 p1PendingExpRow *p1PendingExpRowAlloc(2515 } guidePendingExpRow; 2516 2517 /** Creates a new guidePendingExpRow object 2518 * 2519 * @return A new guidePendingExpRow object or NULL on failure. 2520 */ 2521 2522 guidePendingExpRow *guidePendingExpRowAlloc( 2523 2523 const char *exp_tag, 2524 psS32 p1_version,2524 psS32 guide_version, 2525 2525 const char *recipe 2526 2526 ); 2527 2527 2528 /** Creates a new p1PendingExp table2529 * 2530 * @return true on success 2531 */ 2532 2533 bool p1PendingExpCreateTable(2528 /** Creates a new guidePendingExp table 2529 * 2530 * @return true on success 2531 */ 2532 2533 bool guidePendingExpCreateTable( 2534 2534 psDB *dbh ///< Database handle 2535 2535 ); 2536 2536 2537 /** Deletes a p1PendingExp table2538 * 2539 * @return true on success 2540 */ 2541 2542 bool p1PendingExpDropTable(2537 /** Deletes a guidePendingExp table 2538 * 2539 * @return true on success 2540 */ 2541 2542 bool guidePendingExpDropTable( 2543 2543 psDB *dbh ///< Database handle 2544 2544 ); … … 2551 2551 */ 2552 2552 2553 bool p1PendingExpInsert(2553 bool guidePendingExpInsert( 2554 2554 psDB *dbh, ///< Database handle 2555 2555 const char *exp_tag, 2556 psS32 p1_version,2556 psS32 guide_version, 2557 2557 const char *recipe 2558 2558 ); … … 2563 2563 */ 2564 2564 2565 long long p1PendingExpDelete(2565 long long guidePendingExpDelete( 2566 2566 psDB *dbh, ///< Database handle 2567 2567 const psMetadata *where, ///< Row match criteria … … 2569 2569 ); 2570 2570 2571 /** Insert a single p1PendingExpRow object into a table2571 /** Insert a single guidePendingExpRow object into a table 2572 2572 * 2573 2573 * This function constructs and inserts a single row based on it's parameters. … … 2576 2576 */ 2577 2577 2578 bool p1PendingExpInsertObject(2579 psDB *dbh, ///< Database handle 2580 p1PendingExpRow *object ///< p1PendingExpRow object2581 ); 2582 2583 /** Insert an array of p1PendingExpRow object into a table2578 bool guidePendingExpInsertObject( 2579 psDB *dbh, ///< Database handle 2580 guidePendingExpRow *object ///< guidePendingExpRow object 2581 ); 2582 2583 /** Insert an array of guidePendingExpRow object into a table 2584 2584 * 2585 2585 * This function constructs and inserts multiple rows based on it's parameters. … … 2588 2588 */ 2589 2589 2590 bool p1PendingExpInsertObjects(2591 psDB *dbh, ///< Database handle 2592 psArray *objects ///< array of p1PendingExpRow objects2593 ); 2594 2595 /** Insert data from a binary FITS table p1PendingExpRow into the database2590 bool guidePendingExpInsertObjects( 2591 psDB *dbh, ///< Database handle 2592 psArray *objects ///< array of guidePendingExpRow objects 2593 ); 2594 2595 /** Insert data from a binary FITS table guidePendingExpRow into the database 2596 2596 * 2597 2597 * This function expects a psFits object with a FITS table as the first … … 2603 2603 */ 2604 2604 2605 bool p1PendingExpInsertFits(2605 bool guidePendingExpInsertFits( 2606 2606 psDB *dbh, ///< Database handle 2607 2607 const psFits *fits ///< psFits object … … 2618 2618 */ 2619 2619 2620 bool p1PendingExpSelectRowsFits(2620 bool guidePendingExpSelectRowsFits( 2621 2621 psDB *dbh, ///< Database handle 2622 2622 psFits *fits, ///< psFits object … … 2625 2625 ); 2626 2626 2627 /** Convert a p1PendingExpRow into an equivalent psMetadata2627 /** Convert a guidePendingExpRow into an equivalent psMetadata 2628 2628 * 2629 2629 * @return A psMetadata pointer or NULL on error 2630 2630 */ 2631 2631 2632 psMetadata * p1PendingExpMetadataFromObject(2633 const p1PendingExpRow *object ///< fooRow to convert into a psMetadata2632 psMetadata *guidePendingExpMetadataFromObject( 2633 const guidePendingExpRow *object ///< fooRow to convert into a psMetadata 2634 2634 ); 2635 2635 2636 2636 /** Convert a psMetadata into an equivalent fooRow 2637 2637 * 2638 * @return A p1PendingExpRow pointer or NULL on error2639 */ 2640 2641 p1PendingExpRow *p1PendingExpObjectFromMetadata(2638 * @return A guidePendingExpRow pointer or NULL on error 2639 */ 2640 2641 guidePendingExpRow *guidePendingExpObjectFromMetadata( 2642 2642 psMetadata *md ///< psMetadata to convert into a fooRow 2643 2643 ); 2644 /** Selects up to limit rows from the database and returns as p1PendingExpRow objects in a psArray2644 /** Selects up to limit rows from the database and returns as guidePendingExpRow objects in a psArray 2645 2645 * 2646 2646 * See psDBSelectRows() for documentation on the format of where. … … 2649 2649 */ 2650 2650 2651 psArray * p1PendingExpSelectRowObjects(2651 psArray *guidePendingExpSelectRowObjects( 2652 2652 psDB *dbh, ///< Database handle 2653 2653 const psMetadata *where, ///< Row match criteria 2654 2654 unsigned long long limit ///< Maximum number of elements to return 2655 2655 ); 2656 /** Deletes a row from the database coresponding to an p1PendingExp2656 /** Deletes a row from the database coresponding to an guidePendingExp 2657 2657 * 2658 2658 * Note that a 'where' search psMetadata is constructed from each object and … … 2662 2662 */ 2663 2663 2664 bool p1PendingExpDeleteObject(2665 psDB *dbh, ///< Database handle 2666 const p1PendingExpRow *object ///< Object to delete2664 bool guidePendingExpDeleteObject( 2665 psDB *dbh, ///< Database handle 2666 const guidePendingExpRow *object ///< Object to delete 2667 2667 ); 2668 2668 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 2674 2674 */ 2675 2675 2676 long long p1PendingExpDeleteRowObjects(2676 long long guidePendingExpDeleteRowObjects( 2677 2677 psDB *dbh, ///< Database handle 2678 2678 const psArray *objects, ///< Array of objects to delete 2679 2679 unsigned long long limit ///< Maximum number of elements to delete 2680 2680 ); 2681 /** Formats and prints an array of p1PendingExpRow objects2681 /** Formats and prints an array of guidePendingExpRow objects 2682 2682 * 2683 2683 * When mdcf is set the formated output is in psMetadataConfig … … 2687 2687 */ 2688 2688 2689 bool p1PendingExpPrintObjects(2689 bool guidePendingExpPrintObjects( 2690 2690 FILE *stream, ///< a stream 2691 psArray *objects, ///< An array of p1PendingExpRow objects2691 psArray *objects, ///< An array of guidePendingExpRow objects 2692 2692 bool mdcf ///< format as mdconfig or simple 2693 2693 ); 2694 /** Formats and prints an p1PendingExpRow object2694 /** Formats and prints an guidePendingExpRow object 2695 2695 * 2696 2696 * When mdcf is set the formated output is in psMetadataConfig … … 2700 2700 */ 2701 2701 2702 bool p1PendingExpPrintObject(2702 bool guidePendingExpPrintObject( 2703 2703 FILE *stream, ///< a stream 2704 p1PendingExpRow *object, ///< an p1PendingExpRow object2704 guidePendingExpRow *object, ///< an guidePendingExpRow object 2705 2705 bool mdcf ///< format as mdconfig or simple 2706 2706 ); 2707 /** p2PendingExpRow data structure2708 * 2709 * Structure for representing a single row of p2PendingExp table data.2707 /** chipPendingExpRow data structure 2708 * 2709 * Structure for representing a single row of chipPendingExp table data. 2710 2710 */ 2711 2711 2712 2712 typedef struct { 2713 2713 char *exp_tag; 2714 psS32 p2_version;2715 psS32 p1_version;2714 psS32 chip_version; 2715 psS32 guide_version; 2716 2716 char *label; 2717 2717 char *recipe; 2718 2718 char *expgroup; 2719 2719 char *dvodb; 2720 } p2PendingExpRow;2721 2722 /** Creates a new p2PendingExpRow object2723 * 2724 * @return A new p2PendingExpRow object or NULL on failure.2725 */ 2726 2727 p2PendingExpRow *p2PendingExpRowAlloc(2720 } chipPendingExpRow; 2721 2722 /** Creates a new chipPendingExpRow object 2723 * 2724 * @return A new chipPendingExpRow object or NULL on failure. 2725 */ 2726 2727 chipPendingExpRow *chipPendingExpRowAlloc( 2728 2728 const char *exp_tag, 2729 psS32 p2_version,2730 psS32 p1_version,2729 psS32 chip_version, 2730 psS32 guide_version, 2731 2731 const char *label, 2732 2732 const char *recipe, … … 2735 2735 ); 2736 2736 2737 /** Creates a new p2PendingExp table2738 * 2739 * @return true on success 2740 */ 2741 2742 bool p2PendingExpCreateTable(2737 /** Creates a new chipPendingExp table 2738 * 2739 * @return true on success 2740 */ 2741 2742 bool chipPendingExpCreateTable( 2743 2743 psDB *dbh ///< Database handle 2744 2744 ); 2745 2745 2746 /** Deletes a p2PendingExp table2747 * 2748 * @return true on success 2749 */ 2750 2751 bool p2PendingExpDropTable(2746 /** Deletes a chipPendingExp table 2747 * 2748 * @return true on success 2749 */ 2750 2751 bool chipPendingExpDropTable( 2752 2752 psDB *dbh ///< Database handle 2753 2753 ); … … 2760 2760 */ 2761 2761 2762 bool p2PendingExpInsert(2762 bool chipPendingExpInsert( 2763 2763 psDB *dbh, ///< Database handle 2764 2764 const char *exp_tag, 2765 psS32 p2_version,2766 psS32 p1_version,2765 psS32 chip_version, 2766 psS32 guide_version, 2767 2767 const char *label, 2768 2768 const char *recipe, … … 2776 2776 */ 2777 2777 2778 long long p2PendingExpDelete(2778 long long chipPendingExpDelete( 2779 2779 psDB *dbh, ///< Database handle 2780 2780 const psMetadata *where, ///< Row match criteria … … 2782 2782 ); 2783 2783 2784 /** Insert a single p2PendingExpRow object into a table2784 /** Insert a single chipPendingExpRow object into a table 2785 2785 * 2786 2786 * This function constructs and inserts a single row based on it's parameters. … … 2789 2789 */ 2790 2790 2791 bool p2PendingExpInsertObject(2792 psDB *dbh, ///< Database handle 2793 p2PendingExpRow *object ///< p2PendingExpRow object2794 ); 2795 2796 /** Insert an array of p2PendingExpRow object into a table2791 bool chipPendingExpInsertObject( 2792 psDB *dbh, ///< Database handle 2793 chipPendingExpRow *object ///< chipPendingExpRow object 2794 ); 2795 2796 /** Insert an array of chipPendingExpRow object into a table 2797 2797 * 2798 2798 * This function constructs and inserts multiple rows based on it's parameters. … … 2801 2801 */ 2802 2802 2803 bool p2PendingExpInsertObjects(2804 psDB *dbh, ///< Database handle 2805 psArray *objects ///< array of p2PendingExpRow objects2806 ); 2807 2808 /** Insert data from a binary FITS table p2PendingExpRow into the database2803 bool chipPendingExpInsertObjects( 2804 psDB *dbh, ///< Database handle 2805 psArray *objects ///< array of chipPendingExpRow objects 2806 ); 2807 2808 /** Insert data from a binary FITS table chipPendingExpRow into the database 2809 2809 * 2810 2810 * This function expects a psFits object with a FITS table as the first … … 2816 2816 */ 2817 2817 2818 bool p2PendingExpInsertFits(2818 bool chipPendingExpInsertFits( 2819 2819 psDB *dbh, ///< Database handle 2820 2820 const psFits *fits ///< psFits object … … 2831 2831 */ 2832 2832 2833 bool p2PendingExpSelectRowsFits(2833 bool chipPendingExpSelectRowsFits( 2834 2834 psDB *dbh, ///< Database handle 2835 2835 psFits *fits, ///< psFits object … … 2838 2838 ); 2839 2839 2840 /** Convert a p2PendingExpRow into an equivalent psMetadata2840 /** Convert a chipPendingExpRow into an equivalent psMetadata 2841 2841 * 2842 2842 * @return A psMetadata pointer or NULL on error 2843 2843 */ 2844 2844 2845 psMetadata * p2PendingExpMetadataFromObject(2846 const p2PendingExpRow *object ///< fooRow to convert into a psMetadata2845 psMetadata *chipPendingExpMetadataFromObject( 2846 const chipPendingExpRow *object ///< fooRow to convert into a psMetadata 2847 2847 ); 2848 2848 2849 2849 /** Convert a psMetadata into an equivalent fooRow 2850 2850 * 2851 * @return A p2PendingExpRow pointer or NULL on error2852 */ 2853 2854 p2PendingExpRow *p2PendingExpObjectFromMetadata(2851 * @return A chipPendingExpRow pointer or NULL on error 2852 */ 2853 2854 chipPendingExpRow *chipPendingExpObjectFromMetadata( 2855 2855 psMetadata *md ///< psMetadata to convert into a fooRow 2856 2856 ); 2857 /** Selects up to limit rows from the database and returns as p2PendingExpRow objects in a psArray2857 /** Selects up to limit rows from the database and returns as chipPendingExpRow objects in a psArray 2858 2858 * 2859 2859 * See psDBSelectRows() for documentation on the format of where. … … 2862 2862 */ 2863 2863 2864 psArray * p2PendingExpSelectRowObjects(2864 psArray *chipPendingExpSelectRowObjects( 2865 2865 psDB *dbh, ///< Database handle 2866 2866 const psMetadata *where, ///< Row match criteria 2867 2867 unsigned long long limit ///< Maximum number of elements to return 2868 2868 ); 2869 /** Deletes a row from the database coresponding to an p2PendingExp2869 /** Deletes a row from the database coresponding to an chipPendingExp 2870 2870 * 2871 2871 * Note that a 'where' search psMetadata is constructed from each object and … … 2875 2875 */ 2876 2876 2877 bool p2PendingExpDeleteObject(2878 psDB *dbh, ///< Database handle 2879 const p2PendingExpRow *object ///< Object to delete2877 bool chipPendingExpDeleteObject( 2878 psDB *dbh, ///< Database handle 2879 const chipPendingExpRow *object ///< Object to delete 2880 2880 ); 2881 2881 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 2887 2887 */ 2888 2888 2889 long long p2PendingExpDeleteRowObjects(2889 long long chipPendingExpDeleteRowObjects( 2890 2890 psDB *dbh, ///< Database handle 2891 2891 const psArray *objects, ///< Array of objects to delete 2892 2892 unsigned long long limit ///< Maximum number of elements to delete 2893 2893 ); 2894 /** Formats and prints an array of p2PendingExpRow objects2894 /** Formats and prints an array of chipPendingExpRow objects 2895 2895 * 2896 2896 * When mdcf is set the formated output is in psMetadataConfig … … 2900 2900 */ 2901 2901 2902 bool p2PendingExpPrintObjects(2902 bool chipPendingExpPrintObjects( 2903 2903 FILE *stream, ///< a stream 2904 psArray *objects, ///< An array of p2PendingExpRow objects2904 psArray *objects, ///< An array of chipPendingExpRow objects 2905 2905 bool mdcf ///< format as mdconfig or simple 2906 2906 ); 2907 /** Formats and prints an p2PendingExpRow object2907 /** Formats and prints an chipPendingExpRow object 2908 2908 * 2909 2909 * When mdcf is set the formated output is in psMetadataConfig … … 2913 2913 */ 2914 2914 2915 bool p2PendingExpPrintObject(2915 bool chipPendingExpPrintObject( 2916 2916 FILE *stream, ///< a stream 2917 p2PendingExpRow *object, ///< an p2PendingExpRow object2917 chipPendingExpRow *object, ///< an chipPendingExpRow object 2918 2918 bool mdcf ///< format as mdconfig or simple 2919 2919 ); 2920 /** p2PendingImfileRow data structure2921 * 2922 * Structure for representing a single row of p2PendingImfile table data.2920 /** chipPendingImfileRow data structure 2921 * 2922 * Structure for representing a single row of chipPendingImfile table data. 2923 2923 */ 2924 2924 2925 2925 typedef struct { 2926 2926 char *exp_tag; 2927 psS32 p2_version;2928 psS32 p1_version;2927 psS32 chip_version; 2928 psS32 guide_version; 2929 2929 char *class_id; 2930 2930 char *recipe; 2931 2931 char *uri; 2932 } p2PendingImfileRow;2933 2934 /** Creates a new p2PendingImfileRow object2935 * 2936 * @return A new p2PendingImfileRow object or NULL on failure.2937 */ 2938 2939 p2PendingImfileRow *p2PendingImfileRowAlloc(2932 } chipPendingImfileRow; 2933 2934 /** Creates a new chipPendingImfileRow object 2935 * 2936 * @return A new chipPendingImfileRow object or NULL on failure. 2937 */ 2938 2939 chipPendingImfileRow *chipPendingImfileRowAlloc( 2940 2940 const char *exp_tag, 2941 psS32 p2_version,2942 psS32 p1_version,2941 psS32 chip_version, 2942 psS32 guide_version, 2943 2943 const char *class_id, 2944 2944 const char *recipe, … … 2946 2946 ); 2947 2947 2948 /** Creates a new p2PendingImfile table2949 * 2950 * @return true on success 2951 */ 2952 2953 bool p2PendingImfileCreateTable(2948 /** Creates a new chipPendingImfile table 2949 * 2950 * @return true on success 2951 */ 2952 2953 bool chipPendingImfileCreateTable( 2954 2954 psDB *dbh ///< Database handle 2955 2955 ); 2956 2956 2957 /** Deletes a p2PendingImfile table2958 * 2959 * @return true on success 2960 */ 2961 2962 bool p2PendingImfileDropTable(2957 /** Deletes a chipPendingImfile table 2958 * 2959 * @return true on success 2960 */ 2961 2962 bool chipPendingImfileDropTable( 2963 2963 psDB *dbh ///< Database handle 2964 2964 ); … … 2971 2971 */ 2972 2972 2973 bool p2PendingImfileInsert(2973 bool chipPendingImfileInsert( 2974 2974 psDB *dbh, ///< Database handle 2975 2975 const char *exp_tag, 2976 psS32 p2_version,2977 psS32 p1_version,2976 psS32 chip_version, 2977 psS32 guide_version, 2978 2978 const char *class_id, 2979 2979 const char *recipe, … … 2986 2986 */ 2987 2987 2988 long long p2PendingImfileDelete(2988 long long chipPendingImfileDelete( 2989 2989 psDB *dbh, ///< Database handle 2990 2990 const psMetadata *where, ///< Row match criteria … … 2992 2992 ); 2993 2993 2994 /** Insert a single p2PendingImfileRow object into a table2994 /** Insert a single chipPendingImfileRow object into a table 2995 2995 * 2996 2996 * This function constructs and inserts a single row based on it's parameters. … … 2999 2999 */ 3000 3000 3001 bool p2PendingImfileInsertObject(3002 psDB *dbh, ///< Database handle 3003 p2PendingImfileRow *object ///< p2PendingImfileRow object3004 ); 3005 3006 /** Insert an array of p2PendingImfileRow object into a table3001 bool chipPendingImfileInsertObject( 3002 psDB *dbh, ///< Database handle 3003 chipPendingImfileRow *object ///< chipPendingImfileRow object 3004 ); 3005 3006 /** Insert an array of chipPendingImfileRow object into a table 3007 3007 * 3008 3008 * This function constructs and inserts multiple rows based on it's parameters. … … 3011 3011 */ 3012 3012 3013 bool p2PendingImfileInsertObjects(3014 psDB *dbh, ///< Database handle 3015 psArray *objects ///< array of p2PendingImfileRow objects3016 ); 3017 3018 /** Insert data from a binary FITS table p2PendingImfileRow into the database3013 bool chipPendingImfileInsertObjects( 3014 psDB *dbh, ///< Database handle 3015 psArray *objects ///< array of chipPendingImfileRow objects 3016 ); 3017 3018 /** Insert data from a binary FITS table chipPendingImfileRow into the database 3019 3019 * 3020 3020 * This function expects a psFits object with a FITS table as the first … … 3026 3026 */ 3027 3027 3028 bool p2PendingImfileInsertFits(3028 bool chipPendingImfileInsertFits( 3029 3029 psDB *dbh, ///< Database handle 3030 3030 const psFits *fits ///< psFits object … … 3041 3041 */ 3042 3042 3043 bool p2PendingImfileSelectRowsFits(3043 bool chipPendingImfileSelectRowsFits( 3044 3044 psDB *dbh, ///< Database handle 3045 3045 psFits *fits, ///< psFits object … … 3048 3048 ); 3049 3049 3050 /** Convert a p2PendingImfileRow into an equivalent psMetadata3050 /** Convert a chipPendingImfileRow into an equivalent psMetadata 3051 3051 * 3052 3052 * @return A psMetadata pointer or NULL on error 3053 3053 */ 3054 3054 3055 psMetadata * p2PendingImfileMetadataFromObject(3056 const p2PendingImfileRow *object ///< fooRow to convert into a psMetadata3055 psMetadata *chipPendingImfileMetadataFromObject( 3056 const chipPendingImfileRow *object ///< fooRow to convert into a psMetadata 3057 3057 ); 3058 3058 3059 3059 /** Convert a psMetadata into an equivalent fooRow 3060 3060 * 3061 * @return A p2PendingImfileRow pointer or NULL on error3062 */ 3063 3064 p2PendingImfileRow *p2PendingImfileObjectFromMetadata(3061 * @return A chipPendingImfileRow pointer or NULL on error 3062 */ 3063 3064 chipPendingImfileRow *chipPendingImfileObjectFromMetadata( 3065 3065 psMetadata *md ///< psMetadata to convert into a fooRow 3066 3066 ); 3067 /** Selects up to limit rows from the database and returns as p2PendingImfileRow objects in a psArray3067 /** Selects up to limit rows from the database and returns as chipPendingImfileRow objects in a psArray 3068 3068 * 3069 3069 * See psDBSelectRows() for documentation on the format of where. … … 3072 3072 */ 3073 3073 3074 psArray * p2PendingImfileSelectRowObjects(3074 psArray *chipPendingImfileSelectRowObjects( 3075 3075 psDB *dbh, ///< Database handle 3076 3076 const psMetadata *where, ///< Row match criteria 3077 3077 unsigned long long limit ///< Maximum number of elements to return 3078 3078 ); 3079 /** Deletes a row from the database coresponding to an p2PendingImfile3079 /** Deletes a row from the database coresponding to an chipPendingImfile 3080 3080 * 3081 3081 * Note that a 'where' search psMetadata is constructed from each object and … … 3085 3085 */ 3086 3086 3087 bool p2PendingImfileDeleteObject(3088 psDB *dbh, ///< Database handle 3089 const p2PendingImfileRow *object ///< Object to delete3087 bool chipPendingImfileDeleteObject( 3088 psDB *dbh, ///< Database handle 3089 const chipPendingImfileRow *object ///< Object to delete 3090 3090 ); 3091 3091 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 3097 3097 */ 3098 3098 3099 long long p2PendingImfileDeleteRowObjects(3099 long long chipPendingImfileDeleteRowObjects( 3100 3100 psDB *dbh, ///< Database handle 3101 3101 const psArray *objects, ///< Array of objects to delete 3102 3102 unsigned long long limit ///< Maximum number of elements to delete 3103 3103 ); 3104 /** Formats and prints an array of p2PendingImfileRow objects3104 /** Formats and prints an array of chipPendingImfileRow objects 3105 3105 * 3106 3106 * When mdcf is set the formated output is in psMetadataConfig … … 3110 3110 */ 3111 3111 3112 bool p2PendingImfilePrintObjects(3112 bool chipPendingImfilePrintObjects( 3113 3113 FILE *stream, ///< a stream 3114 psArray *objects, ///< An array of p2PendingImfileRow objects3114 psArray *objects, ///< An array of chipPendingImfileRow objects 3115 3115 bool mdcf ///< format as mdconfig or simple 3116 3116 ); 3117 /** Formats and prints an p2PendingImfileRow object3117 /** Formats and prints an chipPendingImfileRow object 3118 3118 * 3119 3119 * When mdcf is set the formated output is in psMetadataConfig … … 3123 3123 */ 3124 3124 3125 bool p2PendingImfilePrintObject(3125 bool chipPendingImfilePrintObject( 3126 3126 FILE *stream, ///< a stream 3127 p2PendingImfileRow *object, ///< an p2PendingImfileRow object3127 chipPendingImfileRow *object, ///< an chipPendingImfileRow object 3128 3128 bool mdcf ///< format as mdconfig or simple 3129 3129 ); 3130 /** p2ProcessedExpRow data structure3131 * 3132 * Structure for representing a single row of p2ProcessedExp table data.3130 /** chipProcessedExpRow data structure 3131 * 3132 * Structure for representing a single row of chipProcessedExp table data. 3133 3133 */ 3134 3134 3135 3135 typedef struct { 3136 3136 char *exp_tag; 3137 psS32 p2_version;3138 psS32 p1_version;3137 psS32 chip_version; 3138 psS32 guide_version; 3139 3139 char *label; 3140 3140 char *expgroup; 3141 3141 char *dvodb; 3142 } p2ProcessedExpRow;3143 3144 /** Creates a new p2ProcessedExpRow object3145 * 3146 * @return A new p2ProcessedExpRow object or NULL on failure.3147 */ 3148 3149 p2ProcessedExpRow *p2ProcessedExpRowAlloc(3142 } chipProcessedExpRow; 3143 3144 /** Creates a new chipProcessedExpRow object 3145 * 3146 * @return A new chipProcessedExpRow object or NULL on failure. 3147 */ 3148 3149 chipProcessedExpRow *chipProcessedExpRowAlloc( 3150 3150 const char *exp_tag, 3151 psS32 p2_version,3152 psS32 p1_version,3151 psS32 chip_version, 3152 psS32 guide_version, 3153 3153 const char *label, 3154 3154 const char *expgroup, … … 3156 3156 ); 3157 3157 3158 /** Creates a new p2ProcessedExp table3159 * 3160 * @return true on success 3161 */ 3162 3163 bool p2ProcessedExpCreateTable(3158 /** Creates a new chipProcessedExp table 3159 * 3160 * @return true on success 3161 */ 3162 3163 bool chipProcessedExpCreateTable( 3164 3164 psDB *dbh ///< Database handle 3165 3165 ); 3166 3166 3167 /** Deletes a p2ProcessedExp table3168 * 3169 * @return true on success 3170 */ 3171 3172 bool p2ProcessedExpDropTable(3167 /** Deletes a chipProcessedExp table 3168 * 3169 * @return true on success 3170 */ 3171 3172 bool chipProcessedExpDropTable( 3173 3173 psDB *dbh ///< Database handle 3174 3174 ); … … 3181 3181 */ 3182 3182 3183 bool p2ProcessedExpInsert(3183 bool chipProcessedExpInsert( 3184 3184 psDB *dbh, ///< Database handle 3185 3185 const char *exp_tag, 3186 psS32 p2_version,3187 psS32 p1_version,3186 psS32 chip_version, 3187 psS32 guide_version, 3188 3188 const char *label, 3189 3189 const char *expgroup, … … 3196 3196 */ 3197 3197 3198 long long p2ProcessedExpDelete(3198 long long chipProcessedExpDelete( 3199 3199 psDB *dbh, ///< Database handle 3200 3200 const psMetadata *where, ///< Row match criteria … … 3202 3202 ); 3203 3203 3204 /** Insert a single p2ProcessedExpRow object into a table3204 /** Insert a single chipProcessedExpRow object into a table 3205 3205 * 3206 3206 * This function constructs and inserts a single row based on it's parameters. … … 3209 3209 */ 3210 3210 3211 bool p2ProcessedExpInsertObject(3212 psDB *dbh, ///< Database handle 3213 p2ProcessedExpRow *object ///< p2ProcessedExpRow object3214 ); 3215 3216 /** Insert an array of p2ProcessedExpRow object into a table3211 bool chipProcessedExpInsertObject( 3212 psDB *dbh, ///< Database handle 3213 chipProcessedExpRow *object ///< chipProcessedExpRow object 3214 ); 3215 3216 /** Insert an array of chipProcessedExpRow object into a table 3217 3217 * 3218 3218 * This function constructs and inserts multiple rows based on it's parameters. … … 3221 3221 */ 3222 3222 3223 bool p2ProcessedExpInsertObjects(3224 psDB *dbh, ///< Database handle 3225 psArray *objects ///< array of p2ProcessedExpRow objects3226 ); 3227 3228 /** Insert data from a binary FITS table p2ProcessedExpRow into the database3223 bool chipProcessedExpInsertObjects( 3224 psDB *dbh, ///< Database handle 3225 psArray *objects ///< array of chipProcessedExpRow objects 3226 ); 3227 3228 /** Insert data from a binary FITS table chipProcessedExpRow into the database 3229 3229 * 3230 3230 * This function expects a psFits object with a FITS table as the first … … 3236 3236 */ 3237 3237 3238 bool p2ProcessedExpInsertFits(3238 bool chipProcessedExpInsertFits( 3239 3239 psDB *dbh, ///< Database handle 3240 3240 const psFits *fits ///< psFits object … … 3251 3251 */ 3252 3252 3253 bool p2ProcessedExpSelectRowsFits(3253 bool chipProcessedExpSelectRowsFits( 3254 3254 psDB *dbh, ///< Database handle 3255 3255 psFits *fits, ///< psFits object … … 3258 3258 ); 3259 3259 3260 /** Convert a p2ProcessedExpRow into an equivalent psMetadata3260 /** Convert a chipProcessedExpRow into an equivalent psMetadata 3261 3261 * 3262 3262 * @return A psMetadata pointer or NULL on error 3263 3263 */ 3264 3264 3265 psMetadata * p2ProcessedExpMetadataFromObject(3266 const p2ProcessedExpRow *object ///< fooRow to convert into a psMetadata3265 psMetadata *chipProcessedExpMetadataFromObject( 3266 const chipProcessedExpRow *object ///< fooRow to convert into a psMetadata 3267 3267 ); 3268 3268 3269 3269 /** Convert a psMetadata into an equivalent fooRow 3270 3270 * 3271 * @return A p2ProcessedExpRow pointer or NULL on error3272 */ 3273 3274 p2ProcessedExpRow *p2ProcessedExpObjectFromMetadata(3271 * @return A chipProcessedExpRow pointer or NULL on error 3272 */ 3273 3274 chipProcessedExpRow *chipProcessedExpObjectFromMetadata( 3275 3275 psMetadata *md ///< psMetadata to convert into a fooRow 3276 3276 ); 3277 /** Selects up to limit rows from the database and returns as p2ProcessedExpRow objects in a psArray3277 /** Selects up to limit rows from the database and returns as chipProcessedExpRow objects in a psArray 3278 3278 * 3279 3279 * See psDBSelectRows() for documentation on the format of where. … … 3282 3282 */ 3283 3283 3284 psArray * p2ProcessedExpSelectRowObjects(3284 psArray *chipProcessedExpSelectRowObjects( 3285 3285 psDB *dbh, ///< Database handle 3286 3286 const psMetadata *where, ///< Row match criteria 3287 3287 unsigned long long limit ///< Maximum number of elements to return 3288 3288 ); 3289 /** Deletes a row from the database coresponding to an p2ProcessedExp3289 /** Deletes a row from the database coresponding to an chipProcessedExp 3290 3290 * 3291 3291 * Note that a 'where' search psMetadata is constructed from each object and … … 3295 3295 */ 3296 3296 3297 bool p2ProcessedExpDeleteObject(3298 psDB *dbh, ///< Database handle 3299 const p2ProcessedExpRow *object ///< Object to delete3297 bool chipProcessedExpDeleteObject( 3298 psDB *dbh, ///< Database handle 3299 const chipProcessedExpRow *object ///< Object to delete 3300 3300 ); 3301 3301 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 3307 3307 */ 3308 3308 3309 long long p2ProcessedExpDeleteRowObjects(3309 long long chipProcessedExpDeleteRowObjects( 3310 3310 psDB *dbh, ///< Database handle 3311 3311 const psArray *objects, ///< Array of objects to delete 3312 3312 unsigned long long limit ///< Maximum number of elements to delete 3313 3313 ); 3314 /** Formats and prints an array of p2ProcessedExpRow objects3314 /** Formats and prints an array of chipProcessedExpRow objects 3315 3315 * 3316 3316 * When mdcf is set the formated output is in psMetadataConfig … … 3320 3320 */ 3321 3321 3322 bool p2ProcessedExpPrintObjects(3322 bool chipProcessedExpPrintObjects( 3323 3323 FILE *stream, ///< a stream 3324 psArray *objects, ///< An array of p2ProcessedExpRow objects3324 psArray *objects, ///< An array of chipProcessedExpRow objects 3325 3325 bool mdcf ///< format as mdconfig or simple 3326 3326 ); 3327 /** Formats and prints an p2ProcessedExpRow object3327 /** Formats and prints an chipProcessedExpRow object 3328 3328 * 3329 3329 * When mdcf is set the formated output is in psMetadataConfig … … 3333 3333 */ 3334 3334 3335 bool p2ProcessedExpPrintObject(3335 bool chipProcessedExpPrintObject( 3336 3336 FILE *stream, ///< a stream 3337 p2ProcessedExpRow *object, ///< an p2ProcessedExpRow object3337 chipProcessedExpRow *object, ///< an chipProcessedExpRow object 3338 3338 bool mdcf ///< format as mdconfig or simple 3339 3339 ); 3340 /** p2MaskRow data structure3341 * 3342 * Structure for representing a single row of p2Mask table data.3340 /** chipMaskRow data structure 3341 * 3342 * Structure for representing a single row of chipMask table data. 3343 3343 */ 3344 3344 3345 3345 typedef struct { 3346 3346 char *label; 3347 } p2MaskRow;3348 3349 /** Creates a new p2MaskRow object3350 * 3351 * @return A new p2MaskRow object or NULL on failure.3352 */ 3353 3354 p2MaskRow *p2MaskRowAlloc(3347 } chipMaskRow; 3348 3349 /** Creates a new chipMaskRow object 3350 * 3351 * @return A new chipMaskRow object or NULL on failure. 3352 */ 3353 3354 chipMaskRow *chipMaskRowAlloc( 3355 3355 const char *label 3356 3356 ); 3357 3357 3358 /** Creates a new p2Mask table3359 * 3360 * @return true on success 3361 */ 3362 3363 bool p2MaskCreateTable(3358 /** Creates a new chipMask table 3359 * 3360 * @return true on success 3361 */ 3362 3363 bool chipMaskCreateTable( 3364 3364 psDB *dbh ///< Database handle 3365 3365 ); 3366 3366 3367 /** Deletes a p2Mask table3368 * 3369 * @return true on success 3370 */ 3371 3372 bool p2MaskDropTable(3367 /** Deletes a chipMask table 3368 * 3369 * @return true on success 3370 */ 3371 3372 bool chipMaskDropTable( 3373 3373 psDB *dbh ///< Database handle 3374 3374 ); … … 3381 3381 */ 3382 3382 3383 bool p2MaskInsert(3383 bool chipMaskInsert( 3384 3384 psDB *dbh, ///< Database handle 3385 3385 const char *label … … 3391 3391 */ 3392 3392 3393 long long p2MaskDelete(3393 long long chipMaskDelete( 3394 3394 psDB *dbh, ///< Database handle 3395 3395 const psMetadata *where, ///< Row match criteria … … 3397 3397 ); 3398 3398 3399 /** Insert a single p2MaskRow object into a table3399 /** Insert a single chipMaskRow object into a table 3400 3400 * 3401 3401 * This function constructs and inserts a single row based on it's parameters. … … 3404 3404 */ 3405 3405 3406 bool p2MaskInsertObject(3407 psDB *dbh, ///< Database handle 3408 p2MaskRow *object ///< p2MaskRow object3409 ); 3410 3411 /** Insert an array of p2MaskRow object into a table3406 bool chipMaskInsertObject( 3407 psDB *dbh, ///< Database handle 3408 chipMaskRow *object ///< chipMaskRow object 3409 ); 3410 3411 /** Insert an array of chipMaskRow object into a table 3412 3412 * 3413 3413 * This function constructs and inserts multiple rows based on it's parameters. … … 3416 3416 */ 3417 3417 3418 bool p2MaskInsertObjects(3419 psDB *dbh, ///< Database handle 3420 psArray *objects ///< array of p2MaskRow objects3421 ); 3422 3423 /** Insert data from a binary FITS table p2MaskRow into the database3418 bool chipMaskInsertObjects( 3419 psDB *dbh, ///< Database handle 3420 psArray *objects ///< array of chipMaskRow objects 3421 ); 3422 3423 /** Insert data from a binary FITS table chipMaskRow into the database 3424 3424 * 3425 3425 * This function expects a psFits object with a FITS table as the first … … 3431 3431 */ 3432 3432 3433 bool p2MaskInsertFits(3433 bool chipMaskInsertFits( 3434 3434 psDB *dbh, ///< Database handle 3435 3435 const psFits *fits ///< psFits object … … 3446 3446 */ 3447 3447 3448 bool p2MaskSelectRowsFits(3448 bool chipMaskSelectRowsFits( 3449 3449 psDB *dbh, ///< Database handle 3450 3450 psFits *fits, ///< psFits object … … 3453 3453 ); 3454 3454 3455 /** Convert a p2MaskRow into an equivalent psMetadata3455 /** Convert a chipMaskRow into an equivalent psMetadata 3456 3456 * 3457 3457 * @return A psMetadata pointer or NULL on error 3458 3458 */ 3459 3459 3460 psMetadata * p2MaskMetadataFromObject(3461 const p2MaskRow *object ///< fooRow to convert into a psMetadata3460 psMetadata *chipMaskMetadataFromObject( 3461 const chipMaskRow *object ///< fooRow to convert into a psMetadata 3462 3462 ); 3463 3463 3464 3464 /** Convert a psMetadata into an equivalent fooRow 3465 3465 * 3466 * @return A p2MaskRow pointer or NULL on error3467 */ 3468 3469 p2MaskRow *p2MaskObjectFromMetadata(3466 * @return A chipMaskRow pointer or NULL on error 3467 */ 3468 3469 chipMaskRow *chipMaskObjectFromMetadata( 3470 3470 psMetadata *md ///< psMetadata to convert into a fooRow 3471 3471 ); 3472 /** Selects up to limit rows from the database and returns as p2MaskRow objects in a psArray3472 /** Selects up to limit rows from the database and returns as chipMaskRow objects in a psArray 3473 3473 * 3474 3474 * See psDBSelectRows() for documentation on the format of where. … … 3477 3477 */ 3478 3478 3479 psArray * p2MaskSelectRowObjects(3479 psArray *chipMaskSelectRowObjects( 3480 3480 psDB *dbh, ///< Database handle 3481 3481 const psMetadata *where, ///< Row match criteria 3482 3482 unsigned long long limit ///< Maximum number of elements to return 3483 3483 ); 3484 /** Deletes a row from the database coresponding to an p2Mask3484 /** Deletes a row from the database coresponding to an chipMask 3485 3485 * 3486 3486 * Note that a 'where' search psMetadata is constructed from each object and … … 3490 3490 */ 3491 3491 3492 bool p2MaskDeleteObject(3493 psDB *dbh, ///< Database handle 3494 const p2MaskRow *object ///< Object to delete3492 bool chipMaskDeleteObject( 3493 psDB *dbh, ///< Database handle 3494 const chipMaskRow *object ///< Object to delete 3495 3495 ); 3496 3496 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 3502 3502 */ 3503 3503 3504 long long p2MaskDeleteRowObjects(3504 long long chipMaskDeleteRowObjects( 3505 3505 psDB *dbh, ///< Database handle 3506 3506 const psArray *objects, ///< Array of objects to delete 3507 3507 unsigned long long limit ///< Maximum number of elements to delete 3508 3508 ); 3509 /** Formats and prints an array of p2MaskRow objects3509 /** Formats and prints an array of chipMaskRow objects 3510 3510 * 3511 3511 * When mdcf is set the formated output is in psMetadataConfig … … 3515 3515 */ 3516 3516 3517 bool p2MaskPrintObjects(3517 bool chipMaskPrintObjects( 3518 3518 FILE *stream, ///< a stream 3519 psArray *objects, ///< An array of p2MaskRow objects3519 psArray *objects, ///< An array of chipMaskRow objects 3520 3520 bool mdcf ///< format as mdconfig or simple 3521 3521 ); 3522 /** Formats and prints an p2MaskRow object3522 /** Formats and prints an chipMaskRow object 3523 3523 * 3524 3524 * When mdcf is set the formated output is in psMetadataConfig … … 3528 3528 */ 3529 3529 3530 bool p2MaskPrintObject(3530 bool chipMaskPrintObject( 3531 3531 FILE *stream, ///< a stream 3532 p2MaskRow *object, ///< an p2MaskRow object3532 chipMaskRow *object, ///< an chipMaskRow object 3533 3533 bool mdcf ///< format as mdconfig or simple 3534 3534 ); 3535 /** p2ProcessedImfileRow data structure3536 * 3537 * Structure for representing a single row of p2ProcessedImfile table data.3535 /** chipProcessedImfileRow data structure 3536 * 3537 * Structure for representing a single row of chipProcessedImfile table data. 3538 3538 */ 3539 3539 3540 3540 typedef struct { 3541 3541 char *exp_tag; 3542 psS32 p2_version;3543 psS32 p1_version;3542 psS32 chip_version; 3543 psS32 guide_version; 3544 3544 char *class_id; 3545 3545 char *recipe; … … 3551 3551 char *b2_uri; 3552 3552 psS16 fault; 3553 } p2ProcessedImfileRow;3554 3555 /** Creates a new p2ProcessedImfileRow object3556 * 3557 * @return A new p2ProcessedImfileRow object or NULL on failure.3558 */ 3559 3560 p2ProcessedImfileRow *p2ProcessedImfileRowAlloc(3553 } chipProcessedImfileRow; 3554 3555 /** Creates a new chipProcessedImfileRow object 3556 * 3557 * @return A new chipProcessedImfileRow object or NULL on failure. 3558 */ 3559 3560 chipProcessedImfileRow *chipProcessedImfileRowAlloc( 3561 3561 const char *exp_tag, 3562 psS32 p2_version,3563 psS32 p1_version,3562 psS32 chip_version, 3563 psS32 guide_version, 3564 3564 const char *class_id, 3565 3565 const char *recipe, … … 3573 3573 ); 3574 3574 3575 /** Creates a new p2ProcessedImfile table3576 * 3577 * @return true on success 3578 */ 3579 3580 bool p2ProcessedImfileCreateTable(3575 /** Creates a new chipProcessedImfile table 3576 * 3577 * @return true on success 3578 */ 3579 3580 bool chipProcessedImfileCreateTable( 3581 3581 psDB *dbh ///< Database handle 3582 3582 ); 3583 3583 3584 /** Deletes a p2ProcessedImfile table3585 * 3586 * @return true on success 3587 */ 3588 3589 bool p2ProcessedImfileDropTable(3584 /** Deletes a chipProcessedImfile table 3585 * 3586 * @return true on success 3587 */ 3588 3589 bool chipProcessedImfileDropTable( 3590 3590 psDB *dbh ///< Database handle 3591 3591 ); … … 3598 3598 */ 3599 3599 3600 bool p2ProcessedImfileInsert(3600 bool chipProcessedImfileInsert( 3601 3601 psDB *dbh, ///< Database handle 3602 3602 const char *exp_tag, 3603 psS32 p2_version,3604 psS32 p1_version,3603 psS32 chip_version, 3604 psS32 guide_version, 3605 3605 const char *class_id, 3606 3606 const char *recipe, … … 3619 3619 */ 3620 3620 3621 long long p2ProcessedImfileDelete(3621 long long chipProcessedImfileDelete( 3622 3622 psDB *dbh, ///< Database handle 3623 3623 const psMetadata *where, ///< Row match criteria … … 3625 3625 ); 3626 3626 3627 /** Insert a single p2ProcessedImfileRow object into a table3627 /** Insert a single chipProcessedImfileRow object into a table 3628 3628 * 3629 3629 * This function constructs and inserts a single row based on it's parameters. … … 3632 3632 */ 3633 3633 3634 bool p2ProcessedImfileInsertObject(3635 psDB *dbh, ///< Database handle 3636 p2ProcessedImfileRow *object ///< p2ProcessedImfileRow object3637 ); 3638 3639 /** Insert an array of p2ProcessedImfileRow object into a table3634 bool chipProcessedImfileInsertObject( 3635 psDB *dbh, ///< Database handle 3636 chipProcessedImfileRow *object ///< chipProcessedImfileRow object 3637 ); 3638 3639 /** Insert an array of chipProcessedImfileRow object into a table 3640 3640 * 3641 3641 * This function constructs and inserts multiple rows based on it's parameters. … … 3644 3644 */ 3645 3645 3646 bool p2ProcessedImfileInsertObjects(3647 psDB *dbh, ///< Database handle 3648 psArray *objects ///< array of p2ProcessedImfileRow objects3649 ); 3650 3651 /** Insert data from a binary FITS table p2ProcessedImfileRow into the database3646 bool chipProcessedImfileInsertObjects( 3647 psDB *dbh, ///< Database handle 3648 psArray *objects ///< array of chipProcessedImfileRow objects 3649 ); 3650 3651 /** Insert data from a binary FITS table chipProcessedImfileRow into the database 3652 3652 * 3653 3653 * This function expects a psFits object with a FITS table as the first … … 3659 3659 */ 3660 3660 3661 bool p2ProcessedImfileInsertFits(3661 bool chipProcessedImfileInsertFits( 3662 3662 psDB *dbh, ///< Database handle 3663 3663 const psFits *fits ///< psFits object … … 3674 3674 */ 3675 3675 3676 bool p2ProcessedImfileSelectRowsFits(3676 bool chipProcessedImfileSelectRowsFits( 3677 3677 psDB *dbh, ///< Database handle 3678 3678 psFits *fits, ///< psFits object … … 3681 3681 ); 3682 3682 3683 /** Convert a p2ProcessedImfileRow into an equivalent psMetadata3683 /** Convert a chipProcessedImfileRow into an equivalent psMetadata 3684 3684 * 3685 3685 * @return A psMetadata pointer or NULL on error 3686 3686 */ 3687 3687 3688 psMetadata * p2ProcessedImfileMetadataFromObject(3689 const p2ProcessedImfileRow *object ///< fooRow to convert into a psMetadata3688 psMetadata *chipProcessedImfileMetadataFromObject( 3689 const chipProcessedImfileRow *object ///< fooRow to convert into a psMetadata 3690 3690 ); 3691 3691 3692 3692 /** Convert a psMetadata into an equivalent fooRow 3693 3693 * 3694 * @return A p2ProcessedImfileRow pointer or NULL on error3695 */ 3696 3697 p2ProcessedImfileRow *p2ProcessedImfileObjectFromMetadata(3694 * @return A chipProcessedImfileRow pointer or NULL on error 3695 */ 3696 3697 chipProcessedImfileRow *chipProcessedImfileObjectFromMetadata( 3698 3698 psMetadata *md ///< psMetadata to convert into a fooRow 3699 3699 ); 3700 /** Selects up to limit rows from the database and returns as p2ProcessedImfileRow objects in a psArray3700 /** Selects up to limit rows from the database and returns as chipProcessedImfileRow objects in a psArray 3701 3701 * 3702 3702 * See psDBSelectRows() for documentation on the format of where. … … 3705 3705 */ 3706 3706 3707 psArray * p2ProcessedImfileSelectRowObjects(3707 psArray *chipProcessedImfileSelectRowObjects( 3708 3708 psDB *dbh, ///< Database handle 3709 3709 const psMetadata *where, ///< Row match criteria 3710 3710 unsigned long long limit ///< Maximum number of elements to return 3711 3711 ); 3712 /** Deletes a row from the database coresponding to an p2ProcessedImfile3712 /** Deletes a row from the database coresponding to an chipProcessedImfile 3713 3713 * 3714 3714 * Note that a 'where' search psMetadata is constructed from each object and … … 3718 3718 */ 3719 3719 3720 bool p2ProcessedImfileDeleteObject(3721 psDB *dbh, ///< Database handle 3722 const p2ProcessedImfileRow *object ///< Object to delete3720 bool chipProcessedImfileDeleteObject( 3721 psDB *dbh, ///< Database handle 3722 const chipProcessedImfileRow *object ///< Object to delete 3723 3723 ); 3724 3724 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 3730 3730 */ 3731 3731 3732 long long p2ProcessedImfileDeleteRowObjects(3732 long long chipProcessedImfileDeleteRowObjects( 3733 3733 psDB *dbh, ///< Database handle 3734 3734 const psArray *objects, ///< Array of objects to delete 3735 3735 unsigned long long limit ///< Maximum number of elements to delete 3736 3736 ); 3737 /** Formats and prints an array of p2ProcessedImfileRow objects3737 /** Formats and prints an array of chipProcessedImfileRow objects 3738 3738 * 3739 3739 * When mdcf is set the formated output is in psMetadataConfig … … 3743 3743 */ 3744 3744 3745 bool p2ProcessedImfilePrintObjects(3745 bool chipProcessedImfilePrintObjects( 3746 3746 FILE *stream, ///< a stream 3747 psArray *objects, ///< An array of p2ProcessedImfileRow objects3747 psArray *objects, ///< An array of chipProcessedImfileRow objects 3748 3748 bool mdcf ///< format as mdconfig or simple 3749 3749 ); 3750 /** Formats and prints an p2ProcessedImfileRow object3750 /** Formats and prints an chipProcessedImfileRow object 3751 3751 * 3752 3752 * When mdcf is set the formated output is in psMetadataConfig … … 3756 3756 */ 3757 3757 3758 bool p2ProcessedImfilePrintObject(3758 bool chipProcessedImfilePrintObject( 3759 3759 FILE *stream, ///< a stream 3760 p2ProcessedImfileRow *object, ///< an p2ProcessedImfileRow object3760 chipProcessedImfileRow *object, ///< an chipProcessedImfileRow object 3761 3761 bool mdcf ///< format as mdconfig or simple 3762 3762 ); 3763 /** p3PendingExpRow data structure3764 * 3765 * Structure for representing a single row of p3PendingExp table data.3763 /** camPendingExpRow data structure 3764 * 3765 * Structure for representing a single row of camPendingExp table data. 3766 3766 */ 3767 3767 3768 3768 typedef struct { 3769 3769 char *exp_tag; 3770 psS32 p3_version;3771 psS32 p2_version;3770 psS32 cam_version; 3771 psS32 chip_version; 3772 3772 char *label; 3773 3773 char *expgroup; 3774 3774 char *dvodb; 3775 } p3PendingExpRow;3776 3777 /** Creates a new p3PendingExpRow object3778 * 3779 * @return A new p3PendingExpRow object or NULL on failure.3780 */ 3781 3782 p3PendingExpRow *p3PendingExpRowAlloc(3775 } camPendingExpRow; 3776 3777 /** Creates a new camPendingExpRow object 3778 * 3779 * @return A new camPendingExpRow object or NULL on failure. 3780 */ 3781 3782 camPendingExpRow *camPendingExpRowAlloc( 3783 3783 const char *exp_tag, 3784 psS32 p3_version,3785 psS32 p2_version,3784 psS32 cam_version, 3785 psS32 chip_version, 3786 3786 const char *label, 3787 3787 const char *expgroup, … … 3789 3789 ); 3790 3790 3791 /** Creates a new p3PendingExp table3792 * 3793 * @return true on success 3794 */ 3795 3796 bool p3PendingExpCreateTable(3791 /** Creates a new camPendingExp table 3792 * 3793 * @return true on success 3794 */ 3795 3796 bool camPendingExpCreateTable( 3797 3797 psDB *dbh ///< Database handle 3798 3798 ); 3799 3799 3800 /** Deletes a p3PendingExp table3801 * 3802 * @return true on success 3803 */ 3804 3805 bool p3PendingExpDropTable(3800 /** Deletes a camPendingExp table 3801 * 3802 * @return true on success 3803 */ 3804 3805 bool camPendingExpDropTable( 3806 3806 psDB *dbh ///< Database handle 3807 3807 ); … … 3814 3814 */ 3815 3815 3816 bool p3PendingExpInsert(3816 bool camPendingExpInsert( 3817 3817 psDB *dbh, ///< Database handle 3818 3818 const char *exp_tag, 3819 psS32 p3_version,3820 psS32 p2_version,3819 psS32 cam_version, 3820 psS32 chip_version, 3821 3821 const char *label, 3822 3822 const char *expgroup, … … 3829 3829 */ 3830 3830 3831 long long p3PendingExpDelete(3831 long long camPendingExpDelete( 3832 3832 psDB *dbh, ///< Database handle 3833 3833 const psMetadata *where, ///< Row match criteria … … 3835 3835 ); 3836 3836 3837 /** Insert a single p3PendingExpRow object into a table3837 /** Insert a single camPendingExpRow object into a table 3838 3838 * 3839 3839 * This function constructs and inserts a single row based on it's parameters. … … 3842 3842 */ 3843 3843 3844 bool p3PendingExpInsertObject(3845 psDB *dbh, ///< Database handle 3846 p3PendingExpRow *object ///< p3PendingExpRow object3847 ); 3848 3849 /** Insert an array of p3PendingExpRow object into a table3844 bool camPendingExpInsertObject( 3845 psDB *dbh, ///< Database handle 3846 camPendingExpRow *object ///< camPendingExpRow object 3847 ); 3848 3849 /** Insert an array of camPendingExpRow object into a table 3850 3850 * 3851 3851 * This function constructs and inserts multiple rows based on it's parameters. … … 3854 3854 */ 3855 3855 3856 bool p3PendingExpInsertObjects(3857 psDB *dbh, ///< Database handle 3858 psArray *objects ///< array of p3PendingExpRow objects3859 ); 3860 3861 /** Insert data from a binary FITS table p3PendingExpRow into the database3856 bool camPendingExpInsertObjects( 3857 psDB *dbh, ///< Database handle 3858 psArray *objects ///< array of camPendingExpRow objects 3859 ); 3860 3861 /** Insert data from a binary FITS table camPendingExpRow into the database 3862 3862 * 3863 3863 * This function expects a psFits object with a FITS table as the first … … 3869 3869 */ 3870 3870 3871 bool p3PendingExpInsertFits(3871 bool camPendingExpInsertFits( 3872 3872 psDB *dbh, ///< Database handle 3873 3873 const psFits *fits ///< psFits object … … 3884 3884 */ 3885 3885 3886 bool p3PendingExpSelectRowsFits(3886 bool camPendingExpSelectRowsFits( 3887 3887 psDB *dbh, ///< Database handle 3888 3888 psFits *fits, ///< psFits object … … 3891 3891 ); 3892 3892 3893 /** Convert a p3PendingExpRow into an equivalent psMetadata3893 /** Convert a camPendingExpRow into an equivalent psMetadata 3894 3894 * 3895 3895 * @return A psMetadata pointer or NULL on error 3896 3896 */ 3897 3897 3898 psMetadata * p3PendingExpMetadataFromObject(3899 const p3PendingExpRow *object ///< fooRow to convert into a psMetadata3898 psMetadata *camPendingExpMetadataFromObject( 3899 const camPendingExpRow *object ///< fooRow to convert into a psMetadata 3900 3900 ); 3901 3901 3902 3902 /** Convert a psMetadata into an equivalent fooRow 3903 3903 * 3904 * @return A p3PendingExpRow pointer or NULL on error3905 */ 3906 3907 p3PendingExpRow *p3PendingExpObjectFromMetadata(3904 * @return A camPendingExpRow pointer or NULL on error 3905 */ 3906 3907 camPendingExpRow *camPendingExpObjectFromMetadata( 3908 3908 psMetadata *md ///< psMetadata to convert into a fooRow 3909 3909 ); 3910 /** Selects up to limit rows from the database and returns as p3PendingExpRow objects in a psArray3910 /** Selects up to limit rows from the database and returns as camPendingExpRow objects in a psArray 3911 3911 * 3912 3912 * See psDBSelectRows() for documentation on the format of where. … … 3915 3915 */ 3916 3916 3917 psArray * p3PendingExpSelectRowObjects(3917 psArray *camPendingExpSelectRowObjects( 3918 3918 psDB *dbh, ///< Database handle 3919 3919 const psMetadata *where, ///< Row match criteria 3920 3920 unsigned long long limit ///< Maximum number of elements to return 3921 3921 ); 3922 /** Deletes a row from the database coresponding to an p3PendingExp3922 /** Deletes a row from the database coresponding to an camPendingExp 3923 3923 * 3924 3924 * Note that a 'where' search psMetadata is constructed from each object and … … 3928 3928 */ 3929 3929 3930 bool p3PendingExpDeleteObject(3931 psDB *dbh, ///< Database handle 3932 const p3PendingExpRow *object ///< Object to delete3930 bool camPendingExpDeleteObject( 3931 psDB *dbh, ///< Database handle 3932 const camPendingExpRow *object ///< Object to delete 3933 3933 ); 3934 3934 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 3940 3940 */ 3941 3941 3942 long long p3PendingExpDeleteRowObjects(3942 long long camPendingExpDeleteRowObjects( 3943 3943 psDB *dbh, ///< Database handle 3944 3944 const psArray *objects, ///< Array of objects to delete 3945 3945 unsigned long long limit ///< Maximum number of elements to delete 3946 3946 ); 3947 /** Formats and prints an array of p3PendingExpRow objects3947 /** Formats and prints an array of camPendingExpRow objects 3948 3948 * 3949 3949 * When mdcf is set the formated output is in psMetadataConfig … … 3953 3953 */ 3954 3954 3955 bool p3PendingExpPrintObjects(3955 bool camPendingExpPrintObjects( 3956 3956 FILE *stream, ///< a stream 3957 psArray *objects, ///< An array of p3PendingExpRow objects3957 psArray *objects, ///< An array of camPendingExpRow objects 3958 3958 bool mdcf ///< format as mdconfig or simple 3959 3959 ); 3960 /** Formats and prints an p3PendingExpRow object3960 /** Formats and prints an camPendingExpRow object 3961 3961 * 3962 3962 * When mdcf is set the formated output is in psMetadataConfig … … 3966 3966 */ 3967 3967 3968 bool p3PendingExpPrintObject(3968 bool camPendingExpPrintObject( 3969 3969 FILE *stream, ///< a stream 3970 p3PendingExpRow *object, ///< an p3PendingExpRow object3970 camPendingExpRow *object, ///< an camPendingExpRow object 3971 3971 bool mdcf ///< format as mdconfig or simple 3972 3972 ); 3973 /** p3ProcessedExpRow data structure3974 * 3975 * Structure for representing a single row of p3ProcessedExp table data.3973 /** camProcessedExpRow data structure 3974 * 3975 * Structure for representing a single row of camProcessedExp table data. 3976 3976 */ 3977 3977 3978 3978 typedef struct { 3979 3979 char *exp_tag; 3980 psS32 p3_version;3981 psS32 p2_version;3980 psS32 cam_version; 3981 psS32 chip_version; 3982 3982 char *label; 3983 3983 char *uri; … … 3996 3996 char *expgroup; 3997 3997 char *dvodb; 3998 } p3ProcessedExpRow;3999 4000 /** Creates a new p3ProcessedExpRow object4001 * 4002 * @return A new p3ProcessedExpRow object or NULL on failure.4003 */ 4004 4005 p3ProcessedExpRow *p3ProcessedExpRowAlloc(3998 } camProcessedExpRow; 3999 4000 /** Creates a new camProcessedExpRow object 4001 * 4002 * @return A new camProcessedExpRow object or NULL on failure. 4003 */ 4004 4005 camProcessedExpRow *camProcessedExpRowAlloc( 4006 4006 const char *exp_tag, 4007 psS32 p3_version,4008 psS32 p2_version,4007 psS32 cam_version, 4008 psS32 chip_version, 4009 4009 const char *label, 4010 4010 const char *uri, … … 4025 4025 ); 4026 4026 4027 /** Creates a new p3ProcessedExp table4028 * 4029 * @return true on success 4030 */ 4031 4032 bool p3ProcessedExpCreateTable(4027 /** Creates a new camProcessedExp table 4028 * 4029 * @return true on success 4030 */ 4031 4032 bool camProcessedExpCreateTable( 4033 4033 psDB *dbh ///< Database handle 4034 4034 ); 4035 4035 4036 /** Deletes a p3ProcessedExp table4037 * 4038 * @return true on success 4039 */ 4040 4041 bool p3ProcessedExpDropTable(4036 /** Deletes a camProcessedExp table 4037 * 4038 * @return true on success 4039 */ 4040 4041 bool camProcessedExpDropTable( 4042 4042 psDB *dbh ///< Database handle 4043 4043 ); … … 4050 4050 */ 4051 4051 4052 bool p3ProcessedExpInsert(4052 bool camProcessedExpInsert( 4053 4053 psDB *dbh, ///< Database handle 4054 4054 const char *exp_tag, 4055 psS32 p3_version,4056 psS32 p2_version,4055 psS32 cam_version, 4056 psS32 chip_version, 4057 4057 const char *label, 4058 4058 const char *uri, … … 4078 4078 */ 4079 4079 4080 long long p3ProcessedExpDelete(4080 long long camProcessedExpDelete( 4081 4081 psDB *dbh, ///< Database handle 4082 4082 const psMetadata *where, ///< Row match criteria … … 4084 4084 ); 4085 4085 4086 /** Insert a single p3ProcessedExpRow object into a table4086 /** Insert a single camProcessedExpRow object into a table 4087 4087 * 4088 4088 * This function constructs and inserts a single row based on it's parameters. … … 4091 4091 */ 4092 4092 4093 bool p3ProcessedExpInsertObject(4094 psDB *dbh, ///< Database handle 4095 p3ProcessedExpRow *object ///< p3ProcessedExpRow object4096 ); 4097 4098 /** Insert an array of p3ProcessedExpRow object into a table4093 bool camProcessedExpInsertObject( 4094 psDB *dbh, ///< Database handle 4095 camProcessedExpRow *object ///< camProcessedExpRow object 4096 ); 4097 4098 /** Insert an array of camProcessedExpRow object into a table 4099 4099 * 4100 4100 * This function constructs and inserts multiple rows based on it's parameters. … … 4103 4103 */ 4104 4104 4105 bool p3ProcessedExpInsertObjects(4106 psDB *dbh, ///< Database handle 4107 psArray *objects ///< array of p3ProcessedExpRow objects4108 ); 4109 4110 /** Insert data from a binary FITS table p3ProcessedExpRow into the database4105 bool camProcessedExpInsertObjects( 4106 psDB *dbh, ///< Database handle 4107 psArray *objects ///< array of camProcessedExpRow objects 4108 ); 4109 4110 /** Insert data from a binary FITS table camProcessedExpRow into the database 4111 4111 * 4112 4112 * This function expects a psFits object with a FITS table as the first … … 4118 4118 */ 4119 4119 4120 bool p3ProcessedExpInsertFits(4120 bool camProcessedExpInsertFits( 4121 4121 psDB *dbh, ///< Database handle 4122 4122 const psFits *fits ///< psFits object … … 4133 4133 */ 4134 4134 4135 bool p3ProcessedExpSelectRowsFits(4135 bool camProcessedExpSelectRowsFits( 4136 4136 psDB *dbh, ///< Database handle 4137 4137 psFits *fits, ///< psFits object … … 4140 4140 ); 4141 4141 4142 /** Convert a p3ProcessedExpRow into an equivalent psMetadata4142 /** Convert a camProcessedExpRow into an equivalent psMetadata 4143 4143 * 4144 4144 * @return A psMetadata pointer or NULL on error 4145 4145 */ 4146 4146 4147 psMetadata * p3ProcessedExpMetadataFromObject(4148 const p3ProcessedExpRow *object ///< fooRow to convert into a psMetadata4147 psMetadata *camProcessedExpMetadataFromObject( 4148 const camProcessedExpRow *object ///< fooRow to convert into a psMetadata 4149 4149 ); 4150 4150 4151 4151 /** Convert a psMetadata into an equivalent fooRow 4152 4152 * 4153 * @return A p3ProcessedExpRow pointer or NULL on error4154 */ 4155 4156 p3ProcessedExpRow *p3ProcessedExpObjectFromMetadata(4153 * @return A camProcessedExpRow pointer or NULL on error 4154 */ 4155 4156 camProcessedExpRow *camProcessedExpObjectFromMetadata( 4157 4157 psMetadata *md ///< psMetadata to convert into a fooRow 4158 4158 ); 4159 /** Selects up to limit rows from the database and returns as p3ProcessedExpRow objects in a psArray4159 /** Selects up to limit rows from the database and returns as camProcessedExpRow objects in a psArray 4160 4160 * 4161 4161 * See psDBSelectRows() for documentation on the format of where. … … 4164 4164 */ 4165 4165 4166 psArray * p3ProcessedExpSelectRowObjects(4166 psArray *camProcessedExpSelectRowObjects( 4167 4167 psDB *dbh, ///< Database handle 4168 4168 const psMetadata *where, ///< Row match criteria 4169 4169 unsigned long long limit ///< Maximum number of elements to return 4170 4170 ); 4171 /** Deletes a row from the database coresponding to an p3ProcessedExp4171 /** Deletes a row from the database coresponding to an camProcessedExp 4172 4172 * 4173 4173 * Note that a 'where' search psMetadata is constructed from each object and … … 4177 4177 */ 4178 4178 4179 bool p3ProcessedExpDeleteObject(4180 psDB *dbh, ///< Database handle 4181 const p3ProcessedExpRow *object ///< Object to delete4179 bool camProcessedExpDeleteObject( 4180 psDB *dbh, ///< Database handle 4181 const camProcessedExpRow *object ///< Object to delete 4182 4182 ); 4183 4183 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 4189 4189 */ 4190 4190 4191 long long p3ProcessedExpDeleteRowObjects(4191 long long camProcessedExpDeleteRowObjects( 4192 4192 psDB *dbh, ///< Database handle 4193 4193 const psArray *objects, ///< Array of objects to delete 4194 4194 unsigned long long limit ///< Maximum number of elements to delete 4195 4195 ); 4196 /** Formats and prints an array of p3ProcessedExpRow objects4196 /** Formats and prints an array of camProcessedExpRow objects 4197 4197 * 4198 4198 * When mdcf is set the formated output is in psMetadataConfig … … 4202 4202 */ 4203 4203 4204 bool p3ProcessedExpPrintObjects(4204 bool camProcessedExpPrintObjects( 4205 4205 FILE *stream, ///< a stream 4206 psArray *objects, ///< An array of p3ProcessedExpRow objects4206 psArray *objects, ///< An array of camProcessedExpRow objects 4207 4207 bool mdcf ///< format as mdconfig or simple 4208 4208 ); 4209 /** Formats and prints an p3ProcessedExpRow object4209 /** Formats and prints an camProcessedExpRow object 4210 4210 * 4211 4211 * When mdcf is set the formated output is in psMetadataConfig … … 4215 4215 */ 4216 4216 4217 bool p3ProcessedExpPrintObject(4217 bool camProcessedExpPrintObject( 4218 4218 FILE *stream, ///< a stream 4219 p3ProcessedExpRow *object, ///< an p3ProcessedExpRow object4219 camProcessedExpRow *object, ///< an camProcessedExpRow object 4220 4220 bool mdcf ///< format as mdconfig or simple 4221 4221 ); 4222 /** p3MaskRow data structure4223 * 4224 * Structure for representing a single row of p3Mask table data.4222 /** camMaskRow data structure 4223 * 4224 * Structure for representing a single row of camMask table data. 4225 4225 */ 4226 4226 4227 4227 typedef struct { 4228 4228 char *label; 4229 } p3MaskRow;4230 4231 /** Creates a new p3MaskRow object4232 * 4233 * @return A new p3MaskRow object or NULL on failure.4234 */ 4235 4236 p3MaskRow *p3MaskRowAlloc(4229 } camMaskRow; 4230 4231 /** Creates a new camMaskRow object 4232 * 4233 * @return A new camMaskRow object or NULL on failure. 4234 */ 4235 4236 camMaskRow *camMaskRowAlloc( 4237 4237 const char *label 4238 4238 ); 4239 4239 4240 /** Creates a new p3Mask table4241 * 4242 * @return true on success 4243 */ 4244 4245 bool p3MaskCreateTable(4240 /** Creates a new camMask table 4241 * 4242 * @return true on success 4243 */ 4244 4245 bool camMaskCreateTable( 4246 4246 psDB *dbh ///< Database handle 4247 4247 ); 4248 4248 4249 /** Deletes a p3Mask table4250 * 4251 * @return true on success 4252 */ 4253 4254 bool p3MaskDropTable(4249 /** Deletes a camMask table 4250 * 4251 * @return true on success 4252 */ 4253 4254 bool camMaskDropTable( 4255 4255 psDB *dbh ///< Database handle 4256 4256 ); … … 4263 4263 */ 4264 4264 4265 bool p3MaskInsert(4265 bool camMaskInsert( 4266 4266 psDB *dbh, ///< Database handle 4267 4267 const char *label … … 4273 4273 */ 4274 4274 4275 long long p3MaskDelete(4275 long long camMaskDelete( 4276 4276 psDB *dbh, ///< Database handle 4277 4277 const psMetadata *where, ///< Row match criteria … … 4279 4279 ); 4280 4280 4281 /** Insert a single p3MaskRow object into a table4281 /** Insert a single camMaskRow object into a table 4282 4282 * 4283 4283 * This function constructs and inserts a single row based on it's parameters. … … 4286 4286 */ 4287 4287 4288 bool p3MaskInsertObject(4289 psDB *dbh, ///< Database handle 4290 p3MaskRow *object ///< p3MaskRow object4291 ); 4292 4293 /** Insert an array of p3MaskRow object into a table4288 bool camMaskInsertObject( 4289 psDB *dbh, ///< Database handle 4290 camMaskRow *object ///< camMaskRow object 4291 ); 4292 4293 /** Insert an array of camMaskRow object into a table 4294 4294 * 4295 4295 * This function constructs and inserts multiple rows based on it's parameters. … … 4298 4298 */ 4299 4299 4300 bool p3MaskInsertObjects(4301 psDB *dbh, ///< Database handle 4302 psArray *objects ///< array of p3MaskRow objects4303 ); 4304 4305 /** Insert data from a binary FITS table p3MaskRow into the database4300 bool camMaskInsertObjects( 4301 psDB *dbh, ///< Database handle 4302 psArray *objects ///< array of camMaskRow objects 4303 ); 4304 4305 /** Insert data from a binary FITS table camMaskRow into the database 4306 4306 * 4307 4307 * This function expects a psFits object with a FITS table as the first … … 4313 4313 */ 4314 4314 4315 bool p3MaskInsertFits(4315 bool camMaskInsertFits( 4316 4316 psDB *dbh, ///< Database handle 4317 4317 const psFits *fits ///< psFits object … … 4328 4328 */ 4329 4329 4330 bool p3MaskSelectRowsFits(4330 bool camMaskSelectRowsFits( 4331 4331 psDB *dbh, ///< Database handle 4332 4332 psFits *fits, ///< psFits object … … 4335 4335 ); 4336 4336 4337 /** Convert a p3MaskRow into an equivalent psMetadata4337 /** Convert a camMaskRow into an equivalent psMetadata 4338 4338 * 4339 4339 * @return A psMetadata pointer or NULL on error 4340 4340 */ 4341 4341 4342 psMetadata * p3MaskMetadataFromObject(4343 const p3MaskRow *object ///< fooRow to convert into a psMetadata4342 psMetadata *camMaskMetadataFromObject( 4343 const camMaskRow *object ///< fooRow to convert into a psMetadata 4344 4344 ); 4345 4345 4346 4346 /** Convert a psMetadata into an equivalent fooRow 4347 4347 * 4348 * @return A p3MaskRow pointer or NULL on error4349 */ 4350 4351 p3MaskRow *p3MaskObjectFromMetadata(4348 * @return A camMaskRow pointer or NULL on error 4349 */ 4350 4351 camMaskRow *camMaskObjectFromMetadata( 4352 4352 psMetadata *md ///< psMetadata to convert into a fooRow 4353 4353 ); 4354 /** Selects up to limit rows from the database and returns as p3MaskRow objects in a psArray4354 /** Selects up to limit rows from the database and returns as camMaskRow objects in a psArray 4355 4355 * 4356 4356 * See psDBSelectRows() for documentation on the format of where. … … 4359 4359 */ 4360 4360 4361 psArray * p3MaskSelectRowObjects(4361 psArray *camMaskSelectRowObjects( 4362 4362 psDB *dbh, ///< Database handle 4363 4363 const psMetadata *where, ///< Row match criteria 4364 4364 unsigned long long limit ///< Maximum number of elements to return 4365 4365 ); 4366 /** Deletes a row from the database coresponding to an p3Mask4366 /** Deletes a row from the database coresponding to an camMask 4367 4367 * 4368 4368 * Note that a 'where' search psMetadata is constructed from each object and … … 4372 4372 */ 4373 4373 4374 bool p3MaskDeleteObject(4375 psDB *dbh, ///< Database handle 4376 const p3MaskRow *object ///< Object to delete4374 bool camMaskDeleteObject( 4375 psDB *dbh, ///< Database handle 4376 const camMaskRow *object ///< Object to delete 4377 4377 ); 4378 4378 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 4384 4384 */ 4385 4385 4386 long long p3MaskDeleteRowObjects(4386 long long camMaskDeleteRowObjects( 4387 4387 psDB *dbh, ///< Database handle 4388 4388 const psArray *objects, ///< Array of objects to delete 4389 4389 unsigned long long limit ///< Maximum number of elements to delete 4390 4390 ); 4391 /** Formats and prints an array of p3MaskRow objects4391 /** Formats and prints an array of camMaskRow objects 4392 4392 * 4393 4393 * When mdcf is set the formated output is in psMetadataConfig … … 4397 4397 */ 4398 4398 4399 bool p3MaskPrintObjects(4399 bool camMaskPrintObjects( 4400 4400 FILE *stream, ///< a stream 4401 psArray *objects, ///< An array of p3MaskRow objects4401 psArray *objects, ///< An array of camMaskRow objects 4402 4402 bool mdcf ///< format as mdconfig or simple 4403 4403 ); 4404 /** Formats and prints an p3MaskRow object4404 /** Formats and prints an camMaskRow object 4405 4405 * 4406 4406 * When mdcf is set the formated output is in psMetadataConfig … … 4410 4410 */ 4411 4411 4412 bool p3MaskPrintObject(4412 bool camMaskPrintObject( 4413 4413 FILE *stream, ///< a stream 4414 p3MaskRow *object, ///< an p3MaskRow object4414 camMaskRow *object, ///< an camMaskRow object 4415 4415 bool mdcf ///< format as mdconfig or simple 4416 4416 ); … … 6869 6869 bool mdcf ///< format as mdconfig or simple 6870 6870 ); 6871 /** p4RunRow data structure6872 * 6873 * Structure for representing a single row of p4Run table data.6871 /** warpRunRow data structure 6872 * 6873 * Structure for representing a single row of warpRun table data. 6874 6874 */ 6875 6875 6876 6876 typedef struct { 6877 psS32 p4_id;6877 psS32 warp_id; 6878 6878 char *mode; 6879 6879 char *state; … … 6881 6881 char *dvodb; 6882 6882 psTime* registered; 6883 } p4RunRow;6884 6885 /** Creates a new p4RunRow object6886 * 6887 * @return A new p4RunRow object or NULL on failure.6888 */ 6889 6890 p4RunRow *p4RunRowAlloc(6891 psS32 p4_id,6883 } warpRunRow; 6884 6885 /** Creates a new warpRunRow object 6886 * 6887 * @return A new warpRunRow object or NULL on failure. 6888 */ 6889 6890 warpRunRow *warpRunRowAlloc( 6891 psS32 warp_id, 6892 6892 const char *mode, 6893 6893 const char *state, … … 6897 6897 ); 6898 6898 6899 /** Creates a new p4Run table6900 * 6901 * @return true on success 6902 */ 6903 6904 bool p4RunCreateTable(6899 /** Creates a new warpRun table 6900 * 6901 * @return true on success 6902 */ 6903 6904 bool warpRunCreateTable( 6905 6905 psDB *dbh ///< Database handle 6906 6906 ); 6907 6907 6908 /** Deletes a p4Run table6909 * 6910 * @return true on success 6911 */ 6912 6913 bool p4RunDropTable(6908 /** Deletes a warpRun table 6909 * 6910 * @return true on success 6911 */ 6912 6913 bool warpRunDropTable( 6914 6914 psDB *dbh ///< Database handle 6915 6915 ); … … 6922 6922 */ 6923 6923 6924 bool p4RunInsert(6925 psDB *dbh, ///< Database handle 6926 psS32 p4_id,6924 bool warpRunInsert( 6925 psDB *dbh, ///< Database handle 6926 psS32 warp_id, 6927 6927 const char *mode, 6928 6928 const char *state, … … 6937 6937 */ 6938 6938 6939 long long p4RunDelete(6939 long long warpRunDelete( 6940 6940 psDB *dbh, ///< Database handle 6941 6941 const psMetadata *where, ///< Row match criteria … … 6943 6943 ); 6944 6944 6945 /** Insert a single p4RunRow object into a table6945 /** Insert a single warpRunRow object into a table 6946 6946 * 6947 6947 * This function constructs and inserts a single row based on it's parameters. … … 6950 6950 */ 6951 6951 6952 bool p4RunInsertObject(6953 psDB *dbh, ///< Database handle 6954 p4RunRow *object ///< p4RunRow object6955 ); 6956 6957 /** Insert an array of p4RunRow object into a table6952 bool warpRunInsertObject( 6953 psDB *dbh, ///< Database handle 6954 warpRunRow *object ///< warpRunRow object 6955 ); 6956 6957 /** Insert an array of warpRunRow object into a table 6958 6958 * 6959 6959 * This function constructs and inserts multiple rows based on it's parameters. … … 6962 6962 */ 6963 6963 6964 bool p4RunInsertObjects(6965 psDB *dbh, ///< Database handle 6966 psArray *objects ///< array of p4RunRow objects6967 ); 6968 6969 /** Insert data from a binary FITS table p4RunRow into the database6964 bool warpRunInsertObjects( 6965 psDB *dbh, ///< Database handle 6966 psArray *objects ///< array of warpRunRow objects 6967 ); 6968 6969 /** Insert data from a binary FITS table warpRunRow into the database 6970 6970 * 6971 6971 * This function expects a psFits object with a FITS table as the first … … 6977 6977 */ 6978 6978 6979 bool p4RunInsertFits(6979 bool warpRunInsertFits( 6980 6980 psDB *dbh, ///< Database handle 6981 6981 const psFits *fits ///< psFits object … … 6992 6992 */ 6993 6993 6994 bool p4RunSelectRowsFits(6994 bool warpRunSelectRowsFits( 6995 6995 psDB *dbh, ///< Database handle 6996 6996 psFits *fits, ///< psFits object … … 6999 6999 ); 7000 7000 7001 /** Convert a p4RunRow into an equivalent psMetadata7001 /** Convert a warpRunRow into an equivalent psMetadata 7002 7002 * 7003 7003 * @return A psMetadata pointer or NULL on error 7004 7004 */ 7005 7005 7006 psMetadata * p4RunMetadataFromObject(7007 const p4RunRow*object ///< fooRow to convert into a psMetadata7006 psMetadata *warpRunMetadataFromObject( 7007 const warpRunRow *object ///< fooRow to convert into a psMetadata 7008 7008 ); 7009 7009 7010 7010 /** Convert a psMetadata into an equivalent fooRow 7011 7011 * 7012 * @return A p4RunRow pointer or NULL on error7013 */ 7014 7015 p4RunRow *p4RunObjectFromMetadata(7012 * @return A warpRunRow pointer or NULL on error 7013 */ 7014 7015 warpRunRow *warpRunObjectFromMetadata( 7016 7016 psMetadata *md ///< psMetadata to convert into a fooRow 7017 7017 ); 7018 /** Selects up to limit rows from the database and returns as p4RunRow objects in a psArray7018 /** Selects up to limit rows from the database and returns as warpRunRow objects in a psArray 7019 7019 * 7020 7020 * See psDBSelectRows() for documentation on the format of where. … … 7023 7023 */ 7024 7024 7025 psArray * p4RunSelectRowObjects(7025 psArray *warpRunSelectRowObjects( 7026 7026 psDB *dbh, ///< Database handle 7027 7027 const psMetadata *where, ///< Row match criteria 7028 7028 unsigned long long limit ///< Maximum number of elements to return 7029 7029 ); 7030 /** Deletes a row from the database coresponding to an p4Run7030 /** Deletes a row from the database coresponding to an warpRun 7031 7031 * 7032 7032 * Note that a 'where' search psMetadata is constructed from each object and … … 7036 7036 */ 7037 7037 7038 bool p4RunDeleteObject(7039 psDB *dbh, ///< Database handle 7040 const p4RunRow *object ///< Object to delete7038 bool warpRunDeleteObject( 7039 psDB *dbh, ///< Database handle 7040 const warpRunRow *object ///< Object to delete 7041 7041 ); 7042 7042 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 7048 7048 */ 7049 7049 7050 long long p4RunDeleteRowObjects(7050 long long warpRunDeleteRowObjects( 7051 7051 psDB *dbh, ///< Database handle 7052 7052 const psArray *objects, ///< Array of objects to delete 7053 7053 unsigned long long limit ///< Maximum number of elements to delete 7054 7054 ); 7055 /** Formats and prints an array of p4RunRow objects7055 /** Formats and prints an array of warpRunRow objects 7056 7056 * 7057 7057 * When mdcf is set the formated output is in psMetadataConfig … … 7061 7061 */ 7062 7062 7063 bool p4RunPrintObjects(7063 bool warpRunPrintObjects( 7064 7064 FILE *stream, ///< a stream 7065 psArray *objects, ///< An array of p4RunRow objects7065 psArray *objects, ///< An array of warpRunRow objects 7066 7066 bool mdcf ///< format as mdconfig or simple 7067 7067 ); 7068 /** Formats and prints an p4RunRow object7068 /** Formats and prints an warpRunRow object 7069 7069 * 7070 7070 * When mdcf is set the formated output is in psMetadataConfig … … 7074 7074 */ 7075 7075 7076 bool p4RunPrintObject(7076 bool warpRunPrintObject( 7077 7077 FILE *stream, ///< a stream 7078 p4RunRow *object, ///< an p4RunRow object7078 warpRunRow *object, ///< an warpRunRow object 7079 7079 bool mdcf ///< format as mdconfig or simple 7080 7080 ); 7081 /** p4InputExpRow data structure7082 * 7083 * Structure for representing a single row of p4InputExp table data.7081 /** warpInputExpRow data structure 7082 * 7083 * Structure for representing a single row of warpInputExp table data. 7084 7084 */ 7085 7085 7086 7086 typedef struct { 7087 psS32 p4_id;7087 psS32 warp_id; 7088 7088 char *exp_tag; 7089 psS32 p3_version;7089 psS32 cam_version; 7090 7090 bool magiced; 7091 } p4InputExpRow;7092 7093 /** Creates a new p4InputExpRow object7094 * 7095 * @return A new p4InputExpRow object or NULL on failure.7096 */ 7097 7098 p4InputExpRow *p4InputExpRowAlloc(7099 psS32 p4_id,7091 } warpInputExpRow; 7092 7093 /** Creates a new warpInputExpRow object 7094 * 7095 * @return A new warpInputExpRow object or NULL on failure. 7096 */ 7097 7098 warpInputExpRow *warpInputExpRowAlloc( 7099 psS32 warp_id, 7100 7100 const char *exp_tag, 7101 psS32 p3_version,7101 psS32 cam_version, 7102 7102 bool magiced 7103 7103 ); 7104 7104 7105 /** Creates a new p4InputExp table7106 * 7107 * @return true on success 7108 */ 7109 7110 bool p4InputExpCreateTable(7105 /** Creates a new warpInputExp table 7106 * 7107 * @return true on success 7108 */ 7109 7110 bool warpInputExpCreateTable( 7111 7111 psDB *dbh ///< Database handle 7112 7112 ); 7113 7113 7114 /** Deletes a p4InputExp table7115 * 7116 * @return true on success 7117 */ 7118 7119 bool p4InputExpDropTable(7114 /** Deletes a warpInputExp table 7115 * 7116 * @return true on success 7117 */ 7118 7119 bool warpInputExpDropTable( 7120 7120 psDB *dbh ///< Database handle 7121 7121 ); … … 7128 7128 */ 7129 7129 7130 bool p4InputExpInsert(7131 psDB *dbh, ///< Database handle 7132 psS32 p4_id,7130 bool warpInputExpInsert( 7131 psDB *dbh, ///< Database handle 7132 psS32 warp_id, 7133 7133 const char *exp_tag, 7134 psS32 p3_version,7134 psS32 cam_version, 7135 7135 bool magiced 7136 7136 ); … … 7141 7141 */ 7142 7142 7143 long long p4InputExpDelete(7143 long long warpInputExpDelete( 7144 7144 psDB *dbh, ///< Database handle 7145 7145 const psMetadata *where, ///< Row match criteria … … 7147 7147 ); 7148 7148 7149 /** Insert a single p4InputExpRow object into a table7149 /** Insert a single warpInputExpRow object into a table 7150 7150 * 7151 7151 * This function constructs and inserts a single row based on it's parameters. … … 7154 7154 */ 7155 7155 7156 bool p4InputExpInsertObject(7157 psDB *dbh, ///< Database handle 7158 p4InputExpRow *object ///< p4InputExpRow object7159 ); 7160 7161 /** Insert an array of p4InputExpRow object into a table7156 bool warpInputExpInsertObject( 7157 psDB *dbh, ///< Database handle 7158 warpInputExpRow *object ///< warpInputExpRow object 7159 ); 7160 7161 /** Insert an array of warpInputExpRow object into a table 7162 7162 * 7163 7163 * This function constructs and inserts multiple rows based on it's parameters. … … 7166 7166 */ 7167 7167 7168 bool p4InputExpInsertObjects(7169 psDB *dbh, ///< Database handle 7170 psArray *objects ///< array of p4InputExpRow objects7171 ); 7172 7173 /** Insert data from a binary FITS table p4InputExpRow into the database7168 bool warpInputExpInsertObjects( 7169 psDB *dbh, ///< Database handle 7170 psArray *objects ///< array of warpInputExpRow objects 7171 ); 7172 7173 /** Insert data from a binary FITS table warpInputExpRow into the database 7174 7174 * 7175 7175 * This function expects a psFits object with a FITS table as the first … … 7181 7181 */ 7182 7182 7183 bool p4InputExpInsertFits(7183 bool warpInputExpInsertFits( 7184 7184 psDB *dbh, ///< Database handle 7185 7185 const psFits *fits ///< psFits object … … 7196 7196 */ 7197 7197 7198 bool p4InputExpSelectRowsFits(7198 bool warpInputExpSelectRowsFits( 7199 7199 psDB *dbh, ///< Database handle 7200 7200 psFits *fits, ///< psFits object … … 7203 7203 ); 7204 7204 7205 /** Convert a p4InputExpRow into an equivalent psMetadata7205 /** Convert a warpInputExpRow into an equivalent psMetadata 7206 7206 * 7207 7207 * @return A psMetadata pointer or NULL on error 7208 7208 */ 7209 7209 7210 psMetadata * p4InputExpMetadataFromObject(7211 const p4InputExpRow *object ///< fooRow to convert into a psMetadata7210 psMetadata *warpInputExpMetadataFromObject( 7211 const warpInputExpRow *object ///< fooRow to convert into a psMetadata 7212 7212 ); 7213 7213 7214 7214 /** Convert a psMetadata into an equivalent fooRow 7215 7215 * 7216 * @return A p4InputExpRow pointer or NULL on error7217 */ 7218 7219 p4InputExpRow *p4InputExpObjectFromMetadata(7216 * @return A warpInputExpRow pointer or NULL on error 7217 */ 7218 7219 warpInputExpRow *warpInputExpObjectFromMetadata( 7220 7220 psMetadata *md ///< psMetadata to convert into a fooRow 7221 7221 ); 7222 /** Selects up to limit rows from the database and returns as p4InputExpRow objects in a psArray7222 /** Selects up to limit rows from the database and returns as warpInputExpRow objects in a psArray 7223 7223 * 7224 7224 * See psDBSelectRows() for documentation on the format of where. … … 7227 7227 */ 7228 7228 7229 psArray * p4InputExpSelectRowObjects(7229 psArray *warpInputExpSelectRowObjects( 7230 7230 psDB *dbh, ///< Database handle 7231 7231 const psMetadata *where, ///< Row match criteria 7232 7232 unsigned long long limit ///< Maximum number of elements to return 7233 7233 ); 7234 /** Deletes a row from the database coresponding to an p4InputExp7234 /** Deletes a row from the database coresponding to an warpInputExp 7235 7235 * 7236 7236 * Note that a 'where' search psMetadata is constructed from each object and … … 7240 7240 */ 7241 7241 7242 bool p4InputExpDeleteObject(7243 psDB *dbh, ///< Database handle 7244 const p4InputExpRow *object ///< Object to delete7242 bool warpInputExpDeleteObject( 7243 psDB *dbh, ///< Database handle 7244 const warpInputExpRow *object ///< Object to delete 7245 7245 ); 7246 7246 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 7252 7252 */ 7253 7253 7254 long long p4InputExpDeleteRowObjects(7254 long long warpInputExpDeleteRowObjects( 7255 7255 psDB *dbh, ///< Database handle 7256 7256 const psArray *objects, ///< Array of objects to delete 7257 7257 unsigned long long limit ///< Maximum number of elements to delete 7258 7258 ); 7259 /** Formats and prints an array of p4InputExpRow objects7259 /** Formats and prints an array of warpInputExpRow objects 7260 7260 * 7261 7261 * When mdcf is set the formated output is in psMetadataConfig … … 7265 7265 */ 7266 7266 7267 bool p4InputExpPrintObjects(7267 bool warpInputExpPrintObjects( 7268 7268 FILE *stream, ///< a stream 7269 psArray *objects, ///< An array of p4InputExpRow objects7269 psArray *objects, ///< An array of warpInputExpRow objects 7270 7270 bool mdcf ///< format as mdconfig or simple 7271 7271 ); 7272 /** Formats and prints an p4InputExpRow object7272 /** Formats and prints an warpInputExpRow object 7273 7273 * 7274 7274 * When mdcf is set the formated output is in psMetadataConfig … … 7278 7278 */ 7279 7279 7280 bool p4InputExpPrintObject(7280 bool warpInputExpPrintObject( 7281 7281 FILE *stream, ///< a stream 7282 p4InputExpRow *object, ///< an p4InputExpRow object7282 warpInputExpRow *object, ///< an warpInputExpRow object 7283 7283 bool mdcf ///< format as mdconfig or simple 7284 7284 ); 7285 /** p4SkyCellMapRow data structure7286 * 7287 * Structure for representing a single row of p4SkyCellMap table data.7285 /** warpSkyCellMapRow data structure 7286 * 7287 * Structure for representing a single row of warpSkyCellMap table data. 7288 7288 */ 7289 7289 7290 7290 typedef struct { 7291 psS32 p4_id;7291 psS32 warp_id; 7292 7292 char *skycell_id; 7293 7293 char *tess_id; 7294 7294 char *exp_tag; 7295 psS32 p3_version;7295 psS32 cam_version; 7296 7296 char *class_id; 7297 } p4SkyCellMapRow;7298 7299 /** Creates a new p4SkyCellMapRow object7300 * 7301 * @return A new p4SkyCellMapRow object or NULL on failure.7302 */ 7303 7304 p4SkyCellMapRow *p4SkyCellMapRowAlloc(7305 psS32 p4_id,7297 } warpSkyCellMapRow; 7298 7299 /** Creates a new warpSkyCellMapRow object 7300 * 7301 * @return A new warpSkyCellMapRow object or NULL on failure. 7302 */ 7303 7304 warpSkyCellMapRow *warpSkyCellMapRowAlloc( 7305 psS32 warp_id, 7306 7306 const char *skycell_id, 7307 7307 const char *tess_id, 7308 7308 const char *exp_tag, 7309 psS32 p3_version,7309 psS32 cam_version, 7310 7310 const char *class_id 7311 7311 ); 7312 7312 7313 /** Creates a new p4SkyCellMap table7314 * 7315 * @return true on success 7316 */ 7317 7318 bool p4SkyCellMapCreateTable(7313 /** Creates a new warpSkyCellMap table 7314 * 7315 * @return true on success 7316 */ 7317 7318 bool warpSkyCellMapCreateTable( 7319 7319 psDB *dbh ///< Database handle 7320 7320 ); 7321 7321 7322 /** Deletes a p4SkyCellMap table7323 * 7324 * @return true on success 7325 */ 7326 7327 bool p4SkyCellMapDropTable(7322 /** Deletes a warpSkyCellMap table 7323 * 7324 * @return true on success 7325 */ 7326 7327 bool warpSkyCellMapDropTable( 7328 7328 psDB *dbh ///< Database handle 7329 7329 ); … … 7336 7336 */ 7337 7337 7338 bool p4SkyCellMapInsert(7339 psDB *dbh, ///< Database handle 7340 psS32 p4_id,7338 bool warpSkyCellMapInsert( 7339 psDB *dbh, ///< Database handle 7340 psS32 warp_id, 7341 7341 const char *skycell_id, 7342 7342 const char *tess_id, 7343 7343 const char *exp_tag, 7344 psS32 p3_version,7344 psS32 cam_version, 7345 7345 const char *class_id 7346 7346 ); … … 7351 7351 */ 7352 7352 7353 long long p4SkyCellMapDelete(7353 long long warpSkyCellMapDelete( 7354 7354 psDB *dbh, ///< Database handle 7355 7355 const psMetadata *where, ///< Row match criteria … … 7357 7357 ); 7358 7358 7359 /** Insert a single p4SkyCellMapRow object into a table7359 /** Insert a single warpSkyCellMapRow object into a table 7360 7360 * 7361 7361 * This function constructs and inserts a single row based on it's parameters. … … 7364 7364 */ 7365 7365 7366 bool p4SkyCellMapInsertObject(7367 psDB *dbh, ///< Database handle 7368 p4SkyCellMapRow *object ///< p4SkyCellMapRow object7369 ); 7370 7371 /** Insert an array of p4SkyCellMapRow object into a table7366 bool warpSkyCellMapInsertObject( 7367 psDB *dbh, ///< Database handle 7368 warpSkyCellMapRow *object ///< warpSkyCellMapRow object 7369 ); 7370 7371 /** Insert an array of warpSkyCellMapRow object into a table 7372 7372 * 7373 7373 * This function constructs and inserts multiple rows based on it's parameters. … … 7376 7376 */ 7377 7377 7378 bool p4SkyCellMapInsertObjects(7379 psDB *dbh, ///< Database handle 7380 psArray *objects ///< array of p4SkyCellMapRow objects7381 ); 7382 7383 /** Insert data from a binary FITS table p4SkyCellMapRow into the database7378 bool warpSkyCellMapInsertObjects( 7379 psDB *dbh, ///< Database handle 7380 psArray *objects ///< array of warpSkyCellMapRow objects 7381 ); 7382 7383 /** Insert data from a binary FITS table warpSkyCellMapRow into the database 7384 7384 * 7385 7385 * This function expects a psFits object with a FITS table as the first … … 7391 7391 */ 7392 7392 7393 bool p4SkyCellMapInsertFits(7393 bool warpSkyCellMapInsertFits( 7394 7394 psDB *dbh, ///< Database handle 7395 7395 const psFits *fits ///< psFits object … … 7406 7406 */ 7407 7407 7408 bool p4SkyCellMapSelectRowsFits(7408 bool warpSkyCellMapSelectRowsFits( 7409 7409 psDB *dbh, ///< Database handle 7410 7410 psFits *fits, ///< psFits object … … 7413 7413 ); 7414 7414 7415 /** Convert a p4SkyCellMapRow into an equivalent psMetadata7415 /** Convert a warpSkyCellMapRow into an equivalent psMetadata 7416 7416 * 7417 7417 * @return A psMetadata pointer or NULL on error 7418 7418 */ 7419 7419 7420 psMetadata * p4SkyCellMapMetadataFromObject(7421 const p4SkyCellMapRow *object ///< fooRow to convert into a psMetadata7420 psMetadata *warpSkyCellMapMetadataFromObject( 7421 const warpSkyCellMapRow *object ///< fooRow to convert into a psMetadata 7422 7422 ); 7423 7423 7424 7424 /** Convert a psMetadata into an equivalent fooRow 7425 7425 * 7426 * @return A p4SkyCellMapRow pointer or NULL on error7427 */ 7428 7429 p4SkyCellMapRow *p4SkyCellMapObjectFromMetadata(7426 * @return A warpSkyCellMapRow pointer or NULL on error 7427 */ 7428 7429 warpSkyCellMapRow *warpSkyCellMapObjectFromMetadata( 7430 7430 psMetadata *md ///< psMetadata to convert into a fooRow 7431 7431 ); 7432 /** Selects up to limit rows from the database and returns as p4SkyCellMapRow objects in a psArray7432 /** Selects up to limit rows from the database and returns as warpSkyCellMapRow objects in a psArray 7433 7433 * 7434 7434 * See psDBSelectRows() for documentation on the format of where. … … 7437 7437 */ 7438 7438 7439 psArray * p4SkyCellMapSelectRowObjects(7439 psArray *warpSkyCellMapSelectRowObjects( 7440 7440 psDB *dbh, ///< Database handle 7441 7441 const psMetadata *where, ///< Row match criteria 7442 7442 unsigned long long limit ///< Maximum number of elements to return 7443 7443 ); 7444 /** Deletes a row from the database coresponding to an p4SkyCellMap7444 /** Deletes a row from the database coresponding to an warpSkyCellMap 7445 7445 * 7446 7446 * Note that a 'where' search psMetadata is constructed from each object and … … 7450 7450 */ 7451 7451 7452 bool p4SkyCellMapDeleteObject(7453 psDB *dbh, ///< Database handle 7454 const p4SkyCellMapRow *object ///< Object to delete7452 bool warpSkyCellMapDeleteObject( 7453 psDB *dbh, ///< Database handle 7454 const warpSkyCellMapRow *object ///< Object to delete 7455 7455 ); 7456 7456 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 7462 7462 */ 7463 7463 7464 long long p4SkyCellMapDeleteRowObjects(7464 long long warpSkyCellMapDeleteRowObjects( 7465 7465 psDB *dbh, ///< Database handle 7466 7466 const psArray *objects, ///< Array of objects to delete 7467 7467 unsigned long long limit ///< Maximum number of elements to delete 7468 7468 ); 7469 /** Formats and prints an array of p4SkyCellMapRow objects7469 /** Formats and prints an array of warpSkyCellMapRow objects 7470 7470 * 7471 7471 * When mdcf is set the formated output is in psMetadataConfig … … 7475 7475 */ 7476 7476 7477 bool p4SkyCellMapPrintObjects(7477 bool warpSkyCellMapPrintObjects( 7478 7478 FILE *stream, ///< a stream 7479 psArray *objects, ///< An array of p4SkyCellMapRow objects7479 psArray *objects, ///< An array of warpSkyCellMapRow objects 7480 7480 bool mdcf ///< format as mdconfig or simple 7481 7481 ); 7482 /** Formats and prints an p4SkyCellMapRow object7482 /** Formats and prints an warpSkyCellMapRow object 7483 7483 * 7484 7484 * When mdcf is set the formated output is in psMetadataConfig … … 7488 7488 */ 7489 7489 7490 bool p4SkyCellMapPrintObject(7490 bool warpSkyCellMapPrintObject( 7491 7491 FILE *stream, ///< a stream 7492 p4SkyCellMapRow *object, ///< an p4SkyCellMapRow object7492 warpSkyCellMapRow *object, ///< an warpSkyCellMapRow object 7493 7493 bool mdcf ///< format as mdconfig or simple 7494 7494 ); 7495 /** p4SkyfileRow data structure7496 * 7497 * Structure for representing a single row of p4Skyfile table data.7495 /** warpSkyfileRow data structure 7496 * 7497 * Structure for representing a single row of warpSkyfile table data. 7498 7498 */ 7499 7499 7500 7500 typedef struct { 7501 psS32 p4_id;7501 psS32 warp_id; 7502 7502 char *skycell_id; 7503 7503 char *tess_id; … … 7505 7505 psF64 bg; 7506 7506 psF64 bg_mean_stdev; 7507 } p4SkyfileRow;7508 7509 /** Creates a new p4SkyfileRow object7510 * 7511 * @return A new p4SkyfileRow object or NULL on failure.7512 */ 7513 7514 p4SkyfileRow *p4SkyfileRowAlloc(7515 psS32 p4_id,7507 } warpSkyfileRow; 7508 7509 /** Creates a new warpSkyfileRow object 7510 * 7511 * @return A new warpSkyfileRow object or NULL on failure. 7512 */ 7513 7514 warpSkyfileRow *warpSkyfileRowAlloc( 7515 psS32 warp_id, 7516 7516 const char *skycell_id, 7517 7517 const char *tess_id, … … 7521 7521 ); 7522 7522 7523 /** Creates a new p4Skyfile table7524 * 7525 * @return true on success 7526 */ 7527 7528 bool p4SkyfileCreateTable(7523 /** Creates a new warpSkyfile table 7524 * 7525 * @return true on success 7526 */ 7527 7528 bool warpSkyfileCreateTable( 7529 7529 psDB *dbh ///< Database handle 7530 7530 ); 7531 7531 7532 /** Deletes a p4Skyfile table7533 * 7534 * @return true on success 7535 */ 7536 7537 bool p4SkyfileDropTable(7532 /** Deletes a warpSkyfile table 7533 * 7534 * @return true on success 7535 */ 7536 7537 bool warpSkyfileDropTable( 7538 7538 psDB *dbh ///< Database handle 7539 7539 ); … … 7546 7546 */ 7547 7547 7548 bool p4SkyfileInsert(7549 psDB *dbh, ///< Database handle 7550 psS32 p4_id,7548 bool warpSkyfileInsert( 7549 psDB *dbh, ///< Database handle 7550 psS32 warp_id, 7551 7551 const char *skycell_id, 7552 7552 const char *tess_id, … … 7561 7561 */ 7562 7562 7563 long long p4SkyfileDelete(7563 long long warpSkyfileDelete( 7564 7564 psDB *dbh, ///< Database handle 7565 7565 const psMetadata *where, ///< Row match criteria … … 7567 7567 ); 7568 7568 7569 /** Insert a single p4SkyfileRow object into a table7569 /** Insert a single warpSkyfileRow object into a table 7570 7570 * 7571 7571 * This function constructs and inserts a single row based on it's parameters. … … 7574 7574 */ 7575 7575 7576 bool p4SkyfileInsertObject(7577 psDB *dbh, ///< Database handle 7578 p4SkyfileRow *object ///< p4SkyfileRow object7579 ); 7580 7581 /** Insert an array of p4SkyfileRow object into a table7576 bool warpSkyfileInsertObject( 7577 psDB *dbh, ///< Database handle 7578 warpSkyfileRow *object ///< warpSkyfileRow object 7579 ); 7580 7581 /** Insert an array of warpSkyfileRow object into a table 7582 7582 * 7583 7583 * This function constructs and inserts multiple rows based on it's parameters. … … 7586 7586 */ 7587 7587 7588 bool p4SkyfileInsertObjects(7589 psDB *dbh, ///< Database handle 7590 psArray *objects ///< array of p4SkyfileRow objects7591 ); 7592 7593 /** Insert data from a binary FITS table p4SkyfileRow into the database7588 bool warpSkyfileInsertObjects( 7589 psDB *dbh, ///< Database handle 7590 psArray *objects ///< array of warpSkyfileRow objects 7591 ); 7592 7593 /** Insert data from a binary FITS table warpSkyfileRow into the database 7594 7594 * 7595 7595 * This function expects a psFits object with a FITS table as the first … … 7601 7601 */ 7602 7602 7603 bool p4SkyfileInsertFits(7603 bool warpSkyfileInsertFits( 7604 7604 psDB *dbh, ///< Database handle 7605 7605 const psFits *fits ///< psFits object … … 7616 7616 */ 7617 7617 7618 bool p4SkyfileSelectRowsFits(7618 bool warpSkyfileSelectRowsFits( 7619 7619 psDB *dbh, ///< Database handle 7620 7620 psFits *fits, ///< psFits object … … 7623 7623 ); 7624 7624 7625 /** Convert a p4SkyfileRow into an equivalent psMetadata7625 /** Convert a warpSkyfileRow into an equivalent psMetadata 7626 7626 * 7627 7627 * @return A psMetadata pointer or NULL on error 7628 7628 */ 7629 7629 7630 psMetadata * p4SkyfileMetadataFromObject(7631 const p4SkyfileRow *object ///< fooRow to convert into a psMetadata7630 psMetadata *warpSkyfileMetadataFromObject( 7631 const warpSkyfileRow *object ///< fooRow to convert into a psMetadata 7632 7632 ); 7633 7633 7634 7634 /** Convert a psMetadata into an equivalent fooRow 7635 7635 * 7636 * @return A p4SkyfileRow pointer or NULL on error7637 */ 7638 7639 p4SkyfileRow *p4SkyfileObjectFromMetadata(7636 * @return A warpSkyfileRow pointer or NULL on error 7637 */ 7638 7639 warpSkyfileRow *warpSkyfileObjectFromMetadata( 7640 7640 psMetadata *md ///< psMetadata to convert into a fooRow 7641 7641 ); 7642 /** Selects up to limit rows from the database and returns as p4SkyfileRow objects in a psArray7642 /** Selects up to limit rows from the database and returns as warpSkyfileRow objects in a psArray 7643 7643 * 7644 7644 * See psDBSelectRows() for documentation on the format of where. … … 7647 7647 */ 7648 7648 7649 psArray * p4SkyfileSelectRowObjects(7649 psArray *warpSkyfileSelectRowObjects( 7650 7650 psDB *dbh, ///< Database handle 7651 7651 const psMetadata *where, ///< Row match criteria 7652 7652 unsigned long long limit ///< Maximum number of elements to return 7653 7653 ); 7654 /** Deletes a row from the database coresponding to an p4Skyfile7654 /** Deletes a row from the database coresponding to an warpSkyfile 7655 7655 * 7656 7656 * Note that a 'where' search psMetadata is constructed from each object and … … 7660 7660 */ 7661 7661 7662 bool p4SkyfileDeleteObject(7663 psDB *dbh, ///< Database handle 7664 const p4SkyfileRow *object ///< Object to delete7662 bool warpSkyfileDeleteObject( 7663 psDB *dbh, ///< Database handle 7664 const warpSkyfileRow *object ///< Object to delete 7665 7665 ); 7666 7666 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 7672 7672 */ 7673 7673 7674 long long p4SkyfileDeleteRowObjects(7674 long long warpSkyfileDeleteRowObjects( 7675 7675 psDB *dbh, ///< Database handle 7676 7676 const psArray *objects, ///< Array of objects to delete 7677 7677 unsigned long long limit ///< Maximum number of elements to delete 7678 7678 ); 7679 /** Formats and prints an array of p4SkyfileRow objects7679 /** Formats and prints an array of warpSkyfileRow objects 7680 7680 * 7681 7681 * When mdcf is set the formated output is in psMetadataConfig … … 7685 7685 */ 7686 7686 7687 bool p4SkyfilePrintObjects(7687 bool warpSkyfilePrintObjects( 7688 7688 FILE *stream, ///< a stream 7689 psArray *objects, ///< An array of p4SkyfileRow objects7689 psArray *objects, ///< An array of warpSkyfileRow objects 7690 7690 bool mdcf ///< format as mdconfig or simple 7691 7691 ); 7692 /** Formats and prints an p4SkyfileRow object7692 /** Formats and prints an warpSkyfileRow object 7693 7693 * 7694 7694 * When mdcf is set the formated output is in psMetadataConfig … … 7698 7698 */ 7699 7699 7700 bool p4SkyfilePrintObject(7700 bool warpSkyfilePrintObject( 7701 7701 FILE *stream, ///< a stream 7702 p4SkyfileRow *object, ///< an p4SkyfileRow object7702 warpSkyfileRow *object, ///< an warpSkyfileRow object 7703 7703 bool mdcf ///< format as mdconfig or simple 7704 7704 ); 7705 /** p5RunRow data structure7706 * 7707 * Structure for representing a single row of p5Run table data.7705 /** diffRunRow data structure 7706 * 7707 * Structure for representing a single row of diffRun table data. 7708 7708 */ 7709 7709 7710 7710 typedef struct { 7711 psS32 p5_id;7711 psS32 diff_id; 7712 7712 char *state; 7713 7713 char *workdir; … … 7716 7716 char *skycell_id; 7717 7717 char *tess_id; 7718 } p5RunRow;7719 7720 /** Creates a new p5RunRow object7721 * 7722 * @return A new p5RunRow object or NULL on failure.7723 */ 7724 7725 p5RunRow *p5RunRowAlloc(7726 psS32 p5_id,7718 } diffRunRow; 7719 7720 /** Creates a new diffRunRow object 7721 * 7722 * @return A new diffRunRow object or NULL on failure. 7723 */ 7724 7725 diffRunRow *diffRunRowAlloc( 7726 psS32 diff_id, 7727 7727 const char *state, 7728 7728 const char *workdir, … … 7733 7733 ); 7734 7734 7735 /** Creates a new p5Run table7736 * 7737 * @return true on success 7738 */ 7739 7740 bool p5RunCreateTable(7735 /** Creates a new diffRun table 7736 * 7737 * @return true on success 7738 */ 7739 7740 bool diffRunCreateTable( 7741 7741 psDB *dbh ///< Database handle 7742 7742 ); 7743 7743 7744 /** Deletes a p5Run table7745 * 7746 * @return true on success 7747 */ 7748 7749 bool p5RunDropTable(7744 /** Deletes a diffRun table 7745 * 7746 * @return true on success 7747 */ 7748 7749 bool diffRunDropTable( 7750 7750 psDB *dbh ///< Database handle 7751 7751 ); … … 7758 7758 */ 7759 7759 7760 bool p5RunInsert(7761 psDB *dbh, ///< Database handle 7762 psS32 p5_id,7760 bool diffRunInsert( 7761 psDB *dbh, ///< Database handle 7762 psS32 diff_id, 7763 7763 const char *state, 7764 7764 const char *workdir, … … 7774 7774 */ 7775 7775 7776 long long p5RunDelete(7776 long long diffRunDelete( 7777 7777 psDB *dbh, ///< Database handle 7778 7778 const psMetadata *where, ///< Row match criteria … … 7780 7780 ); 7781 7781 7782 /** Insert a single p5RunRow object into a table7782 /** Insert a single diffRunRow object into a table 7783 7783 * 7784 7784 * This function constructs and inserts a single row based on it's parameters. … … 7787 7787 */ 7788 7788 7789 bool p5RunInsertObject(7790 psDB *dbh, ///< Database handle 7791 p5RunRow *object ///< p5RunRow object7792 ); 7793 7794 /** Insert an array of p5RunRow object into a table7789 bool diffRunInsertObject( 7790 psDB *dbh, ///< Database handle 7791 diffRunRow *object ///< diffRunRow object 7792 ); 7793 7794 /** Insert an array of diffRunRow object into a table 7795 7795 * 7796 7796 * This function constructs and inserts multiple rows based on it's parameters. … … 7799 7799 */ 7800 7800 7801 bool p5RunInsertObjects(7802 psDB *dbh, ///< Database handle 7803 psArray *objects ///< array of p5RunRow objects7804 ); 7805 7806 /** Insert data from a binary FITS table p5RunRow into the database7801 bool diffRunInsertObjects( 7802 psDB *dbh, ///< Database handle 7803 psArray *objects ///< array of diffRunRow objects 7804 ); 7805 7806 /** Insert data from a binary FITS table diffRunRow into the database 7807 7807 * 7808 7808 * This function expects a psFits object with a FITS table as the first … … 7814 7814 */ 7815 7815 7816 bool p5RunInsertFits(7816 bool diffRunInsertFits( 7817 7817 psDB *dbh, ///< Database handle 7818 7818 const psFits *fits ///< psFits object … … 7829 7829 */ 7830 7830 7831 bool p5RunSelectRowsFits(7831 bool diffRunSelectRowsFits( 7832 7832 psDB *dbh, ///< Database handle 7833 7833 psFits *fits, ///< psFits object … … 7836 7836 ); 7837 7837 7838 /** Convert a p5RunRow into an equivalent psMetadata7838 /** Convert a diffRunRow into an equivalent psMetadata 7839 7839 * 7840 7840 * @return A psMetadata pointer or NULL on error 7841 7841 */ 7842 7842 7843 psMetadata * p5RunMetadataFromObject(7844 const p5RunRow*object ///< fooRow to convert into a psMetadata7843 psMetadata *diffRunMetadataFromObject( 7844 const diffRunRow *object ///< fooRow to convert into a psMetadata 7845 7845 ); 7846 7846 7847 7847 /** Convert a psMetadata into an equivalent fooRow 7848 7848 * 7849 * @return A p5RunRow pointer or NULL on error7850 */ 7851 7852 p5RunRow *p5RunObjectFromMetadata(7849 * @return A diffRunRow pointer or NULL on error 7850 */ 7851 7852 diffRunRow *diffRunObjectFromMetadata( 7853 7853 psMetadata *md ///< psMetadata to convert into a fooRow 7854 7854 ); 7855 /** Selects up to limit rows from the database and returns as p5RunRow objects in a psArray7855 /** Selects up to limit rows from the database and returns as diffRunRow objects in a psArray 7856 7856 * 7857 7857 * See psDBSelectRows() for documentation on the format of where. … … 7860 7860 */ 7861 7861 7862 psArray * p5RunSelectRowObjects(7862 psArray *diffRunSelectRowObjects( 7863 7863 psDB *dbh, ///< Database handle 7864 7864 const psMetadata *where, ///< Row match criteria 7865 7865 unsigned long long limit ///< Maximum number of elements to return 7866 7866 ); 7867 /** Deletes a row from the database coresponding to an p5Run7867 /** Deletes a row from the database coresponding to an diffRun 7868 7868 * 7869 7869 * Note that a 'where' search psMetadata is constructed from each object and … … 7873 7873 */ 7874 7874 7875 bool p5RunDeleteObject(7876 psDB *dbh, ///< Database handle 7877 const p5RunRow *object ///< Object to delete7875 bool diffRunDeleteObject( 7876 psDB *dbh, ///< Database handle 7877 const diffRunRow *object ///< Object to delete 7878 7878 ); 7879 7879 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 7885 7885 */ 7886 7886 7887 long long p5RunDeleteRowObjects(7887 long long diffRunDeleteRowObjects( 7888 7888 psDB *dbh, ///< Database handle 7889 7889 const psArray *objects, ///< Array of objects to delete 7890 7890 unsigned long long limit ///< Maximum number of elements to delete 7891 7891 ); 7892 /** Formats and prints an array of p5RunRow objects7892 /** Formats and prints an array of diffRunRow objects 7893 7893 * 7894 7894 * When mdcf is set the formated output is in psMetadataConfig … … 7898 7898 */ 7899 7899 7900 bool p5RunPrintObjects(7900 bool diffRunPrintObjects( 7901 7901 FILE *stream, ///< a stream 7902 psArray *objects, ///< An array of p5RunRow objects7902 psArray *objects, ///< An array of diffRunRow objects 7903 7903 bool mdcf ///< format as mdconfig or simple 7904 7904 ); 7905 /** Formats and prints an p5RunRow object7905 /** Formats and prints an diffRunRow object 7906 7906 * 7907 7907 * When mdcf is set the formated output is in psMetadataConfig … … 7911 7911 */ 7912 7912 7913 bool p5RunPrintObject(7913 bool diffRunPrintObject( 7914 7914 FILE *stream, ///< a stream 7915 p5RunRow *object, ///< an p5RunRow object7915 diffRunRow *object, ///< an diffRunRow object 7916 7916 bool mdcf ///< format as mdconfig or simple 7917 7917 ); 7918 /** p5InputSkyfileRow data structure7919 * 7920 * Structure for representing a single row of p5InputSkyfile table data.7918 /** diffInputSkyfileRow data structure 7919 * 7920 * Structure for representing a single row of diffInputSkyfile table data. 7921 7921 */ 7922 7922 7923 7923 typedef struct { 7924 psS32 p5_id;7925 psS32 p4_id;7924 psS32 diff_id; 7925 psS32 warp_id; 7926 7926 char *skycell_id; 7927 7927 char *tess_id; 7928 7928 char *kind; 7929 7929 bool template; 7930 } p5InputSkyfileRow;7931 7932 /** Creates a new p5InputSkyfileRow object7933 * 7934 * @return A new p5InputSkyfileRow object or NULL on failure.7935 */ 7936 7937 p5InputSkyfileRow *p5InputSkyfileRowAlloc(7938 psS32 p5_id,7939 psS32 p4_id,7930 } diffInputSkyfileRow; 7931 7932 /** Creates a new diffInputSkyfileRow object 7933 * 7934 * @return A new diffInputSkyfileRow object or NULL on failure. 7935 */ 7936 7937 diffInputSkyfileRow *diffInputSkyfileRowAlloc( 7938 psS32 diff_id, 7939 psS32 warp_id, 7940 7940 const char *skycell_id, 7941 7941 const char *tess_id, … … 7944 7944 ); 7945 7945 7946 /** Creates a new p5InputSkyfile table7947 * 7948 * @return true on success 7949 */ 7950 7951 bool p5InputSkyfileCreateTable(7946 /** Creates a new diffInputSkyfile table 7947 * 7948 * @return true on success 7949 */ 7950 7951 bool diffInputSkyfileCreateTable( 7952 7952 psDB *dbh ///< Database handle 7953 7953 ); 7954 7954 7955 /** Deletes a p5InputSkyfile table7956 * 7957 * @return true on success 7958 */ 7959 7960 bool p5InputSkyfileDropTable(7955 /** Deletes a diffInputSkyfile table 7956 * 7957 * @return true on success 7958 */ 7959 7960 bool diffInputSkyfileDropTable( 7961 7961 psDB *dbh ///< Database handle 7962 7962 ); … … 7969 7969 */ 7970 7970 7971 bool p5InputSkyfileInsert(7972 psDB *dbh, ///< Database handle 7973 psS32 p5_id,7974 psS32 p4_id,7971 bool diffInputSkyfileInsert( 7972 psDB *dbh, ///< Database handle 7973 psS32 diff_id, 7974 psS32 warp_id, 7975 7975 const char *skycell_id, 7976 7976 const char *tess_id, … … 7984 7984 */ 7985 7985 7986 long long p5InputSkyfileDelete(7986 long long diffInputSkyfileDelete( 7987 7987 psDB *dbh, ///< Database handle 7988 7988 const psMetadata *where, ///< Row match criteria … … 7990 7990 ); 7991 7991 7992 /** Insert a single p5InputSkyfileRow object into a table7992 /** Insert a single diffInputSkyfileRow object into a table 7993 7993 * 7994 7994 * This function constructs and inserts a single row based on it's parameters. … … 7997 7997 */ 7998 7998 7999 bool p5InputSkyfileInsertObject(8000 psDB *dbh, ///< Database handle 8001 p5InputSkyfileRow *object ///< p5InputSkyfileRow object8002 ); 8003 8004 /** Insert an array of p5InputSkyfileRow object into a table7999 bool diffInputSkyfileInsertObject( 8000 psDB *dbh, ///< Database handle 8001 diffInputSkyfileRow *object ///< diffInputSkyfileRow object 8002 ); 8003 8004 /** Insert an array of diffInputSkyfileRow object into a table 8005 8005 * 8006 8006 * This function constructs and inserts multiple rows based on it's parameters. … … 8009 8009 */ 8010 8010 8011 bool p5InputSkyfileInsertObjects(8012 psDB *dbh, ///< Database handle 8013 psArray *objects ///< array of p5InputSkyfileRow objects8014 ); 8015 8016 /** Insert data from a binary FITS table p5InputSkyfileRow into the database8011 bool diffInputSkyfileInsertObjects( 8012 psDB *dbh, ///< Database handle 8013 psArray *objects ///< array of diffInputSkyfileRow objects 8014 ); 8015 8016 /** Insert data from a binary FITS table diffInputSkyfileRow into the database 8017 8017 * 8018 8018 * This function expects a psFits object with a FITS table as the first … … 8024 8024 */ 8025 8025 8026 bool p5InputSkyfileInsertFits(8026 bool diffInputSkyfileInsertFits( 8027 8027 psDB *dbh, ///< Database handle 8028 8028 const psFits *fits ///< psFits object … … 8039 8039 */ 8040 8040 8041 bool p5InputSkyfileSelectRowsFits(8041 bool diffInputSkyfileSelectRowsFits( 8042 8042 psDB *dbh, ///< Database handle 8043 8043 psFits *fits, ///< psFits object … … 8046 8046 ); 8047 8047 8048 /** Convert a p5InputSkyfileRow into an equivalent psMetadata8048 /** Convert a diffInputSkyfileRow into an equivalent psMetadata 8049 8049 * 8050 8050 * @return A psMetadata pointer or NULL on error 8051 8051 */ 8052 8052 8053 psMetadata * p5InputSkyfileMetadataFromObject(8054 const p5InputSkyfileRow *object ///< fooRow to convert into a psMetadata8053 psMetadata *diffInputSkyfileMetadataFromObject( 8054 const diffInputSkyfileRow *object ///< fooRow to convert into a psMetadata 8055 8055 ); 8056 8056 8057 8057 /** Convert a psMetadata into an equivalent fooRow 8058 8058 * 8059 * @return A p5InputSkyfileRow pointer or NULL on error8060 */ 8061 8062 p5InputSkyfileRow *p5InputSkyfileObjectFromMetadata(8059 * @return A diffInputSkyfileRow pointer or NULL on error 8060 */ 8061 8062 diffInputSkyfileRow *diffInputSkyfileObjectFromMetadata( 8063 8063 psMetadata *md ///< psMetadata to convert into a fooRow 8064 8064 ); 8065 /** Selects up to limit rows from the database and returns as p5InputSkyfileRow objects in a psArray8065 /** Selects up to limit rows from the database and returns as diffInputSkyfileRow objects in a psArray 8066 8066 * 8067 8067 * See psDBSelectRows() for documentation on the format of where. … … 8070 8070 */ 8071 8071 8072 psArray * p5InputSkyfileSelectRowObjects(8072 psArray *diffInputSkyfileSelectRowObjects( 8073 8073 psDB *dbh, ///< Database handle 8074 8074 const psMetadata *where, ///< Row match criteria 8075 8075 unsigned long long limit ///< Maximum number of elements to return 8076 8076 ); 8077 /** Deletes a row from the database coresponding to an p5InputSkyfile8077 /** Deletes a row from the database coresponding to an diffInputSkyfile 8078 8078 * 8079 8079 * Note that a 'where' search psMetadata is constructed from each object and … … 8083 8083 */ 8084 8084 8085 bool p5InputSkyfileDeleteObject(8086 psDB *dbh, ///< Database handle 8087 const p5InputSkyfileRow *object ///< Object to delete8085 bool diffInputSkyfileDeleteObject( 8086 psDB *dbh, ///< Database handle 8087 const diffInputSkyfileRow *object ///< Object to delete 8088 8088 ); 8089 8089 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8095 8095 */ 8096 8096 8097 long long p5InputSkyfileDeleteRowObjects(8097 long long diffInputSkyfileDeleteRowObjects( 8098 8098 psDB *dbh, ///< Database handle 8099 8099 const psArray *objects, ///< Array of objects to delete 8100 8100 unsigned long long limit ///< Maximum number of elements to delete 8101 8101 ); 8102 /** Formats and prints an array of p5InputSkyfileRow objects8102 /** Formats and prints an array of diffInputSkyfileRow objects 8103 8103 * 8104 8104 * When mdcf is set the formated output is in psMetadataConfig … … 8108 8108 */ 8109 8109 8110 bool p5InputSkyfilePrintObjects(8110 bool diffInputSkyfilePrintObjects( 8111 8111 FILE *stream, ///< a stream 8112 psArray *objects, ///< An array of p5InputSkyfileRow objects8112 psArray *objects, ///< An array of diffInputSkyfileRow objects 8113 8113 bool mdcf ///< format as mdconfig or simple 8114 8114 ); 8115 /** Formats and prints an p5InputSkyfileRow object8115 /** Formats and prints an diffInputSkyfileRow object 8116 8116 * 8117 8117 * When mdcf is set the formated output is in psMetadataConfig … … 8121 8121 */ 8122 8122 8123 bool p5InputSkyfilePrintObject(8123 bool diffInputSkyfilePrintObject( 8124 8124 FILE *stream, ///< a stream 8125 p5InputSkyfileRow *object, ///< an p5InputSkyfileRow object8125 diffInputSkyfileRow *object, ///< an diffInputSkyfileRow object 8126 8126 bool mdcf ///< format as mdconfig or simple 8127 8127 ); 8128 /** p5DiffSkyfileRow data structure8129 * 8130 * Structure for representing a single row of p5DiffSkyfile table data.8128 /** diffSkyfileRow data structure 8129 * 8130 * Structure for representing a single row of diffSkyfile table data. 8131 8131 */ 8132 8132 8133 8133 typedef struct { 8134 psS32 p5_id;8134 psS32 diff_id; 8135 8135 char *uri; 8136 8136 psF64 bg; 8137 8137 psF64 bg_mean_stdev; 8138 } p5DiffSkyfileRow;8139 8140 /** Creates a new p5DiffSkyfileRow object8141 * 8142 * @return A new p5DiffSkyfileRow object or NULL on failure.8143 */ 8144 8145 p5DiffSkyfileRow *p5DiffSkyfileRowAlloc(8146 psS32 p5_id,8138 } diffSkyfileRow; 8139 8140 /** Creates a new diffSkyfileRow object 8141 * 8142 * @return A new diffSkyfileRow object or NULL on failure. 8143 */ 8144 8145 diffSkyfileRow *diffSkyfileRowAlloc( 8146 psS32 diff_id, 8147 8147 const char *uri, 8148 8148 psF64 bg, … … 8150 8150 ); 8151 8151 8152 /** Creates a new p5DiffSkyfile table8153 * 8154 * @return true on success 8155 */ 8156 8157 bool p5DiffSkyfileCreateTable(8152 /** Creates a new diffSkyfile table 8153 * 8154 * @return true on success 8155 */ 8156 8157 bool diffSkyfileCreateTable( 8158 8158 psDB *dbh ///< Database handle 8159 8159 ); 8160 8160 8161 /** Deletes a p5DiffSkyfile table8162 * 8163 * @return true on success 8164 */ 8165 8166 bool p5DiffSkyfileDropTable(8161 /** Deletes a diffSkyfile table 8162 * 8163 * @return true on success 8164 */ 8165 8166 bool diffSkyfileDropTable( 8167 8167 psDB *dbh ///< Database handle 8168 8168 ); … … 8175 8175 */ 8176 8176 8177 bool p5DiffSkyfileInsert(8178 psDB *dbh, ///< Database handle 8179 psS32 p5_id,8177 bool diffSkyfileInsert( 8178 psDB *dbh, ///< Database handle 8179 psS32 diff_id, 8180 8180 const char *uri, 8181 8181 psF64 bg, … … 8188 8188 */ 8189 8189 8190 long long p5DiffSkyfileDelete(8190 long long diffSkyfileDelete( 8191 8191 psDB *dbh, ///< Database handle 8192 8192 const psMetadata *where, ///< Row match criteria … … 8194 8194 ); 8195 8195 8196 /** Insert a single p5DiffSkyfileRow object into a table8196 /** Insert a single diffSkyfileRow object into a table 8197 8197 * 8198 8198 * This function constructs and inserts a single row based on it's parameters. … … 8201 8201 */ 8202 8202 8203 bool p5DiffSkyfileInsertObject(8204 psDB *dbh, ///< Database handle 8205 p5DiffSkyfileRow *object ///< p5DiffSkyfileRow object8206 ); 8207 8208 /** Insert an array of p5DiffSkyfileRow object into a table8203 bool diffSkyfileInsertObject( 8204 psDB *dbh, ///< Database handle 8205 diffSkyfileRow *object ///< diffSkyfileRow object 8206 ); 8207 8208 /** Insert an array of diffSkyfileRow object into a table 8209 8209 * 8210 8210 * This function constructs and inserts multiple rows based on it's parameters. … … 8213 8213 */ 8214 8214 8215 bool p5DiffSkyfileInsertObjects(8216 psDB *dbh, ///< Database handle 8217 psArray *objects ///< array of p5DiffSkyfileRow objects8218 ); 8219 8220 /** Insert data from a binary FITS table p5DiffSkyfileRow into the database8215 bool diffSkyfileInsertObjects( 8216 psDB *dbh, ///< Database handle 8217 psArray *objects ///< array of diffSkyfileRow objects 8218 ); 8219 8220 /** Insert data from a binary FITS table diffSkyfileRow into the database 8221 8221 * 8222 8222 * This function expects a psFits object with a FITS table as the first … … 8228 8228 */ 8229 8229 8230 bool p5DiffSkyfileInsertFits(8230 bool diffSkyfileInsertFits( 8231 8231 psDB *dbh, ///< Database handle 8232 8232 const psFits *fits ///< psFits object … … 8243 8243 */ 8244 8244 8245 bool p5DiffSkyfileSelectRowsFits(8245 bool diffSkyfileSelectRowsFits( 8246 8246 psDB *dbh, ///< Database handle 8247 8247 psFits *fits, ///< psFits object … … 8250 8250 ); 8251 8251 8252 /** Convert a p5DiffSkyfileRow into an equivalent psMetadata8252 /** Convert a diffSkyfileRow into an equivalent psMetadata 8253 8253 * 8254 8254 * @return A psMetadata pointer or NULL on error 8255 8255 */ 8256 8256 8257 psMetadata * p5DiffSkyfileMetadataFromObject(8258 const p5DiffSkyfileRow *object ///< fooRow to convert into a psMetadata8257 psMetadata *diffSkyfileMetadataFromObject( 8258 const diffSkyfileRow *object ///< fooRow to convert into a psMetadata 8259 8259 ); 8260 8260 8261 8261 /** Convert a psMetadata into an equivalent fooRow 8262 8262 * 8263 * @return A p5DiffSkyfileRow pointer or NULL on error8264 */ 8265 8266 p5DiffSkyfileRow *p5DiffSkyfileObjectFromMetadata(8263 * @return A diffSkyfileRow pointer or NULL on error 8264 */ 8265 8266 diffSkyfileRow *diffSkyfileObjectFromMetadata( 8267 8267 psMetadata *md ///< psMetadata to convert into a fooRow 8268 8268 ); 8269 /** Selects up to limit rows from the database and returns as p5DiffSkyfileRow objects in a psArray8269 /** Selects up to limit rows from the database and returns as diffSkyfileRow objects in a psArray 8270 8270 * 8271 8271 * See psDBSelectRows() for documentation on the format of where. … … 8274 8274 */ 8275 8275 8276 psArray * p5DiffSkyfileSelectRowObjects(8276 psArray *diffSkyfileSelectRowObjects( 8277 8277 psDB *dbh, ///< Database handle 8278 8278 const psMetadata *where, ///< Row match criteria 8279 8279 unsigned long long limit ///< Maximum number of elements to return 8280 8280 ); 8281 /** Deletes a row from the database coresponding to an p5DiffSkyfile8281 /** Deletes a row from the database coresponding to an diffSkyfile 8282 8282 * 8283 8283 * Note that a 'where' search psMetadata is constructed from each object and … … 8287 8287 */ 8288 8288 8289 bool p5DiffSkyfileDeleteObject(8290 psDB *dbh, ///< Database handle 8291 const p5DiffSkyfileRow *object ///< Object to delete8289 bool diffSkyfileDeleteObject( 8290 psDB *dbh, ///< Database handle 8291 const diffSkyfileRow *object ///< Object to delete 8292 8292 ); 8293 8293 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8299 8299 */ 8300 8300 8301 long long p5DiffSkyfileDeleteRowObjects(8301 long long diffSkyfileDeleteRowObjects( 8302 8302 psDB *dbh, ///< Database handle 8303 8303 const psArray *objects, ///< Array of objects to delete 8304 8304 unsigned long long limit ///< Maximum number of elements to delete 8305 8305 ); 8306 /** Formats and prints an array of p5DiffSkyfileRow objects8306 /** Formats and prints an array of diffSkyfileRow objects 8307 8307 * 8308 8308 * When mdcf is set the formated output is in psMetadataConfig … … 8312 8312 */ 8313 8313 8314 bool p5DiffSkyfilePrintObjects(8314 bool diffSkyfilePrintObjects( 8315 8315 FILE *stream, ///< a stream 8316 psArray *objects, ///< An array of p5DiffSkyfileRow objects8316 psArray *objects, ///< An array of diffSkyfileRow objects 8317 8317 bool mdcf ///< format as mdconfig or simple 8318 8318 ); 8319 /** Formats and prints an p5DiffSkyfileRow object8319 /** Formats and prints an diffSkyfileRow object 8320 8320 * 8321 8321 * When mdcf is set the formated output is in psMetadataConfig … … 8325 8325 */ 8326 8326 8327 bool p5DiffSkyfilePrintObject(8327 bool diffSkyfilePrintObject( 8328 8328 FILE *stream, ///< a stream 8329 p5DiffSkyfileRow *object, ///< an p5DiffSkyfileRow object8329 diffSkyfileRow *object, ///< an diffSkyfileRow object 8330 8330 bool mdcf ///< format as mdconfig or simple 8331 8331 ); 8332 /** p6RunRow data structure8333 * 8334 * Structure for representing a single row of p6Run table data.8332 /** stackRunRow data structure 8333 * 8334 * Structure for representing a single row of stackRun table data. 8335 8335 */ 8336 8336 8337 8337 typedef struct { 8338 psS32 p6_id;8338 psS32 stack_id; 8339 8339 char *state; 8340 8340 char *workdir; … … 8343 8343 char *skycell_id; 8344 8344 char *tess_id; 8345 } p6RunRow;8346 8347 /** Creates a new p6RunRow object8348 * 8349 * @return A new p6RunRow object or NULL on failure.8350 */ 8351 8352 p6RunRow *p6RunRowAlloc(8353 psS32 p6_id,8345 } stackRunRow; 8346 8347 /** Creates a new stackRunRow object 8348 * 8349 * @return A new stackRunRow object or NULL on failure. 8350 */ 8351 8352 stackRunRow *stackRunRowAlloc( 8353 psS32 stack_id, 8354 8354 const char *state, 8355 8355 const char *workdir, … … 8360 8360 ); 8361 8361 8362 /** Creates a new p6Run table8363 * 8364 * @return true on success 8365 */ 8366 8367 bool p6RunCreateTable(8362 /** Creates a new stackRun table 8363 * 8364 * @return true on success 8365 */ 8366 8367 bool stackRunCreateTable( 8368 8368 psDB *dbh ///< Database handle 8369 8369 ); 8370 8370 8371 /** Deletes a p6Run table8372 * 8373 * @return true on success 8374 */ 8375 8376 bool p6RunDropTable(8371 /** Deletes a stackRun table 8372 * 8373 * @return true on success 8374 */ 8375 8376 bool stackRunDropTable( 8377 8377 psDB *dbh ///< Database handle 8378 8378 ); … … 8385 8385 */ 8386 8386 8387 bool p6RunInsert(8388 psDB *dbh, ///< Database handle 8389 psS32 p6_id,8387 bool stackRunInsert( 8388 psDB *dbh, ///< Database handle 8389 psS32 stack_id, 8390 8390 const char *state, 8391 8391 const char *workdir, … … 8401 8401 */ 8402 8402 8403 long long p6RunDelete(8403 long long stackRunDelete( 8404 8404 psDB *dbh, ///< Database handle 8405 8405 const psMetadata *where, ///< Row match criteria … … 8407 8407 ); 8408 8408 8409 /** Insert a single p6RunRow object into a table8409 /** Insert a single stackRunRow object into a table 8410 8410 * 8411 8411 * This function constructs and inserts a single row based on it's parameters. … … 8414 8414 */ 8415 8415 8416 bool p6RunInsertObject(8417 psDB *dbh, ///< Database handle 8418 p6RunRow *object ///< p6RunRow object8419 ); 8420 8421 /** Insert an array of p6RunRow object into a table8416 bool stackRunInsertObject( 8417 psDB *dbh, ///< Database handle 8418 stackRunRow *object ///< stackRunRow object 8419 ); 8420 8421 /** Insert an array of stackRunRow object into a table 8422 8422 * 8423 8423 * This function constructs and inserts multiple rows based on it's parameters. … … 8426 8426 */ 8427 8427 8428 bool p6RunInsertObjects(8429 psDB *dbh, ///< Database handle 8430 psArray *objects ///< array of p6RunRow objects8431 ); 8432 8433 /** Insert data from a binary FITS table p6RunRow into the database8428 bool stackRunInsertObjects( 8429 psDB *dbh, ///< Database handle 8430 psArray *objects ///< array of stackRunRow objects 8431 ); 8432 8433 /** Insert data from a binary FITS table stackRunRow into the database 8434 8434 * 8435 8435 * This function expects a psFits object with a FITS table as the first … … 8441 8441 */ 8442 8442 8443 bool p6RunInsertFits(8443 bool stackRunInsertFits( 8444 8444 psDB *dbh, ///< Database handle 8445 8445 const psFits *fits ///< psFits object … … 8456 8456 */ 8457 8457 8458 bool p6RunSelectRowsFits(8458 bool stackRunSelectRowsFits( 8459 8459 psDB *dbh, ///< Database handle 8460 8460 psFits *fits, ///< psFits object … … 8463 8463 ); 8464 8464 8465 /** Convert a p6RunRow into an equivalent psMetadata8465 /** Convert a stackRunRow into an equivalent psMetadata 8466 8466 * 8467 8467 * @return A psMetadata pointer or NULL on error 8468 8468 */ 8469 8469 8470 psMetadata * p6RunMetadataFromObject(8471 const p6RunRow*object ///< fooRow to convert into a psMetadata8470 psMetadata *stackRunMetadataFromObject( 8471 const stackRunRow *object ///< fooRow to convert into a psMetadata 8472 8472 ); 8473 8473 8474 8474 /** Convert a psMetadata into an equivalent fooRow 8475 8475 * 8476 * @return A p6RunRow pointer or NULL on error8477 */ 8478 8479 p6RunRow *p6RunObjectFromMetadata(8476 * @return A stackRunRow pointer or NULL on error 8477 */ 8478 8479 stackRunRow *stackRunObjectFromMetadata( 8480 8480 psMetadata *md ///< psMetadata to convert into a fooRow 8481 8481 ); 8482 /** Selects up to limit rows from the database and returns as p6RunRow objects in a psArray8482 /** Selects up to limit rows from the database and returns as stackRunRow objects in a psArray 8483 8483 * 8484 8484 * See psDBSelectRows() for documentation on the format of where. … … 8487 8487 */ 8488 8488 8489 psArray * p6RunSelectRowObjects(8489 psArray *stackRunSelectRowObjects( 8490 8490 psDB *dbh, ///< Database handle 8491 8491 const psMetadata *where, ///< Row match criteria 8492 8492 unsigned long long limit ///< Maximum number of elements to return 8493 8493 ); 8494 /** Deletes a row from the database coresponding to an p6Run8494 /** Deletes a row from the database coresponding to an stackRun 8495 8495 * 8496 8496 * Note that a 'where' search psMetadata is constructed from each object and … … 8500 8500 */ 8501 8501 8502 bool p6RunDeleteObject(8503 psDB *dbh, ///< Database handle 8504 const p6RunRow *object ///< Object to delete8502 bool stackRunDeleteObject( 8503 psDB *dbh, ///< Database handle 8504 const stackRunRow *object ///< Object to delete 8505 8505 ); 8506 8506 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8512 8512 */ 8513 8513 8514 long long p6RunDeleteRowObjects(8514 long long stackRunDeleteRowObjects( 8515 8515 psDB *dbh, ///< Database handle 8516 8516 const psArray *objects, ///< Array of objects to delete 8517 8517 unsigned long long limit ///< Maximum number of elements to delete 8518 8518 ); 8519 /** Formats and prints an array of p6RunRow objects8519 /** Formats and prints an array of stackRunRow objects 8520 8520 * 8521 8521 * When mdcf is set the formated output is in psMetadataConfig … … 8525 8525 */ 8526 8526 8527 bool p6RunPrintObjects(8527 bool stackRunPrintObjects( 8528 8528 FILE *stream, ///< a stream 8529 psArray *objects, ///< An array of p6RunRow objects8529 psArray *objects, ///< An array of stackRunRow objects 8530 8530 bool mdcf ///< format as mdconfig or simple 8531 8531 ); 8532 /** Formats and prints an p6RunRow object8532 /** Formats and prints an stackRunRow object 8533 8533 * 8534 8534 * When mdcf is set the formated output is in psMetadataConfig … … 8538 8538 */ 8539 8539 8540 bool p6RunPrintObject(8540 bool stackRunPrintObject( 8541 8541 FILE *stream, ///< a stream 8542 p6RunRow *object, ///< an p6RunRow object8542 stackRunRow *object, ///< an stackRunRow object 8543 8543 bool mdcf ///< format as mdconfig or simple 8544 8544 ); 8545 /** p6InputSkyfileRow data structure8546 * 8547 * Structure for representing a single row of p6InputSkyfile table data.8545 /** stackInputSkyfileRow data structure 8546 * 8547 * Structure for representing a single row of stackInputSkyfile table data. 8548 8548 */ 8549 8549 8550 8550 typedef struct { 8551 psS32 p6_id;8552 psS32 p4_id;8553 } p6InputSkyfileRow;8554 8555 /** Creates a new p6InputSkyfileRow object8556 * 8557 * @return A new p6InputSkyfileRow object or NULL on failure.8558 */ 8559 8560 p6InputSkyfileRow *p6InputSkyfileRowAlloc(8561 psS32 p6_id,8562 psS32 p4_id8563 ); 8564 8565 /** Creates a new p6InputSkyfile table8566 * 8567 * @return true on success 8568 */ 8569 8570 bool p6InputSkyfileCreateTable(8551 psS32 stack_id; 8552 psS32 warp_id; 8553 } stackInputSkyfileRow; 8554 8555 /** Creates a new stackInputSkyfileRow object 8556 * 8557 * @return A new stackInputSkyfileRow object or NULL on failure. 8558 */ 8559 8560 stackInputSkyfileRow *stackInputSkyfileRowAlloc( 8561 psS32 stack_id, 8562 psS32 warp_id 8563 ); 8564 8565 /** Creates a new stackInputSkyfile table 8566 * 8567 * @return true on success 8568 */ 8569 8570 bool stackInputSkyfileCreateTable( 8571 8571 psDB *dbh ///< Database handle 8572 8572 ); 8573 8573 8574 /** Deletes a p6InputSkyfile table8575 * 8576 * @return true on success 8577 */ 8578 8579 bool p6InputSkyfileDropTable(8574 /** Deletes a stackInputSkyfile table 8575 * 8576 * @return true on success 8577 */ 8578 8579 bool stackInputSkyfileDropTable( 8580 8580 psDB *dbh ///< Database handle 8581 8581 ); … … 8588 8588 */ 8589 8589 8590 bool p6InputSkyfileInsert(8591 psDB *dbh, ///< Database handle 8592 psS32 p6_id,8593 psS32 p4_id8590 bool stackInputSkyfileInsert( 8591 psDB *dbh, ///< Database handle 8592 psS32 stack_id, 8593 psS32 warp_id 8594 8594 ); 8595 8595 … … 8599 8599 */ 8600 8600 8601 long long p6InputSkyfileDelete(8601 long long stackInputSkyfileDelete( 8602 8602 psDB *dbh, ///< Database handle 8603 8603 const psMetadata *where, ///< Row match criteria … … 8605 8605 ); 8606 8606 8607 /** Insert a single p6InputSkyfileRow object into a table8607 /** Insert a single stackInputSkyfileRow object into a table 8608 8608 * 8609 8609 * This function constructs and inserts a single row based on it's parameters. … … 8612 8612 */ 8613 8613 8614 bool p6InputSkyfileInsertObject(8615 psDB *dbh, ///< Database handle 8616 p6InputSkyfileRow *object ///< p6InputSkyfileRow object8617 ); 8618 8619 /** Insert an array of p6InputSkyfileRow object into a table8614 bool stackInputSkyfileInsertObject( 8615 psDB *dbh, ///< Database handle 8616 stackInputSkyfileRow *object ///< stackInputSkyfileRow object 8617 ); 8618 8619 /** Insert an array of stackInputSkyfileRow object into a table 8620 8620 * 8621 8621 * This function constructs and inserts multiple rows based on it's parameters. … … 8624 8624 */ 8625 8625 8626 bool p6InputSkyfileInsertObjects(8627 psDB *dbh, ///< Database handle 8628 psArray *objects ///< array of p6InputSkyfileRow objects8629 ); 8630 8631 /** Insert data from a binary FITS table p6InputSkyfileRow into the database8626 bool stackInputSkyfileInsertObjects( 8627 psDB *dbh, ///< Database handle 8628 psArray *objects ///< array of stackInputSkyfileRow objects 8629 ); 8630 8631 /** Insert data from a binary FITS table stackInputSkyfileRow into the database 8632 8632 * 8633 8633 * This function expects a psFits object with a FITS table as the first … … 8639 8639 */ 8640 8640 8641 bool p6InputSkyfileInsertFits(8641 bool stackInputSkyfileInsertFits( 8642 8642 psDB *dbh, ///< Database handle 8643 8643 const psFits *fits ///< psFits object … … 8654 8654 */ 8655 8655 8656 bool p6InputSkyfileSelectRowsFits(8656 bool stackInputSkyfileSelectRowsFits( 8657 8657 psDB *dbh, ///< Database handle 8658 8658 psFits *fits, ///< psFits object … … 8661 8661 ); 8662 8662 8663 /** Convert a p6InputSkyfileRow into an equivalent psMetadata8663 /** Convert a stackInputSkyfileRow into an equivalent psMetadata 8664 8664 * 8665 8665 * @return A psMetadata pointer or NULL on error 8666 8666 */ 8667 8667 8668 psMetadata * p6InputSkyfileMetadataFromObject(8669 const p6InputSkyfileRow *object ///< fooRow to convert into a psMetadata8668 psMetadata *stackInputSkyfileMetadataFromObject( 8669 const stackInputSkyfileRow *object ///< fooRow to convert into a psMetadata 8670 8670 ); 8671 8671 8672 8672 /** Convert a psMetadata into an equivalent fooRow 8673 8673 * 8674 * @return A p6InputSkyfileRow pointer or NULL on error8675 */ 8676 8677 p6InputSkyfileRow *p6InputSkyfileObjectFromMetadata(8674 * @return A stackInputSkyfileRow pointer or NULL on error 8675 */ 8676 8677 stackInputSkyfileRow *stackInputSkyfileObjectFromMetadata( 8678 8678 psMetadata *md ///< psMetadata to convert into a fooRow 8679 8679 ); 8680 /** Selects up to limit rows from the database and returns as p6InputSkyfileRow objects in a psArray8680 /** Selects up to limit rows from the database and returns as stackInputSkyfileRow objects in a psArray 8681 8681 * 8682 8682 * See psDBSelectRows() for documentation on the format of where. … … 8685 8685 */ 8686 8686 8687 psArray * p6InputSkyfileSelectRowObjects(8687 psArray *stackInputSkyfileSelectRowObjects( 8688 8688 psDB *dbh, ///< Database handle 8689 8689 const psMetadata *where, ///< Row match criteria 8690 8690 unsigned long long limit ///< Maximum number of elements to return 8691 8691 ); 8692 /** Deletes a row from the database coresponding to an p6InputSkyfile8692 /** Deletes a row from the database coresponding to an stackInputSkyfile 8693 8693 * 8694 8694 * Note that a 'where' search psMetadata is constructed from each object and … … 8698 8698 */ 8699 8699 8700 bool p6InputSkyfileDeleteObject(8701 psDB *dbh, ///< Database handle 8702 const p6InputSkyfileRow *object ///< Object to delete8700 bool stackInputSkyfileDeleteObject( 8701 psDB *dbh, ///< Database handle 8702 const stackInputSkyfileRow *object ///< Object to delete 8703 8703 ); 8704 8704 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8710 8710 */ 8711 8711 8712 long long p6InputSkyfileDeleteRowObjects(8712 long long stackInputSkyfileDeleteRowObjects( 8713 8713 psDB *dbh, ///< Database handle 8714 8714 const psArray *objects, ///< Array of objects to delete 8715 8715 unsigned long long limit ///< Maximum number of elements to delete 8716 8716 ); 8717 /** Formats and prints an array of p6InputSkyfileRow objects8717 /** Formats and prints an array of stackInputSkyfileRow objects 8718 8718 * 8719 8719 * When mdcf is set the formated output is in psMetadataConfig … … 8723 8723 */ 8724 8724 8725 bool p6InputSkyfilePrintObjects(8725 bool stackInputSkyfilePrintObjects( 8726 8726 FILE *stream, ///< a stream 8727 psArray *objects, ///< An array of p6InputSkyfileRow objects8727 psArray *objects, ///< An array of stackInputSkyfileRow objects 8728 8728 bool mdcf ///< format as mdconfig or simple 8729 8729 ); 8730 /** Formats and prints an p6InputSkyfileRow object8730 /** Formats and prints an stackInputSkyfileRow object 8731 8731 * 8732 8732 * When mdcf is set the formated output is in psMetadataConfig … … 8736 8736 */ 8737 8737 8738 bool p6InputSkyfilePrintObject(8738 bool stackInputSkyfilePrintObject( 8739 8739 FILE *stream, ///< a stream 8740 p6InputSkyfileRow *object, ///< an p6InputSkyfileRow object8740 stackInputSkyfileRow *object, ///< an stackInputSkyfileRow object 8741 8741 bool mdcf ///< format as mdconfig or simple 8742 8742 ); 8743 /** p6SumSkyfileRow data structure8744 * 8745 * Structure for representing a single row of p6SumSkyfile table data.8743 /** stackSumSkyfileRow data structure 8744 * 8745 * Structure for representing a single row of stackSumSkyfile table data. 8746 8746 */ 8747 8747 8748 8748 typedef struct { 8749 psS32 p6_id;8749 psS32 stack_id; 8750 8750 char *uri; 8751 8751 psF64 bg; 8752 8752 psF64 bg_mean_stdev; 8753 } p6SumSkyfileRow;8754 8755 /** Creates a new p6SumSkyfileRow object8756 * 8757 * @return A new p6SumSkyfileRow object or NULL on failure.8758 */ 8759 8760 p6SumSkyfileRow *p6SumSkyfileRowAlloc(8761 psS32 p6_id,8753 } stackSumSkyfileRow; 8754 8755 /** Creates a new stackSumSkyfileRow object 8756 * 8757 * @return A new stackSumSkyfileRow object or NULL on failure. 8758 */ 8759 8760 stackSumSkyfileRow *stackSumSkyfileRowAlloc( 8761 psS32 stack_id, 8762 8762 const char *uri, 8763 8763 psF64 bg, … … 8765 8765 ); 8766 8766 8767 /** Creates a new p6SumSkyfile table8768 * 8769 * @return true on success 8770 */ 8771 8772 bool p6SumSkyfileCreateTable(8767 /** Creates a new stackSumSkyfile table 8768 * 8769 * @return true on success 8770 */ 8771 8772 bool stackSumSkyfileCreateTable( 8773 8773 psDB *dbh ///< Database handle 8774 8774 ); 8775 8775 8776 /** Deletes a p6SumSkyfile table8777 * 8778 * @return true on success 8779 */ 8780 8781 bool p6SumSkyfileDropTable(8776 /** Deletes a stackSumSkyfile table 8777 * 8778 * @return true on success 8779 */ 8780 8781 bool stackSumSkyfileDropTable( 8782 8782 psDB *dbh ///< Database handle 8783 8783 ); … … 8790 8790 */ 8791 8791 8792 bool p6SumSkyfileInsert(8793 psDB *dbh, ///< Database handle 8794 psS32 p6_id,8792 bool stackSumSkyfileInsert( 8793 psDB *dbh, ///< Database handle 8794 psS32 stack_id, 8795 8795 const char *uri, 8796 8796 psF64 bg, … … 8803 8803 */ 8804 8804 8805 long long p6SumSkyfileDelete(8805 long long stackSumSkyfileDelete( 8806 8806 psDB *dbh, ///< Database handle 8807 8807 const psMetadata *where, ///< Row match criteria … … 8809 8809 ); 8810 8810 8811 /** Insert a single p6SumSkyfileRow object into a table8811 /** Insert a single stackSumSkyfileRow object into a table 8812 8812 * 8813 8813 * This function constructs and inserts a single row based on it's parameters. … … 8816 8816 */ 8817 8817 8818 bool p6SumSkyfileInsertObject(8819 psDB *dbh, ///< Database handle 8820 p6SumSkyfileRow *object ///< p6SumSkyfileRow object8821 ); 8822 8823 /** Insert an array of p6SumSkyfileRow object into a table8818 bool stackSumSkyfileInsertObject( 8819 psDB *dbh, ///< Database handle 8820 stackSumSkyfileRow *object ///< stackSumSkyfileRow object 8821 ); 8822 8823 /** Insert an array of stackSumSkyfileRow object into a table 8824 8824 * 8825 8825 * This function constructs and inserts multiple rows based on it's parameters. … … 8828 8828 */ 8829 8829 8830 bool p6SumSkyfileInsertObjects(8831 psDB *dbh, ///< Database handle 8832 psArray *objects ///< array of p6SumSkyfileRow objects8833 ); 8834 8835 /** Insert data from a binary FITS table p6SumSkyfileRow into the database8830 bool stackSumSkyfileInsertObjects( 8831 psDB *dbh, ///< Database handle 8832 psArray *objects ///< array of stackSumSkyfileRow objects 8833 ); 8834 8835 /** Insert data from a binary FITS table stackSumSkyfileRow into the database 8836 8836 * 8837 8837 * This function expects a psFits object with a FITS table as the first … … 8843 8843 */ 8844 8844 8845 bool p6SumSkyfileInsertFits(8845 bool stackSumSkyfileInsertFits( 8846 8846 psDB *dbh, ///< Database handle 8847 8847 const psFits *fits ///< psFits object … … 8858 8858 */ 8859 8859 8860 bool p6SumSkyfileSelectRowsFits(8860 bool stackSumSkyfileSelectRowsFits( 8861 8861 psDB *dbh, ///< Database handle 8862 8862 psFits *fits, ///< psFits object … … 8865 8865 ); 8866 8866 8867 /** Convert a p6SumSkyfileRow into an equivalent psMetadata8867 /** Convert a stackSumSkyfileRow into an equivalent psMetadata 8868 8868 * 8869 8869 * @return A psMetadata pointer or NULL on error 8870 8870 */ 8871 8871 8872 psMetadata * p6SumSkyfileMetadataFromObject(8873 const p6SumSkyfileRow *object ///< fooRow to convert into a psMetadata8872 psMetadata *stackSumSkyfileMetadataFromObject( 8873 const stackSumSkyfileRow *object ///< fooRow to convert into a psMetadata 8874 8874 ); 8875 8875 8876 8876 /** Convert a psMetadata into an equivalent fooRow 8877 8877 * 8878 * @return A p6SumSkyfileRow pointer or NULL on error8879 */ 8880 8881 p6SumSkyfileRow *p6SumSkyfileObjectFromMetadata(8878 * @return A stackSumSkyfileRow pointer or NULL on error 8879 */ 8880 8881 stackSumSkyfileRow *stackSumSkyfileObjectFromMetadata( 8882 8882 psMetadata *md ///< psMetadata to convert into a fooRow 8883 8883 ); 8884 /** Selects up to limit rows from the database and returns as p6SumSkyfileRow objects in a psArray8884 /** Selects up to limit rows from the database and returns as stackSumSkyfileRow objects in a psArray 8885 8885 * 8886 8886 * See psDBSelectRows() for documentation on the format of where. … … 8889 8889 */ 8890 8890 8891 psArray * p6SumSkyfileSelectRowObjects(8891 psArray *stackSumSkyfileSelectRowObjects( 8892 8892 psDB *dbh, ///< Database handle 8893 8893 const psMetadata *where, ///< Row match criteria 8894 8894 unsigned long long limit ///< Maximum number of elements to return 8895 8895 ); 8896 /** Deletes a row from the database coresponding to an p6SumSkyfile8896 /** Deletes a row from the database coresponding to an stackSumSkyfile 8897 8897 * 8898 8898 * Note that a 'where' search psMetadata is constructed from each object and … … 8902 8902 */ 8903 8903 8904 bool p6SumSkyfileDeleteObject(8905 psDB *dbh, ///< Database handle 8906 const p6SumSkyfileRow *object ///< Object to delete8904 bool stackSumSkyfileDeleteObject( 8905 psDB *dbh, ///< Database handle 8906 const stackSumSkyfileRow *object ///< Object to delete 8907 8907 ); 8908 8908 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8914 8914 */ 8915 8915 8916 long long p6SumSkyfileDeleteRowObjects(8916 long long stackSumSkyfileDeleteRowObjects( 8917 8917 psDB *dbh, ///< Database handle 8918 8918 const psArray *objects, ///< Array of objects to delete 8919 8919 unsigned long long limit ///< Maximum number of elements to delete 8920 8920 ); 8921 /** Formats and prints an array of p6SumSkyfileRow objects8921 /** Formats and prints an array of stackSumSkyfileRow objects 8922 8922 * 8923 8923 * When mdcf is set the formated output is in psMetadataConfig … … 8927 8927 */ 8928 8928 8929 bool p6SumSkyfilePrintObjects(8929 bool stackSumSkyfilePrintObjects( 8930 8930 FILE *stream, ///< a stream 8931 psArray *objects, ///< An array of p6SumSkyfileRow objects8931 psArray *objects, ///< An array of stackSumSkyfileRow objects 8932 8932 bool mdcf ///< format as mdconfig or simple 8933 8933 ); 8934 /** Formats and prints an p6SumSkyfileRow object8934 /** Formats and prints an stackSumSkyfileRow object 8935 8935 * 8936 8936 * When mdcf is set the formated output is in psMetadataConfig … … 8940 8940 */ 8941 8941 8942 bool p6SumSkyfilePrintObject(8942 bool stackSumSkyfilePrintObject( 8943 8943 FILE *stream, ///< a stream 8944 p6SumSkyfileRow *object, ///< an p6SumSkyfileRow object8944 stackSumSkyfileRow *object, ///< an stackSumSkyfileRow object 8945 8945 bool mdcf ///< format as mdconfig or simple 8946 8946 ); … … 8952 8952 #endif 8953 8953 8954 #endif // P6SUMSKYFILE_DB_H8954 #endif // STACKSUMSKYFILE_DB_H -
trunk/ippdb/tests/alloc.c
r11988 r12026 505 505 506 506 { 507 p1PendingExpRow *object;508 509 object = p1PendingExpRowAlloc("a string", -32, "a string" );510 511 if (!object) { 512 exit(EXIT_FAILURE); 513 } 514 515 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 516 psFree(object); 517 exit(EXIT_FAILURE); 518 } 519 if (!object-> p1_version == -32) {507 guidePendingExpRow *object; 508 509 object = guidePendingExpRowAlloc("a string", -32, "a string" ); 510 511 if (!object) { 512 exit(EXIT_FAILURE); 513 } 514 515 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 516 psFree(object); 517 exit(EXIT_FAILURE); 518 } 519 if (!object->guide_version == -32) { 520 520 psFree(object); 521 521 exit(EXIT_FAILURE); … … 530 530 531 531 { 532 p2PendingExpRow *object;533 534 object = p2PendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", "a string" );535 536 if (!object) { 537 exit(EXIT_FAILURE); 538 } 539 540 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 541 psFree(object); 542 exit(EXIT_FAILURE); 543 } 544 if (!object-> p2_version == -32) {545 psFree(object); 546 exit(EXIT_FAILURE); 547 } 548 if (!object-> p1_version == -32) {532 chipPendingExpRow *object; 533 534 object = chipPendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", "a string" ); 535 536 if (!object) { 537 exit(EXIT_FAILURE); 538 } 539 540 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 541 psFree(object); 542 exit(EXIT_FAILURE); 543 } 544 if (!object->chip_version == -32) { 545 psFree(object); 546 exit(EXIT_FAILURE); 547 } 548 if (!object->guide_version == -32) { 549 549 psFree(object); 550 550 exit(EXIT_FAILURE); … … 571 571 572 572 { 573 p2PendingImfileRow *object;574 575 object = p2PendingImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string" );576 577 if (!object) { 578 exit(EXIT_FAILURE); 579 } 580 581 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 582 psFree(object); 583 exit(EXIT_FAILURE); 584 } 585 if (!object-> p2_version == -32) {586 psFree(object); 587 exit(EXIT_FAILURE); 588 } 589 if (!object-> p1_version == -32) {573 chipPendingImfileRow *object; 574 575 object = chipPendingImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string" ); 576 577 if (!object) { 578 exit(EXIT_FAILURE); 579 } 580 581 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 582 psFree(object); 583 exit(EXIT_FAILURE); 584 } 585 if (!object->chip_version == -32) { 586 psFree(object); 587 exit(EXIT_FAILURE); 588 } 589 if (!object->guide_version == -32) { 590 590 psFree(object); 591 591 exit(EXIT_FAILURE); … … 608 608 609 609 { 610 p2ProcessedExpRow *object;611 612 object = p2ProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string" );613 614 if (!object) { 615 exit(EXIT_FAILURE); 616 } 617 618 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 619 psFree(object); 620 exit(EXIT_FAILURE); 621 } 622 if (!object-> p2_version == -32) {623 psFree(object); 624 exit(EXIT_FAILURE); 625 } 626 if (!object-> p1_version == -32) {610 chipProcessedExpRow *object; 611 612 object = chipProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string" ); 613 614 if (!object) { 615 exit(EXIT_FAILURE); 616 } 617 618 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 619 psFree(object); 620 exit(EXIT_FAILURE); 621 } 622 if (!object->chip_version == -32) { 623 psFree(object); 624 exit(EXIT_FAILURE); 625 } 626 if (!object->guide_version == -32) { 627 627 psFree(object); 628 628 exit(EXIT_FAILURE); … … 645 645 646 646 { 647 p2MaskRow*object;648 649 object = p2MaskRowAlloc("a string" );647 chipMaskRow *object; 648 649 object = chipMaskRowAlloc("a string" ); 650 650 651 651 if (!object) { … … 662 662 663 663 { 664 p2ProcessedImfileRow *object;665 666 object = p2ProcessedImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16 );667 668 if (!object) { 669 exit(EXIT_FAILURE); 670 } 671 672 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 673 psFree(object); 674 exit(EXIT_FAILURE); 675 } 676 if (!object-> p2_version == -32) {677 psFree(object); 678 exit(EXIT_FAILURE); 679 } 680 if (!object-> p1_version == -32) {664 chipProcessedImfileRow *object; 665 666 object = chipProcessedImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16 ); 667 668 if (!object) { 669 exit(EXIT_FAILURE); 670 } 671 672 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 673 psFree(object); 674 exit(EXIT_FAILURE); 675 } 676 if (!object->chip_version == -32) { 677 psFree(object); 678 exit(EXIT_FAILURE); 679 } 680 if (!object->guide_version == -32) { 681 681 psFree(object); 682 682 exit(EXIT_FAILURE); … … 723 723 724 724 { 725 p3PendingExpRow *object;726 727 object = p3PendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string" );728 729 if (!object) { 730 exit(EXIT_FAILURE); 731 } 732 733 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 734 psFree(object); 735 exit(EXIT_FAILURE); 736 } 737 if (!object-> p3_version == -32) {738 psFree(object); 739 exit(EXIT_FAILURE); 740 } 741 if (!object-> p2_version == -32) {725 camPendingExpRow *object; 726 727 object = camPendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string" ); 728 729 if (!object) { 730 exit(EXIT_FAILURE); 731 } 732 733 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 734 psFree(object); 735 exit(EXIT_FAILURE); 736 } 737 if (!object->cam_version == -32) { 738 psFree(object); 739 exit(EXIT_FAILURE); 740 } 741 if (!object->chip_version == -32) { 742 742 psFree(object); 743 743 exit(EXIT_FAILURE); … … 760 760 761 761 { 762 p3ProcessedExpRow *object;763 764 object = p3ProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string" );765 766 if (!object) { 767 exit(EXIT_FAILURE); 768 } 769 770 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 771 psFree(object); 772 exit(EXIT_FAILURE); 773 } 774 if (!object-> p3_version == -32) {775 psFree(object); 776 exit(EXIT_FAILURE); 777 } 778 if (!object-> p2_version == -32) {762 camProcessedExpRow *object; 763 764 object = camProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string" ); 765 766 if (!object) { 767 exit(EXIT_FAILURE); 768 } 769 770 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 771 psFree(object); 772 exit(EXIT_FAILURE); 773 } 774 if (!object->cam_version == -32) { 775 psFree(object); 776 exit(EXIT_FAILURE); 777 } 778 if (!object->chip_version == -32) { 779 779 psFree(object); 780 780 exit(EXIT_FAILURE); … … 849 849 850 850 { 851 p3MaskRow*object;852 853 object = p3MaskRowAlloc("a string" );851 camMaskRow *object; 852 853 object = camMaskRowAlloc("a string" ); 854 854 855 855 if (!object) { … … 1460 1460 1461 1461 { 1462 p4RunRow*object;1463 1464 object = p4RunRowAlloc(-32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z" );1465 1466 if (!object) { 1467 exit(EXIT_FAILURE); 1468 } 1469 1470 if (!object-> p4_id == -32) {1462 warpRunRow *object; 1463 1464 object = warpRunRowAlloc(-32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z" ); 1465 1466 if (!object) { 1467 exit(EXIT_FAILURE); 1468 } 1469 1470 if (!object->warp_id == -32) { 1471 1471 psFree(object); 1472 1472 exit(EXIT_FAILURE); … … 1496 1496 1497 1497 { 1498 p4InputExpRow*object;1499 1500 object = p4InputExpRowAlloc(-32, "a string", -32, true );1501 1502 if (!object) { 1503 exit(EXIT_FAILURE); 1504 } 1505 1506 if (!object-> p4_id == -32) {1507 psFree(object); 1508 exit(EXIT_FAILURE); 1509 } 1510 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 1511 psFree(object); 1512 exit(EXIT_FAILURE); 1513 } 1514 if (!object-> p3_version == -32) {1498 warpInputExpRow *object; 1499 1500 object = warpInputExpRowAlloc(-32, "a string", -32, true ); 1501 1502 if (!object) { 1503 exit(EXIT_FAILURE); 1504 } 1505 1506 if (!object->warp_id == -32) { 1507 psFree(object); 1508 exit(EXIT_FAILURE); 1509 } 1510 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) { 1511 psFree(object); 1512 exit(EXIT_FAILURE); 1513 } 1514 if (!object->cam_version == -32) { 1515 1515 psFree(object); 1516 1516 exit(EXIT_FAILURE); … … 1525 1525 1526 1526 { 1527 p4SkyCellMapRow *object;1528 1529 object = p4SkyCellMapRowAlloc(-32, "a string", "a string", "a string", -32, "a string" );1530 1531 if (!object) { 1532 exit(EXIT_FAILURE); 1533 } 1534 1535 if (!object-> p4_id == -32) {1527 warpSkyCellMapRow *object; 1528 1529 object = warpSkyCellMapRowAlloc(-32, "a string", "a string", "a string", -32, "a string" ); 1530 1531 if (!object) { 1532 exit(EXIT_FAILURE); 1533 } 1534 1535 if (!object->warp_id == -32) { 1536 1536 psFree(object); 1537 1537 exit(EXIT_FAILURE); … … 1549 1549 exit(EXIT_FAILURE); 1550 1550 } 1551 if (!object-> p3_version == -32) {1551 if (!object->cam_version == -32) { 1552 1552 psFree(object); 1553 1553 exit(EXIT_FAILURE); … … 1562 1562 1563 1563 { 1564 p4SkyfileRow*object;1565 1566 object = p4SkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64 );1567 1568 if (!object) { 1569 exit(EXIT_FAILURE); 1570 } 1571 1572 if (!object-> p4_id == -32) {1564 warpSkyfileRow *object; 1565 1566 object = warpSkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64 ); 1567 1568 if (!object) { 1569 exit(EXIT_FAILURE); 1570 } 1571 1572 if (!object->warp_id == -32) { 1573 1573 psFree(object); 1574 1574 exit(EXIT_FAILURE); … … 1599 1599 1600 1600 { 1601 p5RunRow*object;1602 1603 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string" );1604 1605 if (!object) { 1606 exit(EXIT_FAILURE); 1607 } 1608 1609 if (!object-> p5_id == -32) {1601 diffRunRow *object; 1602 1603 object = diffRunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string" ); 1604 1605 if (!object) { 1606 exit(EXIT_FAILURE); 1607 } 1608 1609 if (!object->diff_id == -32) { 1610 1610 psFree(object); 1611 1611 exit(EXIT_FAILURE); … … 1639 1639 1640 1640 { 1641 p5InputSkyfileRow *object;1642 1643 object = p5InputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true );1644 1645 if (!object) { 1646 exit(EXIT_FAILURE); 1647 } 1648 1649 if (!object-> p5_id == -32) {1650 psFree(object); 1651 exit(EXIT_FAILURE); 1652 } 1653 if (!object-> p4_id == -32) {1641 diffInputSkyfileRow *object; 1642 1643 object = diffInputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true ); 1644 1645 if (!object) { 1646 exit(EXIT_FAILURE); 1647 } 1648 1649 if (!object->diff_id == -32) { 1650 psFree(object); 1651 exit(EXIT_FAILURE); 1652 } 1653 if (!object->warp_id == -32) { 1654 1654 psFree(object); 1655 1655 exit(EXIT_FAILURE); … … 1676 1676 1677 1677 { 1678 p5DiffSkyfileRow*object;1679 1680 object = p5DiffSkyfileRowAlloc(-32, "a string", 64.64, 64.64 );1681 1682 if (!object) { 1683 exit(EXIT_FAILURE); 1684 } 1685 1686 if (!object-> p5_id == -32) {1678 diffSkyfileRow *object; 1679 1680 object = diffSkyfileRowAlloc(-32, "a string", 64.64, 64.64 ); 1681 1682 if (!object) { 1683 exit(EXIT_FAILURE); 1684 } 1685 1686 if (!object->diff_id == -32) { 1687 1687 psFree(object); 1688 1688 exit(EXIT_FAILURE); … … 1705 1705 1706 1706 { 1707 p6RunRow*object;1708 1709 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string" );1710 1711 if (!object) { 1712 exit(EXIT_FAILURE); 1713 } 1714 1715 if (!object-> p6_id == -32) {1707 stackRunRow *object; 1708 1709 object = stackRunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string" ); 1710 1711 if (!object) { 1712 exit(EXIT_FAILURE); 1713 } 1714 1715 if (!object->stack_id == -32) { 1716 1716 psFree(object); 1717 1717 exit(EXIT_FAILURE); … … 1745 1745 1746 1746 { 1747 p6InputSkyfileRow *object;1748 1749 object = p6InputSkyfileRowAlloc(-32, -32 );1750 1751 if (!object) { 1752 exit(EXIT_FAILURE); 1753 } 1754 1755 if (!object-> p6_id == -32) {1756 psFree(object); 1757 exit(EXIT_FAILURE); 1758 } 1759 if (!object-> p4_id == -32) {1760 psFree(object); 1761 exit(EXIT_FAILURE); 1762 } 1763 1764 psFree(object); 1765 } 1766 1767 { 1768 p6SumSkyfileRow *object;1769 1770 object = p6SumSkyfileRowAlloc(-32, "a string", 64.64, 64.64 );1771 1772 if (!object) { 1773 exit(EXIT_FAILURE); 1774 } 1775 1776 if (!object-> p6_id == -32) {1747 stackInputSkyfileRow *object; 1748 1749 object = stackInputSkyfileRowAlloc(-32, -32 ); 1750 1751 if (!object) { 1752 exit(EXIT_FAILURE); 1753 } 1754 1755 if (!object->stack_id == -32) { 1756 psFree(object); 1757 exit(EXIT_FAILURE); 1758 } 1759 if (!object->warp_id == -32) { 1760 psFree(object); 1761 exit(EXIT_FAILURE); 1762 } 1763 1764 psFree(object); 1765 } 1766 1767 { 1768 stackSumSkyfileRow *object; 1769 1770 object = stackSumSkyfileRowAlloc(-32, "a string", 64.64, 64.64 ); 1771 1772 if (!object) { 1773 exit(EXIT_FAILURE); 1774 } 1775 1776 if (!object->stack_id == -32) { 1777 1777 psFree(object); 1778 1778 exit(EXIT_FAILURE); -
trunk/ippdb/tests/createtable.c
r11988 r12026 178 178 } 179 179 180 if(! p1PendingExpCreateTable(dbh)) {181 exit(EXIT_FAILURE); 182 } 183 184 psDBCleanup(dbh); 185 } 186 187 { 188 psDB *dbh; 189 190 dbh = psDBInit("localhost", "test", NULL, "test"); 191 if (!dbh) { 192 exit(EXIT_FAILURE); 193 } 194 195 if(! p2PendingExpCreateTable(dbh)) {196 exit(EXIT_FAILURE); 197 } 198 199 psDBCleanup(dbh); 200 } 201 202 { 203 psDB *dbh; 204 205 dbh = psDBInit("localhost", "test", NULL, "test"); 206 if (!dbh) { 207 exit(EXIT_FAILURE); 208 } 209 210 if(! p2PendingImfileCreateTable(dbh)) {211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if(! p2ProcessedExpCreateTable(dbh)) {226 exit(EXIT_FAILURE); 227 } 228 229 psDBCleanup(dbh); 230 } 231 232 { 233 psDB *dbh; 234 235 dbh = psDBInit("localhost", "test", NULL, "test"); 236 if (!dbh) { 237 exit(EXIT_FAILURE); 238 } 239 240 if(! p2MaskCreateTable(dbh)) {241 exit(EXIT_FAILURE); 242 } 243 244 psDBCleanup(dbh); 245 } 246 247 { 248 psDB *dbh; 249 250 dbh = psDBInit("localhost", "test", NULL, "test"); 251 if (!dbh) { 252 exit(EXIT_FAILURE); 253 } 254 255 if(! p2ProcessedImfileCreateTable(dbh)) {256 exit(EXIT_FAILURE); 257 } 258 259 psDBCleanup(dbh); 260 } 261 262 { 263 psDB *dbh; 264 265 dbh = psDBInit("localhost", "test", NULL, "test"); 266 if (!dbh) { 267 exit(EXIT_FAILURE); 268 } 269 270 if(! p3PendingExpCreateTable(dbh)) {271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if(! p3ProcessedExpCreateTable(dbh)) {286 exit(EXIT_FAILURE); 287 } 288 289 psDBCleanup(dbh); 290 } 291 292 { 293 psDB *dbh; 294 295 dbh = psDBInit("localhost", "test", NULL, "test"); 296 if (!dbh) { 297 exit(EXIT_FAILURE); 298 } 299 300 if(! p3MaskCreateTable(dbh)) {180 if(!guidePendingExpCreateTable(dbh)) { 181 exit(EXIT_FAILURE); 182 } 183 184 psDBCleanup(dbh); 185 } 186 187 { 188 psDB *dbh; 189 190 dbh = psDBInit("localhost", "test", NULL, "test"); 191 if (!dbh) { 192 exit(EXIT_FAILURE); 193 } 194 195 if(!chipPendingExpCreateTable(dbh)) { 196 exit(EXIT_FAILURE); 197 } 198 199 psDBCleanup(dbh); 200 } 201 202 { 203 psDB *dbh; 204 205 dbh = psDBInit("localhost", "test", NULL, "test"); 206 if (!dbh) { 207 exit(EXIT_FAILURE); 208 } 209 210 if(!chipPendingImfileCreateTable(dbh)) { 211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if(!chipProcessedExpCreateTable(dbh)) { 226 exit(EXIT_FAILURE); 227 } 228 229 psDBCleanup(dbh); 230 } 231 232 { 233 psDB *dbh; 234 235 dbh = psDBInit("localhost", "test", NULL, "test"); 236 if (!dbh) { 237 exit(EXIT_FAILURE); 238 } 239 240 if(!chipMaskCreateTable(dbh)) { 241 exit(EXIT_FAILURE); 242 } 243 244 psDBCleanup(dbh); 245 } 246 247 { 248 psDB *dbh; 249 250 dbh = psDBInit("localhost", "test", NULL, "test"); 251 if (!dbh) { 252 exit(EXIT_FAILURE); 253 } 254 255 if(!chipProcessedImfileCreateTable(dbh)) { 256 exit(EXIT_FAILURE); 257 } 258 259 psDBCleanup(dbh); 260 } 261 262 { 263 psDB *dbh; 264 265 dbh = psDBInit("localhost", "test", NULL, "test"); 266 if (!dbh) { 267 exit(EXIT_FAILURE); 268 } 269 270 if(!camPendingExpCreateTable(dbh)) { 271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if(!camProcessedExpCreateTable(dbh)) { 286 exit(EXIT_FAILURE); 287 } 288 289 psDBCleanup(dbh); 290 } 291 292 { 293 psDB *dbh; 294 295 dbh = psDBInit("localhost", "test", NULL, "test"); 296 if (!dbh) { 297 exit(EXIT_FAILURE); 298 } 299 300 if(!camMaskCreateTable(dbh)) { 301 301 exit(EXIT_FAILURE); 302 302 } … … 478 478 } 479 479 480 if(! p4RunCreateTable(dbh)) {481 exit(EXIT_FAILURE); 482 } 483 484 psDBCleanup(dbh); 485 } 486 487 { 488 psDB *dbh; 489 490 dbh = psDBInit("localhost", "test", NULL, "test"); 491 if (!dbh) { 492 exit(EXIT_FAILURE); 493 } 494 495 if(! p4InputExpCreateTable(dbh)) {496 exit(EXIT_FAILURE); 497 } 498 499 psDBCleanup(dbh); 500 } 501 502 { 503 psDB *dbh; 504 505 dbh = psDBInit("localhost", "test", NULL, "test"); 506 if (!dbh) { 507 exit(EXIT_FAILURE); 508 } 509 510 if(! p4SkyCellMapCreateTable(dbh)) {511 exit(EXIT_FAILURE); 512 } 513 514 psDBCleanup(dbh); 515 } 516 517 { 518 psDB *dbh; 519 520 dbh = psDBInit("localhost", "test", NULL, "test"); 521 if (!dbh) { 522 exit(EXIT_FAILURE); 523 } 524 525 if(! p4SkyfileCreateTable(dbh)) {526 exit(EXIT_FAILURE); 527 } 528 529 psDBCleanup(dbh); 530 } 531 532 { 533 psDB *dbh; 534 535 dbh = psDBInit("localhost", "test", NULL, "test"); 536 if (!dbh) { 537 exit(EXIT_FAILURE); 538 } 539 540 if(! p5RunCreateTable(dbh)) {541 exit(EXIT_FAILURE); 542 } 543 544 psDBCleanup(dbh); 545 } 546 547 { 548 psDB *dbh; 549 550 dbh = psDBInit("localhost", "test", NULL, "test"); 551 if (!dbh) { 552 exit(EXIT_FAILURE); 553 } 554 555 if(! p5InputSkyfileCreateTable(dbh)) {556 exit(EXIT_FAILURE); 557 } 558 559 psDBCleanup(dbh); 560 } 561 562 { 563 psDB *dbh; 564 565 dbh = psDBInit("localhost", "test", NULL, "test"); 566 if (!dbh) { 567 exit(EXIT_FAILURE); 568 } 569 570 if(! p5DiffSkyfileCreateTable(dbh)) {571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if(! p6RunCreateTable(dbh)) {586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 592 { 593 psDB *dbh; 594 595 dbh = psDBInit("localhost", "test", NULL, "test"); 596 if (!dbh) { 597 exit(EXIT_FAILURE); 598 } 599 600 if(! p6InputSkyfileCreateTable(dbh)) {601 exit(EXIT_FAILURE); 602 } 603 604 psDBCleanup(dbh); 605 } 606 607 { 608 psDB *dbh; 609 610 dbh = psDBInit("localhost", "test", NULL, "test"); 611 if (!dbh) { 612 exit(EXIT_FAILURE); 613 } 614 615 if(! p6SumSkyfileCreateTable(dbh)) {480 if(!warpRunCreateTable(dbh)) { 481 exit(EXIT_FAILURE); 482 } 483 484 psDBCleanup(dbh); 485 } 486 487 { 488 psDB *dbh; 489 490 dbh = psDBInit("localhost", "test", NULL, "test"); 491 if (!dbh) { 492 exit(EXIT_FAILURE); 493 } 494 495 if(!warpInputExpCreateTable(dbh)) { 496 exit(EXIT_FAILURE); 497 } 498 499 psDBCleanup(dbh); 500 } 501 502 { 503 psDB *dbh; 504 505 dbh = psDBInit("localhost", "test", NULL, "test"); 506 if (!dbh) { 507 exit(EXIT_FAILURE); 508 } 509 510 if(!warpSkyCellMapCreateTable(dbh)) { 511 exit(EXIT_FAILURE); 512 } 513 514 psDBCleanup(dbh); 515 } 516 517 { 518 psDB *dbh; 519 520 dbh = psDBInit("localhost", "test", NULL, "test"); 521 if (!dbh) { 522 exit(EXIT_FAILURE); 523 } 524 525 if(!warpSkyfileCreateTable(dbh)) { 526 exit(EXIT_FAILURE); 527 } 528 529 psDBCleanup(dbh); 530 } 531 532 { 533 psDB *dbh; 534 535 dbh = psDBInit("localhost", "test", NULL, "test"); 536 if (!dbh) { 537 exit(EXIT_FAILURE); 538 } 539 540 if(!diffRunCreateTable(dbh)) { 541 exit(EXIT_FAILURE); 542 } 543 544 psDBCleanup(dbh); 545 } 546 547 { 548 psDB *dbh; 549 550 dbh = psDBInit("localhost", "test", NULL, "test"); 551 if (!dbh) { 552 exit(EXIT_FAILURE); 553 } 554 555 if(!diffInputSkyfileCreateTable(dbh)) { 556 exit(EXIT_FAILURE); 557 } 558 559 psDBCleanup(dbh); 560 } 561 562 { 563 psDB *dbh; 564 565 dbh = psDBInit("localhost", "test", NULL, "test"); 566 if (!dbh) { 567 exit(EXIT_FAILURE); 568 } 569 570 if(!diffSkyfileCreateTable(dbh)) { 571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if(!stackRunCreateTable(dbh)) { 586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 592 { 593 psDB *dbh; 594 595 dbh = psDBInit("localhost", "test", NULL, "test"); 596 if (!dbh) { 597 exit(EXIT_FAILURE); 598 } 599 600 if(!stackInputSkyfileCreateTable(dbh)) { 601 exit(EXIT_FAILURE); 602 } 603 604 psDBCleanup(dbh); 605 } 606 607 { 608 psDB *dbh; 609 610 dbh = psDBInit("localhost", "test", NULL, "test"); 611 if (!dbh) { 612 exit(EXIT_FAILURE); 613 } 614 615 if(!stackSumSkyfileCreateTable(dbh)) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/dbcleanup.c
r11988 r12026 22 22 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS rawExp"); 23 23 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS rawImfile"); 24 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p1PendingExp");25 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2PendingExp");26 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2PendingImfile");27 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2ProcessedExp");28 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2Mask");29 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2ProcessedImfile");30 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3PendingExp");31 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3ProcessedExp");32 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3Mask");24 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS guidePendingExp"); 25 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipPendingExp"); 26 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipPendingImfile"); 27 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipProcessedExp"); 28 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipMask"); 29 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipProcessedImfile"); 30 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camPendingExp"); 31 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camProcessedExp"); 32 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camMask"); 33 33 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detRun"); 34 34 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detInputExp"); … … 42 42 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detResidExp"); 43 43 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detRunSummary"); 44 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4Run");45 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4InputExp");46 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4SkyCellMap");47 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4Skyfile");48 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5Run");49 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputSkyfile");50 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffSkyfile");51 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run");52 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6InputSkyfile");53 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6SumSkyfile");44 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpRun"); 45 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpInputExp"); 46 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyCellMap"); 47 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyfile"); 48 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffRun"); 49 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffInputSkyfile"); 50 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffSkyfile"); 51 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS stackRun"); 52 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS stackInputSkyfile"); 53 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS stackSumSkyfile"); 54 54 55 55 psDBCleanup(dbh); -
trunk/ippdb/tests/dbsetup.c
r11988 r12026 46 46 rawImfileCreateTable(dbh); 47 47 48 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p1PendingExp");49 p1PendingExpCreateTable(dbh);48 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS guidePendingExp"); 49 guidePendingExpCreateTable(dbh); 50 50 51 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2PendingExp");52 p2PendingExpCreateTable(dbh);51 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipPendingExp"); 52 chipPendingExpCreateTable(dbh); 53 53 54 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2PendingImfile");55 p2PendingImfileCreateTable(dbh);54 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipPendingImfile"); 55 chipPendingImfileCreateTable(dbh); 56 56 57 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2ProcessedExp");58 p2ProcessedExpCreateTable(dbh);57 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipProcessedExp"); 58 chipProcessedExpCreateTable(dbh); 59 59 60 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2Mask");61 p2MaskCreateTable(dbh);60 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipMask"); 61 chipMaskCreateTable(dbh); 62 62 63 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p2ProcessedImfile");64 p2ProcessedImfileCreateTable(dbh);63 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS chipProcessedImfile"); 64 chipProcessedImfileCreateTable(dbh); 65 65 66 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3PendingExp");67 p3PendingExpCreateTable(dbh);66 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camPendingExp"); 67 camPendingExpCreateTable(dbh); 68 68 69 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3ProcessedExp");70 p3ProcessedExpCreateTable(dbh);69 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camProcessedExp"); 70 camProcessedExpCreateTable(dbh); 71 71 72 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p3Mask");73 p3MaskCreateTable(dbh);72 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS camMask"); 73 camMaskCreateTable(dbh); 74 74 75 75 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS detRun"); … … 106 106 detRunSummaryCreateTable(dbh); 107 107 108 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4Run");109 p4RunCreateTable(dbh);108 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpRun"); 109 warpRunCreateTable(dbh); 110 110 111 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4InputExp");112 p4InputExpCreateTable(dbh);111 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpInputExp"); 112 warpInputExpCreateTable(dbh); 113 113 114 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4SkyCellMap");115 p4SkyCellMapCreateTable(dbh);114 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyCellMap"); 115 warpSkyCellMapCreateTable(dbh); 116 116 117 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4Skyfile");118 p4SkyfileCreateTable(dbh);117 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS warpSkyfile"); 118 warpSkyfileCreateTable(dbh); 119 119 120 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5Run");121 p5RunCreateTable(dbh);120 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffRun"); 121 diffRunCreateTable(dbh); 122 122 123 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputSkyfile");124 p5InputSkyfileCreateTable(dbh);123 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffInputSkyfile"); 124 diffInputSkyfileCreateTable(dbh); 125 125 126 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffSkyfile");127 p5DiffSkyfileCreateTable(dbh);126 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS diffSkyfile"); 127 diffSkyfileCreateTable(dbh); 128 128 129 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run");130 p6RunCreateTable(dbh);129 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS stackRun"); 130 stackRunCreateTable(dbh); 131 131 132 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6InputSkyfile");133 p6InputSkyfileCreateTable(dbh);132 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS stackInputSkyfile"); 133 stackInputSkyfileCreateTable(dbh); 134 134 135 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6SumSkyfile");136 p6SumSkyfileCreateTable(dbh);135 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS stackSumSkyfile"); 136 stackSumSkyfileCreateTable(dbh); 137 137 138 138 psDBCleanup(dbh); -
trunk/ippdb/tests/droptable.c
r11988 r12026 178 178 } 179 179 180 if (! p1PendingExpDropTable(dbh)) {181 exit(EXIT_FAILURE); 182 } 183 184 psDBCleanup(dbh); 185 } 186 187 { 188 psDB *dbh; 189 190 dbh = psDBInit("localhost", "test", NULL, "test"); 191 if (!dbh) { 192 exit(EXIT_FAILURE); 193 } 194 195 if (! p2PendingExpDropTable(dbh)) {196 exit(EXIT_FAILURE); 197 } 198 199 psDBCleanup(dbh); 200 } 201 202 { 203 psDB *dbh; 204 205 dbh = psDBInit("localhost", "test", NULL, "test"); 206 if (!dbh) { 207 exit(EXIT_FAILURE); 208 } 209 210 if (! p2PendingImfileDropTable(dbh)) {211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if (! p2ProcessedExpDropTable(dbh)) {226 exit(EXIT_FAILURE); 227 } 228 229 psDBCleanup(dbh); 230 } 231 232 { 233 psDB *dbh; 234 235 dbh = psDBInit("localhost", "test", NULL, "test"); 236 if (!dbh) { 237 exit(EXIT_FAILURE); 238 } 239 240 if (! p2MaskDropTable(dbh)) {241 exit(EXIT_FAILURE); 242 } 243 244 psDBCleanup(dbh); 245 } 246 247 { 248 psDB *dbh; 249 250 dbh = psDBInit("localhost", "test", NULL, "test"); 251 if (!dbh) { 252 exit(EXIT_FAILURE); 253 } 254 255 if (! p2ProcessedImfileDropTable(dbh)) {256 exit(EXIT_FAILURE); 257 } 258 259 psDBCleanup(dbh); 260 } 261 262 { 263 psDB *dbh; 264 265 dbh = psDBInit("localhost", "test", NULL, "test"); 266 if (!dbh) { 267 exit(EXIT_FAILURE); 268 } 269 270 if (! p3PendingExpDropTable(dbh)) {271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (! p3ProcessedExpDropTable(dbh)) {286 exit(EXIT_FAILURE); 287 } 288 289 psDBCleanup(dbh); 290 } 291 292 { 293 psDB *dbh; 294 295 dbh = psDBInit("localhost", "test", NULL, "test"); 296 if (!dbh) { 297 exit(EXIT_FAILURE); 298 } 299 300 if (! p3MaskDropTable(dbh)) {180 if (!guidePendingExpDropTable(dbh)) { 181 exit(EXIT_FAILURE); 182 } 183 184 psDBCleanup(dbh); 185 } 186 187 { 188 psDB *dbh; 189 190 dbh = psDBInit("localhost", "test", NULL, "test"); 191 if (!dbh) { 192 exit(EXIT_FAILURE); 193 } 194 195 if (!chipPendingExpDropTable(dbh)) { 196 exit(EXIT_FAILURE); 197 } 198 199 psDBCleanup(dbh); 200 } 201 202 { 203 psDB *dbh; 204 205 dbh = psDBInit("localhost", "test", NULL, "test"); 206 if (!dbh) { 207 exit(EXIT_FAILURE); 208 } 209 210 if (!chipPendingImfileDropTable(dbh)) { 211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if (!chipProcessedExpDropTable(dbh)) { 226 exit(EXIT_FAILURE); 227 } 228 229 psDBCleanup(dbh); 230 } 231 232 { 233 psDB *dbh; 234 235 dbh = psDBInit("localhost", "test", NULL, "test"); 236 if (!dbh) { 237 exit(EXIT_FAILURE); 238 } 239 240 if (!chipMaskDropTable(dbh)) { 241 exit(EXIT_FAILURE); 242 } 243 244 psDBCleanup(dbh); 245 } 246 247 { 248 psDB *dbh; 249 250 dbh = psDBInit("localhost", "test", NULL, "test"); 251 if (!dbh) { 252 exit(EXIT_FAILURE); 253 } 254 255 if (!chipProcessedImfileDropTable(dbh)) { 256 exit(EXIT_FAILURE); 257 } 258 259 psDBCleanup(dbh); 260 } 261 262 { 263 psDB *dbh; 264 265 dbh = psDBInit("localhost", "test", NULL, "test"); 266 if (!dbh) { 267 exit(EXIT_FAILURE); 268 } 269 270 if (!camPendingExpDropTable(dbh)) { 271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (!camProcessedExpDropTable(dbh)) { 286 exit(EXIT_FAILURE); 287 } 288 289 psDBCleanup(dbh); 290 } 291 292 { 293 psDB *dbh; 294 295 dbh = psDBInit("localhost", "test", NULL, "test"); 296 if (!dbh) { 297 exit(EXIT_FAILURE); 298 } 299 300 if (!camMaskDropTable(dbh)) { 301 301 exit(EXIT_FAILURE); 302 302 } … … 478 478 } 479 479 480 if (! p4RunDropTable(dbh)) {481 exit(EXIT_FAILURE); 482 } 483 484 psDBCleanup(dbh); 485 } 486 487 { 488 psDB *dbh; 489 490 dbh = psDBInit("localhost", "test", NULL, "test"); 491 if (!dbh) { 492 exit(EXIT_FAILURE); 493 } 494 495 if (! p4InputExpDropTable(dbh)) {496 exit(EXIT_FAILURE); 497 } 498 499 psDBCleanup(dbh); 500 } 501 502 { 503 psDB *dbh; 504 505 dbh = psDBInit("localhost", "test", NULL, "test"); 506 if (!dbh) { 507 exit(EXIT_FAILURE); 508 } 509 510 if (! p4SkyCellMapDropTable(dbh)) {511 exit(EXIT_FAILURE); 512 } 513 514 psDBCleanup(dbh); 515 } 516 517 { 518 psDB *dbh; 519 520 dbh = psDBInit("localhost", "test", NULL, "test"); 521 if (!dbh) { 522 exit(EXIT_FAILURE); 523 } 524 525 if (! p4SkyfileDropTable(dbh)) {526 exit(EXIT_FAILURE); 527 } 528 529 psDBCleanup(dbh); 530 } 531 532 { 533 psDB *dbh; 534 535 dbh = psDBInit("localhost", "test", NULL, "test"); 536 if (!dbh) { 537 exit(EXIT_FAILURE); 538 } 539 540 if (! p5RunDropTable(dbh)) {541 exit(EXIT_FAILURE); 542 } 543 544 psDBCleanup(dbh); 545 } 546 547 { 548 psDB *dbh; 549 550 dbh = psDBInit("localhost", "test", NULL, "test"); 551 if (!dbh) { 552 exit(EXIT_FAILURE); 553 } 554 555 if (! p5InputSkyfileDropTable(dbh)) {556 exit(EXIT_FAILURE); 557 } 558 559 psDBCleanup(dbh); 560 } 561 562 { 563 psDB *dbh; 564 565 dbh = psDBInit("localhost", "test", NULL, "test"); 566 if (!dbh) { 567 exit(EXIT_FAILURE); 568 } 569 570 if (! p5DiffSkyfileDropTable(dbh)) {571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if (! p6RunDropTable(dbh)) {586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 592 { 593 psDB *dbh; 594 595 dbh = psDBInit("localhost", "test", NULL, "test"); 596 if (!dbh) { 597 exit(EXIT_FAILURE); 598 } 599 600 if (! p6InputSkyfileDropTable(dbh)) {601 exit(EXIT_FAILURE); 602 } 603 604 psDBCleanup(dbh); 605 } 606 607 { 608 psDB *dbh; 609 610 dbh = psDBInit("localhost", "test", NULL, "test"); 611 if (!dbh) { 612 exit(EXIT_FAILURE); 613 } 614 615 if (! p6SumSkyfileDropTable(dbh)) {480 if (!warpRunDropTable(dbh)) { 481 exit(EXIT_FAILURE); 482 } 483 484 psDBCleanup(dbh); 485 } 486 487 { 488 psDB *dbh; 489 490 dbh = psDBInit("localhost", "test", NULL, "test"); 491 if (!dbh) { 492 exit(EXIT_FAILURE); 493 } 494 495 if (!warpInputExpDropTable(dbh)) { 496 exit(EXIT_FAILURE); 497 } 498 499 psDBCleanup(dbh); 500 } 501 502 { 503 psDB *dbh; 504 505 dbh = psDBInit("localhost", "test", NULL, "test"); 506 if (!dbh) { 507 exit(EXIT_FAILURE); 508 } 509 510 if (!warpSkyCellMapDropTable(dbh)) { 511 exit(EXIT_FAILURE); 512 } 513 514 psDBCleanup(dbh); 515 } 516 517 { 518 psDB *dbh; 519 520 dbh = psDBInit("localhost", "test", NULL, "test"); 521 if (!dbh) { 522 exit(EXIT_FAILURE); 523 } 524 525 if (!warpSkyfileDropTable(dbh)) { 526 exit(EXIT_FAILURE); 527 } 528 529 psDBCleanup(dbh); 530 } 531 532 { 533 psDB *dbh; 534 535 dbh = psDBInit("localhost", "test", NULL, "test"); 536 if (!dbh) { 537 exit(EXIT_FAILURE); 538 } 539 540 if (!diffRunDropTable(dbh)) { 541 exit(EXIT_FAILURE); 542 } 543 544 psDBCleanup(dbh); 545 } 546 547 { 548 psDB *dbh; 549 550 dbh = psDBInit("localhost", "test", NULL, "test"); 551 if (!dbh) { 552 exit(EXIT_FAILURE); 553 } 554 555 if (!diffInputSkyfileDropTable(dbh)) { 556 exit(EXIT_FAILURE); 557 } 558 559 psDBCleanup(dbh); 560 } 561 562 { 563 psDB *dbh; 564 565 dbh = psDBInit("localhost", "test", NULL, "test"); 566 if (!dbh) { 567 exit(EXIT_FAILURE); 568 } 569 570 if (!diffSkyfileDropTable(dbh)) { 571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if (!stackRunDropTable(dbh)) { 586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 592 { 593 psDB *dbh; 594 595 dbh = psDBInit("localhost", "test", NULL, "test"); 596 if (!dbh) { 597 exit(EXIT_FAILURE); 598 } 599 600 if (!stackInputSkyfileDropTable(dbh)) { 601 exit(EXIT_FAILURE); 602 } 603 604 psDBCleanup(dbh); 605 } 606 607 { 608 psDB *dbh; 609 610 dbh = psDBInit("localhost", "test", NULL, "test"); 611 if (!dbh) { 612 exit(EXIT_FAILURE); 613 } 614 615 if (!stackSumSkyfileDropTable(dbh)) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/insert.c
r11988 r12026 178 178 } 179 179 180 if (! p1PendingExpInsert(dbh, "a string", -32, "a string")) {181 exit(EXIT_FAILURE); 182 } 183 184 psDBCleanup(dbh); 185 } 186 187 { 188 psDB *dbh; 189 190 dbh = psDBInit("localhost", "test", NULL, "test"); 191 if (!dbh) { 192 exit(EXIT_FAILURE); 193 } 194 195 if (! p2PendingExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string", "a string")) {196 exit(EXIT_FAILURE); 197 } 198 199 psDBCleanup(dbh); 200 } 201 202 { 203 psDB *dbh; 204 205 dbh = psDBInit("localhost", "test", NULL, "test"); 206 if (!dbh) { 207 exit(EXIT_FAILURE); 208 } 209 210 if (! p2PendingImfileInsert(dbh, "a string", -32, -32, "a string", "a string", "a string")) {211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if (! p2ProcessedExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string")) {226 exit(EXIT_FAILURE); 227 } 228 229 psDBCleanup(dbh); 230 } 231 232 { 233 psDB *dbh; 234 235 dbh = psDBInit("localhost", "test", NULL, "test"); 236 if (!dbh) { 237 exit(EXIT_FAILURE); 238 } 239 240 if (! p2MaskInsert(dbh, "a string")) {241 exit(EXIT_FAILURE); 242 } 243 244 psDBCleanup(dbh); 245 } 246 247 { 248 psDB *dbh; 249 250 dbh = psDBInit("localhost", "test", NULL, "test"); 251 if (!dbh) { 252 exit(EXIT_FAILURE); 253 } 254 255 if (! p2ProcessedImfileInsert(dbh, "a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16)) {256 exit(EXIT_FAILURE); 257 } 258 259 psDBCleanup(dbh); 260 } 261 262 { 263 psDB *dbh; 264 265 dbh = psDBInit("localhost", "test", NULL, "test"); 266 if (!dbh) { 267 exit(EXIT_FAILURE); 268 } 269 270 if (! p3PendingExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string")) {271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (! p3ProcessedExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string")) {286 exit(EXIT_FAILURE); 287 } 288 289 psDBCleanup(dbh); 290 } 291 292 { 293 psDB *dbh; 294 295 dbh = psDBInit("localhost", "test", NULL, "test"); 296 if (!dbh) { 297 exit(EXIT_FAILURE); 298 } 299 300 if (! p3MaskInsert(dbh, "a string")) {180 if (!guidePendingExpInsert(dbh, "a string", -32, "a string")) { 181 exit(EXIT_FAILURE); 182 } 183 184 psDBCleanup(dbh); 185 } 186 187 { 188 psDB *dbh; 189 190 dbh = psDBInit("localhost", "test", NULL, "test"); 191 if (!dbh) { 192 exit(EXIT_FAILURE); 193 } 194 195 if (!chipPendingExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string", "a string")) { 196 exit(EXIT_FAILURE); 197 } 198 199 psDBCleanup(dbh); 200 } 201 202 { 203 psDB *dbh; 204 205 dbh = psDBInit("localhost", "test", NULL, "test"); 206 if (!dbh) { 207 exit(EXIT_FAILURE); 208 } 209 210 if (!chipPendingImfileInsert(dbh, "a string", -32, -32, "a string", "a string", "a string")) { 211 exit(EXIT_FAILURE); 212 } 213 214 psDBCleanup(dbh); 215 } 216 217 { 218 psDB *dbh; 219 220 dbh = psDBInit("localhost", "test", NULL, "test"); 221 if (!dbh) { 222 exit(EXIT_FAILURE); 223 } 224 225 if (!chipProcessedExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string")) { 226 exit(EXIT_FAILURE); 227 } 228 229 psDBCleanup(dbh); 230 } 231 232 { 233 psDB *dbh; 234 235 dbh = psDBInit("localhost", "test", NULL, "test"); 236 if (!dbh) { 237 exit(EXIT_FAILURE); 238 } 239 240 if (!chipMaskInsert(dbh, "a string")) { 241 exit(EXIT_FAILURE); 242 } 243 244 psDBCleanup(dbh); 245 } 246 247 { 248 psDB *dbh; 249 250 dbh = psDBInit("localhost", "test", NULL, "test"); 251 if (!dbh) { 252 exit(EXIT_FAILURE); 253 } 254 255 if (!chipProcessedImfileInsert(dbh, "a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16)) { 256 exit(EXIT_FAILURE); 257 } 258 259 psDBCleanup(dbh); 260 } 261 262 { 263 psDB *dbh; 264 265 dbh = psDBInit("localhost", "test", NULL, "test"); 266 if (!dbh) { 267 exit(EXIT_FAILURE); 268 } 269 270 if (!camPendingExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string")) { 271 exit(EXIT_FAILURE); 272 } 273 274 psDBCleanup(dbh); 275 } 276 277 { 278 psDB *dbh; 279 280 dbh = psDBInit("localhost", "test", NULL, "test"); 281 if (!dbh) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (!camProcessedExpInsert(dbh, "a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string")) { 286 exit(EXIT_FAILURE); 287 } 288 289 psDBCleanup(dbh); 290 } 291 292 { 293 psDB *dbh; 294 295 dbh = psDBInit("localhost", "test", NULL, "test"); 296 if (!dbh) { 297 exit(EXIT_FAILURE); 298 } 299 300 if (!camMaskInsert(dbh, "a string")) { 301 301 exit(EXIT_FAILURE); 302 302 } … … 478 478 } 479 479 480 if (! p4RunInsert(dbh, -32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z")) {481 exit(EXIT_FAILURE); 482 } 483 484 psDBCleanup(dbh); 485 } 486 487 { 488 psDB *dbh; 489 490 dbh = psDBInit("localhost", "test", NULL, "test"); 491 if (!dbh) { 492 exit(EXIT_FAILURE); 493 } 494 495 if (! p4InputExpInsert(dbh, -32, "a string", -32, true)) {496 exit(EXIT_FAILURE); 497 } 498 499 psDBCleanup(dbh); 500 } 501 502 { 503 psDB *dbh; 504 505 dbh = psDBInit("localhost", "test", NULL, "test"); 506 if (!dbh) { 507 exit(EXIT_FAILURE); 508 } 509 510 if (! p4SkyCellMapInsert(dbh, -32, "a string", "a string", "a string", -32, "a string")) {511 exit(EXIT_FAILURE); 512 } 513 514 psDBCleanup(dbh); 515 } 516 517 { 518 psDB *dbh; 519 520 dbh = psDBInit("localhost", "test", NULL, "test"); 521 if (!dbh) { 522 exit(EXIT_FAILURE); 523 } 524 525 if (! p4SkyfileInsert(dbh, -32, "a string", "a string", "a string", 64.64, 64.64)) {526 exit(EXIT_FAILURE); 527 } 528 529 psDBCleanup(dbh); 530 } 531 532 { 533 psDB *dbh; 534 535 dbh = psDBInit("localhost", "test", NULL, "test"); 536 if (!dbh) { 537 exit(EXIT_FAILURE); 538 } 539 540 if (! p5RunInsert(dbh, -32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) {541 exit(EXIT_FAILURE); 542 } 543 544 psDBCleanup(dbh); 545 } 546 547 { 548 psDB *dbh; 549 550 dbh = psDBInit("localhost", "test", NULL, "test"); 551 if (!dbh) { 552 exit(EXIT_FAILURE); 553 } 554 555 if (! p5InputSkyfileInsert(dbh, -32, -32, "a string", "a string", "a string", true)) {556 exit(EXIT_FAILURE); 557 } 558 559 psDBCleanup(dbh); 560 } 561 562 { 563 psDB *dbh; 564 565 dbh = psDBInit("localhost", "test", NULL, "test"); 566 if (!dbh) { 567 exit(EXIT_FAILURE); 568 } 569 570 if (! p5DiffSkyfileInsert(dbh, -32, "a string", 64.64, 64.64)) {571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if (! p6RunInsert(dbh, -32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) {586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 592 { 593 psDB *dbh; 594 595 dbh = psDBInit("localhost", "test", NULL, "test"); 596 if (!dbh) { 597 exit(EXIT_FAILURE); 598 } 599 600 if (! p6InputSkyfileInsert(dbh, -32, -32)) {601 exit(EXIT_FAILURE); 602 } 603 604 psDBCleanup(dbh); 605 } 606 607 { 608 psDB *dbh; 609 610 dbh = psDBInit("localhost", "test", NULL, "test"); 611 if (!dbh) { 612 exit(EXIT_FAILURE); 613 } 614 615 if (! p6SumSkyfileInsert(dbh, -32, "a string", 64.64, 64.64)) {480 if (!warpRunInsert(dbh, -32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z")) { 481 exit(EXIT_FAILURE); 482 } 483 484 psDBCleanup(dbh); 485 } 486 487 { 488 psDB *dbh; 489 490 dbh = psDBInit("localhost", "test", NULL, "test"); 491 if (!dbh) { 492 exit(EXIT_FAILURE); 493 } 494 495 if (!warpInputExpInsert(dbh, -32, "a string", -32, true)) { 496 exit(EXIT_FAILURE); 497 } 498 499 psDBCleanup(dbh); 500 } 501 502 { 503 psDB *dbh; 504 505 dbh = psDBInit("localhost", "test", NULL, "test"); 506 if (!dbh) { 507 exit(EXIT_FAILURE); 508 } 509 510 if (!warpSkyCellMapInsert(dbh, -32, "a string", "a string", "a string", -32, "a string")) { 511 exit(EXIT_FAILURE); 512 } 513 514 psDBCleanup(dbh); 515 } 516 517 { 518 psDB *dbh; 519 520 dbh = psDBInit("localhost", "test", NULL, "test"); 521 if (!dbh) { 522 exit(EXIT_FAILURE); 523 } 524 525 if (!warpSkyfileInsert(dbh, -32, "a string", "a string", "a string", 64.64, 64.64)) { 526 exit(EXIT_FAILURE); 527 } 528 529 psDBCleanup(dbh); 530 } 531 532 { 533 psDB *dbh; 534 535 dbh = psDBInit("localhost", "test", NULL, "test"); 536 if (!dbh) { 537 exit(EXIT_FAILURE); 538 } 539 540 if (!diffRunInsert(dbh, -32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) { 541 exit(EXIT_FAILURE); 542 } 543 544 psDBCleanup(dbh); 545 } 546 547 { 548 psDB *dbh; 549 550 dbh = psDBInit("localhost", "test", NULL, "test"); 551 if (!dbh) { 552 exit(EXIT_FAILURE); 553 } 554 555 if (!diffInputSkyfileInsert(dbh, -32, -32, "a string", "a string", "a string", true)) { 556 exit(EXIT_FAILURE); 557 } 558 559 psDBCleanup(dbh); 560 } 561 562 { 563 psDB *dbh; 564 565 dbh = psDBInit("localhost", "test", NULL, "test"); 566 if (!dbh) { 567 exit(EXIT_FAILURE); 568 } 569 570 if (!diffSkyfileInsert(dbh, -32, "a string", 64.64, 64.64)) { 571 exit(EXIT_FAILURE); 572 } 573 574 psDBCleanup(dbh); 575 } 576 577 { 578 psDB *dbh; 579 580 dbh = psDBInit("localhost", "test", NULL, "test"); 581 if (!dbh) { 582 exit(EXIT_FAILURE); 583 } 584 585 if (!stackRunInsert(dbh, -32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string")) { 586 exit(EXIT_FAILURE); 587 } 588 589 psDBCleanup(dbh); 590 } 591 592 { 593 psDB *dbh; 594 595 dbh = psDBInit("localhost", "test", NULL, "test"); 596 if (!dbh) { 597 exit(EXIT_FAILURE); 598 } 599 600 if (!stackInputSkyfileInsert(dbh, -32, -32)) { 601 exit(EXIT_FAILURE); 602 } 603 604 psDBCleanup(dbh); 605 } 606 607 { 608 psDB *dbh; 609 610 dbh = psDBInit("localhost", "test", NULL, "test"); 611 if (!dbh) { 612 exit(EXIT_FAILURE); 613 } 614 615 if (!stackSumSkyfileInsert(dbh, -32, "a string", 64.64, 64.64)) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/insertfits.c
r11988 r12026 310 310 } 311 311 312 if (! p1PendingExpInsertFits(dbh, fits)) {313 exit(EXIT_FAILURE); 314 } 315 316 if (!psFitsClose(fits)) { 317 exit(EXIT_FAILURE); 318 } 319 320 psDBCleanup(dbh); 321 } 322 323 { 324 psDB *dbh; 325 psFits *fits; 326 327 dbh = psDBInit("localhost", "test", NULL, "test"); 328 if (!dbh) { 329 exit(EXIT_FAILURE); 330 } 331 332 // open a temp 333 fits = psFitsOpen(TMP_FILENAME, "r"); 334 if (!fits) { 335 exit(EXIT_FAILURE); 336 } 337 338 if (! p2PendingExpInsertFits(dbh, fits)) {339 exit(EXIT_FAILURE); 340 } 341 342 if (!psFitsClose(fits)) { 343 exit(EXIT_FAILURE); 344 } 345 346 psDBCleanup(dbh); 347 } 348 349 { 350 psDB *dbh; 351 psFits *fits; 352 353 dbh = psDBInit("localhost", "test", NULL, "test"); 354 if (!dbh) { 355 exit(EXIT_FAILURE); 356 } 357 358 // open a temp 359 fits = psFitsOpen(TMP_FILENAME, "r"); 360 if (!fits) { 361 exit(EXIT_FAILURE); 362 } 363 364 if (! p2PendingImfileInsertFits(dbh, fits)) {365 exit(EXIT_FAILURE); 366 } 367 368 if (!psFitsClose(fits)) { 369 exit(EXIT_FAILURE); 370 } 371 372 psDBCleanup(dbh); 373 } 374 375 { 376 psDB *dbh; 377 psFits *fits; 378 379 dbh = psDBInit("localhost", "test", NULL, "test"); 380 if (!dbh) { 381 exit(EXIT_FAILURE); 382 } 383 384 // open a temp 385 fits = psFitsOpen(TMP_FILENAME, "r"); 386 if (!fits) { 387 exit(EXIT_FAILURE); 388 } 389 390 if (! p2ProcessedExpInsertFits(dbh, fits)) {391 exit(EXIT_FAILURE); 392 } 393 394 if (!psFitsClose(fits)) { 395 exit(EXIT_FAILURE); 396 } 397 398 psDBCleanup(dbh); 399 } 400 401 { 402 psDB *dbh; 403 psFits *fits; 404 405 dbh = psDBInit("localhost", "test", NULL, "test"); 406 if (!dbh) { 407 exit(EXIT_FAILURE); 408 } 409 410 // open a temp 411 fits = psFitsOpen(TMP_FILENAME, "r"); 412 if (!fits) { 413 exit(EXIT_FAILURE); 414 } 415 416 if (! p2MaskInsertFits(dbh, fits)) {417 exit(EXIT_FAILURE); 418 } 419 420 if (!psFitsClose(fits)) { 421 exit(EXIT_FAILURE); 422 } 423 424 psDBCleanup(dbh); 425 } 426 427 { 428 psDB *dbh; 429 psFits *fits; 430 431 dbh = psDBInit("localhost", "test", NULL, "test"); 432 if (!dbh) { 433 exit(EXIT_FAILURE); 434 } 435 436 // open a temp 437 fits = psFitsOpen(TMP_FILENAME, "r"); 438 if (!fits) { 439 exit(EXIT_FAILURE); 440 } 441 442 if (! p2ProcessedImfileInsertFits(dbh, fits)) {443 exit(EXIT_FAILURE); 444 } 445 446 if (!psFitsClose(fits)) { 447 exit(EXIT_FAILURE); 448 } 449 450 psDBCleanup(dbh); 451 } 452 453 { 454 psDB *dbh; 455 psFits *fits; 456 457 dbh = psDBInit("localhost", "test", NULL, "test"); 458 if (!dbh) { 459 exit(EXIT_FAILURE); 460 } 461 462 // open a temp 463 fits = psFitsOpen(TMP_FILENAME, "r"); 464 if (!fits) { 465 exit(EXIT_FAILURE); 466 } 467 468 if (! p3PendingExpInsertFits(dbh, fits)) {469 exit(EXIT_FAILURE); 470 } 471 472 if (!psFitsClose(fits)) { 473 exit(EXIT_FAILURE); 474 } 475 476 psDBCleanup(dbh); 477 } 478 479 { 480 psDB *dbh; 481 psFits *fits; 482 483 dbh = psDBInit("localhost", "test", NULL, "test"); 484 if (!dbh) { 485 exit(EXIT_FAILURE); 486 } 487 488 // open a temp 489 fits = psFitsOpen(TMP_FILENAME, "r"); 490 if (!fits) { 491 exit(EXIT_FAILURE); 492 } 493 494 if (! p3ProcessedExpInsertFits(dbh, fits)) {495 exit(EXIT_FAILURE); 496 } 497 498 if (!psFitsClose(fits)) { 499 exit(EXIT_FAILURE); 500 } 501 502 psDBCleanup(dbh); 503 } 504 505 { 506 psDB *dbh; 507 psFits *fits; 508 509 dbh = psDBInit("localhost", "test", NULL, "test"); 510 if (!dbh) { 511 exit(EXIT_FAILURE); 512 } 513 514 // open a temp 515 fits = psFitsOpen(TMP_FILENAME, "r"); 516 if (!fits) { 517 exit(EXIT_FAILURE); 518 } 519 520 if (! p3MaskInsertFits(dbh, fits)) {312 if (!guidePendingExpInsertFits(dbh, fits)) { 313 exit(EXIT_FAILURE); 314 } 315 316 if (!psFitsClose(fits)) { 317 exit(EXIT_FAILURE); 318 } 319 320 psDBCleanup(dbh); 321 } 322 323 { 324 psDB *dbh; 325 psFits *fits; 326 327 dbh = psDBInit("localhost", "test", NULL, "test"); 328 if (!dbh) { 329 exit(EXIT_FAILURE); 330 } 331 332 // open a temp 333 fits = psFitsOpen(TMP_FILENAME, "r"); 334 if (!fits) { 335 exit(EXIT_FAILURE); 336 } 337 338 if (!chipPendingExpInsertFits(dbh, fits)) { 339 exit(EXIT_FAILURE); 340 } 341 342 if (!psFitsClose(fits)) { 343 exit(EXIT_FAILURE); 344 } 345 346 psDBCleanup(dbh); 347 } 348 349 { 350 psDB *dbh; 351 psFits *fits; 352 353 dbh = psDBInit("localhost", "test", NULL, "test"); 354 if (!dbh) { 355 exit(EXIT_FAILURE); 356 } 357 358 // open a temp 359 fits = psFitsOpen(TMP_FILENAME, "r"); 360 if (!fits) { 361 exit(EXIT_FAILURE); 362 } 363 364 if (!chipPendingImfileInsertFits(dbh, fits)) { 365 exit(EXIT_FAILURE); 366 } 367 368 if (!psFitsClose(fits)) { 369 exit(EXIT_FAILURE); 370 } 371 372 psDBCleanup(dbh); 373 } 374 375 { 376 psDB *dbh; 377 psFits *fits; 378 379 dbh = psDBInit("localhost", "test", NULL, "test"); 380 if (!dbh) { 381 exit(EXIT_FAILURE); 382 } 383 384 // open a temp 385 fits = psFitsOpen(TMP_FILENAME, "r"); 386 if (!fits) { 387 exit(EXIT_FAILURE); 388 } 389 390 if (!chipProcessedExpInsertFits(dbh, fits)) { 391 exit(EXIT_FAILURE); 392 } 393 394 if (!psFitsClose(fits)) { 395 exit(EXIT_FAILURE); 396 } 397 398 psDBCleanup(dbh); 399 } 400 401 { 402 psDB *dbh; 403 psFits *fits; 404 405 dbh = psDBInit("localhost", "test", NULL, "test"); 406 if (!dbh) { 407 exit(EXIT_FAILURE); 408 } 409 410 // open a temp 411 fits = psFitsOpen(TMP_FILENAME, "r"); 412 if (!fits) { 413 exit(EXIT_FAILURE); 414 } 415 416 if (!chipMaskInsertFits(dbh, fits)) { 417 exit(EXIT_FAILURE); 418 } 419 420 if (!psFitsClose(fits)) { 421 exit(EXIT_FAILURE); 422 } 423 424 psDBCleanup(dbh); 425 } 426 427 { 428 psDB *dbh; 429 psFits *fits; 430 431 dbh = psDBInit("localhost", "test", NULL, "test"); 432 if (!dbh) { 433 exit(EXIT_FAILURE); 434 } 435 436 // open a temp 437 fits = psFitsOpen(TMP_FILENAME, "r"); 438 if (!fits) { 439 exit(EXIT_FAILURE); 440 } 441 442 if (!chipProcessedImfileInsertFits(dbh, fits)) { 443 exit(EXIT_FAILURE); 444 } 445 446 if (!psFitsClose(fits)) { 447 exit(EXIT_FAILURE); 448 } 449 450 psDBCleanup(dbh); 451 } 452 453 { 454 psDB *dbh; 455 psFits *fits; 456 457 dbh = psDBInit("localhost", "test", NULL, "test"); 458 if (!dbh) { 459 exit(EXIT_FAILURE); 460 } 461 462 // open a temp 463 fits = psFitsOpen(TMP_FILENAME, "r"); 464 if (!fits) { 465 exit(EXIT_FAILURE); 466 } 467 468 if (!camPendingExpInsertFits(dbh, fits)) { 469 exit(EXIT_FAILURE); 470 } 471 472 if (!psFitsClose(fits)) { 473 exit(EXIT_FAILURE); 474 } 475 476 psDBCleanup(dbh); 477 } 478 479 { 480 psDB *dbh; 481 psFits *fits; 482 483 dbh = psDBInit("localhost", "test", NULL, "test"); 484 if (!dbh) { 485 exit(EXIT_FAILURE); 486 } 487 488 // open a temp 489 fits = psFitsOpen(TMP_FILENAME, "r"); 490 if (!fits) { 491 exit(EXIT_FAILURE); 492 } 493 494 if (!camProcessedExpInsertFits(dbh, fits)) { 495 exit(EXIT_FAILURE); 496 } 497 498 if (!psFitsClose(fits)) { 499 exit(EXIT_FAILURE); 500 } 501 502 psDBCleanup(dbh); 503 } 504 505 { 506 psDB *dbh; 507 psFits *fits; 508 509 dbh = psDBInit("localhost", "test", NULL, "test"); 510 if (!dbh) { 511 exit(EXIT_FAILURE); 512 } 513 514 // open a temp 515 fits = psFitsOpen(TMP_FILENAME, "r"); 516 if (!fits) { 517 exit(EXIT_FAILURE); 518 } 519 520 if (!camMaskInsertFits(dbh, fits)) { 521 521 exit(EXIT_FAILURE); 522 522 } … … 830 830 } 831 831 832 if (! p4RunInsertFits(dbh, fits)) {833 exit(EXIT_FAILURE); 834 } 835 836 if (!psFitsClose(fits)) { 837 exit(EXIT_FAILURE); 838 } 839 840 psDBCleanup(dbh); 841 } 842 843 { 844 psDB *dbh; 845 psFits *fits; 846 847 dbh = psDBInit("localhost", "test", NULL, "test"); 848 if (!dbh) { 849 exit(EXIT_FAILURE); 850 } 851 852 // open a temp 853 fits = psFitsOpen(TMP_FILENAME, "r"); 854 if (!fits) { 855 exit(EXIT_FAILURE); 856 } 857 858 if (! p4InputExpInsertFits(dbh, fits)) {859 exit(EXIT_FAILURE); 860 } 861 862 if (!psFitsClose(fits)) { 863 exit(EXIT_FAILURE); 864 } 865 866 psDBCleanup(dbh); 867 } 868 869 { 870 psDB *dbh; 871 psFits *fits; 872 873 dbh = psDBInit("localhost", "test", NULL, "test"); 874 if (!dbh) { 875 exit(EXIT_FAILURE); 876 } 877 878 // open a temp 879 fits = psFitsOpen(TMP_FILENAME, "r"); 880 if (!fits) { 881 exit(EXIT_FAILURE); 882 } 883 884 if (! p4SkyCellMapInsertFits(dbh, fits)) {885 exit(EXIT_FAILURE); 886 } 887 888 if (!psFitsClose(fits)) { 889 exit(EXIT_FAILURE); 890 } 891 892 psDBCleanup(dbh); 893 } 894 895 { 896 psDB *dbh; 897 psFits *fits; 898 899 dbh = psDBInit("localhost", "test", NULL, "test"); 900 if (!dbh) { 901 exit(EXIT_FAILURE); 902 } 903 904 // open a temp 905 fits = psFitsOpen(TMP_FILENAME, "r"); 906 if (!fits) { 907 exit(EXIT_FAILURE); 908 } 909 910 if (! p4SkyfileInsertFits(dbh, fits)) {911 exit(EXIT_FAILURE); 912 } 913 914 if (!psFitsClose(fits)) { 915 exit(EXIT_FAILURE); 916 } 917 918 psDBCleanup(dbh); 919 } 920 921 { 922 psDB *dbh; 923 psFits *fits; 924 925 dbh = psDBInit("localhost", "test", NULL, "test"); 926 if (!dbh) { 927 exit(EXIT_FAILURE); 928 } 929 930 // open a temp 931 fits = psFitsOpen(TMP_FILENAME, "r"); 932 if (!fits) { 933 exit(EXIT_FAILURE); 934 } 935 936 if (! p5RunInsertFits(dbh, fits)) {937 exit(EXIT_FAILURE); 938 } 939 940 if (!psFitsClose(fits)) { 941 exit(EXIT_FAILURE); 942 } 943 944 psDBCleanup(dbh); 945 } 946 947 { 948 psDB *dbh; 949 psFits *fits; 950 951 dbh = psDBInit("localhost", "test", NULL, "test"); 952 if (!dbh) { 953 exit(EXIT_FAILURE); 954 } 955 956 // open a temp 957 fits = psFitsOpen(TMP_FILENAME, "r"); 958 if (!fits) { 959 exit(EXIT_FAILURE); 960 } 961 962 if (! p5InputSkyfileInsertFits(dbh, fits)) {963 exit(EXIT_FAILURE); 964 } 965 966 if (!psFitsClose(fits)) { 967 exit(EXIT_FAILURE); 968 } 969 970 psDBCleanup(dbh); 971 } 972 973 { 974 psDB *dbh; 975 psFits *fits; 976 977 dbh = psDBInit("localhost", "test", NULL, "test"); 978 if (!dbh) { 979 exit(EXIT_FAILURE); 980 } 981 982 // open a temp 983 fits = psFitsOpen(TMP_FILENAME, "r"); 984 if (!fits) { 985 exit(EXIT_FAILURE); 986 } 987 988 if (! p5DiffSkyfileInsertFits(dbh, fits)) {989 exit(EXIT_FAILURE); 990 } 991 992 if (!psFitsClose(fits)) { 993 exit(EXIT_FAILURE); 994 } 995 996 psDBCleanup(dbh); 997 } 998 999 { 1000 psDB *dbh; 1001 psFits *fits; 1002 1003 dbh = psDBInit("localhost", "test", NULL, "test"); 1004 if (!dbh) { 1005 exit(EXIT_FAILURE); 1006 } 1007 1008 // open a temp 1009 fits = psFitsOpen(TMP_FILENAME, "r"); 1010 if (!fits) { 1011 exit(EXIT_FAILURE); 1012 } 1013 1014 if (! p6RunInsertFits(dbh, fits)) {1015 exit(EXIT_FAILURE); 1016 } 1017 1018 if (!psFitsClose(fits)) { 1019 exit(EXIT_FAILURE); 1020 } 1021 1022 psDBCleanup(dbh); 1023 } 1024 1025 { 1026 psDB *dbh; 1027 psFits *fits; 1028 1029 dbh = psDBInit("localhost", "test", NULL, "test"); 1030 if (!dbh) { 1031 exit(EXIT_FAILURE); 1032 } 1033 1034 // open a temp 1035 fits = psFitsOpen(TMP_FILENAME, "r"); 1036 if (!fits) { 1037 exit(EXIT_FAILURE); 1038 } 1039 1040 if (! p6InputSkyfileInsertFits(dbh, fits)) {1041 exit(EXIT_FAILURE); 1042 } 1043 1044 if (!psFitsClose(fits)) { 1045 exit(EXIT_FAILURE); 1046 } 1047 1048 psDBCleanup(dbh); 1049 } 1050 1051 { 1052 psDB *dbh; 1053 psFits *fits; 1054 1055 dbh = psDBInit("localhost", "test", NULL, "test"); 1056 if (!dbh) { 1057 exit(EXIT_FAILURE); 1058 } 1059 1060 // open a temp 1061 fits = psFitsOpen(TMP_FILENAME, "r"); 1062 if (!fits) { 1063 exit(EXIT_FAILURE); 1064 } 1065 1066 if (! p6SumSkyfileInsertFits(dbh, fits)) {832 if (!warpRunInsertFits(dbh, fits)) { 833 exit(EXIT_FAILURE); 834 } 835 836 if (!psFitsClose(fits)) { 837 exit(EXIT_FAILURE); 838 } 839 840 psDBCleanup(dbh); 841 } 842 843 { 844 psDB *dbh; 845 psFits *fits; 846 847 dbh = psDBInit("localhost", "test", NULL, "test"); 848 if (!dbh) { 849 exit(EXIT_FAILURE); 850 } 851 852 // open a temp 853 fits = psFitsOpen(TMP_FILENAME, "r"); 854 if (!fits) { 855 exit(EXIT_FAILURE); 856 } 857 858 if (!warpInputExpInsertFits(dbh, fits)) { 859 exit(EXIT_FAILURE); 860 } 861 862 if (!psFitsClose(fits)) { 863 exit(EXIT_FAILURE); 864 } 865 866 psDBCleanup(dbh); 867 } 868 869 { 870 psDB *dbh; 871 psFits *fits; 872 873 dbh = psDBInit("localhost", "test", NULL, "test"); 874 if (!dbh) { 875 exit(EXIT_FAILURE); 876 } 877 878 // open a temp 879 fits = psFitsOpen(TMP_FILENAME, "r"); 880 if (!fits) { 881 exit(EXIT_FAILURE); 882 } 883 884 if (!warpSkyCellMapInsertFits(dbh, fits)) { 885 exit(EXIT_FAILURE); 886 } 887 888 if (!psFitsClose(fits)) { 889 exit(EXIT_FAILURE); 890 } 891 892 psDBCleanup(dbh); 893 } 894 895 { 896 psDB *dbh; 897 psFits *fits; 898 899 dbh = psDBInit("localhost", "test", NULL, "test"); 900 if (!dbh) { 901 exit(EXIT_FAILURE); 902 } 903 904 // open a temp 905 fits = psFitsOpen(TMP_FILENAME, "r"); 906 if (!fits) { 907 exit(EXIT_FAILURE); 908 } 909 910 if (!warpSkyfileInsertFits(dbh, fits)) { 911 exit(EXIT_FAILURE); 912 } 913 914 if (!psFitsClose(fits)) { 915 exit(EXIT_FAILURE); 916 } 917 918 psDBCleanup(dbh); 919 } 920 921 { 922 psDB *dbh; 923 psFits *fits; 924 925 dbh = psDBInit("localhost", "test", NULL, "test"); 926 if (!dbh) { 927 exit(EXIT_FAILURE); 928 } 929 930 // open a temp 931 fits = psFitsOpen(TMP_FILENAME, "r"); 932 if (!fits) { 933 exit(EXIT_FAILURE); 934 } 935 936 if (!diffRunInsertFits(dbh, fits)) { 937 exit(EXIT_FAILURE); 938 } 939 940 if (!psFitsClose(fits)) { 941 exit(EXIT_FAILURE); 942 } 943 944 psDBCleanup(dbh); 945 } 946 947 { 948 psDB *dbh; 949 psFits *fits; 950 951 dbh = psDBInit("localhost", "test", NULL, "test"); 952 if (!dbh) { 953 exit(EXIT_FAILURE); 954 } 955 956 // open a temp 957 fits = psFitsOpen(TMP_FILENAME, "r"); 958 if (!fits) { 959 exit(EXIT_FAILURE); 960 } 961 962 if (!diffInputSkyfileInsertFits(dbh, fits)) { 963 exit(EXIT_FAILURE); 964 } 965 966 if (!psFitsClose(fits)) { 967 exit(EXIT_FAILURE); 968 } 969 970 psDBCleanup(dbh); 971 } 972 973 { 974 psDB *dbh; 975 psFits *fits; 976 977 dbh = psDBInit("localhost", "test", NULL, "test"); 978 if (!dbh) { 979 exit(EXIT_FAILURE); 980 } 981 982 // open a temp 983 fits = psFitsOpen(TMP_FILENAME, "r"); 984 if (!fits) { 985 exit(EXIT_FAILURE); 986 } 987 988 if (!diffSkyfileInsertFits(dbh, fits)) { 989 exit(EXIT_FAILURE); 990 } 991 992 if (!psFitsClose(fits)) { 993 exit(EXIT_FAILURE); 994 } 995 996 psDBCleanup(dbh); 997 } 998 999 { 1000 psDB *dbh; 1001 psFits *fits; 1002 1003 dbh = psDBInit("localhost", "test", NULL, "test"); 1004 if (!dbh) { 1005 exit(EXIT_FAILURE); 1006 } 1007 1008 // open a temp 1009 fits = psFitsOpen(TMP_FILENAME, "r"); 1010 if (!fits) { 1011 exit(EXIT_FAILURE); 1012 } 1013 1014 if (!stackRunInsertFits(dbh, fits)) { 1015 exit(EXIT_FAILURE); 1016 } 1017 1018 if (!psFitsClose(fits)) { 1019 exit(EXIT_FAILURE); 1020 } 1021 1022 psDBCleanup(dbh); 1023 } 1024 1025 { 1026 psDB *dbh; 1027 psFits *fits; 1028 1029 dbh = psDBInit("localhost", "test", NULL, "test"); 1030 if (!dbh) { 1031 exit(EXIT_FAILURE); 1032 } 1033 1034 // open a temp 1035 fits = psFitsOpen(TMP_FILENAME, "r"); 1036 if (!fits) { 1037 exit(EXIT_FAILURE); 1038 } 1039 1040 if (!stackInputSkyfileInsertFits(dbh, fits)) { 1041 exit(EXIT_FAILURE); 1042 } 1043 1044 if (!psFitsClose(fits)) { 1045 exit(EXIT_FAILURE); 1046 } 1047 1048 psDBCleanup(dbh); 1049 } 1050 1051 { 1052 psDB *dbh; 1053 psFits *fits; 1054 1055 dbh = psDBInit("localhost", "test", NULL, "test"); 1056 if (!dbh) { 1057 exit(EXIT_FAILURE); 1058 } 1059 1060 // open a temp 1061 fits = psFitsOpen(TMP_FILENAME, "r"); 1062 if (!fits) { 1063 exit(EXIT_FAILURE); 1064 } 1065 1066 if (!stackSumSkyfileInsertFits(dbh, fits)) { 1067 1067 exit(EXIT_FAILURE); 1068 1068 } -
trunk/ippdb/tests/insertobject.c
r11988 r12026 249 249 { 250 250 psDB *dbh; 251 p1PendingExpRow *object;252 253 dbh = psDBInit("localhost", "test", NULL, "test"); 254 if (!dbh) { 255 exit(EXIT_FAILURE); 256 } 257 258 object = p1PendingExpRowAlloc("a string", -32, "a string");259 if (!object) { 260 exit(EXIT_FAILURE); 261 } 262 263 if (! p1PendingExpInsertObject(dbh, object)) {264 exit(EXIT_FAILURE); 265 } 266 267 psFree(object); 268 psDBCleanup(dbh); 269 } 270 271 { 272 psDB *dbh; 273 p2PendingExpRow *object;274 275 dbh = psDBInit("localhost", "test", NULL, "test"); 276 if (!dbh) { 277 exit(EXIT_FAILURE); 278 } 279 280 object = p2PendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", "a string");281 if (!object) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (! p2PendingExpInsertObject(dbh, object)) {286 exit(EXIT_FAILURE); 287 } 288 289 psFree(object); 290 psDBCleanup(dbh); 291 } 292 293 { 294 psDB *dbh; 295 p2PendingImfileRow *object;296 297 dbh = psDBInit("localhost", "test", NULL, "test"); 298 if (!dbh) { 299 exit(EXIT_FAILURE); 300 } 301 302 object = p2PendingImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string");303 if (!object) { 304 exit(EXIT_FAILURE); 305 } 306 307 if (! p2PendingImfileInsertObject(dbh, object)) {308 exit(EXIT_FAILURE); 309 } 310 311 psFree(object); 312 psDBCleanup(dbh); 313 } 314 315 { 316 psDB *dbh; 317 p2ProcessedExpRow *object;318 319 dbh = psDBInit("localhost", "test", NULL, "test"); 320 if (!dbh) { 321 exit(EXIT_FAILURE); 322 } 323 324 object = p2ProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string");325 if (!object) { 326 exit(EXIT_FAILURE); 327 } 328 329 if (! p2ProcessedExpInsertObject(dbh, object)) {330 exit(EXIT_FAILURE); 331 } 332 333 psFree(object); 334 psDBCleanup(dbh); 335 } 336 337 { 338 psDB *dbh; 339 p2MaskRow*object;340 341 dbh = psDBInit("localhost", "test", NULL, "test"); 342 if (!dbh) { 343 exit(EXIT_FAILURE); 344 } 345 346 object = p2MaskRowAlloc("a string");347 if (!object) { 348 exit(EXIT_FAILURE); 349 } 350 351 if (! p2MaskInsertObject(dbh, object)) {352 exit(EXIT_FAILURE); 353 } 354 355 psFree(object); 356 psDBCleanup(dbh); 357 } 358 359 { 360 psDB *dbh; 361 p2ProcessedImfileRow *object;362 363 dbh = psDBInit("localhost", "test", NULL, "test"); 364 if (!dbh) { 365 exit(EXIT_FAILURE); 366 } 367 368 object = p2ProcessedImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16);369 if (!object) { 370 exit(EXIT_FAILURE); 371 } 372 373 if (! p2ProcessedImfileInsertObject(dbh, object)) {374 exit(EXIT_FAILURE); 375 } 376 377 psFree(object); 378 psDBCleanup(dbh); 379 } 380 381 { 382 psDB *dbh; 383 p3PendingExpRow *object;384 385 dbh = psDBInit("localhost", "test", NULL, "test"); 386 if (!dbh) { 387 exit(EXIT_FAILURE); 388 } 389 390 object = p3PendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string");391 if (!object) { 392 exit(EXIT_FAILURE); 393 } 394 395 if (! p3PendingExpInsertObject(dbh, object)) {396 exit(EXIT_FAILURE); 397 } 398 399 psFree(object); 400 psDBCleanup(dbh); 401 } 402 403 { 404 psDB *dbh; 405 p3ProcessedExpRow *object;406 407 dbh = psDBInit("localhost", "test", NULL, "test"); 408 if (!dbh) { 409 exit(EXIT_FAILURE); 410 } 411 412 object = p3ProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string");413 if (!object) { 414 exit(EXIT_FAILURE); 415 } 416 417 if (! p3ProcessedExpInsertObject(dbh, object)) {418 exit(EXIT_FAILURE); 419 } 420 421 psFree(object); 422 psDBCleanup(dbh); 423 } 424 425 { 426 psDB *dbh; 427 p3MaskRow*object;428 429 dbh = psDBInit("localhost", "test", NULL, "test"); 430 if (!dbh) { 431 exit(EXIT_FAILURE); 432 } 433 434 object = p3MaskRowAlloc("a string");435 if (!object) { 436 exit(EXIT_FAILURE); 437 } 438 439 if (! p3MaskInsertObject(dbh, object)) {251 guidePendingExpRow *object; 252 253 dbh = psDBInit("localhost", "test", NULL, "test"); 254 if (!dbh) { 255 exit(EXIT_FAILURE); 256 } 257 258 object = guidePendingExpRowAlloc("a string", -32, "a string"); 259 if (!object) { 260 exit(EXIT_FAILURE); 261 } 262 263 if (!guidePendingExpInsertObject(dbh, object)) { 264 exit(EXIT_FAILURE); 265 } 266 267 psFree(object); 268 psDBCleanup(dbh); 269 } 270 271 { 272 psDB *dbh; 273 chipPendingExpRow *object; 274 275 dbh = psDBInit("localhost", "test", NULL, "test"); 276 if (!dbh) { 277 exit(EXIT_FAILURE); 278 } 279 280 object = chipPendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", "a string"); 281 if (!object) { 282 exit(EXIT_FAILURE); 283 } 284 285 if (!chipPendingExpInsertObject(dbh, object)) { 286 exit(EXIT_FAILURE); 287 } 288 289 psFree(object); 290 psDBCleanup(dbh); 291 } 292 293 { 294 psDB *dbh; 295 chipPendingImfileRow *object; 296 297 dbh = psDBInit("localhost", "test", NULL, "test"); 298 if (!dbh) { 299 exit(EXIT_FAILURE); 300 } 301 302 object = chipPendingImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string"); 303 if (!object) { 304 exit(EXIT_FAILURE); 305 } 306 307 if (!chipPendingImfileInsertObject(dbh, object)) { 308 exit(EXIT_FAILURE); 309 } 310 311 psFree(object); 312 psDBCleanup(dbh); 313 } 314 315 { 316 psDB *dbh; 317 chipProcessedExpRow *object; 318 319 dbh = psDBInit("localhost", "test", NULL, "test"); 320 if (!dbh) { 321 exit(EXIT_FAILURE); 322 } 323 324 object = chipProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string"); 325 if (!object) { 326 exit(EXIT_FAILURE); 327 } 328 329 if (!chipProcessedExpInsertObject(dbh, object)) { 330 exit(EXIT_FAILURE); 331 } 332 333 psFree(object); 334 psDBCleanup(dbh); 335 } 336 337 { 338 psDB *dbh; 339 chipMaskRow *object; 340 341 dbh = psDBInit("localhost", "test", NULL, "test"); 342 if (!dbh) { 343 exit(EXIT_FAILURE); 344 } 345 346 object = chipMaskRowAlloc("a string"); 347 if (!object) { 348 exit(EXIT_FAILURE); 349 } 350 351 if (!chipMaskInsertObject(dbh, object)) { 352 exit(EXIT_FAILURE); 353 } 354 355 psFree(object); 356 psDBCleanup(dbh); 357 } 358 359 { 360 psDB *dbh; 361 chipProcessedImfileRow *object; 362 363 dbh = psDBInit("localhost", "test", NULL, "test"); 364 if (!dbh) { 365 exit(EXIT_FAILURE); 366 } 367 368 object = chipProcessedImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16); 369 if (!object) { 370 exit(EXIT_FAILURE); 371 } 372 373 if (!chipProcessedImfileInsertObject(dbh, object)) { 374 exit(EXIT_FAILURE); 375 } 376 377 psFree(object); 378 psDBCleanup(dbh); 379 } 380 381 { 382 psDB *dbh; 383 camPendingExpRow *object; 384 385 dbh = psDBInit("localhost", "test", NULL, "test"); 386 if (!dbh) { 387 exit(EXIT_FAILURE); 388 } 389 390 object = camPendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string"); 391 if (!object) { 392 exit(EXIT_FAILURE); 393 } 394 395 if (!camPendingExpInsertObject(dbh, object)) { 396 exit(EXIT_FAILURE); 397 } 398 399 psFree(object); 400 psDBCleanup(dbh); 401 } 402 403 { 404 psDB *dbh; 405 camProcessedExpRow *object; 406 407 dbh = psDBInit("localhost", "test", NULL, "test"); 408 if (!dbh) { 409 exit(EXIT_FAILURE); 410 } 411 412 object = camProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string"); 413 if (!object) { 414 exit(EXIT_FAILURE); 415 } 416 417 if (!camProcessedExpInsertObject(dbh, object)) { 418 exit(EXIT_FAILURE); 419 } 420 421 psFree(object); 422 psDBCleanup(dbh); 423 } 424 425 { 426 psDB *dbh; 427 camMaskRow *object; 428 429 dbh = psDBInit("localhost", "test", NULL, "test"); 430 if (!dbh) { 431 exit(EXIT_FAILURE); 432 } 433 434 object = camMaskRowAlloc("a string"); 435 if (!object) { 436 exit(EXIT_FAILURE); 437 } 438 439 if (!camMaskInsertObject(dbh, object)) { 440 440 exit(EXIT_FAILURE); 441 441 } … … 689 689 { 690 690 psDB *dbh; 691 p4RunRow*object;692 693 dbh = psDBInit("localhost", "test", NULL, "test"); 694 if (!dbh) { 695 exit(EXIT_FAILURE); 696 } 697 698 object = p4RunRowAlloc(-32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z");699 if (!object) { 700 exit(EXIT_FAILURE); 701 } 702 703 if (! p4RunInsertObject(dbh, object)) {704 exit(EXIT_FAILURE); 705 } 706 707 psFree(object); 708 psDBCleanup(dbh); 709 } 710 711 { 712 psDB *dbh; 713 p4InputExpRow*object;714 715 dbh = psDBInit("localhost", "test", NULL, "test"); 716 if (!dbh) { 717 exit(EXIT_FAILURE); 718 } 719 720 object = p4InputExpRowAlloc(-32, "a string", -32, true);721 if (!object) { 722 exit(EXIT_FAILURE); 723 } 724 725 if (! p4InputExpInsertObject(dbh, object)) {726 exit(EXIT_FAILURE); 727 } 728 729 psFree(object); 730 psDBCleanup(dbh); 731 } 732 733 { 734 psDB *dbh; 735 p4SkyCellMapRow *object;736 737 dbh = psDBInit("localhost", "test", NULL, "test"); 738 if (!dbh) { 739 exit(EXIT_FAILURE); 740 } 741 742 object = p4SkyCellMapRowAlloc(-32, "a string", "a string", "a string", -32, "a string");743 if (!object) { 744 exit(EXIT_FAILURE); 745 } 746 747 if (! p4SkyCellMapInsertObject(dbh, object)) {748 exit(EXIT_FAILURE); 749 } 750 751 psFree(object); 752 psDBCleanup(dbh); 753 } 754 755 { 756 psDB *dbh; 757 p4SkyfileRow*object;758 759 dbh = psDBInit("localhost", "test", NULL, "test"); 760 if (!dbh) { 761 exit(EXIT_FAILURE); 762 } 763 764 object = p4SkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64);765 if (!object) { 766 exit(EXIT_FAILURE); 767 } 768 769 if (! p4SkyfileInsertObject(dbh, object)) {770 exit(EXIT_FAILURE); 771 } 772 773 psFree(object); 774 psDBCleanup(dbh); 775 } 776 777 { 778 psDB *dbh; 779 p5RunRow*object;780 781 dbh = psDBInit("localhost", "test", NULL, "test"); 782 if (!dbh) { 783 exit(EXIT_FAILURE); 784 } 785 786 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");787 if (!object) { 788 exit(EXIT_FAILURE); 789 } 790 791 if (! p5RunInsertObject(dbh, object)) {792 exit(EXIT_FAILURE); 793 } 794 795 psFree(object); 796 psDBCleanup(dbh); 797 } 798 799 { 800 psDB *dbh; 801 p5InputSkyfileRow *object;802 803 dbh = psDBInit("localhost", "test", NULL, "test"); 804 if (!dbh) { 805 exit(EXIT_FAILURE); 806 } 807 808 object = p5InputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true);809 if (!object) { 810 exit(EXIT_FAILURE); 811 } 812 813 if (! p5InputSkyfileInsertObject(dbh, object)) {814 exit(EXIT_FAILURE); 815 } 816 817 psFree(object); 818 psDBCleanup(dbh); 819 } 820 821 { 822 psDB *dbh; 823 p5DiffSkyfileRow*object;824 825 dbh = psDBInit("localhost", "test", NULL, "test"); 826 if (!dbh) { 827 exit(EXIT_FAILURE); 828 } 829 830 object = p5DiffSkyfileRowAlloc(-32, "a string", 64.64, 64.64);831 if (!object) { 832 exit(EXIT_FAILURE); 833 } 834 835 if (! p5DiffSkyfileInsertObject(dbh, object)) {836 exit(EXIT_FAILURE); 837 } 838 839 psFree(object); 840 psDBCleanup(dbh); 841 } 842 843 { 844 psDB *dbh; 845 p6RunRow*object;846 847 dbh = psDBInit("localhost", "test", NULL, "test"); 848 if (!dbh) { 849 exit(EXIT_FAILURE); 850 } 851 852 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");853 if (!object) { 854 exit(EXIT_FAILURE); 855 } 856 857 if (! p6RunInsertObject(dbh, object)) {858 exit(EXIT_FAILURE); 859 } 860 861 psFree(object); 862 psDBCleanup(dbh); 863 } 864 865 { 866 psDB *dbh; 867 p6InputSkyfileRow *object;868 869 dbh = psDBInit("localhost", "test", NULL, "test"); 870 if (!dbh) { 871 exit(EXIT_FAILURE); 872 } 873 874 object = p6InputSkyfileRowAlloc(-32, -32);875 if (!object) { 876 exit(EXIT_FAILURE); 877 } 878 879 if (! p6InputSkyfileInsertObject(dbh, object)) {880 exit(EXIT_FAILURE); 881 } 882 883 psFree(object); 884 psDBCleanup(dbh); 885 } 886 887 { 888 psDB *dbh; 889 p6SumSkyfileRow *object;890 891 dbh = psDBInit("localhost", "test", NULL, "test"); 892 if (!dbh) { 893 exit(EXIT_FAILURE); 894 } 895 896 object = p6SumSkyfileRowAlloc(-32, "a string", 64.64, 64.64);897 if (!object) { 898 exit(EXIT_FAILURE); 899 } 900 901 if (! p6SumSkyfileInsertObject(dbh, object)) {691 warpRunRow *object; 692 693 dbh = psDBInit("localhost", "test", NULL, "test"); 694 if (!dbh) { 695 exit(EXIT_FAILURE); 696 } 697 698 object = warpRunRowAlloc(-32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z"); 699 if (!object) { 700 exit(EXIT_FAILURE); 701 } 702 703 if (!warpRunInsertObject(dbh, object)) { 704 exit(EXIT_FAILURE); 705 } 706 707 psFree(object); 708 psDBCleanup(dbh); 709 } 710 711 { 712 psDB *dbh; 713 warpInputExpRow *object; 714 715 dbh = psDBInit("localhost", "test", NULL, "test"); 716 if (!dbh) { 717 exit(EXIT_FAILURE); 718 } 719 720 object = warpInputExpRowAlloc(-32, "a string", -32, true); 721 if (!object) { 722 exit(EXIT_FAILURE); 723 } 724 725 if (!warpInputExpInsertObject(dbh, object)) { 726 exit(EXIT_FAILURE); 727 } 728 729 psFree(object); 730 psDBCleanup(dbh); 731 } 732 733 { 734 psDB *dbh; 735 warpSkyCellMapRow *object; 736 737 dbh = psDBInit("localhost", "test", NULL, "test"); 738 if (!dbh) { 739 exit(EXIT_FAILURE); 740 } 741 742 object = warpSkyCellMapRowAlloc(-32, "a string", "a string", "a string", -32, "a string"); 743 if (!object) { 744 exit(EXIT_FAILURE); 745 } 746 747 if (!warpSkyCellMapInsertObject(dbh, object)) { 748 exit(EXIT_FAILURE); 749 } 750 751 psFree(object); 752 psDBCleanup(dbh); 753 } 754 755 { 756 psDB *dbh; 757 warpSkyfileRow *object; 758 759 dbh = psDBInit("localhost", "test", NULL, "test"); 760 if (!dbh) { 761 exit(EXIT_FAILURE); 762 } 763 764 object = warpSkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64); 765 if (!object) { 766 exit(EXIT_FAILURE); 767 } 768 769 if (!warpSkyfileInsertObject(dbh, object)) { 770 exit(EXIT_FAILURE); 771 } 772 773 psFree(object); 774 psDBCleanup(dbh); 775 } 776 777 { 778 psDB *dbh; 779 diffRunRow *object; 780 781 dbh = psDBInit("localhost", "test", NULL, "test"); 782 if (!dbh) { 783 exit(EXIT_FAILURE); 784 } 785 786 object = diffRunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 787 if (!object) { 788 exit(EXIT_FAILURE); 789 } 790 791 if (!diffRunInsertObject(dbh, object)) { 792 exit(EXIT_FAILURE); 793 } 794 795 psFree(object); 796 psDBCleanup(dbh); 797 } 798 799 { 800 psDB *dbh; 801 diffInputSkyfileRow *object; 802 803 dbh = psDBInit("localhost", "test", NULL, "test"); 804 if (!dbh) { 805 exit(EXIT_FAILURE); 806 } 807 808 object = diffInputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true); 809 if (!object) { 810 exit(EXIT_FAILURE); 811 } 812 813 if (!diffInputSkyfileInsertObject(dbh, object)) { 814 exit(EXIT_FAILURE); 815 } 816 817 psFree(object); 818 psDBCleanup(dbh); 819 } 820 821 { 822 psDB *dbh; 823 diffSkyfileRow *object; 824 825 dbh = psDBInit("localhost", "test", NULL, "test"); 826 if (!dbh) { 827 exit(EXIT_FAILURE); 828 } 829 830 object = diffSkyfileRowAlloc(-32, "a string", 64.64, 64.64); 831 if (!object) { 832 exit(EXIT_FAILURE); 833 } 834 835 if (!diffSkyfileInsertObject(dbh, object)) { 836 exit(EXIT_FAILURE); 837 } 838 839 psFree(object); 840 psDBCleanup(dbh); 841 } 842 843 { 844 psDB *dbh; 845 stackRunRow *object; 846 847 dbh = psDBInit("localhost", "test", NULL, "test"); 848 if (!dbh) { 849 exit(EXIT_FAILURE); 850 } 851 852 object = stackRunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 853 if (!object) { 854 exit(EXIT_FAILURE); 855 } 856 857 if (!stackRunInsertObject(dbh, object)) { 858 exit(EXIT_FAILURE); 859 } 860 861 psFree(object); 862 psDBCleanup(dbh); 863 } 864 865 { 866 psDB *dbh; 867 stackInputSkyfileRow *object; 868 869 dbh = psDBInit("localhost", "test", NULL, "test"); 870 if (!dbh) { 871 exit(EXIT_FAILURE); 872 } 873 874 object = stackInputSkyfileRowAlloc(-32, -32); 875 if (!object) { 876 exit(EXIT_FAILURE); 877 } 878 879 if (!stackInputSkyfileInsertObject(dbh, object)) { 880 exit(EXIT_FAILURE); 881 } 882 883 psFree(object); 884 psDBCleanup(dbh); 885 } 886 887 { 888 psDB *dbh; 889 stackSumSkyfileRow *object; 890 891 dbh = psDBInit("localhost", "test", NULL, "test"); 892 if (!dbh) { 893 exit(EXIT_FAILURE); 894 } 895 896 object = stackSumSkyfileRowAlloc(-32, "a string", 64.64, 64.64); 897 if (!object) { 898 exit(EXIT_FAILURE); 899 } 900 901 if (!stackSumSkyfileInsertObject(dbh, object)) { 902 902 exit(EXIT_FAILURE); 903 903 } -
trunk/ippdb/tests/metadatafromobject.c
r11988 r12026 591 591 { 592 592 psMetadata *md; 593 p1PendingExpRow *object;594 bool status; 595 596 object = p1PendingExpRowAlloc("a string", -32, "a string");597 if (!object) { 598 exit(EXIT_FAILURE); 599 } 600 601 md = p1PendingExpMetadataFromObject(object);593 guidePendingExpRow *object; 594 bool status; 595 596 object = guidePendingExpRowAlloc("a string", -32, "a string"); 597 if (!object) { 598 exit(EXIT_FAILURE); 599 } 600 601 md = guidePendingExpMetadataFromObject(object); 602 602 if (!md) { 603 603 exit(EXIT_FAILURE); … … 610 610 exit(EXIT_FAILURE); 611 611 } 612 if (!psMetadataLookupS32(&status, md, " p1_version") == -32) {612 if (!psMetadataLookupS32(&status, md, "guide_version") == -32) { 613 613 psFree(md); 614 614 exit(EXIT_FAILURE); … … 624 624 { 625 625 psMetadata *md; 626 p2PendingExpRow *object;627 bool status; 628 629 object = p2PendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", "a string");630 if (!object) { 631 exit(EXIT_FAILURE); 632 } 633 634 md = p2PendingExpMetadataFromObject(object);626 chipPendingExpRow *object; 627 bool status; 628 629 object = chipPendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", "a string"); 630 if (!object) { 631 exit(EXIT_FAILURE); 632 } 633 634 md = chipPendingExpMetadataFromObject(object); 635 635 if (!md) { 636 636 exit(EXIT_FAILURE); … … 643 643 exit(EXIT_FAILURE); 644 644 } 645 if (!psMetadataLookupS32(&status, md, " p2_version") == -32) {646 psFree(md); 647 exit(EXIT_FAILURE); 648 } 649 if (!psMetadataLookupS32(&status, md, " p1_version") == -32) {645 if (!psMetadataLookupS32(&status, md, "chip_version") == -32) { 646 psFree(md); 647 exit(EXIT_FAILURE); 648 } 649 if (!psMetadataLookupS32(&status, md, "guide_version") == -32) { 650 650 psFree(md); 651 651 exit(EXIT_FAILURE); … … 673 673 { 674 674 psMetadata *md; 675 p2PendingImfileRow *object;676 bool status; 677 678 object = p2PendingImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string");679 if (!object) { 680 exit(EXIT_FAILURE); 681 } 682 683 md = p2PendingImfileMetadataFromObject(object);675 chipPendingImfileRow *object; 676 bool status; 677 678 object = chipPendingImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string"); 679 if (!object) { 680 exit(EXIT_FAILURE); 681 } 682 683 md = chipPendingImfileMetadataFromObject(object); 684 684 if (!md) { 685 685 exit(EXIT_FAILURE); … … 692 692 exit(EXIT_FAILURE); 693 693 } 694 if (!psMetadataLookupS32(&status, md, " p2_version") == -32) {695 psFree(md); 696 exit(EXIT_FAILURE); 697 } 698 if (!psMetadataLookupS32(&status, md, " p1_version") == -32) {694 if (!psMetadataLookupS32(&status, md, "chip_version") == -32) { 695 psFree(md); 696 exit(EXIT_FAILURE); 697 } 698 if (!psMetadataLookupS32(&status, md, "guide_version") == -32) { 699 699 psFree(md); 700 700 exit(EXIT_FAILURE); … … 718 718 { 719 719 psMetadata *md; 720 p2ProcessedExpRow *object;721 bool status; 722 723 object = p2ProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string");724 if (!object) { 725 exit(EXIT_FAILURE); 726 } 727 728 md = p2ProcessedExpMetadataFromObject(object);720 chipProcessedExpRow *object; 721 bool status; 722 723 object = chipProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string"); 724 if (!object) { 725 exit(EXIT_FAILURE); 726 } 727 728 md = chipProcessedExpMetadataFromObject(object); 729 729 if (!md) { 730 730 exit(EXIT_FAILURE); … … 737 737 exit(EXIT_FAILURE); 738 738 } 739 if (!psMetadataLookupS32(&status, md, " p2_version") == -32) {740 psFree(md); 741 exit(EXIT_FAILURE); 742 } 743 if (!psMetadataLookupS32(&status, md, " p1_version") == -32) {739 if (!psMetadataLookupS32(&status, md, "chip_version") == -32) { 740 psFree(md); 741 exit(EXIT_FAILURE); 742 } 743 if (!psMetadataLookupS32(&status, md, "guide_version") == -32) { 744 744 psFree(md); 745 745 exit(EXIT_FAILURE); … … 763 763 { 764 764 psMetadata *md; 765 p2MaskRow*object;766 bool status; 767 768 object = p2MaskRowAlloc("a string");769 if (!object) { 770 exit(EXIT_FAILURE); 771 } 772 773 md = p2MaskMetadataFromObject(object);765 chipMaskRow *object; 766 bool status; 767 768 object = chipMaskRowAlloc("a string"); 769 if (!object) { 770 exit(EXIT_FAILURE); 771 } 772 773 md = chipMaskMetadataFromObject(object); 774 774 if (!md) { 775 775 exit(EXIT_FAILURE); … … 788 788 { 789 789 psMetadata *md; 790 p2ProcessedImfileRow *object;791 bool status; 792 793 object = p2ProcessedImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16);794 if (!object) { 795 exit(EXIT_FAILURE); 796 } 797 798 md = p2ProcessedImfileMetadataFromObject(object);790 chipProcessedImfileRow *object; 791 bool status; 792 793 object = chipProcessedImfileRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, "a string", "a string", -16); 794 if (!object) { 795 exit(EXIT_FAILURE); 796 } 797 798 md = chipProcessedImfileMetadataFromObject(object); 799 799 if (!md) { 800 800 exit(EXIT_FAILURE); … … 807 807 exit(EXIT_FAILURE); 808 808 } 809 if (!psMetadataLookupS32(&status, md, " p2_version") == -32) {810 psFree(md); 811 exit(EXIT_FAILURE); 812 } 813 if (!psMetadataLookupS32(&status, md, " p1_version") == -32) {809 if (!psMetadataLookupS32(&status, md, "chip_version") == -32) { 810 psFree(md); 811 exit(EXIT_FAILURE); 812 } 813 if (!psMetadataLookupS32(&status, md, "guide_version") == -32) { 814 814 psFree(md); 815 815 exit(EXIT_FAILURE); … … 856 856 { 857 857 psMetadata *md; 858 p3PendingExpRow *object;859 bool status; 860 861 object = p3PendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string");862 if (!object) { 863 exit(EXIT_FAILURE); 864 } 865 866 md = p3PendingExpMetadataFromObject(object);858 camPendingExpRow *object; 859 bool status; 860 861 object = camPendingExpRowAlloc("a string", -32, -32, "a string", "a string", "a string"); 862 if (!object) { 863 exit(EXIT_FAILURE); 864 } 865 866 md = camPendingExpMetadataFromObject(object); 867 867 if (!md) { 868 868 exit(EXIT_FAILURE); … … 875 875 exit(EXIT_FAILURE); 876 876 } 877 if (!psMetadataLookupS32(&status, md, " p3_version") == -32) {878 psFree(md); 879 exit(EXIT_FAILURE); 880 } 881 if (!psMetadataLookupS32(&status, md, " p2_version") == -32) {877 if (!psMetadataLookupS32(&status, md, "cam_version") == -32) { 878 psFree(md); 879 exit(EXIT_FAILURE); 880 } 881 if (!psMetadataLookupS32(&status, md, "chip_version") == -32) { 882 882 psFree(md); 883 883 exit(EXIT_FAILURE); … … 901 901 { 902 902 psMetadata *md; 903 p3ProcessedExpRow *object;904 bool status; 905 906 object = p3ProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string");907 if (!object) { 908 exit(EXIT_FAILURE); 909 } 910 911 md = p3ProcessedExpMetadataFromObject(object);903 camProcessedExpRow *object; 904 bool status; 905 906 object = camProcessedExpRowAlloc("a string", -32, -32, "a string", "a string", "a string", 64.64, 64.64, 64.64, 32.32, 32.32, -32, "a string", "a string", 32.32, 32.32, -16, "a string", "a string"); 907 if (!object) { 908 exit(EXIT_FAILURE); 909 } 910 911 md = camProcessedExpMetadataFromObject(object); 912 912 if (!md) { 913 913 exit(EXIT_FAILURE); … … 920 920 exit(EXIT_FAILURE); 921 921 } 922 if (!psMetadataLookupS32(&status, md, " p3_version") == -32) {923 psFree(md); 924 exit(EXIT_FAILURE); 925 } 926 if (!psMetadataLookupS32(&status, md, " p2_version") == -32) {922 if (!psMetadataLookupS32(&status, md, "cam_version") == -32) { 923 psFree(md); 924 exit(EXIT_FAILURE); 925 } 926 if (!psMetadataLookupS32(&status, md, "chip_version") == -32) { 927 927 psFree(md); 928 928 exit(EXIT_FAILURE); … … 997 997 { 998 998 psMetadata *md; 999 p3MaskRow*object;1000 bool status; 1001 1002 object = p3MaskRowAlloc("a string");1003 if (!object) { 1004 exit(EXIT_FAILURE); 1005 } 1006 1007 md = p3MaskMetadataFromObject(object);999 camMaskRow *object; 1000 bool status; 1001 1002 object = camMaskRowAlloc("a string"); 1003 if (!object) { 1004 exit(EXIT_FAILURE); 1005 } 1006 1007 md = camMaskMetadataFromObject(object); 1008 1008 if (!md) { 1009 1009 exit(EXIT_FAILURE); … … 1695 1695 { 1696 1696 psMetadata *md; 1697 p4RunRow*object;1698 bool status; 1699 1700 object = p4RunRowAlloc(-32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z");1701 if (!object) { 1702 exit(EXIT_FAILURE); 1703 } 1704 1705 md = p4RunMetadataFromObject(object);1706 if (!md) { 1707 exit(EXIT_FAILURE); 1708 } 1709 1710 psFree(object); 1711 1712 if (!psMetadataLookupS32(&status, md, " p4_id") == -32) {1697 warpRunRow *object; 1698 bool status; 1699 1700 object = warpRunRowAlloc(-32, "a string", "a string", "a string", "a string", "0001-01-01T00:00:00Z"); 1701 if (!object) { 1702 exit(EXIT_FAILURE); 1703 } 1704 1705 md = warpRunMetadataFromObject(object); 1706 if (!md) { 1707 exit(EXIT_FAILURE); 1708 } 1709 1710 psFree(object); 1711 1712 if (!psMetadataLookupS32(&status, md, "warp_id") == -32) { 1713 1713 psFree(md); 1714 1714 exit(EXIT_FAILURE); … … 1739 1739 { 1740 1740 psMetadata *md; 1741 p4InputExpRow*object;1742 bool status; 1743 1744 object = p4InputExpRowAlloc(-32, "a string", -32, true);1745 if (!object) { 1746 exit(EXIT_FAILURE); 1747 } 1748 1749 md = p4InputExpMetadataFromObject(object);1750 if (!md) { 1751 exit(EXIT_FAILURE); 1752 } 1753 1754 psFree(object); 1755 1756 if (!psMetadataLookupS32(&status, md, " p4_id") == -32) {1741 warpInputExpRow *object; 1742 bool status; 1743 1744 object = warpInputExpRowAlloc(-32, "a string", -32, true); 1745 if (!object) { 1746 exit(EXIT_FAILURE); 1747 } 1748 1749 md = warpInputExpMetadataFromObject(object); 1750 if (!md) { 1751 exit(EXIT_FAILURE); 1752 } 1753 1754 psFree(object); 1755 1756 if (!psMetadataLookupS32(&status, md, "warp_id") == -32) { 1757 1757 psFree(md); 1758 1758 exit(EXIT_FAILURE); … … 1762 1762 exit(EXIT_FAILURE); 1763 1763 } 1764 if (!psMetadataLookupS32(&status, md, " p3_version") == -32) {1764 if (!psMetadataLookupS32(&status, md, "cam_version") == -32) { 1765 1765 psFree(md); 1766 1766 exit(EXIT_FAILURE); … … 1776 1776 { 1777 1777 psMetadata *md; 1778 p4SkyCellMapRow *object;1779 bool status; 1780 1781 object = p4SkyCellMapRowAlloc(-32, "a string", "a string", "a string", -32, "a string");1782 if (!object) { 1783 exit(EXIT_FAILURE); 1784 } 1785 1786 md = p4SkyCellMapMetadataFromObject(object);1787 if (!md) { 1788 exit(EXIT_FAILURE); 1789 } 1790 1791 psFree(object); 1792 1793 if (!psMetadataLookupS32(&status, md, " p4_id") == -32) {1778 warpSkyCellMapRow *object; 1779 bool status; 1780 1781 object = warpSkyCellMapRowAlloc(-32, "a string", "a string", "a string", -32, "a string"); 1782 if (!object) { 1783 exit(EXIT_FAILURE); 1784 } 1785 1786 md = warpSkyCellMapMetadataFromObject(object); 1787 if (!md) { 1788 exit(EXIT_FAILURE); 1789 } 1790 1791 psFree(object); 1792 1793 if (!psMetadataLookupS32(&status, md, "warp_id") == -32) { 1794 1794 psFree(md); 1795 1795 exit(EXIT_FAILURE); … … 1807 1807 exit(EXIT_FAILURE); 1808 1808 } 1809 if (!psMetadataLookupS32(&status, md, " p3_version") == -32) {1809 if (!psMetadataLookupS32(&status, md, "cam_version") == -32) { 1810 1810 psFree(md); 1811 1811 exit(EXIT_FAILURE); … … 1821 1821 { 1822 1822 psMetadata *md; 1823 p4SkyfileRow*object;1824 bool status; 1825 1826 object = p4SkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64);1827 if (!object) { 1828 exit(EXIT_FAILURE); 1829 } 1830 1831 md = p4SkyfileMetadataFromObject(object);1832 if (!md) { 1833 exit(EXIT_FAILURE); 1834 } 1835 1836 psFree(object); 1837 1838 if (!psMetadataLookupS32(&status, md, " p4_id") == -32) {1823 warpSkyfileRow *object; 1824 bool status; 1825 1826 object = warpSkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64); 1827 if (!object) { 1828 exit(EXIT_FAILURE); 1829 } 1830 1831 md = warpSkyfileMetadataFromObject(object); 1832 if (!md) { 1833 exit(EXIT_FAILURE); 1834 } 1835 1836 psFree(object); 1837 1838 if (!psMetadataLookupS32(&status, md, "warp_id") == -32) { 1839 1839 psFree(md); 1840 1840 exit(EXIT_FAILURE); … … 1866 1866 { 1867 1867 psMetadata *md; 1868 p5RunRow*object;1869 bool status; 1870 1871 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");1872 if (!object) { 1873 exit(EXIT_FAILURE); 1874 } 1875 1876 md = p5RunMetadataFromObject(object);1877 if (!md) { 1878 exit(EXIT_FAILURE); 1879 } 1880 1881 psFree(object); 1882 1883 if (!psMetadataLookupS32(&status, md, " p5_id") == -32) {1868 diffRunRow *object; 1869 bool status; 1870 1871 object = diffRunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 1872 if (!object) { 1873 exit(EXIT_FAILURE); 1874 } 1875 1876 md = diffRunMetadataFromObject(object); 1877 if (!md) { 1878 exit(EXIT_FAILURE); 1879 } 1880 1881 psFree(object); 1882 1883 if (!psMetadataLookupS32(&status, md, "diff_id") == -32) { 1884 1884 psFree(md); 1885 1885 exit(EXIT_FAILURE); … … 1914 1914 { 1915 1915 psMetadata *md; 1916 p5InputSkyfileRow *object;1917 bool status; 1918 1919 object = p5InputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true);1920 if (!object) { 1921 exit(EXIT_FAILURE); 1922 } 1923 1924 md = p5InputSkyfileMetadataFromObject(object);1925 if (!md) { 1926 exit(EXIT_FAILURE); 1927 } 1928 1929 psFree(object); 1930 1931 if (!psMetadataLookupS32(&status, md, " p5_id") == -32) {1932 psFree(md); 1933 exit(EXIT_FAILURE); 1934 } 1935 if (!psMetadataLookupS32(&status, md, " p4_id") == -32) {1916 diffInputSkyfileRow *object; 1917 bool status; 1918 1919 object = diffInputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true); 1920 if (!object) { 1921 exit(EXIT_FAILURE); 1922 } 1923 1924 md = diffInputSkyfileMetadataFromObject(object); 1925 if (!md) { 1926 exit(EXIT_FAILURE); 1927 } 1928 1929 psFree(object); 1930 1931 if (!psMetadataLookupS32(&status, md, "diff_id") == -32) { 1932 psFree(md); 1933 exit(EXIT_FAILURE); 1934 } 1935 if (!psMetadataLookupS32(&status, md, "warp_id") == -32) { 1936 1936 psFree(md); 1937 1937 exit(EXIT_FAILURE); … … 1959 1959 { 1960 1960 psMetadata *md; 1961 p5DiffSkyfileRow*object;1962 bool status; 1963 1964 object = p5DiffSkyfileRowAlloc(-32, "a string", 64.64, 64.64);1965 if (!object) { 1966 exit(EXIT_FAILURE); 1967 } 1968 1969 md = p5DiffSkyfileMetadataFromObject(object);1970 if (!md) { 1971 exit(EXIT_FAILURE); 1972 } 1973 1974 psFree(object); 1975 1976 if (!psMetadataLookupS32(&status, md, " p5_id") == -32) {1961 diffSkyfileRow *object; 1962 bool status; 1963 1964 object = diffSkyfileRowAlloc(-32, "a string", 64.64, 64.64); 1965 if (!object) { 1966 exit(EXIT_FAILURE); 1967 } 1968 1969 md = diffSkyfileMetadataFromObject(object); 1970 if (!md) { 1971 exit(EXIT_FAILURE); 1972 } 1973 1974 psFree(object); 1975 1976 if (!psMetadataLookupS32(&status, md, "diff_id") == -32) { 1977 1977 psFree(md); 1978 1978 exit(EXIT_FAILURE); … … 1996 1996 { 1997 1997 psMetadata *md; 1998 p6RunRow*object;1999 bool status; 2000 2001 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string");2002 if (!object) { 2003 exit(EXIT_FAILURE); 2004 } 2005 2006 md = p6RunMetadataFromObject(object);2007 if (!md) { 2008 exit(EXIT_FAILURE); 2009 } 2010 2011 psFree(object); 2012 2013 if (!psMetadataLookupS32(&status, md, " p6_id") == -32) {1998 stackRunRow *object; 1999 bool status; 2000 2001 object = stackRunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 2002 if (!object) { 2003 exit(EXIT_FAILURE); 2004 } 2005 2006 md = stackRunMetadataFromObject(object); 2007 if (!md) { 2008 exit(EXIT_FAILURE); 2009 } 2010 2011 psFree(object); 2012 2013 if (!psMetadataLookupS32(&status, md, "stack_id") == -32) { 2014 2014 psFree(md); 2015 2015 exit(EXIT_FAILURE); … … 2044 2044 { 2045 2045 psMetadata *md; 2046 p6InputSkyfileRow *object;2047 bool status; 2048 2049 object = p6InputSkyfileRowAlloc(-32, -32);2050 if (!object) { 2051 exit(EXIT_FAILURE); 2052 } 2053 2054 md = p6InputSkyfileMetadataFromObject(object);2055 if (!md) { 2056 exit(EXIT_FAILURE); 2057 } 2058 2059 psFree(object); 2060 2061 if (!psMetadataLookupS32(&status, md, " p6_id") == -32) {2062 psFree(md); 2063 exit(EXIT_FAILURE); 2064 } 2065 if (!psMetadataLookupS32(&status, md, " p4_id") == -32) {2066 psFree(md); 2067 exit(EXIT_FAILURE); 2068 } 2069 2070 psFree(md); 2071 } 2072 2073 { 2074 psMetadata *md; 2075 p6SumSkyfileRow *object;2076 bool status; 2077 2078 object = p6SumSkyfileRowAlloc(-32, "a string", 64.64, 64.64);2079 if (!object) { 2080 exit(EXIT_FAILURE); 2081 } 2082 2083 md = p6SumSkyfileMetadataFromObject(object);2084 if (!md) { 2085 exit(EXIT_FAILURE); 2086 } 2087 2088 psFree(object); 2089 2090 if (!psMetadataLookupS32(&status, md, " p6_id") == -32) {2046 stackInputSkyfileRow *object; 2047 bool status; 2048 2049 object = stackInputSkyfileRowAlloc(-32, -32); 2050 if (!object) { 2051 exit(EXIT_FAILURE); 2052 } 2053 2054 md = stackInputSkyfileMetadataFromObject(object); 2055 if (!md) { 2056 exit(EXIT_FAILURE); 2057 } 2058 2059 psFree(object); 2060 2061 if (!psMetadataLookupS32(&status, md, "stack_id") == -32) { 2062 psFree(md); 2063 exit(EXIT_FAILURE); 2064 } 2065 if (!psMetadataLookupS32(&status, md, "warp_id") == -32) { 2066 psFree(md); 2067 exit(EXIT_FAILURE); 2068 } 2069 2070 psFree(md); 2071 } 2072 2073 { 2074 psMetadata *md; 2075 stackSumSkyfileRow *object; 2076 bool status; 2077 2078 object = stackSumSkyfileRowAlloc(-32, "a string", 64.64, 64.64); 2079 if (!object) { 2080 exit(EXIT_FAILURE); 2081 } 2082 2083 md = stackSumSkyfileMetadataFromObject(object); 2084 if (!md) { 2085 exit(EXIT_FAILURE); 2086 } 2087 2088 psFree(object); 2089 2090 if (!psMetadataLookupS32(&status, md, "stack_id") == -32) { 2091 2091 psFree(md); 2092 2092 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r11988 r12026 908 908 { 909 909 psMetadata *md; 910 p1PendingExpRow *object;910 guidePendingExpRow *object; 911 911 912 912 md = psMetadataAlloc(); … … 915 915 exit(EXIT_FAILURE); 916 916 } 917 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p1_version", 0, NULL, -32)) {917 if (!psMetadataAddS32(md, PS_LIST_TAIL, "guide_version", 0, NULL, -32)) { 918 918 psFree(md); 919 919 exit(EXIT_FAILURE); … … 924 924 } 925 925 926 object = p1PendingExpObjectFromMetadata(md);926 object = guidePendingExpObjectFromMetadata(md); 927 927 if (!object) { 928 928 psFree(md); … … 936 936 exit(EXIT_FAILURE); 937 937 } 938 if (!object-> p1_version == -32) {938 if (!object->guide_version == -32) { 939 939 psFree(object); 940 940 exit(EXIT_FAILURE); … … 950 950 { 951 951 psMetadata *md; 952 p2PendingExpRow *object;952 chipPendingExpRow *object; 953 953 954 954 md = psMetadataAlloc(); … … 957 957 exit(EXIT_FAILURE); 958 958 } 959 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p2_version", 0, NULL, -32)) {960 psFree(md); 961 exit(EXIT_FAILURE); 962 } 963 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p1_version", 0, NULL, -32)) {959 if (!psMetadataAddS32(md, PS_LIST_TAIL, "chip_version", 0, NULL, -32)) { 960 psFree(md); 961 exit(EXIT_FAILURE); 962 } 963 if (!psMetadataAddS32(md, PS_LIST_TAIL, "guide_version", 0, NULL, -32)) { 964 964 psFree(md); 965 965 exit(EXIT_FAILURE); … … 982 982 } 983 983 984 object = p2PendingExpObjectFromMetadata(md);984 object = chipPendingExpObjectFromMetadata(md); 985 985 if (!object) { 986 986 psFree(md); … … 994 994 exit(EXIT_FAILURE); 995 995 } 996 if (!object-> p2_version == -32) {997 psFree(object); 998 exit(EXIT_FAILURE); 999 } 1000 if (!object-> p1_version == -32) {996 if (!object->chip_version == -32) { 997 psFree(object); 998 exit(EXIT_FAILURE); 999 } 1000 if (!object->guide_version == -32) { 1001 1001 psFree(object); 1002 1002 exit(EXIT_FAILURE); … … 1024 1024 { 1025 1025 psMetadata *md; 1026 p2PendingImfileRow *object;1026 chipPendingImfileRow *object; 1027 1027 1028 1028 md = psMetadataAlloc(); … … 1031 1031 exit(EXIT_FAILURE); 1032 1032 } 1033 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p2_version", 0, NULL, -32)) {1034 psFree(md); 1035 exit(EXIT_FAILURE); 1036 } 1037 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p1_version", 0, NULL, -32)) {1033 if (!psMetadataAddS32(md, PS_LIST_TAIL, "chip_version", 0, NULL, -32)) { 1034 psFree(md); 1035 exit(EXIT_FAILURE); 1036 } 1037 if (!psMetadataAddS32(md, PS_LIST_TAIL, "guide_version", 0, NULL, -32)) { 1038 1038 psFree(md); 1039 1039 exit(EXIT_FAILURE); … … 1052 1052 } 1053 1053 1054 object = p2PendingImfileObjectFromMetadata(md);1054 object = chipPendingImfileObjectFromMetadata(md); 1055 1055 if (!object) { 1056 1056 psFree(md); … … 1064 1064 exit(EXIT_FAILURE); 1065 1065 } 1066 if (!object-> p2_version == -32) {1067 psFree(object); 1068 exit(EXIT_FAILURE); 1069 } 1070 if (!object-> p1_version == -32) {1066 if (!object->chip_version == -32) { 1067 psFree(object); 1068 exit(EXIT_FAILURE); 1069 } 1070 if (!object->guide_version == -32) { 1071 1071 psFree(object); 1072 1072 exit(EXIT_FAILURE); … … 1090 1090 { 1091 1091 psMetadata *md; 1092 p2ProcessedExpRow *object;1092 chipProcessedExpRow *object; 1093 1093 1094 1094 md = psMetadataAlloc(); … … 1097 1097 exit(EXIT_FAILURE); 1098 1098 } 1099 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p2_version", 0, NULL, -32)) {1100 psFree(md); 1101 exit(EXIT_FAILURE); 1102 } 1103 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p1_version", 0, NULL, -32)) {1099 if (!psMetadataAddS32(md, PS_LIST_TAIL, "chip_version", 0, NULL, -32)) { 1100 psFree(md); 1101 exit(EXIT_FAILURE); 1102 } 1103 if (!psMetadataAddS32(md, PS_LIST_TAIL, "guide_version", 0, NULL, -32)) { 1104 1104 psFree(md); 1105 1105 exit(EXIT_FAILURE); … … 1118 1118 } 1119 1119 1120 object = p2ProcessedExpObjectFromMetadata(md);1120 object = chipProcessedExpObjectFromMetadata(md); 1121 1121 if (!object) { 1122 1122 psFree(md); … … 1130 1130 exit(EXIT_FAILURE); 1131 1131 } 1132 if (!object-> p2_version == -32) {1133 psFree(object); 1134 exit(EXIT_FAILURE); 1135 } 1136 if (!object-> p1_version == -32) {1132 if (!object->chip_version == -32) { 1133 psFree(object); 1134 exit(EXIT_FAILURE); 1135 } 1136 if (!object->guide_version == -32) { 1137 1137 psFree(object); 1138 1138 exit(EXIT_FAILURE); … … 1156 1156 { 1157 1157 psMetadata *md; 1158 p2MaskRow*object;1158 chipMaskRow *object; 1159 1159 1160 1160 md = psMetadataAlloc(); … … 1164 1164 } 1165 1165 1166 object = p2MaskObjectFromMetadata(md);1166 object = chipMaskObjectFromMetadata(md); 1167 1167 if (!object) { 1168 1168 psFree(md); … … 1182 1182 { 1183 1183 psMetadata *md; 1184 p2ProcessedImfileRow *object;1184 chipProcessedImfileRow *object; 1185 1185 1186 1186 md = psMetadataAlloc(); … … 1189 1189 exit(EXIT_FAILURE); 1190 1190 } 1191 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p2_version", 0, NULL, -32)) {1192 psFree(md); 1193 exit(EXIT_FAILURE); 1194 } 1195 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p1_version", 0, NULL, -32)) {1191 if (!psMetadataAddS32(md, PS_LIST_TAIL, "chip_version", 0, NULL, -32)) { 1192 psFree(md); 1193 exit(EXIT_FAILURE); 1194 } 1195 if (!psMetadataAddS32(md, PS_LIST_TAIL, "guide_version", 0, NULL, -32)) { 1196 1196 psFree(md); 1197 1197 exit(EXIT_FAILURE); … … 1233 1233 } 1234 1234 1235 object = p2ProcessedImfileObjectFromMetadata(md);1235 object = chipProcessedImfileObjectFromMetadata(md); 1236 1236 if (!object) { 1237 1237 psFree(md); … … 1245 1245 exit(EXIT_FAILURE); 1246 1246 } 1247 if (!object-> p2_version == -32) {1248 psFree(object); 1249 exit(EXIT_FAILURE); 1250 } 1251 if (!object-> p1_version == -32) {1247 if (!object->chip_version == -32) { 1248 psFree(object); 1249 exit(EXIT_FAILURE); 1250 } 1251 if (!object->guide_version == -32) { 1252 1252 psFree(object); 1253 1253 exit(EXIT_FAILURE); … … 1294 1294 { 1295 1295 psMetadata *md; 1296 p3PendingExpRow *object;1296 camPendingExpRow *object; 1297 1297 1298 1298 md = psMetadataAlloc(); … … 1301 1301 exit(EXIT_FAILURE); 1302 1302 } 1303 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p3_version", 0, NULL, -32)) {1304 psFree(md); 1305 exit(EXIT_FAILURE); 1306 } 1307 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p2_version", 0, NULL, -32)) {1303 if (!psMetadataAddS32(md, PS_LIST_TAIL, "cam_version", 0, NULL, -32)) { 1304 psFree(md); 1305 exit(EXIT_FAILURE); 1306 } 1307 if (!psMetadataAddS32(md, PS_LIST_TAIL, "chip_version", 0, NULL, -32)) { 1308 1308 psFree(md); 1309 1309 exit(EXIT_FAILURE); … … 1322 1322 } 1323 1323 1324 object = p3PendingExpObjectFromMetadata(md);1324 object = camPendingExpObjectFromMetadata(md); 1325 1325 if (!object) { 1326 1326 psFree(md); … … 1334 1334 exit(EXIT_FAILURE); 1335 1335 } 1336 if (!object-> p3_version == -32) {1337 psFree(object); 1338 exit(EXIT_FAILURE); 1339 } 1340 if (!object-> p2_version == -32) {1336 if (!object->cam_version == -32) { 1337 psFree(object); 1338 exit(EXIT_FAILURE); 1339 } 1340 if (!object->chip_version == -32) { 1341 1341 psFree(object); 1342 1342 exit(EXIT_FAILURE); … … 1360 1360 { 1361 1361 psMetadata *md; 1362 p3ProcessedExpRow *object;1362 camProcessedExpRow *object; 1363 1363 1364 1364 md = psMetadataAlloc(); … … 1367 1367 exit(EXIT_FAILURE); 1368 1368 } 1369 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p3_version", 0, NULL, -32)) {1370 psFree(md); 1371 exit(EXIT_FAILURE); 1372 } 1373 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p2_version", 0, NULL, -32)) {1369 if (!psMetadataAddS32(md, PS_LIST_TAIL, "cam_version", 0, NULL, -32)) { 1370 psFree(md); 1371 exit(EXIT_FAILURE); 1372 } 1373 if (!psMetadataAddS32(md, PS_LIST_TAIL, "chip_version", 0, NULL, -32)) { 1374 1374 psFree(md); 1375 1375 exit(EXIT_FAILURE); … … 1439 1439 } 1440 1440 1441 object = p3ProcessedExpObjectFromMetadata(md);1441 object = camProcessedExpObjectFromMetadata(md); 1442 1442 if (!object) { 1443 1443 psFree(md); … … 1451 1451 exit(EXIT_FAILURE); 1452 1452 } 1453 if (!object-> p3_version == -32) {1454 psFree(object); 1455 exit(EXIT_FAILURE); 1456 } 1457 if (!object-> p2_version == -32) {1453 if (!object->cam_version == -32) { 1454 psFree(object); 1455 exit(EXIT_FAILURE); 1456 } 1457 if (!object->chip_version == -32) { 1458 1458 psFree(object); 1459 1459 exit(EXIT_FAILURE); … … 1528 1528 { 1529 1529 psMetadata *md; 1530 p3MaskRow*object;1530 camMaskRow *object; 1531 1531 1532 1532 md = psMetadataAlloc(); … … 1536 1536 } 1537 1537 1538 object = p3MaskObjectFromMetadata(md);1538 object = camMaskObjectFromMetadata(md); 1539 1539 if (!object) { 1540 1540 psFree(md); … … 2636 2636 { 2637 2637 psMetadata *md; 2638 p4RunRow*object;2639 2640 md = psMetadataAlloc(); 2641 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p4_id", 0, NULL, -32)) {2638 warpRunRow *object; 2639 2640 md = psMetadataAlloc(); 2641 if (!psMetadataAddS32(md, PS_LIST_TAIL, "warp_id", 0, NULL, -32)) { 2642 2642 psFree(md); 2643 2643 exit(EXIT_FAILURE); … … 2663 2663 } 2664 2664 2665 object = p4RunObjectFromMetadata(md);2666 if (!object) { 2667 psFree(md); 2668 exit(EXIT_FAILURE); 2669 } 2670 2671 psFree(md); 2672 2673 if (!object-> p4_id == -32) {2665 object = warpRunObjectFromMetadata(md); 2666 if (!object) { 2667 psFree(md); 2668 exit(EXIT_FAILURE); 2669 } 2670 2671 psFree(md); 2672 2673 if (!object->warp_id == -32) { 2674 2674 psFree(object); 2675 2675 exit(EXIT_FAILURE); … … 2700 2700 { 2701 2701 psMetadata *md; 2702 p4InputExpRow*object;2703 2704 md = psMetadataAlloc(); 2705 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p4_id", 0, NULL, -32)) {2702 warpInputExpRow *object; 2703 2704 md = psMetadataAlloc(); 2705 if (!psMetadataAddS32(md, PS_LIST_TAIL, "warp_id", 0, NULL, -32)) { 2706 2706 psFree(md); 2707 2707 exit(EXIT_FAILURE); … … 2711 2711 exit(EXIT_FAILURE); 2712 2712 } 2713 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p3_version", 0, NULL, -32)) {2713 if (!psMetadataAddS32(md, PS_LIST_TAIL, "cam_version", 0, NULL, -32)) { 2714 2714 psFree(md); 2715 2715 exit(EXIT_FAILURE); … … 2720 2720 } 2721 2721 2722 object = p4InputExpObjectFromMetadata(md);2723 if (!object) { 2724 psFree(md); 2725 exit(EXIT_FAILURE); 2726 } 2727 2728 psFree(md); 2729 2730 if (!object-> p4_id == -32) {2722 object = warpInputExpObjectFromMetadata(md); 2723 if (!object) { 2724 psFree(md); 2725 exit(EXIT_FAILURE); 2726 } 2727 2728 psFree(md); 2729 2730 if (!object->warp_id == -32) { 2731 2731 psFree(object); 2732 2732 exit(EXIT_FAILURE); … … 2736 2736 exit(EXIT_FAILURE); 2737 2737 } 2738 if (!object-> p3_version == -32) {2738 if (!object->cam_version == -32) { 2739 2739 psFree(object); 2740 2740 exit(EXIT_FAILURE); … … 2750 2750 { 2751 2751 psMetadata *md; 2752 p4SkyCellMapRow *object;2753 2754 md = psMetadataAlloc(); 2755 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p4_id", 0, NULL, -32)) {2752 warpSkyCellMapRow *object; 2753 2754 md = psMetadataAlloc(); 2755 if (!psMetadataAddS32(md, PS_LIST_TAIL, "warp_id", 0, NULL, -32)) { 2756 2756 psFree(md); 2757 2757 exit(EXIT_FAILURE); … … 2769 2769 exit(EXIT_FAILURE); 2770 2770 } 2771 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p3_version", 0, NULL, -32)) {2771 if (!psMetadataAddS32(md, PS_LIST_TAIL, "cam_version", 0, NULL, -32)) { 2772 2772 psFree(md); 2773 2773 exit(EXIT_FAILURE); … … 2778 2778 } 2779 2779 2780 object = p4SkyCellMapObjectFromMetadata(md);2781 if (!object) { 2782 psFree(md); 2783 exit(EXIT_FAILURE); 2784 } 2785 2786 psFree(md); 2787 2788 if (!object-> p4_id == -32) {2780 object = warpSkyCellMapObjectFromMetadata(md); 2781 if (!object) { 2782 psFree(md); 2783 exit(EXIT_FAILURE); 2784 } 2785 2786 psFree(md); 2787 2788 if (!object->warp_id == -32) { 2789 2789 psFree(object); 2790 2790 exit(EXIT_FAILURE); … … 2802 2802 exit(EXIT_FAILURE); 2803 2803 } 2804 if (!object-> p3_version == -32) {2804 if (!object->cam_version == -32) { 2805 2805 psFree(object); 2806 2806 exit(EXIT_FAILURE); … … 2816 2816 { 2817 2817 psMetadata *md; 2818 p4SkyfileRow*object;2819 2820 md = psMetadataAlloc(); 2821 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p4_id", 0, NULL, -32)) {2818 warpSkyfileRow *object; 2819 2820 md = psMetadataAlloc(); 2821 if (!psMetadataAddS32(md, PS_LIST_TAIL, "warp_id", 0, NULL, -32)) { 2822 2822 psFree(md); 2823 2823 exit(EXIT_FAILURE); … … 2844 2844 } 2845 2845 2846 object = p4SkyfileObjectFromMetadata(md);2847 if (!object) { 2848 psFree(md); 2849 exit(EXIT_FAILURE); 2850 } 2851 2852 psFree(md); 2853 2854 if (!object-> p4_id == -32) {2846 object = warpSkyfileObjectFromMetadata(md); 2847 if (!object) { 2848 psFree(md); 2849 exit(EXIT_FAILURE); 2850 } 2851 2852 psFree(md); 2853 2854 if (!object->warp_id == -32) { 2855 2855 psFree(object); 2856 2856 exit(EXIT_FAILURE); … … 2882 2882 { 2883 2883 psMetadata *md; 2884 p5RunRow*object;2885 2886 md = psMetadataAlloc(); 2887 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p5_id", 0, NULL, -32)) {2884 diffRunRow *object; 2885 2886 md = psMetadataAlloc(); 2887 if (!psMetadataAddS32(md, PS_LIST_TAIL, "diff_id", 0, NULL, -32)) { 2888 2888 psFree(md); 2889 2889 exit(EXIT_FAILURE); … … 2913 2913 } 2914 2914 2915 object = p5RunObjectFromMetadata(md);2916 if (!object) { 2917 psFree(md); 2918 exit(EXIT_FAILURE); 2919 } 2920 2921 psFree(md); 2922 2923 if (!object-> p5_id == -32) {2915 object = diffRunObjectFromMetadata(md); 2916 if (!object) { 2917 psFree(md); 2918 exit(EXIT_FAILURE); 2919 } 2920 2921 psFree(md); 2922 2923 if (!object->diff_id == -32) { 2924 2924 psFree(object); 2925 2925 exit(EXIT_FAILURE); … … 2954 2954 { 2955 2955 psMetadata *md; 2956 p5InputSkyfileRow *object;2957 2958 md = psMetadataAlloc(); 2959 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p5_id", 0, NULL, -32)) {2960 psFree(md); 2961 exit(EXIT_FAILURE); 2962 } 2963 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p4_id", 0, NULL, -32)) {2956 diffInputSkyfileRow *object; 2957 2958 md = psMetadataAlloc(); 2959 if (!psMetadataAddS32(md, PS_LIST_TAIL, "diff_id", 0, NULL, -32)) { 2960 psFree(md); 2961 exit(EXIT_FAILURE); 2962 } 2963 if (!psMetadataAddS32(md, PS_LIST_TAIL, "warp_id", 0, NULL, -32)) { 2964 2964 psFree(md); 2965 2965 exit(EXIT_FAILURE); … … 2982 2982 } 2983 2983 2984 object = p5InputSkyfileObjectFromMetadata(md);2985 if (!object) { 2986 psFree(md); 2987 exit(EXIT_FAILURE); 2988 } 2989 2990 psFree(md); 2991 2992 if (!object-> p5_id == -32) {2993 psFree(object); 2994 exit(EXIT_FAILURE); 2995 } 2996 if (!object-> p4_id == -32) {2984 object = diffInputSkyfileObjectFromMetadata(md); 2985 if (!object) { 2986 psFree(md); 2987 exit(EXIT_FAILURE); 2988 } 2989 2990 psFree(md); 2991 2992 if (!object->diff_id == -32) { 2993 psFree(object); 2994 exit(EXIT_FAILURE); 2995 } 2996 if (!object->warp_id == -32) { 2997 2997 psFree(object); 2998 2998 exit(EXIT_FAILURE); … … 3020 3020 { 3021 3021 psMetadata *md; 3022 p5DiffSkyfileRow*object;3023 3024 md = psMetadataAlloc(); 3025 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p5_id", 0, NULL, -32)) {3022 diffSkyfileRow *object; 3023 3024 md = psMetadataAlloc(); 3025 if (!psMetadataAddS32(md, PS_LIST_TAIL, "diff_id", 0, NULL, -32)) { 3026 3026 psFree(md); 3027 3027 exit(EXIT_FAILURE); … … 3040 3040 } 3041 3041 3042 object = p5DiffSkyfileObjectFromMetadata(md);3043 if (!object) { 3044 psFree(md); 3045 exit(EXIT_FAILURE); 3046 } 3047 3048 psFree(md); 3049 3050 if (!object-> p5_id == -32) {3042 object = diffSkyfileObjectFromMetadata(md); 3043 if (!object) { 3044 psFree(md); 3045 exit(EXIT_FAILURE); 3046 } 3047 3048 psFree(md); 3049 3050 if (!object->diff_id == -32) { 3051 3051 psFree(object); 3052 3052 exit(EXIT_FAILURE); … … 3070 3070 { 3071 3071 psMetadata *md; 3072 p6RunRow*object;3073 3074 md = psMetadataAlloc(); 3075 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p6_id", 0, NULL, -32)) {3072 stackRunRow *object; 3073 3074 md = psMetadataAlloc(); 3075 if (!psMetadataAddS32(md, PS_LIST_TAIL, "stack_id", 0, NULL, -32)) { 3076 3076 psFree(md); 3077 3077 exit(EXIT_FAILURE); … … 3101 3101 } 3102 3102 3103 object = p6RunObjectFromMetadata(md);3104 if (!object) { 3105 psFree(md); 3106 exit(EXIT_FAILURE); 3107 } 3108 3109 psFree(md); 3110 3111 if (!object-> p6_id == -32) {3103 object = stackRunObjectFromMetadata(md); 3104 if (!object) { 3105 psFree(md); 3106 exit(EXIT_FAILURE); 3107 } 3108 3109 psFree(md); 3110 3111 if (!object->stack_id == -32) { 3112 3112 psFree(object); 3113 3113 exit(EXIT_FAILURE); … … 3142 3142 { 3143 3143 psMetadata *md; 3144 p6InputSkyfileRow *object;3145 3146 md = psMetadataAlloc(); 3147 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p6_id", 0, NULL, -32)) {3148 psFree(md); 3149 exit(EXIT_FAILURE); 3150 } 3151 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p4_id", 0, NULL, -32)) {3152 psFree(md); 3153 exit(EXIT_FAILURE); 3154 } 3155 3156 object = p6InputSkyfileObjectFromMetadata(md);3157 if (!object) { 3158 psFree(md); 3159 exit(EXIT_FAILURE); 3160 } 3161 3162 psFree(md); 3163 3164 if (!object-> p6_id == -32) {3165 psFree(object); 3166 exit(EXIT_FAILURE); 3167 } 3168 if (!object-> p4_id == -32) {3169 psFree(object); 3170 exit(EXIT_FAILURE); 3171 } 3172 3173 psFree(object); 3174 } 3175 3176 { 3177 psMetadata *md; 3178 p6SumSkyfileRow *object;3179 3180 md = psMetadataAlloc(); 3181 if (!psMetadataAddS32(md, PS_LIST_TAIL, " p6_id", 0, NULL, -32)) {3144 stackInputSkyfileRow *object; 3145 3146 md = psMetadataAlloc(); 3147 if (!psMetadataAddS32(md, PS_LIST_TAIL, "stack_id", 0, NULL, -32)) { 3148 psFree(md); 3149 exit(EXIT_FAILURE); 3150 } 3151 if (!psMetadataAddS32(md, PS_LIST_TAIL, "warp_id", 0, NULL, -32)) { 3152 psFree(md); 3153 exit(EXIT_FAILURE); 3154 } 3155 3156 object = stackInputSkyfileObjectFromMetadata(md); 3157 if (!object) { 3158 psFree(md); 3159 exit(EXIT_FAILURE); 3160 } 3161 3162 psFree(md); 3163 3164 if (!object->stack_id == -32) { 3165 psFree(object); 3166 exit(EXIT_FAILURE); 3167 } 3168 if (!object->warp_id == -32) { 3169 psFree(object); 3170 exit(EXIT_FAILURE); 3171 } 3172 3173 psFree(object); 3174 } 3175 3176 { 3177 psMetadata *md; 3178 stackSumSkyfileRow *object; 3179 3180 md = psMetadataAlloc(); 3181 if (!psMetadataAddS32(md, PS_LIST_TAIL, "stack_id", 0, NULL, -32)) { 3182 3182 psFree(md); 3183 3183 exit(EXIT_FAILURE); … … 3196 3196 } 3197 3197 3198 object = p6SumSkyfileObjectFromMetadata(md);3199 if (!object) { 3200 psFree(md); 3201 exit(EXIT_FAILURE); 3202 } 3203 3204 psFree(md); 3205 3206 if (!object-> p6_id == -32) {3198 object = stackSumSkyfileObjectFromMetadata(md); 3199 if (!object) { 3200 psFree(md); 3201 exit(EXIT_FAILURE); 3202 } 3203 3204 psFree(md); 3205 3206 if (!object->stack_id == -32) { 3207 3207 psFree(object); 3208 3208 exit(EXIT_FAILURE); -
trunk/ippdb/tests/selectrowsfits.c
r11988 r12026 263 263 } 264 264 265 if (! p1PendingExpSelectRowsFits(dbh, fits, NULL, 1)) {266 exit(EXIT_FAILURE); 267 } 268 269 psFree(fits); 270 psDBCleanup(dbh); 271 } 272 273 { 274 psDB *dbh; 275 psFits *fits; 276 277 dbh = psDBInit("localhost", "test", NULL, "test"); 278 if (!dbh) { 279 exit(EXIT_FAILURE); 280 } 281 282 fits = psFitsOpen(TMP_FILENAME, "w"); 283 if (!fits) { 284 exit(EXIT_FAILURE); 285 } 286 287 if (! p2PendingExpSelectRowsFits(dbh, fits, NULL, 1)) {288 exit(EXIT_FAILURE); 289 } 290 291 psFree(fits); 292 psDBCleanup(dbh); 293 } 294 295 { 296 psDB *dbh; 297 psFits *fits; 298 299 dbh = psDBInit("localhost", "test", NULL, "test"); 300 if (!dbh) { 301 exit(EXIT_FAILURE); 302 } 303 304 fits = psFitsOpen(TMP_FILENAME, "w"); 305 if (!fits) { 306 exit(EXIT_FAILURE); 307 } 308 309 if (! p2PendingImfileSelectRowsFits(dbh, fits, NULL, 1)) {310 exit(EXIT_FAILURE); 311 } 312 313 psFree(fits); 314 psDBCleanup(dbh); 315 } 316 317 { 318 psDB *dbh; 319 psFits *fits; 320 321 dbh = psDBInit("localhost", "test", NULL, "test"); 322 if (!dbh) { 323 exit(EXIT_FAILURE); 324 } 325 326 fits = psFitsOpen(TMP_FILENAME, "w"); 327 if (!fits) { 328 exit(EXIT_FAILURE); 329 } 330 331 if (! p2ProcessedExpSelectRowsFits(dbh, fits, NULL, 1)) {332 exit(EXIT_FAILURE); 333 } 334 335 psFree(fits); 336 psDBCleanup(dbh); 337 } 338 339 { 340 psDB *dbh; 341 psFits *fits; 342 343 dbh = psDBInit("localhost", "test", NULL, "test"); 344 if (!dbh) { 345 exit(EXIT_FAILURE); 346 } 347 348 fits = psFitsOpen(TMP_FILENAME, "w"); 349 if (!fits) { 350 exit(EXIT_FAILURE); 351 } 352 353 if (! p2MaskSelectRowsFits(dbh, fits, NULL, 1)) {354 exit(EXIT_FAILURE); 355 } 356 357 psFree(fits); 358 psDBCleanup(dbh); 359 } 360 361 { 362 psDB *dbh; 363 psFits *fits; 364 365 dbh = psDBInit("localhost", "test", NULL, "test"); 366 if (!dbh) { 367 exit(EXIT_FAILURE); 368 } 369 370 fits = psFitsOpen(TMP_FILENAME, "w"); 371 if (!fits) { 372 exit(EXIT_FAILURE); 373 } 374 375 if (! p2ProcessedImfileSelectRowsFits(dbh, fits, NULL, 1)) {376 exit(EXIT_FAILURE); 377 } 378 379 psFree(fits); 380 psDBCleanup(dbh); 381 } 382 383 { 384 psDB *dbh; 385 psFits *fits; 386 387 dbh = psDBInit("localhost", "test", NULL, "test"); 388 if (!dbh) { 389 exit(EXIT_FAILURE); 390 } 391 392 fits = psFitsOpen(TMP_FILENAME, "w"); 393 if (!fits) { 394 exit(EXIT_FAILURE); 395 } 396 397 if (! p3PendingExpSelectRowsFits(dbh, fits, NULL, 1)) {398 exit(EXIT_FAILURE); 399 } 400 401 psFree(fits); 402 psDBCleanup(dbh); 403 } 404 405 { 406 psDB *dbh; 407 psFits *fits; 408 409 dbh = psDBInit("localhost", "test", NULL, "test"); 410 if (!dbh) { 411 exit(EXIT_FAILURE); 412 } 413 414 fits = psFitsOpen(TMP_FILENAME, "w"); 415 if (!fits) { 416 exit(EXIT_FAILURE); 417 } 418 419 if (! p3ProcessedExpSelectRowsFits(dbh, fits, NULL, 1)) {420 exit(EXIT_FAILURE); 421 } 422 423 psFree(fits); 424 psDBCleanup(dbh); 425 } 426 427 { 428 psDB *dbh; 429 psFits *fits; 430 431 dbh = psDBInit("localhost", "test", NULL, "test"); 432 if (!dbh) { 433 exit(EXIT_FAILURE); 434 } 435 436 fits = psFitsOpen(TMP_FILENAME, "w"); 437 if (!fits) { 438 exit(EXIT_FAILURE); 439 } 440 441 if (! p3MaskSelectRowsFits(dbh, fits, NULL, 1)) {265 if (!guidePendingExpSelectRowsFits(dbh, fits, NULL, 1)) { 266 exit(EXIT_FAILURE); 267 } 268 269 psFree(fits); 270 psDBCleanup(dbh); 271 } 272 273 { 274 psDB *dbh; 275 psFits *fits; 276 277 dbh = psDBInit("localhost", "test", NULL, "test"); 278 if (!dbh) { 279 exit(EXIT_FAILURE); 280 } 281 282 fits = psFitsOpen(TMP_FILENAME, "w"); 283 if (!fits) { 284 exit(EXIT_FAILURE); 285 } 286 287 if (!chipPendingExpSelectRowsFits(dbh, fits, NULL, 1)) { 288 exit(EXIT_FAILURE); 289 } 290 291 psFree(fits); 292 psDBCleanup(dbh); 293 } 294 295 { 296 psDB *dbh; 297 psFits *fits; 298 299 dbh = psDBInit("localhost", "test", NULL, "test"); 300 if (!dbh) { 301 exit(EXIT_FAILURE); 302 } 303 304 fits = psFitsOpen(TMP_FILENAME, "w"); 305 if (!fits) { 306 exit(EXIT_FAILURE); 307 } 308 309 if (!chipPendingImfileSelectRowsFits(dbh, fits, NULL, 1)) { 310 exit(EXIT_FAILURE); 311 } 312 313 psFree(fits); 314 psDBCleanup(dbh); 315 } 316 317 { 318 psDB *dbh; 319 psFits *fits; 320 321 dbh = psDBInit("localhost", "test", NULL, "test"); 322 if (!dbh) { 323 exit(EXIT_FAILURE); 324 } 325 326 fits = psFitsOpen(TMP_FILENAME, "w"); 327 if (!fits) { 328 exit(EXIT_FAILURE); 329 } 330 331 if (!chipProcessedExpSelectRowsFits(dbh, fits, NULL, 1)) { 332 exit(EXIT_FAILURE); 333 } 334 335 psFree(fits); 336 psDBCleanup(dbh); 337 } 338 339 { 340 psDB *dbh; 341 psFits *fits; 342 343 dbh = psDBInit("localhost", "test", NULL, "test"); 344 if (!dbh) { 345 exit(EXIT_FAILURE); 346 } 347 348 fits = psFitsOpen(TMP_FILENAME, "w"); 349 if (!fits) { 350 exit(EXIT_FAILURE); 351 } 352 353 if (!chipMaskSelectRowsFits(dbh, fits, NULL, 1)) { 354 exit(EXIT_FAILURE); 355 } 356 357 psFree(fits); 358 psDBCleanup(dbh); 359 } 360 361 { 362 psDB *dbh; 363 psFits *fits; 364 365 dbh = psDBInit("localhost", "test", NULL, "test"); 366 if (!dbh) { 367 exit(EXIT_FAILURE); 368 } 369 370 fits = psFitsOpen(TMP_FILENAME, "w"); 371 if (!fits) { 372 exit(EXIT_FAILURE); 373 } 374 375 if (!chipProcessedImfileSelectRowsFits(dbh, fits, NULL, 1)) { 376 exit(EXIT_FAILURE); 377 } 378 379 psFree(fits); 380 psDBCleanup(dbh); 381 } 382 383 { 384 psDB *dbh; 385 psFits *fits; 386 387 dbh = psDBInit("localhost", "test", NULL, "test"); 388 if (!dbh) { 389 exit(EXIT_FAILURE); 390 } 391 392 fits = psFitsOpen(TMP_FILENAME, "w"); 393 if (!fits) { 394 exit(EXIT_FAILURE); 395 } 396 397 if (!camPendingExpSelectRowsFits(dbh, fits, NULL, 1)) { 398 exit(EXIT_FAILURE); 399 } 400 401 psFree(fits); 402 psDBCleanup(dbh); 403 } 404 405 { 406 psDB *dbh; 407 psFits *fits; 408 409 dbh = psDBInit("localhost", "test", NULL, "test"); 410 if (!dbh) { 411 exit(EXIT_FAILURE); 412 } 413 414 fits = psFitsOpen(TMP_FILENAME, "w"); 415 if (!fits) { 416 exit(EXIT_FAILURE); 417 } 418 419 if (!camProcessedExpSelectRowsFits(dbh, fits, NULL, 1)) { 420 exit(EXIT_FAILURE); 421 } 422 423 psFree(fits); 424 psDBCleanup(dbh); 425 } 426 427 { 428 psDB *dbh; 429 psFits *fits; 430 431 dbh = psDBInit("localhost", "test", NULL, "test"); 432 if (!dbh) { 433 exit(EXIT_FAILURE); 434 } 435 436 fits = psFitsOpen(TMP_FILENAME, "w"); 437 if (!fits) { 438 exit(EXIT_FAILURE); 439 } 440 441 if (!camMaskSelectRowsFits(dbh, fits, NULL, 1)) { 442 442 exit(EXIT_FAILURE); 443 443 } … … 703 703 } 704 704 705 if (! p4RunSelectRowsFits(dbh, fits, NULL, 1)) {706 exit(EXIT_FAILURE); 707 } 708 709 psFree(fits); 710 psDBCleanup(dbh); 711 } 712 713 { 714 psDB *dbh; 715 psFits *fits; 716 717 dbh = psDBInit("localhost", "test", NULL, "test"); 718 if (!dbh) { 719 exit(EXIT_FAILURE); 720 } 721 722 fits = psFitsOpen(TMP_FILENAME, "w"); 723 if (!fits) { 724 exit(EXIT_FAILURE); 725 } 726 727 if (! p4InputExpSelectRowsFits(dbh, fits, NULL, 1)) {728 exit(EXIT_FAILURE); 729 } 730 731 psFree(fits); 732 psDBCleanup(dbh); 733 } 734 735 { 736 psDB *dbh; 737 psFits *fits; 738 739 dbh = psDBInit("localhost", "test", NULL, "test"); 740 if (!dbh) { 741 exit(EXIT_FAILURE); 742 } 743 744 fits = psFitsOpen(TMP_FILENAME, "w"); 745 if (!fits) { 746 exit(EXIT_FAILURE); 747 } 748 749 if (! p4SkyCellMapSelectRowsFits(dbh, fits, NULL, 1)) {750 exit(EXIT_FAILURE); 751 } 752 753 psFree(fits); 754 psDBCleanup(dbh); 755 } 756 757 { 758 psDB *dbh; 759 psFits *fits; 760 761 dbh = psDBInit("localhost", "test", NULL, "test"); 762 if (!dbh) { 763 exit(EXIT_FAILURE); 764 } 765 766 fits = psFitsOpen(TMP_FILENAME, "w"); 767 if (!fits) { 768 exit(EXIT_FAILURE); 769 } 770 771 if (! p4SkyfileSelectRowsFits(dbh, fits, NULL, 1)) {772 exit(EXIT_FAILURE); 773 } 774 775 psFree(fits); 776 psDBCleanup(dbh); 777 } 778 779 { 780 psDB *dbh; 781 psFits *fits; 782 783 dbh = psDBInit("localhost", "test", NULL, "test"); 784 if (!dbh) { 785 exit(EXIT_FAILURE); 786 } 787 788 fits = psFitsOpen(TMP_FILENAME, "w"); 789 if (!fits) { 790 exit(EXIT_FAILURE); 791 } 792 793 if (! p5RunSelectRowsFits(dbh, fits, NULL, 1)) {794 exit(EXIT_FAILURE); 795 } 796 797 psFree(fits); 798 psDBCleanup(dbh); 799 } 800 801 { 802 psDB *dbh; 803 psFits *fits; 804 805 dbh = psDBInit("localhost", "test", NULL, "test"); 806 if (!dbh) { 807 exit(EXIT_FAILURE); 808 } 809 810 fits = psFitsOpen(TMP_FILENAME, "w"); 811 if (!fits) { 812 exit(EXIT_FAILURE); 813 } 814 815 if (! p5InputSkyfileSelectRowsFits(dbh, fits, NULL, 1)) {816 exit(EXIT_FAILURE); 817 } 818 819 psFree(fits); 820 psDBCleanup(dbh); 821 } 822 823 { 824 psDB *dbh; 825 psFits *fits; 826 827 dbh = psDBInit("localhost", "test", NULL, "test"); 828 if (!dbh) { 829 exit(EXIT_FAILURE); 830 } 831 832 fits = psFitsOpen(TMP_FILENAME, "w"); 833 if (!fits) { 834 exit(EXIT_FAILURE); 835 } 836 837 if (! p5DiffSkyfileSelectRowsFits(dbh, fits, NULL, 1)) {838 exit(EXIT_FAILURE); 839 } 840 841 psFree(fits); 842 psDBCleanup(dbh); 843 } 844 845 { 846 psDB *dbh; 847 psFits *fits; 848 849 dbh = psDBInit("localhost", "test", NULL, "test"); 850 if (!dbh) { 851 exit(EXIT_FAILURE); 852 } 853 854 fits = psFitsOpen(TMP_FILENAME, "w"); 855 if (!fits) { 856 exit(EXIT_FAILURE); 857 } 858 859 if (! p6RunSelectRowsFits(dbh, fits, NULL, 1)) {860 exit(EXIT_FAILURE); 861 } 862 863 psFree(fits); 864 psDBCleanup(dbh); 865 } 866 867 { 868 psDB *dbh; 869 psFits *fits; 870 871 dbh = psDBInit("localhost", "test", NULL, "test"); 872 if (!dbh) { 873 exit(EXIT_FAILURE); 874 } 875 876 fits = psFitsOpen(TMP_FILENAME, "w"); 877 if (!fits) { 878 exit(EXIT_FAILURE); 879 } 880 881 if (! p6InputSkyfileSelectRowsFits(dbh, fits, NULL, 1)) {882 exit(EXIT_FAILURE); 883 } 884 885 psFree(fits); 886 psDBCleanup(dbh); 887 } 888 889 { 890 psDB *dbh; 891 psFits *fits; 892 893 dbh = psDBInit("localhost", "test", NULL, "test"); 894 if (!dbh) { 895 exit(EXIT_FAILURE); 896 } 897 898 fits = psFitsOpen(TMP_FILENAME, "w"); 899 if (!fits) { 900 exit(EXIT_FAILURE); 901 } 902 903 if (! p6SumSkyfileSelectRowsFits(dbh, fits, NULL, 1)) {705 if (!warpRunSelectRowsFits(dbh, fits, NULL, 1)) { 706 exit(EXIT_FAILURE); 707 } 708 709 psFree(fits); 710 psDBCleanup(dbh); 711 } 712 713 { 714 psDB *dbh; 715 psFits *fits; 716 717 dbh = psDBInit("localhost", "test", NULL, "test"); 718 if (!dbh) { 719 exit(EXIT_FAILURE); 720 } 721 722 fits = psFitsOpen(TMP_FILENAME, "w"); 723 if (!fits) { 724 exit(EXIT_FAILURE); 725 } 726 727 if (!warpInputExpSelectRowsFits(dbh, fits, NULL, 1)) { 728 exit(EXIT_FAILURE); 729 } 730 731 psFree(fits); 732 psDBCleanup(dbh); 733 } 734 735 { 736 psDB *dbh; 737 psFits *fits; 738 739 dbh = psDBInit("localhost", "test", NULL, "test"); 740 if (!dbh) { 741 exit(EXIT_FAILURE); 742 } 743 744 fits = psFitsOpen(TMP_FILENAME, "w"); 745 if (!fits) { 746 exit(EXIT_FAILURE); 747 } 748 749 if (!warpSkyCellMapSelectRowsFits(dbh, fits, NULL, 1)) { 750 exit(EXIT_FAILURE); 751 } 752 753 psFree(fits); 754 psDBCleanup(dbh); 755 } 756 757 { 758 psDB *dbh; 759 psFits *fits; 760 761 dbh = psDBInit("localhost", "test", NULL, "test"); 762 if (!dbh) { 763 exit(EXIT_FAILURE); 764 } 765 766 fits = psFitsOpen(TMP_FILENAME, "w"); 767 if (!fits) { 768 exit(EXIT_FAILURE); 769 } 770 771 if (!warpSkyfileSelectRowsFits(dbh, fits, NULL, 1)) { 772 exit(EXIT_FAILURE); 773 } 774 775 psFree(fits); 776 psDBCleanup(dbh); 777 } 778 779 { 780 psDB *dbh; 781 psFits *fits; 782 783 dbh = psDBInit("localhost", "test", NULL, "test"); 784 if (!dbh) { 785 exit(EXIT_FAILURE); 786 } 787 788 fits = psFitsOpen(TMP_FILENAME, "w"); 789 if (!fits) { 790 exit(EXIT_FAILURE); 791 } 792 793 if (!diffRunSelectRowsFits(dbh, fits, NULL, 1)) { 794 exit(EXIT_FAILURE); 795 } 796 797 psFree(fits); 798 psDBCleanup(dbh); 799 } 800 801 { 802 psDB *dbh; 803 psFits *fits; 804 805 dbh = psDBInit("localhost", "test", NULL, "test"); 806 if (!dbh) { 807 exit(EXIT_FAILURE); 808 } 809 810 fits = psFitsOpen(TMP_FILENAME, "w"); 811 if (!fits) { 812 exit(EXIT_FAILURE); 813 } 814 815 if (!diffInputSkyfileSelectRowsFits(dbh, fits, NULL, 1)) { 816 exit(EXIT_FAILURE); 817 } 818 819 psFree(fits); 820 psDBCleanup(dbh); 821 } 822 823 { 824 psDB *dbh; 825 psFits *fits; 826 827 dbh = psDBInit("localhost", "test", NULL, "test"); 828 if (!dbh) { 829 exit(EXIT_FAILURE); 830 } 831 832 fits = psFitsOpen(TMP_FILENAME, "w"); 833 if (!fits) { 834 exit(EXIT_FAILURE); 835 } 836 837 if (!diffSkyfileSelectRowsFits(dbh, fits, NULL, 1)) { 838 exit(EXIT_FAILURE); 839 } 840 841 psFree(fits); 842 psDBCleanup(dbh); 843 } 844 845 { 846 psDB *dbh; 847 psFits *fits; 848 849 dbh = psDBInit("localhost", "test", NULL, "test"); 850 if (!dbh) { 851 exit(EXIT_FAILURE); 852 } 853 854 fits = psFitsOpen(TMP_FILENAME, "w"); 855 if (!fits) { 856 exit(EXIT_FAILURE); 857 } 858 859 if (!stackRunSelectRowsFits(dbh, fits, NULL, 1)) { 860 exit(EXIT_FAILURE); 861 } 862 863 psFree(fits); 864 psDBCleanup(dbh); 865 } 866 867 { 868 psDB *dbh; 869 psFits *fits; 870 871 dbh = psDBInit("localhost", "test", NULL, "test"); 872 if (!dbh) { 873 exit(EXIT_FAILURE); 874 } 875 876 fits = psFitsOpen(TMP_FILENAME, "w"); 877 if (!fits) { 878 exit(EXIT_FAILURE); 879 } 880 881 if (!stackInputSkyfileSelectRowsFits(dbh, fits, NULL, 1)) { 882 exit(EXIT_FAILURE); 883 } 884 885 psFree(fits); 886 psDBCleanup(dbh); 887 } 888 889 { 890 psDB *dbh; 891 psFits *fits; 892 893 dbh = psDBInit("localhost", "test", NULL, "test"); 894 if (!dbh) { 895 exit(EXIT_FAILURE); 896 } 897 898 fits = psFitsOpen(TMP_FILENAME, "w"); 899 if (!fits) { 900 exit(EXIT_FAILURE); 901 } 902 903 if (!stackSumSkyfileSelectRowsFits(dbh, fits, NULL, 1)) { 904 904 exit(EXIT_FAILURE); 905 905 }
Note:
See TracChangeset
for help on using the changeset viewer.
