Changeset 11988
- Timestamp:
- Feb 21, 2007, 4:29:12 PM (19 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 15 edited
-
Makefile.am (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (137 diffs)
-
src/ippdb.h (modified) (82 diffs)
-
tests/alloc.c (modified) (9 diffs)
-
tests/createtable.c (modified) (3 diffs)
-
tests/dbcleanup.c (modified) (1 diff)
-
tests/dbsetup.c (modified) (1 diff)
-
tests/droptable.c (modified) (3 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertfits.c (modified) (3 diffs)
-
tests/insertobject.c (modified) (5 diffs)
-
tests/metadatafromobject.c (modified) (9 diffs)
-
tests/objectfrommetadata.c (modified) (12 diffs)
-
tests/selectrowsfits.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/Makefile.am
r11867 r11988 44 44 $(top_builddir)/docs/man/man3/p4InputExpRow.3 \ 45 45 $(top_builddir)/docs/man/man3/p4SkyCellMapRow.3 \ 46 $(top_builddir)/docs/man/man3/p4S cfileRow.3 \46 $(top_builddir)/docs/man/man3/p4SkyfileRow.3 \ 47 47 $(top_builddir)/docs/man/man3/p5RunRow.3 \ 48 $(top_builddir)/docs/man/man3/p5InputS cfileRow.3 \49 $(top_builddir)/docs/man/man3/p5DiffS cfileRow.3 \48 $(top_builddir)/docs/man/man3/p5InputSkyfileRow.3 \ 49 $(top_builddir)/docs/man/man3/p5DiffSkyfileRow.3 \ 50 50 $(top_builddir)/docs/man/man3/p6RunRow.3 \ 51 $(top_builddir)/docs/man/man3/p6InputS cfileRow.3 \52 $(top_builddir)/docs/man/man3/p6SumS cfileRow.351 $(top_builddir)/docs/man/man3/p6InputSkyfileRow.3 \ 52 $(top_builddir)/docs/man/man3/p6SumSkyfileRow.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/p4S cfileRow.3 docs/man/man3/p5RunRow.3 docs/man/man3/p5InputScfileRow.3 docs/man/man3/p5DiffScfileRow.3 docs/man/man3/p6RunRow.3 docs/man/man3/p6InputScfileRow.3 docs/man/man3/p6SumScfileRow.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/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: 56 56 $(DOXYGEN) 57 57 -
trunk/ippdb/configure.ac
r11873 r11988 7 7 AC_PREREQ(2.59) 8 8 9 AC_INIT([ippdb], [1.1. 9], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [1.1.10], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r11873 r11988 65 65 #define P4INPUTEXP_TABLE_NAME "p4InputExp" 66 66 #define P4SKYCELLMAP_TABLE_NAME "p4SkyCellMap" 67 #define P4S CFILE_TABLE_NAME "p4Scfile"67 #define P4SKYFILE_TABLE_NAME "p4Skyfile" 68 68 #define P5RUN_TABLE_NAME "p5Run" 69 #define P5INPUTS CFILE_TABLE_NAME "p5InputScfile"70 #define P5DIFFS CFILE_TABLE_NAME "p5DiffScfile"69 #define P5INPUTSKYFILE_TABLE_NAME "p5InputSkyfile" 70 #define P5DIFFSKYFILE_TABLE_NAME "p5DiffSkyfile" 71 71 #define P6RUN_TABLE_NAME "p6Run" 72 #define P6INPUTS CFILE_TABLE_NAME "p6InputScfile"73 #define P6SUMS CFILE_TABLE_NAME "p6SumScfile"72 #define P6INPUTSKYFILE_TABLE_NAME "p6InputSkyfile" 73 #define P6SUMSKYFILE_TABLE_NAME "p6SumSkyfile" 74 74 #define MAX_STRING_LENGTH 1024 75 75 … … 14846 14846 return true; 14847 14847 } 14848 static void p4S cfileRowFree(p4ScfileRow *object);14849 14850 p4S cfileRow *p4ScfileRowAlloc(psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *uri, psF64 bg, psF64 bg_mean_stdev)14851 { 14852 p4S cfileRow*_object;14853 14854 _object = psAlloc(sizeof(p4S cfileRow));14855 psMemSetDeallocator(_object, (psFreeFunc)p4S cfileRowFree);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 14856 14857 14857 _object->p4_id = p4_id; 14858 14858 _object->skycell_id = psStringCopy(skycell_id); 14859 14859 _object->tess_id = psStringCopy(tess_id); 14860 _object->exp_tag = psStringCopy(exp_tag);14861 _object->p3_version = p3_version;14862 14860 _object->uri = psStringCopy(uri); 14863 14861 _object->bg = bg; … … 14867 14865 } 14868 14866 14869 static void p4S cfileRowFree(p4ScfileRow *object)14867 static void p4SkyfileRowFree(p4SkyfileRow *object) 14870 14868 { 14871 14869 psFree(object->skycell_id); 14872 14870 psFree(object->tess_id); 14873 psFree(object->exp_tag);14874 14871 psFree(object->uri); 14875 14872 } 14876 14873 14877 bool p4S cfileCreateTable(psDB *dbh)14874 bool p4SkyfileCreateTable(psDB *dbh) 14878 14875 { 14879 14876 psMetadata *md = psMetadataAlloc(); … … 14893 14890 return false; 14894 14891 } 14895 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, "Key", "64")) {14896 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");14897 psFree(md);14898 return false;14899 }14900 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, "Key", 0)) {14901 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14902 psFree(md);14903 return false;14904 }14905 14892 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) { 14906 14893 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 14919 14906 } 14920 14907 14921 bool status = psDBCreateTable(dbh, P4S CFILE_TABLE_NAME, md);14908 bool status = psDBCreateTable(dbh, P4SKYFILE_TABLE_NAME, md); 14922 14909 14923 14910 psFree(md); … … 14926 14913 } 14927 14914 14928 bool p4S cfileDropTable(psDB *dbh)14929 { 14930 return psDBDropTable(dbh, P4S CFILE_TABLE_NAME);14931 } 14932 14933 bool p4S cfileInsert(psDB * dbh, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *exp_tag, psS32 p3_version, const char *uri, psF64 bg, psF64 bg_mean_stdev)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) 14934 14921 { 14935 14922 psMetadata *md = psMetadataAlloc(); … … 14949 14936 return false; 14950 14937 } 14951 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, exp_tag)) {14952 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");14953 psFree(md);14954 return false;14955 }14956 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, p3_version)) {14957 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");14958 psFree(md);14959 return false;14960 }14961 14938 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 14962 14939 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 14975 14952 } 14976 14953 14977 bool status = psDBInsertOneRow(dbh, P4S CFILE_TABLE_NAME, md);14954 bool status = psDBInsertOneRow(dbh, P4SKYFILE_TABLE_NAME, md); 14978 14955 psFree(md); 14979 14956 … … 14981 14958 } 14982 14959 14983 long long p4S cfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)14960 long long p4SkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 14984 14961 { 14985 14962 long long deleted = 0; 14986 14963 14987 long long count = psDBDeleteRows(dbh, P4S CFILE_TABLE_NAME, where, limit);14964 long long count = psDBDeleteRows(dbh, P4SKYFILE_TABLE_NAME, where, limit); 14988 14965 if (count < 0) { 14989 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4S cfile");14966 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Skyfile"); 14990 14967 return count; 14991 14968 … … 14995 14972 return deleted; 14996 14973 } 14997 bool p4S cfileInsertObject(psDB *dbh, p4ScfileRow *object)14998 { 14999 return p4S cfileInsert(dbh, object->p4_id, object->skycell_id, object->tess_id, object->exp_tag, object->p3_version, object->uri, object->bg, object->bg_mean_stdev);15000 } 15001 15002 bool p4S cfileInsertObjects(psDB *dbh, psArray *objects)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) 15003 14980 { 15004 14981 for (long i = 0; i < psArrayLength(objects); i++) { 15005 if (!p4S cfileInsertObject(dbh, objects->data[i])) {14982 if (!p4SkyfileInsertObject(dbh, objects->data[i])) { 15006 14983 return false; 15007 14984 } … … 15011 14988 } 15012 14989 15013 bool p4S cfileInsertFits(psDB *dbh, const psFits *fits)14990 bool p4SkyfileInsertFits(psDB *dbh, const psFits *fits) 15014 14991 { 15015 14992 psArray *rowSet; 15016 14993 15017 // move to (the first?) extension named P4S CFILE_TABLE_NAME15018 if (!psFitsMoveExtName(fits, P4S CFILE_TABLE_NAME)) {15019 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P4S CFILE_TABLE_NAME);14994 // move to (the first?) extension named P4SKYFILE_TABLE_NAME 14995 if (!psFitsMoveExtName(fits, P4SKYFILE_TABLE_NAME)) { 14996 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P4SKYFILE_TABLE_NAME); 15020 14997 return false; 15021 14998 } … … 15035 15012 } 15036 15013 15037 if (!psDBInsertRows(dbh, P4S CFILE_TABLE_NAME, rowSet)) {15014 if (!psDBInsertRows(dbh, P4SKYFILE_TABLE_NAME, rowSet)) { 15038 15015 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 15039 15016 psFree(rowSet); … … 15046 15023 } 15047 15024 15048 bool p4S cfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)15025 bool p4SkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 15049 15026 { 15050 15027 psArray *rowSet; 15051 15028 15052 rowSet = psDBSelectRows(dbh, P4S CFILE_TABLE_NAME, where, limit);15029 rowSet = psDBSelectRows(dbh, P4SKYFILE_TABLE_NAME, where, limit); 15053 15030 if (!rowSet) { 15054 15031 return false; … … 15056 15033 15057 15034 // output to fits 15058 if (!psFitsWriteTable(fits, NULL, rowSet, P4S CFILE_TABLE_NAME)) {15035 if (!psFitsWriteTable(fits, NULL, rowSet, P4SKYFILE_TABLE_NAME)) { 15059 15036 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 15060 15037 psFree(rowSet); … … 15067 15044 } 15068 15045 15069 psMetadata *p4S cfileMetadataFromObject(const p4ScfileRow *object)15046 psMetadata *p4SkyfileMetadataFromObject(const p4SkyfileRow *object) 15070 15047 { 15071 15048 psMetadata *md = psMetadataAlloc(); … … 15085 15062 return false; 15086 15063 } 15087 if (!psMetadataAdd(md, PS_LIST_TAIL, "exp_tag", PS_DATA_STRING, NULL, object->exp_tag)) {15088 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");15089 psFree(md);15090 return false;15091 }15092 if (!psMetadataAdd(md, PS_LIST_TAIL, "p3_version", PS_DATA_S32, NULL, object->p3_version)) {15093 psError(PS_ERR_UNKNOWN, false, "failed to add item p3_version");15094 psFree(md);15095 return false;15096 }15097 15064 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) { 15098 15065 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 15115 15082 } 15116 15083 15117 p4S cfileRow *p4ScfileObjectFromMetadata(psMetadata *md)15084 p4SkyfileRow *p4SkyfileObjectFromMetadata(psMetadata *md) 15118 15085 { 15119 15086 … … 15134 15101 return false; 15135 15102 } 15136 char* exp_tag = psMetadataLookupPtr(&status, md, "exp_tag");15137 if (!status) {15138 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item exp_tag");15139 return false;15140 }15141 psS32 p3_version = psMetadataLookupS32(&status, md, "p3_version");15142 if (!status) {15143 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item p3_version");15144 return false;15145 }15146 15103 char* uri = psMetadataLookupPtr(&status, md, "uri"); 15147 15104 if (!status) { … … 15160 15117 } 15161 15118 15162 return p4S cfileRowAlloc(p4_id, skycell_id, tess_id, exp_tag, p3_version, uri, bg, bg_mean_stdev);15163 } 15164 psArray *p4S cfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)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) 15165 15122 { 15166 15123 psArray *rowSet; … … 15168 15125 psU64 i; 15169 15126 15170 rowSet = psDBSelectRows(dbh, P4S CFILE_TABLE_NAME, where, limit);15127 rowSet = psDBSelectRows(dbh, P4SKYFILE_TABLE_NAME, where, limit); 15171 15128 if (!rowSet) { 15172 15129 return NULL; … … 15178 15135 15179 15136 for (i = 0; i < rowSet->n; i++) { 15180 p4S cfileRow *object = p4ScfileObjectFromMetadata(rowSet->data[i]);15137 p4SkyfileRow *object = p4SkyfileObjectFromMetadata(rowSet->data[i]); 15181 15138 psArrayAdd(returnSet, 0, object); 15182 15139 psFree(object); … … 15187 15144 return returnSet; 15188 15145 } 15189 bool p4S cfileDeleteObject(psDB *dbh, const p4ScfileRow *object)15190 { 15191 psMetadata *where = p4S cfileMetadataFromObject(object);15192 long long count = psDBDeleteRows(dbh, P4S CFILE_TABLE_NAME, where, 0);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); 15193 15150 psFree(where); 15194 15151 if (count < 0) { 15195 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4S cfile");15152 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Skyfile"); 15196 15153 return false; 15197 15154 } … … 15199 15156 // XXX should this be a psAbort() instead? It is possible that 15200 15157 // having an object match multiple rows was by design. 15201 psError(PS_ERR_UNKNOWN, true, "p4S cfileRow object matched more then one row. Check your database schema");15202 return false; 15203 } 15204 15205 return true; 15206 } 15207 long long p4S cfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)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) 15208 15165 { 15209 15166 long long deleted = 0; 15210 15167 15211 15168 for (long long i = 0; i < objects->n; i++) { 15212 p4S cfileRow *object = objects->data[i];15213 psMetadata *where = p4S cfileMetadataFromObject(object);15214 long long count = psDBDeleteRows(dbh, P4S CFILE_TABLE_NAME, where, limit);15169 p4SkyfileRow *object = objects->data[i]; 15170 psMetadata *where = p4SkyfileMetadataFromObject(object); 15171 long long count = psDBDeleteRows(dbh, P4SKYFILE_TABLE_NAME, where, limit); 15215 15172 psFree(where); 15216 15173 if (count < 0) { 15217 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4S cfile");15174 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p4Skyfile"); 15218 15175 return count; 15219 15176 } … … 15224 15181 return deleted; 15225 15182 } 15226 bool p4S cfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)15183 bool p4SkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 15227 15184 { 15228 15185 PS_ASSERT_PTR_NON_NULL(objects, false); … … 15230 15187 psMetadata *output = psMetadataAlloc(); 15231 15188 for (long i = 0; i < psArrayLength(objects); i++) { 15232 psMetadata *md = p4S cfileMetadataFromObject(objects->data[i]);15189 psMetadata *md = p4SkyfileMetadataFromObject(objects->data[i]); 15233 15190 if (!psMetadataAddMetadata( 15234 15191 output, 15235 15192 PS_LIST_TAIL, 15236 P4S CFILE_TABLE_NAME,15193 P4SKYFILE_TABLE_NAME, 15237 15194 PS_META_DUPLICATE_OK, 15238 15195 NULL, … … 15255 15212 return true; 15256 15213 } 15257 bool p4S cfilePrintObject(FILE *stream, p4ScfileRow *object, bool mdcf)15214 bool p4SkyfilePrintObject(FILE *stream, p4SkyfileRow *object, bool mdcf) 15258 15215 { 15259 15216 PS_ASSERT_PTR_NON_NULL(object, false); 15260 15217 15261 psMetadata *md = p4S cfileMetadataFromObject(object);15218 psMetadata *md = p4SkyfileMetadataFromObject(object); 15262 15219 15263 15220 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 15272 15229 static void p5RunRowFree(p5RunRow *object); 15273 15230 15274 p5RunRow *p5RunRowAlloc(psS32 p5_id, const char *state, const char *workdir, const char *dvodb, psTime* registered )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) 15275 15232 { 15276 15233 p5RunRow *_object; … … 15284 15241 _object->dvodb = psStringCopy(dvodb); 15285 15242 _object->registered = psTimeCopy(registered); 15243 _object->skycell_id = psStringCopy(skycell_id); 15244 _object->tess_id = psStringCopy(tess_id); 15286 15245 15287 15246 return _object; … … 15294 15253 psFree(object->dvodb); 15295 15254 psFree(object->registered); 15255 psFree(object->skycell_id); 15256 psFree(object->tess_id); 15296 15257 } 15297 15258 … … 15324 15285 return false; 15325 15286 } 15287 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, "Key", "64")) { 15288 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 15289 psFree(md); 15290 return false; 15291 } 15292 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, "Key", "64")) { 15293 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 15294 psFree(md); 15295 return false; 15296 } 15326 15297 15327 15298 bool status = psDBCreateTable(dbh, P5RUN_TABLE_NAME, md); … … 15337 15308 } 15338 15309 15339 bool p5RunInsert(psDB * dbh, psS32 p5_id, const char *state, const char *workdir, const char *dvodb, psTime* registered )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) 15340 15311 { 15341 15312 psMetadata *md = psMetadataAlloc(); … … 15362 15333 if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) { 15363 15334 psError(PS_ERR_UNKNOWN, false, "failed to add item registered"); 15335 psFree(md); 15336 return false; 15337 } 15338 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, skycell_id)) { 15339 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 15340 psFree(md); 15341 return false; 15342 } 15343 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) { 15344 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 15364 15345 psFree(md); 15365 15346 return false; … … 15388 15369 bool p5RunInsertObject(psDB *dbh, p5RunRow *object) 15389 15370 { 15390 return p5RunInsert(dbh, object->p5_id, object->state, object->workdir, object->dvodb, object->registered );15371 return p5RunInsert(dbh, object->p5_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id); 15391 15372 } 15392 15373 … … 15486 15467 return false; 15487 15468 } 15469 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, object->skycell_id)) { 15470 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 15471 psFree(md); 15472 return false; 15473 } 15474 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, object->tess_id)) { 15475 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 15476 psFree(md); 15477 return false; 15478 } 15488 15479 15489 15480 … … 15520 15511 return false; 15521 15512 } 15522 15523 return p5RunRowAlloc(p5_id, state, workdir, dvodb, registered); 15513 char* skycell_id = psMetadataLookupPtr(&status, md, "skycell_id"); 15514 if (!status) { 15515 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item skycell_id"); 15516 return false; 15517 } 15518 char* tess_id = psMetadataLookupPtr(&status, md, "tess_id"); 15519 if (!status) { 15520 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item tess_id"); 15521 return false; 15522 } 15523 15524 return p5RunRowAlloc(p5_id, state, workdir, dvodb, registered, skycell_id, tess_id); 15524 15525 } 15525 15526 psArray *p5RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 15631 15632 return true; 15632 15633 } 15633 static void p5InputS cfileRowFree(p5InputScfileRow *object);15634 15635 p5InputS cfileRow *p5InputScfileRowAlloc(psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)15636 { 15637 p5InputS cfileRow *_object;15638 15639 _object = psAlloc(sizeof(p5InputS cfileRow));15640 psMemSetDeallocator(_object, (psFreeFunc)p5InputS cfileRowFree);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); 15641 15642 15642 15643 _object->p5_id = p5_id; … … 15650 15651 } 15651 15652 15652 static void p5InputS cfileRowFree(p5InputScfileRow *object)15653 static void p5InputSkyfileRowFree(p5InputSkyfileRow *object) 15653 15654 { 15654 15655 psFree(object->skycell_id); … … 15657 15658 } 15658 15659 15659 bool p5InputS cfileCreateTable(psDB *dbh)15660 bool p5InputSkyfileCreateTable(psDB *dbh) 15660 15661 { 15661 15662 psMetadata *md = psMetadataAlloc(); … … 15691 15692 } 15692 15693 15693 bool status = psDBCreateTable(dbh, P5INPUTS CFILE_TABLE_NAME, md);15694 bool status = psDBCreateTable(dbh, P5INPUTSKYFILE_TABLE_NAME, md); 15694 15695 15695 15696 psFree(md); … … 15698 15699 } 15699 15700 15700 bool p5InputS cfileDropTable(psDB *dbh)15701 { 15702 return psDBDropTable(dbh, P5INPUTS CFILE_TABLE_NAME);15703 } 15704 15705 bool p5InputS cfileInsert(psDB * dbh, psS32 p5_id, psS32 p4_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)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) 15706 15707 { 15707 15708 psMetadata *md = psMetadataAlloc(); … … 15737 15738 } 15738 15739 15739 bool status = psDBInsertOneRow(dbh, P5INPUTS CFILE_TABLE_NAME, md);15740 bool status = psDBInsertOneRow(dbh, P5INPUTSKYFILE_TABLE_NAME, md); 15740 15741 psFree(md); 15741 15742 … … 15743 15744 } 15744 15745 15745 long long p5InputS cfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)15746 long long p5InputSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 15746 15747 { 15747 15748 long long deleted = 0; 15748 15749 15749 long long count = psDBDeleteRows(dbh, P5INPUTS CFILE_TABLE_NAME, where, limit);15750 long long count = psDBDeleteRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit); 15750 15751 if (count < 0) { 15751 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputS cfile");15752 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputSkyfile"); 15752 15753 return count; 15753 15754 … … 15757 15758 return deleted; 15758 15759 } 15759 bool p5InputS cfileInsertObject(psDB *dbh, p5InputScfileRow *object)15760 { 15761 return p5InputS cfileInsert(dbh, object->p5_id, object->p4_id, object->skycell_id, object->tess_id, object->kind, object->template);15762 } 15763 15764 bool p5InputS cfileInsertObjects(psDB *dbh, psArray *objects)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) 15765 15766 { 15766 15767 for (long i = 0; i < psArrayLength(objects); i++) { 15767 if (!p5InputS cfileInsertObject(dbh, objects->data[i])) {15768 if (!p5InputSkyfileInsertObject(dbh, objects->data[i])) { 15768 15769 return false; 15769 15770 } … … 15773 15774 } 15774 15775 15775 bool p5InputS cfileInsertFits(psDB *dbh, const psFits *fits)15776 bool p5InputSkyfileInsertFits(psDB *dbh, const psFits *fits) 15776 15777 { 15777 15778 psArray *rowSet; 15778 15779 15779 // move to (the first?) extension named P5INPUTS CFILE_TABLE_NAME15780 if (!psFitsMoveExtName(fits, P5INPUTS CFILE_TABLE_NAME)) {15781 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5INPUTS CFILE_TABLE_NAME);15780 // move to (the first?) extension named P5INPUTSKYFILE_TABLE_NAME 15781 if (!psFitsMoveExtName(fits, P5INPUTSKYFILE_TABLE_NAME)) { 15782 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5INPUTSKYFILE_TABLE_NAME); 15782 15783 return false; 15783 15784 } … … 15797 15798 } 15798 15799 15799 if (!psDBInsertRows(dbh, P5INPUTS CFILE_TABLE_NAME, rowSet)) {15800 if (!psDBInsertRows(dbh, P5INPUTSKYFILE_TABLE_NAME, rowSet)) { 15800 15801 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 15801 15802 psFree(rowSet); … … 15808 15809 } 15809 15810 15810 bool p5InputS cfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)15811 bool p5InputSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 15811 15812 { 15812 15813 psArray *rowSet; 15813 15814 15814 rowSet = psDBSelectRows(dbh, P5INPUTS CFILE_TABLE_NAME, where, limit);15815 rowSet = psDBSelectRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit); 15815 15816 if (!rowSet) { 15816 15817 return false; … … 15818 15819 15819 15820 // output to fits 15820 if (!psFitsWriteTable(fits, NULL, rowSet, P5INPUTS CFILE_TABLE_NAME)) {15821 if (!psFitsWriteTable(fits, NULL, rowSet, P5INPUTSKYFILE_TABLE_NAME)) { 15821 15822 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 15822 15823 psFree(rowSet); … … 15829 15830 } 15830 15831 15831 psMetadata *p5InputS cfileMetadataFromObject(const p5InputScfileRow *object)15832 psMetadata *p5InputSkyfileMetadataFromObject(const p5InputSkyfileRow *object) 15832 15833 { 15833 15834 psMetadata *md = psMetadataAlloc(); … … 15867 15868 } 15868 15869 15869 p5InputS cfileRow *p5InputScfileObjectFromMetadata(psMetadata *md)15870 p5InputSkyfileRow *p5InputSkyfileObjectFromMetadata(psMetadata *md) 15870 15871 { 15871 15872 … … 15902 15903 } 15903 15904 15904 return p5InputS cfileRowAlloc(p5_id, p4_id, skycell_id, tess_id, kind, template);15905 } 15906 psArray *p5InputS cfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)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) 15907 15908 { 15908 15909 psArray *rowSet; … … 15910 15911 psU64 i; 15911 15912 15912 rowSet = psDBSelectRows(dbh, P5INPUTS CFILE_TABLE_NAME, where, limit);15913 rowSet = psDBSelectRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit); 15913 15914 if (!rowSet) { 15914 15915 return NULL; … … 15920 15921 15921 15922 for (i = 0; i < rowSet->n; i++) { 15922 p5InputS cfileRow *object = p5InputScfileObjectFromMetadata(rowSet->data[i]);15923 p5InputSkyfileRow *object = p5InputSkyfileObjectFromMetadata(rowSet->data[i]); 15923 15924 psArrayAdd(returnSet, 0, object); 15924 15925 psFree(object); … … 15929 15930 return returnSet; 15930 15931 } 15931 bool p5InputS cfileDeleteObject(psDB *dbh, const p5InputScfileRow *object)15932 { 15933 psMetadata *where = p5InputS cfileMetadataFromObject(object);15934 long long count = psDBDeleteRows(dbh, P5INPUTS CFILE_TABLE_NAME, where, 0);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); 15935 15936 psFree(where); 15936 15937 if (count < 0) { 15937 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputS cfile");15938 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputSkyfile"); 15938 15939 return false; 15939 15940 } … … 15941 15942 // XXX should this be a psAbort() instead? It is possible that 15942 15943 // having an object match multiple rows was by design. 15943 psError(PS_ERR_UNKNOWN, true, "p5InputS cfileRow object matched more then one row. Check your database schema");15944 return false; 15945 } 15946 15947 return true; 15948 } 15949 long long p5InputS cfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)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) 15950 15951 { 15951 15952 long long deleted = 0; 15952 15953 15953 15954 for (long long i = 0; i < objects->n; i++) { 15954 p5InputS cfileRow *object = objects->data[i];15955 psMetadata *where = p5InputS cfileMetadataFromObject(object);15956 long long count = psDBDeleteRows(dbh, P5INPUTS CFILE_TABLE_NAME, where, limit);15955 p5InputSkyfileRow *object = objects->data[i]; 15956 psMetadata *where = p5InputSkyfileMetadataFromObject(object); 15957 long long count = psDBDeleteRows(dbh, P5INPUTSKYFILE_TABLE_NAME, where, limit); 15957 15958 psFree(where); 15958 15959 if (count < 0) { 15959 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputS cfile");15960 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5InputSkyfile"); 15960 15961 return count; 15961 15962 } … … 15966 15967 return deleted; 15967 15968 } 15968 bool p5InputS cfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)15969 bool p5InputSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 15969 15970 { 15970 15971 PS_ASSERT_PTR_NON_NULL(objects, false); … … 15972 15973 psMetadata *output = psMetadataAlloc(); 15973 15974 for (long i = 0; i < psArrayLength(objects); i++) { 15974 psMetadata *md = p5InputS cfileMetadataFromObject(objects->data[i]);15975 psMetadata *md = p5InputSkyfileMetadataFromObject(objects->data[i]); 15975 15976 if (!psMetadataAddMetadata( 15976 15977 output, 15977 15978 PS_LIST_TAIL, 15978 P5INPUTS CFILE_TABLE_NAME,15979 P5INPUTSKYFILE_TABLE_NAME, 15979 15980 PS_META_DUPLICATE_OK, 15980 15981 NULL, … … 15997 15998 return true; 15998 15999 } 15999 bool p5InputS cfilePrintObject(FILE *stream, p5InputScfileRow *object, bool mdcf)16000 bool p5InputSkyfilePrintObject(FILE *stream, p5InputSkyfileRow *object, bool mdcf) 16000 16001 { 16001 16002 PS_ASSERT_PTR_NON_NULL(object, false); 16002 16003 16003 psMetadata *md = p5InputS cfileMetadataFromObject(object);16004 psMetadata *md = p5InputSkyfileMetadataFromObject(object); 16004 16005 16005 16006 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 16012 16013 return true; 16013 16014 } 16014 static void p5DiffS cfileRowFree(p5DiffScfileRow *object);16015 16016 p5DiffS cfileRow *p5DiffScfileRowAlloc(psS32 p5_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)16017 { 16018 p5DiffS cfileRow *_object;16019 16020 _object = psAlloc(sizeof(p5DiffS cfileRow));16021 psMemSetDeallocator(_object, (psFreeFunc)p5DiffS cfileRowFree);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); 16022 16023 16023 16024 _object->p5_id = p5_id; 16024 _object->skycell_id = psStringCopy(skycell_id);16025 _object->tess_id = psStringCopy(tess_id);16026 16025 _object->uri = psStringCopy(uri); 16027 16026 _object->bg = bg; … … 16031 16030 } 16032 16031 16033 static void p5DiffScfileRowFree(p5DiffScfileRow *object) 16034 { 16035 psFree(object->skycell_id); 16036 psFree(object->tess_id); 16032 static void p5DiffSkyfileRowFree(p5DiffSkyfileRow *object) 16033 { 16037 16034 psFree(object->uri); 16038 16035 } 16039 16036 16040 bool p5DiffS cfileCreateTable(psDB *dbh)16037 bool p5DiffSkyfileCreateTable(psDB *dbh) 16041 16038 { 16042 16039 psMetadata *md = psMetadataAlloc(); … … 16046 16043 return false; 16047 16044 } 16048 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, "Primary Key", "64")) {16049 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");16050 psFree(md);16051 return false;16052 }16053 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, "Primary Key", "64")) {16054 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");16055 psFree(md);16056 return false;16057 }16058 16045 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) { 16059 16046 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 16072 16059 } 16073 16060 16074 bool status = psDBCreateTable(dbh, P5DIFFS CFILE_TABLE_NAME, md);16061 bool status = psDBCreateTable(dbh, P5DIFFSKYFILE_TABLE_NAME, md); 16075 16062 16076 16063 psFree(md); … … 16079 16066 } 16080 16067 16081 bool p5DiffS cfileDropTable(psDB *dbh)16082 { 16083 return psDBDropTable(dbh, P5DIFFS CFILE_TABLE_NAME);16084 } 16085 16086 bool p5DiffS cfileInsert(psDB * dbh, psS32 p5_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)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) 16087 16074 { 16088 16075 psMetadata *md = psMetadataAlloc(); … … 16092 16079 return false; 16093 16080 } 16094 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, skycell_id)) {16095 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");16096 psFree(md);16097 return false;16098 }16099 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {16100 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");16101 psFree(md);16102 return false;16103 }16104 16081 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 16105 16082 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 16118 16095 } 16119 16096 16120 bool status = psDBInsertOneRow(dbh, P5DIFFS CFILE_TABLE_NAME, md);16097 bool status = psDBInsertOneRow(dbh, P5DIFFSKYFILE_TABLE_NAME, md); 16121 16098 psFree(md); 16122 16099 … … 16124 16101 } 16125 16102 16126 long long p5DiffS cfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)16103 long long p5DiffSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 16127 16104 { 16128 16105 long long deleted = 0; 16129 16106 16130 long long count = psDBDeleteRows(dbh, P5DIFFS CFILE_TABLE_NAME, where, limit);16107 long long count = psDBDeleteRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit); 16131 16108 if (count < 0) { 16132 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffS cfile");16109 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffSkyfile"); 16133 16110 return count; 16134 16111 … … 16138 16115 return deleted; 16139 16116 } 16140 bool p5DiffS cfileInsertObject(psDB *dbh, p5DiffScfileRow *object)16141 { 16142 return p5DiffS cfileInsert(dbh, object->p5_id, object->skycell_id, object->tess_id, object->uri, object->bg, object->bg_mean_stdev);16143 } 16144 16145 bool p5DiffS cfileInsertObjects(psDB *dbh, psArray *objects)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) 16146 16123 { 16147 16124 for (long i = 0; i < psArrayLength(objects); i++) { 16148 if (!p5DiffS cfileInsertObject(dbh, objects->data[i])) {16125 if (!p5DiffSkyfileInsertObject(dbh, objects->data[i])) { 16149 16126 return false; 16150 16127 } … … 16154 16131 } 16155 16132 16156 bool p5DiffS cfileInsertFits(psDB *dbh, const psFits *fits)16133 bool p5DiffSkyfileInsertFits(psDB *dbh, const psFits *fits) 16157 16134 { 16158 16135 psArray *rowSet; 16159 16136 16160 // move to (the first?) extension named P5DIFFS CFILE_TABLE_NAME16161 if (!psFitsMoveExtName(fits, P5DIFFS CFILE_TABLE_NAME)) {16162 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5DIFFS CFILE_TABLE_NAME);16137 // move to (the first?) extension named P5DIFFSKYFILE_TABLE_NAME 16138 if (!psFitsMoveExtName(fits, P5DIFFSKYFILE_TABLE_NAME)) { 16139 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P5DIFFSKYFILE_TABLE_NAME); 16163 16140 return false; 16164 16141 } … … 16178 16155 } 16179 16156 16180 if (!psDBInsertRows(dbh, P5DIFFS CFILE_TABLE_NAME, rowSet)) {16157 if (!psDBInsertRows(dbh, P5DIFFSKYFILE_TABLE_NAME, rowSet)) { 16181 16158 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 16182 16159 psFree(rowSet); … … 16189 16166 } 16190 16167 16191 bool p5DiffS cfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)16168 bool p5DiffSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 16192 16169 { 16193 16170 psArray *rowSet; 16194 16171 16195 rowSet = psDBSelectRows(dbh, P5DIFFS CFILE_TABLE_NAME, where, limit);16172 rowSet = psDBSelectRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit); 16196 16173 if (!rowSet) { 16197 16174 return false; … … 16199 16176 16200 16177 // output to fits 16201 if (!psFitsWriteTable(fits, NULL, rowSet, P5DIFFS CFILE_TABLE_NAME)) {16178 if (!psFitsWriteTable(fits, NULL, rowSet, P5DIFFSKYFILE_TABLE_NAME)) { 16202 16179 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 16203 16180 psFree(rowSet); … … 16210 16187 } 16211 16188 16212 psMetadata *p5DiffS cfileMetadataFromObject(const p5DiffScfileRow *object)16189 psMetadata *p5DiffSkyfileMetadataFromObject(const p5DiffSkyfileRow *object) 16213 16190 { 16214 16191 psMetadata *md = psMetadataAlloc(); … … 16218 16195 return false; 16219 16196 } 16220 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, object->skycell_id)) {16221 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");16222 psFree(md);16223 return false;16224 }16225 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, object->tess_id)) {16226 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");16227 psFree(md);16228 return false;16229 }16230 16197 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) { 16231 16198 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 16248 16215 } 16249 16216 16250 p5DiffS cfileRow *p5DiffScfileObjectFromMetadata(psMetadata *md)16217 p5DiffSkyfileRow *p5DiffSkyfileObjectFromMetadata(psMetadata *md) 16251 16218 { 16252 16219 … … 16257 16224 return false; 16258 16225 } 16259 char* skycell_id = psMetadataLookupPtr(&status, md, "skycell_id");16260 if (!status) {16261 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item skycell_id");16262 return false;16263 }16264 char* tess_id = psMetadataLookupPtr(&status, md, "tess_id");16265 if (!status) {16266 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item tess_id");16267 return false;16268 }16269 16226 char* uri = psMetadataLookupPtr(&status, md, "uri"); 16270 16227 if (!status) { … … 16283 16240 } 16284 16241 16285 return p5DiffS cfileRowAlloc(p5_id, skycell_id, tess_id, uri, bg, bg_mean_stdev);16286 } 16287 psArray *p5DiffS cfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)16242 return p5DiffSkyfileRowAlloc(p5_id, uri, bg, bg_mean_stdev); 16243 } 16244 psArray *p5DiffSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16288 16245 { 16289 16246 psArray *rowSet; … … 16291 16248 psU64 i; 16292 16249 16293 rowSet = psDBSelectRows(dbh, P5DIFFS CFILE_TABLE_NAME, where, limit);16250 rowSet = psDBSelectRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit); 16294 16251 if (!rowSet) { 16295 16252 return NULL; … … 16301 16258 16302 16259 for (i = 0; i < rowSet->n; i++) { 16303 p5DiffS cfileRow *object = p5DiffScfileObjectFromMetadata(rowSet->data[i]);16260 p5DiffSkyfileRow *object = p5DiffSkyfileObjectFromMetadata(rowSet->data[i]); 16304 16261 psArrayAdd(returnSet, 0, object); 16305 16262 psFree(object); … … 16310 16267 return returnSet; 16311 16268 } 16312 bool p5DiffS cfileDeleteObject(psDB *dbh, const p5DiffScfileRow *object)16313 { 16314 psMetadata *where = p5DiffS cfileMetadataFromObject(object);16315 long long count = psDBDeleteRows(dbh, P5DIFFS CFILE_TABLE_NAME, where, 0);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); 16316 16273 psFree(where); 16317 16274 if (count < 0) { 16318 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffS cfile");16275 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffSkyfile"); 16319 16276 return false; 16320 16277 } … … 16322 16279 // XXX should this be a psAbort() instead? It is possible that 16323 16280 // having an object match multiple rows was by design. 16324 psError(PS_ERR_UNKNOWN, true, "p5DiffS cfileRow object matched more then one row. Check your database schema");16325 return false; 16326 } 16327 16328 return true; 16329 } 16330 long long p5DiffS cfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)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) 16331 16288 { 16332 16289 long long deleted = 0; 16333 16290 16334 16291 for (long long i = 0; i < objects->n; i++) { 16335 p5DiffS cfileRow *object = objects->data[i];16336 psMetadata *where = p5DiffS cfileMetadataFromObject(object);16337 long long count = psDBDeleteRows(dbh, P5DIFFS CFILE_TABLE_NAME, where, limit);16292 p5DiffSkyfileRow *object = objects->data[i]; 16293 psMetadata *where = p5DiffSkyfileMetadataFromObject(object); 16294 long long count = psDBDeleteRows(dbh, P5DIFFSKYFILE_TABLE_NAME, where, limit); 16338 16295 psFree(where); 16339 16296 if (count < 0) { 16340 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffS cfile");16297 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p5DiffSkyfile"); 16341 16298 return count; 16342 16299 } … … 16347 16304 return deleted; 16348 16305 } 16349 bool p5DiffS cfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)16306 bool p5DiffSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 16350 16307 { 16351 16308 PS_ASSERT_PTR_NON_NULL(objects, false); … … 16353 16310 psMetadata *output = psMetadataAlloc(); 16354 16311 for (long i = 0; i < psArrayLength(objects); i++) { 16355 psMetadata *md = p5DiffS cfileMetadataFromObject(objects->data[i]);16312 psMetadata *md = p5DiffSkyfileMetadataFromObject(objects->data[i]); 16356 16313 if (!psMetadataAddMetadata( 16357 16314 output, 16358 16315 PS_LIST_TAIL, 16359 P5DIFFS CFILE_TABLE_NAME,16316 P5DIFFSKYFILE_TABLE_NAME, 16360 16317 PS_META_DUPLICATE_OK, 16361 16318 NULL, … … 16378 16335 return true; 16379 16336 } 16380 bool p5DiffS cfilePrintObject(FILE *stream, p5DiffScfileRow *object, bool mdcf)16337 bool p5DiffSkyfilePrintObject(FILE *stream, p5DiffSkyfileRow *object, bool mdcf) 16381 16338 { 16382 16339 PS_ASSERT_PTR_NON_NULL(object, false); 16383 16340 16384 psMetadata *md = p5DiffS cfileMetadataFromObject(object);16341 psMetadata *md = p5DiffSkyfileMetadataFromObject(object); 16385 16342 16386 16343 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 16395 16352 static void p6RunRowFree(p6RunRow *object); 16396 16353 16397 p6RunRow *p6RunRowAlloc(psS32 p6_id, const char *state, const char *workdir, const char *dvodb, psTime* registered )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) 16398 16355 { 16399 16356 p6RunRow *_object; … … 16407 16364 _object->dvodb = psStringCopy(dvodb); 16408 16365 _object->registered = psTimeCopy(registered); 16366 _object->skycell_id = psStringCopy(skycell_id); 16367 _object->tess_id = psStringCopy(tess_id); 16409 16368 16410 16369 return _object; … … 16417 16376 psFree(object->dvodb); 16418 16377 psFree(object->registered); 16378 psFree(object->skycell_id); 16379 psFree(object->tess_id); 16419 16380 } 16420 16381 … … 16447 16408 return false; 16448 16409 } 16410 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, "Key", "64")) { 16411 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 16412 psFree(md); 16413 return false; 16414 } 16415 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, "Key", "64")) { 16416 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 16417 psFree(md); 16418 return false; 16419 } 16449 16420 16450 16421 bool status = psDBCreateTable(dbh, P6RUN_TABLE_NAME, md); … … 16460 16431 } 16461 16432 16462 bool p6RunInsert(psDB * dbh, psS32 p6_id, const char *state, const char *workdir, const char *dvodb, psTime* registered )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) 16463 16434 { 16464 16435 psMetadata *md = psMetadataAlloc(); … … 16485 16456 if (!psMetadataAdd(md, PS_LIST_TAIL, "registered", PS_DATA_TIME, NULL, registered)) { 16486 16457 psError(PS_ERR_UNKNOWN, false, "failed to add item registered"); 16458 psFree(md); 16459 return false; 16460 } 16461 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, skycell_id)) { 16462 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 16463 psFree(md); 16464 return false; 16465 } 16466 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) { 16467 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 16487 16468 psFree(md); 16488 16469 return false; … … 16511 16492 bool p6RunInsertObject(psDB *dbh, p6RunRow *object) 16512 16493 { 16513 return p6RunInsert(dbh, object->p6_id, object->state, object->workdir, object->dvodb, object->registered );16494 return p6RunInsert(dbh, object->p6_id, object->state, object->workdir, object->dvodb, object->registered, object->skycell_id, object->tess_id); 16514 16495 } 16515 16496 … … 16609 16590 return false; 16610 16591 } 16592 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, object->skycell_id)) { 16593 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 16594 psFree(md); 16595 return false; 16596 } 16597 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, object->tess_id)) { 16598 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 16599 psFree(md); 16600 return false; 16601 } 16611 16602 16612 16603 … … 16643 16634 return false; 16644 16635 } 16645 16646 return p6RunRowAlloc(p6_id, state, workdir, dvodb, registered); 16636 char* skycell_id = psMetadataLookupPtr(&status, md, "skycell_id"); 16637 if (!status) { 16638 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item skycell_id"); 16639 return false; 16640 } 16641 char* tess_id = psMetadataLookupPtr(&status, md, "tess_id"); 16642 if (!status) { 16643 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item tess_id"); 16644 return false; 16645 } 16646 16647 return p6RunRowAlloc(p6_id, state, workdir, dvodb, registered, skycell_id, tess_id); 16647 16648 } 16648 16649 psArray *p6RunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 16754 16755 return true; 16755 16756 } 16756 static void p6InputS cfileRowFree(p6InputScfileRow *object);16757 16758 p6InputS cfileRow *p6InputScfileRowAlloc(psS32 p6_id, psS32 p4_id, const char *skycell_id, const char *tess_id)16759 { 16760 p6InputS cfileRow *_object;16761 16762 _object = psAlloc(sizeof(p6InputS cfileRow));16763 psMemSetDeallocator(_object, (psFreeFunc)p6InputS cfileRowFree);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); 16764 16765 16765 16766 _object->p6_id = p6_id; 16766 16767 _object->p4_id = p4_id; 16767 _object->skycell_id = psStringCopy(skycell_id);16768 _object->tess_id = psStringCopy(tess_id);16769 16768 16770 16769 return _object; 16771 16770 } 16772 16771 16773 static void p6InputScfileRowFree(p6InputScfileRow *object) 16774 { 16775 psFree(object->skycell_id); 16776 psFree(object->tess_id); 16777 } 16778 16779 bool p6InputScfileCreateTable(psDB *dbh) 16772 static void p6InputSkyfileRowFree(p6InputSkyfileRow *object) 16773 { 16774 } 16775 16776 bool p6InputSkyfileCreateTable(psDB *dbh) 16780 16777 { 16781 16778 psMetadata *md = psMetadataAlloc(); … … 16790 16787 return false; 16791 16788 } 16792 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, "Primary Key", "64")) { 16793 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 16794 psFree(md); 16795 return false; 16796 } 16797 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, "Primary Key", "64")) { 16798 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 16799 psFree(md); 16800 return false; 16801 } 16802 16803 bool status = psDBCreateTable(dbh, P6INPUTSCFILE_TABLE_NAME, md); 16789 16790 bool status = psDBCreateTable(dbh, P6INPUTSKYFILE_TABLE_NAME, md); 16804 16791 16805 16792 psFree(md); … … 16808 16795 } 16809 16796 16810 bool p6InputS cfileDropTable(psDB *dbh)16811 { 16812 return psDBDropTable(dbh, P6INPUTS CFILE_TABLE_NAME);16813 } 16814 16815 bool p6InputS cfileInsert(psDB * dbh, psS32 p6_id, psS32 p4_id, const char *skycell_id, const char *tess_id)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) 16816 16803 { 16817 16804 psMetadata *md = psMetadataAlloc(); … … 16826 16813 return false; 16827 16814 } 16828 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, skycell_id)) { 16829 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 16830 psFree(md); 16831 return false; 16832 } 16833 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) { 16834 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 16835 psFree(md); 16836 return false; 16837 } 16838 16839 bool status = psDBInsertOneRow(dbh, P6INPUTSCFILE_TABLE_NAME, md); 16815 16816 bool status = psDBInsertOneRow(dbh, P6INPUTSKYFILE_TABLE_NAME, md); 16840 16817 psFree(md); 16841 16818 … … 16843 16820 } 16844 16821 16845 long long p6InputS cfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)16822 long long p6InputSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 16846 16823 { 16847 16824 long long deleted = 0; 16848 16825 16849 long long count = psDBDeleteRows(dbh, P6INPUTS CFILE_TABLE_NAME, where, limit);16826 long long count = psDBDeleteRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit); 16850 16827 if (count < 0) { 16851 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputS cfile");16828 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputSkyfile"); 16852 16829 return count; 16853 16830 … … 16857 16834 return deleted; 16858 16835 } 16859 bool p6InputS cfileInsertObject(psDB *dbh, p6InputScfileRow *object)16860 { 16861 return p6InputS cfileInsert(dbh, object->p6_id, object->p4_id, object->skycell_id, object->tess_id);16862 } 16863 16864 bool p6InputS cfileInsertObjects(psDB *dbh, psArray *objects)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) 16865 16842 { 16866 16843 for (long i = 0; i < psArrayLength(objects); i++) { 16867 if (!p6InputS cfileInsertObject(dbh, objects->data[i])) {16844 if (!p6InputSkyfileInsertObject(dbh, objects->data[i])) { 16868 16845 return false; 16869 16846 } … … 16873 16850 } 16874 16851 16875 bool p6InputS cfileInsertFits(psDB *dbh, const psFits *fits)16852 bool p6InputSkyfileInsertFits(psDB *dbh, const psFits *fits) 16876 16853 { 16877 16854 psArray *rowSet; 16878 16855 16879 // move to (the first?) extension named P6INPUTS CFILE_TABLE_NAME16880 if (!psFitsMoveExtName(fits, P6INPUTS CFILE_TABLE_NAME)) {16881 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6INPUTS CFILE_TABLE_NAME);16856 // move to (the first?) extension named P6INPUTSKYFILE_TABLE_NAME 16857 if (!psFitsMoveExtName(fits, P6INPUTSKYFILE_TABLE_NAME)) { 16858 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6INPUTSKYFILE_TABLE_NAME); 16882 16859 return false; 16883 16860 } … … 16897 16874 } 16898 16875 16899 if (!psDBInsertRows(dbh, P6INPUTS CFILE_TABLE_NAME, rowSet)) {16876 if (!psDBInsertRows(dbh, P6INPUTSKYFILE_TABLE_NAME, rowSet)) { 16900 16877 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 16901 16878 psFree(rowSet); … … 16908 16885 } 16909 16886 16910 bool p6InputS cfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)16887 bool p6InputSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 16911 16888 { 16912 16889 psArray *rowSet; 16913 16890 16914 rowSet = psDBSelectRows(dbh, P6INPUTS CFILE_TABLE_NAME, where, limit);16891 rowSet = psDBSelectRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit); 16915 16892 if (!rowSet) { 16916 16893 return false; … … 16918 16895 16919 16896 // output to fits 16920 if (!psFitsWriteTable(fits, NULL, rowSet, P6INPUTS CFILE_TABLE_NAME)) {16897 if (!psFitsWriteTable(fits, NULL, rowSet, P6INPUTSKYFILE_TABLE_NAME)) { 16921 16898 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 16922 16899 psFree(rowSet); … … 16929 16906 } 16930 16907 16931 psMetadata *p6InputS cfileMetadataFromObject(const p6InputScfileRow *object)16908 psMetadata *p6InputSkyfileMetadataFromObject(const p6InputSkyfileRow *object) 16932 16909 { 16933 16910 psMetadata *md = psMetadataAlloc(); … … 16942 16919 return false; 16943 16920 } 16944 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, object->skycell_id)) {16945 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");16946 psFree(md);16947 return false;16948 }16949 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, object->tess_id)) {16950 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");16951 psFree(md);16952 return false;16953 }16954 16921 16955 16922 … … 16957 16924 } 16958 16925 16959 p6InputS cfileRow *p6InputScfileObjectFromMetadata(psMetadata *md)16926 p6InputSkyfileRow *p6InputSkyfileObjectFromMetadata(psMetadata *md) 16960 16927 { 16961 16928 … … 16971 16938 return false; 16972 16939 } 16973 char* skycell_id = psMetadataLookupPtr(&status, md, "skycell_id"); 16974 if (!status) { 16975 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item skycell_id"); 16976 return false; 16977 } 16978 char* tess_id = psMetadataLookupPtr(&status, md, "tess_id"); 16979 if (!status) { 16980 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item tess_id"); 16981 return false; 16982 } 16983 16984 return p6InputScfileRowAlloc(p6_id, p4_id, skycell_id, tess_id); 16985 } 16986 psArray *p6InputScfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16940 16941 return p6InputSkyfileRowAlloc(p6_id, p4_id); 16942 } 16943 psArray *p6InputSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 16987 16944 { 16988 16945 psArray *rowSet; … … 16990 16947 psU64 i; 16991 16948 16992 rowSet = psDBSelectRows(dbh, P6INPUTS CFILE_TABLE_NAME, where, limit);16949 rowSet = psDBSelectRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit); 16993 16950 if (!rowSet) { 16994 16951 return NULL; … … 17000 16957 17001 16958 for (i = 0; i < rowSet->n; i++) { 17002 p6InputS cfileRow *object = p6InputScfileObjectFromMetadata(rowSet->data[i]);16959 p6InputSkyfileRow *object = p6InputSkyfileObjectFromMetadata(rowSet->data[i]); 17003 16960 psArrayAdd(returnSet, 0, object); 17004 16961 psFree(object); … … 17009 16966 return returnSet; 17010 16967 } 17011 bool p6InputS cfileDeleteObject(psDB *dbh, const p6InputScfileRow *object)17012 { 17013 psMetadata *where = p6InputS cfileMetadataFromObject(object);17014 long long count = psDBDeleteRows(dbh, P6INPUTS CFILE_TABLE_NAME, where, 0);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); 17015 16972 psFree(where); 17016 16973 if (count < 0) { 17017 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputS cfile");16974 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputSkyfile"); 17018 16975 return false; 17019 16976 } … … 17021 16978 // XXX should this be a psAbort() instead? It is possible that 17022 16979 // having an object match multiple rows was by design. 17023 psError(PS_ERR_UNKNOWN, true, "p6InputS cfileRow object matched more then one row. Check your database schema");17024 return false; 17025 } 17026 17027 return true; 17028 } 17029 long long p6InputS cfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)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) 17030 16987 { 17031 16988 long long deleted = 0; 17032 16989 17033 16990 for (long long i = 0; i < objects->n; i++) { 17034 p6InputS cfileRow *object = objects->data[i];17035 psMetadata *where = p6InputS cfileMetadataFromObject(object);17036 long long count = psDBDeleteRows(dbh, P6INPUTS CFILE_TABLE_NAME, where, limit);16991 p6InputSkyfileRow *object = objects->data[i]; 16992 psMetadata *where = p6InputSkyfileMetadataFromObject(object); 16993 long long count = psDBDeleteRows(dbh, P6INPUTSKYFILE_TABLE_NAME, where, limit); 17037 16994 psFree(where); 17038 16995 if (count < 0) { 17039 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputS cfile");16996 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6InputSkyfile"); 17040 16997 return count; 17041 16998 } … … 17046 17003 return deleted; 17047 17004 } 17048 bool p6InputS cfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)17005 bool p6InputSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 17049 17006 { 17050 17007 PS_ASSERT_PTR_NON_NULL(objects, false); … … 17052 17009 psMetadata *output = psMetadataAlloc(); 17053 17010 for (long i = 0; i < psArrayLength(objects); i++) { 17054 psMetadata *md = p6InputS cfileMetadataFromObject(objects->data[i]);17011 psMetadata *md = p6InputSkyfileMetadataFromObject(objects->data[i]); 17055 17012 if (!psMetadataAddMetadata( 17056 17013 output, 17057 17014 PS_LIST_TAIL, 17058 P6INPUTS CFILE_TABLE_NAME,17015 P6INPUTSKYFILE_TABLE_NAME, 17059 17016 PS_META_DUPLICATE_OK, 17060 17017 NULL, … … 17077 17034 return true; 17078 17035 } 17079 bool p6InputS cfilePrintObject(FILE *stream, p6InputScfileRow *object, bool mdcf)17036 bool p6InputSkyfilePrintObject(FILE *stream, p6InputSkyfileRow *object, bool mdcf) 17080 17037 { 17081 17038 PS_ASSERT_PTR_NON_NULL(object, false); 17082 17039 17083 psMetadata *md = p6InputS cfileMetadataFromObject(object);17040 psMetadata *md = p6InputSkyfileMetadataFromObject(object); 17084 17041 17085 17042 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { … … 17092 17049 return true; 17093 17050 } 17094 static void p6SumS cfileRowFree(p6SumScfileRow *object);17095 17096 p6SumS cfileRow *p6SumScfileRowAlloc(psS32 p6_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)17097 { 17098 p6SumS cfileRow*_object;17099 17100 _object = psAlloc(sizeof(p6SumS cfileRow));17101 psMemSetDeallocator(_object, (psFreeFunc)p6SumS cfileRowFree);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); 17102 17059 17103 17060 _object->p6_id = p6_id; 17104 _object->skycell_id = psStringCopy(skycell_id);17105 _object->tess_id = psStringCopy(tess_id);17106 17061 _object->uri = psStringCopy(uri); 17107 17062 _object->bg = bg; … … 17111 17066 } 17112 17067 17113 static void p6SumScfileRowFree(p6SumScfileRow *object) 17114 { 17115 psFree(object->skycell_id); 17116 psFree(object->tess_id); 17068 static void p6SumSkyfileRowFree(p6SumSkyfileRow *object) 17069 { 17117 17070 psFree(object->uri); 17118 17071 } 17119 17072 17120 bool p6SumS cfileCreateTable(psDB *dbh)17073 bool p6SumSkyfileCreateTable(psDB *dbh) 17121 17074 { 17122 17075 psMetadata *md = psMetadataAlloc(); … … 17126 17079 return false; 17127 17080 } 17128 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, "Primary Key", "64")) {17129 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");17130 psFree(md);17131 return false;17132 }17133 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, "Primary Key", "64")) {17134 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");17135 psFree(md);17136 return false;17137 }17138 17081 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, "255")) { 17139 17082 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 17152 17095 } 17153 17096 17154 bool status = psDBCreateTable(dbh, P6SUMS CFILE_TABLE_NAME, md);17097 bool status = psDBCreateTable(dbh, P6SUMSKYFILE_TABLE_NAME, md); 17155 17098 17156 17099 psFree(md); … … 17159 17102 } 17160 17103 17161 bool p6SumS cfileDropTable(psDB *dbh)17162 { 17163 return psDBDropTable(dbh, P6SUMS CFILE_TABLE_NAME);17164 } 17165 17166 bool p6SumS cfileInsert(psDB * dbh, psS32 p6_id, const char *skycell_id, const char *tess_id, const char *uri, psF64 bg, psF64 bg_mean_stdev)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) 17167 17110 { 17168 17111 psMetadata *md = psMetadataAlloc(); … … 17172 17115 return false; 17173 17116 } 17174 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, skycell_id)) {17175 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");17176 psFree(md);17177 return false;17178 }17179 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, tess_id)) {17180 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");17181 psFree(md);17182 return false;17183 }17184 17117 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, uri)) { 17185 17118 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 17198 17131 } 17199 17132 17200 bool status = psDBInsertOneRow(dbh, P6SUMS CFILE_TABLE_NAME, md);17133 bool status = psDBInsertOneRow(dbh, P6SUMSKYFILE_TABLE_NAME, md); 17201 17134 psFree(md); 17202 17135 … … 17204 17137 } 17205 17138 17206 long long p6SumS cfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit)17139 long long p6SumSkyfileDelete(psDB *dbh, const psMetadata *where, unsigned long long limit) 17207 17140 { 17208 17141 long long deleted = 0; 17209 17142 17210 long long count = psDBDeleteRows(dbh, P6SUMS CFILE_TABLE_NAME, where, limit);17143 long long count = psDBDeleteRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit); 17211 17144 if (count < 0) { 17212 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumS cfile");17145 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumSkyfile"); 17213 17146 return count; 17214 17147 … … 17218 17151 return deleted; 17219 17152 } 17220 bool p6SumS cfileInsertObject(psDB *dbh, p6SumScfileRow *object)17221 { 17222 return p6SumS cfileInsert(dbh, object->p6_id, object->skycell_id, object->tess_id, object->uri, object->bg, object->bg_mean_stdev);17223 } 17224 17225 bool p6SumS cfileInsertObjects(psDB *dbh, psArray *objects)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) 17226 17159 { 17227 17160 for (long i = 0; i < psArrayLength(objects); i++) { 17228 if (!p6SumS cfileInsertObject(dbh, objects->data[i])) {17161 if (!p6SumSkyfileInsertObject(dbh, objects->data[i])) { 17229 17162 return false; 17230 17163 } … … 17234 17167 } 17235 17168 17236 bool p6SumS cfileInsertFits(psDB *dbh, const psFits *fits)17169 bool p6SumSkyfileInsertFits(psDB *dbh, const psFits *fits) 17237 17170 { 17238 17171 psArray *rowSet; 17239 17172 17240 // move to (the first?) extension named P6SUMS CFILE_TABLE_NAME17241 if (!psFitsMoveExtName(fits, P6SUMS CFILE_TABLE_NAME)) {17242 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6SUMS CFILE_TABLE_NAME);17173 // move to (the first?) extension named P6SUMSKYFILE_TABLE_NAME 17174 if (!psFitsMoveExtName(fits, P6SUMSKYFILE_TABLE_NAME)) { 17175 psError(PS_ERR_UNKNOWN, true, "failed to find FITS extension %s", P6SUMSKYFILE_TABLE_NAME); 17243 17176 return false; 17244 17177 } … … 17258 17191 } 17259 17192 17260 if (!psDBInsertRows(dbh, P6SUMS CFILE_TABLE_NAME, rowSet)) {17193 if (!psDBInsertRows(dbh, P6SUMSKYFILE_TABLE_NAME, rowSet)) { 17261 17194 psError(PS_ERR_UNKNOWN, false, "databse insert failed"); 17262 17195 psFree(rowSet); … … 17269 17202 } 17270 17203 17271 bool p6SumS cfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit)17204 bool p6SumSkyfileSelectRowsFits(psDB *dbh, psFits *fits, const psMetadata *where, unsigned long long limit) 17272 17205 { 17273 17206 psArray *rowSet; 17274 17207 17275 rowSet = psDBSelectRows(dbh, P6SUMS CFILE_TABLE_NAME, where, limit);17208 rowSet = psDBSelectRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit); 17276 17209 if (!rowSet) { 17277 17210 return false; … … 17279 17212 17280 17213 // output to fits 17281 if (!psFitsWriteTable(fits, NULL, rowSet, P6SUMS CFILE_TABLE_NAME)) {17214 if (!psFitsWriteTable(fits, NULL, rowSet, P6SUMSKYFILE_TABLE_NAME)) { 17282 17215 psError(PS_ERR_UNKNOWN, false, "FITS table write failed"); 17283 17216 psFree(rowSet); … … 17290 17223 } 17291 17224 17292 psMetadata *p6SumS cfileMetadataFromObject(const p6SumScfileRow *object)17225 psMetadata *p6SumSkyfileMetadataFromObject(const p6SumSkyfileRow *object) 17293 17226 { 17294 17227 psMetadata *md = psMetadataAlloc(); … … 17298 17231 return false; 17299 17232 } 17300 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, NULL, object->skycell_id)) {17301 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id");17302 psFree(md);17303 return false;17304 }17305 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, NULL, object->tess_id)) {17306 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id");17307 psFree(md);17308 return false;17309 }17310 17233 if (!psMetadataAdd(md, PS_LIST_TAIL, "uri", PS_DATA_STRING, NULL, object->uri)) { 17311 17234 psError(PS_ERR_UNKNOWN, false, "failed to add item uri"); … … 17328 17251 } 17329 17252 17330 p6SumS cfileRow *p6SumScfileObjectFromMetadata(psMetadata *md)17253 p6SumSkyfileRow *p6SumSkyfileObjectFromMetadata(psMetadata *md) 17331 17254 { 17332 17255 … … 17337 17260 return false; 17338 17261 } 17339 char* skycell_id = psMetadataLookupPtr(&status, md, "skycell_id");17340 if (!status) {17341 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item skycell_id");17342 return false;17343 }17344 char* tess_id = psMetadataLookupPtr(&status, md, "tess_id");17345 if (!status) {17346 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item tess_id");17347 return false;17348 }17349 17262 char* uri = psMetadataLookupPtr(&status, md, "uri"); 17350 17263 if (!status) { … … 17363 17276 } 17364 17277 17365 return p6SumS cfileRowAlloc(p6_id, skycell_id, tess_id, uri, bg, bg_mean_stdev);17366 } 17367 psArray *p6SumS cfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)17278 return p6SumSkyfileRowAlloc(p6_id, uri, bg, bg_mean_stdev); 17279 } 17280 psArray *p6SumSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) 17368 17281 { 17369 17282 psArray *rowSet; … … 17371 17284 psU64 i; 17372 17285 17373 rowSet = psDBSelectRows(dbh, P6SUMS CFILE_TABLE_NAME, where, limit);17286 rowSet = psDBSelectRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit); 17374 17287 if (!rowSet) { 17375 17288 return NULL; … … 17381 17294 17382 17295 for (i = 0; i < rowSet->n; i++) { 17383 p6SumS cfileRow *object = p6SumScfileObjectFromMetadata(rowSet->data[i]);17296 p6SumSkyfileRow *object = p6SumSkyfileObjectFromMetadata(rowSet->data[i]); 17384 17297 psArrayAdd(returnSet, 0, object); 17385 17298 psFree(object); … … 17390 17303 return returnSet; 17391 17304 } 17392 bool p6SumS cfileDeleteObject(psDB *dbh, const p6SumScfileRow *object)17393 { 17394 psMetadata *where = p6SumS cfileMetadataFromObject(object);17395 long long count = psDBDeleteRows(dbh, P6SUMS CFILE_TABLE_NAME, where, 0);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); 17396 17309 psFree(where); 17397 17310 if (count < 0) { 17398 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumS cfile");17311 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumSkyfile"); 17399 17312 return false; 17400 17313 } … … 17402 17315 // XXX should this be a psAbort() instead? It is possible that 17403 17316 // having an object match multiple rows was by design. 17404 psError(PS_ERR_UNKNOWN, true, "p6SumS cfileRow object matched more then one row. Check your database schema");17405 return false; 17406 } 17407 17408 return true; 17409 } 17410 long long p6SumS cfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)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) 17411 17324 { 17412 17325 long long deleted = 0; 17413 17326 17414 17327 for (long long i = 0; i < objects->n; i++) { 17415 p6SumS cfileRow *object = objects->data[i];17416 psMetadata *where = p6SumS cfileMetadataFromObject(object);17417 long long count = psDBDeleteRows(dbh, P6SUMS CFILE_TABLE_NAME, where, limit);17328 p6SumSkyfileRow *object = objects->data[i]; 17329 psMetadata *where = p6SumSkyfileMetadataFromObject(object); 17330 long long count = psDBDeleteRows(dbh, P6SUMSKYFILE_TABLE_NAME, where, limit); 17418 17331 psFree(where); 17419 17332 if (count < 0) { 17420 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumS cfile");17333 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p6SumSkyfile"); 17421 17334 return count; 17422 17335 } … … 17427 17340 return deleted; 17428 17341 } 17429 bool p6SumS cfilePrintObjects(FILE *stream, psArray *objects, bool mdcf)17342 bool p6SumSkyfilePrintObjects(FILE *stream, psArray *objects, bool mdcf) 17430 17343 { 17431 17344 PS_ASSERT_PTR_NON_NULL(objects, false); … … 17433 17346 psMetadata *output = psMetadataAlloc(); 17434 17347 for (long i = 0; i < psArrayLength(objects); i++) { 17435 psMetadata *md = p6SumS cfileMetadataFromObject(objects->data[i]);17348 psMetadata *md = p6SumSkyfileMetadataFromObject(objects->data[i]); 17436 17349 if (!psMetadataAddMetadata( 17437 17350 output, 17438 17351 PS_LIST_TAIL, 17439 P6SUMS CFILE_TABLE_NAME,17352 P6SUMSKYFILE_TABLE_NAME, 17440 17353 PS_META_DUPLICATE_OK, 17441 17354 NULL, … … 17458 17371 return true; 17459 17372 } 17460 bool p6SumS cfilePrintObject(FILE *stream, p6SumScfileRow *object, bool mdcf)17373 bool p6SumSkyfilePrintObject(FILE *stream, p6SumSkyfileRow *object, bool mdcf) 17461 17374 { 17462 17375 PS_ASSERT_PTR_NON_NULL(object, false); 17463 17376 17464 psMetadata *md = p6SumS cfileMetadataFromObject(object);17377 psMetadata *md = p6SumSkyfileMetadataFromObject(object); 17465 17378 17466 17379 if (!ippdbPrintMetadataRaw(stream, md, mdcf)) { -
trunk/ippdb/src/ippdb.h
r11873 r11988 7493 7493 bool mdcf ///< format as mdconfig or simple 7494 7494 ); 7495 /** p4S cfileRow data structure7496 * 7497 * Structure for representing a single row of p4S cfile table data.7495 /** p4SkyfileRow data structure 7496 * 7497 * Structure for representing a single row of p4Skyfile table data. 7498 7498 */ 7499 7499 … … 7502 7502 char *skycell_id; 7503 7503 char *tess_id; 7504 char *exp_tag;7505 psS32 p3_version;7506 7504 char *uri; 7507 7505 psF64 bg; 7508 7506 psF64 bg_mean_stdev; 7509 } p4S cfileRow;7510 7511 /** Creates a new p4S cfileRow object7512 * 7513 * @return A new p4S cfileRow object or NULL on failure.7514 */ 7515 7516 p4S cfileRow *p4ScfileRowAlloc(7507 } p4SkyfileRow; 7508 7509 /** Creates a new p4SkyfileRow object 7510 * 7511 * @return A new p4SkyfileRow object or NULL on failure. 7512 */ 7513 7514 p4SkyfileRow *p4SkyfileRowAlloc( 7517 7515 psS32 p4_id, 7518 7516 const char *skycell_id, 7519 7517 const char *tess_id, 7520 const char *exp_tag,7521 psS32 p3_version,7522 7518 const char *uri, 7523 7519 psF64 bg, … … 7525 7521 ); 7526 7522 7527 /** Creates a new p4S cfile table7528 * 7529 * @return true on success 7530 */ 7531 7532 bool p4S cfileCreateTable(7523 /** Creates a new p4Skyfile table 7524 * 7525 * @return true on success 7526 */ 7527 7528 bool p4SkyfileCreateTable( 7533 7529 psDB *dbh ///< Database handle 7534 7530 ); 7535 7531 7536 /** Deletes a p4S cfile table7537 * 7538 * @return true on success 7539 */ 7540 7541 bool p4S cfileDropTable(7532 /** Deletes a p4Skyfile table 7533 * 7534 * @return true on success 7535 */ 7536 7537 bool p4SkyfileDropTable( 7542 7538 psDB *dbh ///< Database handle 7543 7539 ); … … 7550 7546 */ 7551 7547 7552 bool p4S cfileInsert(7548 bool p4SkyfileInsert( 7553 7549 psDB *dbh, ///< Database handle 7554 7550 psS32 p4_id, 7555 7551 const char *skycell_id, 7556 7552 const char *tess_id, 7557 const char *exp_tag,7558 psS32 p3_version,7559 7553 const char *uri, 7560 7554 psF64 bg, … … 7567 7561 */ 7568 7562 7569 long long p4S cfileDelete(7563 long long p4SkyfileDelete( 7570 7564 psDB *dbh, ///< Database handle 7571 7565 const psMetadata *where, ///< Row match criteria … … 7573 7567 ); 7574 7568 7575 /** Insert a single p4S cfileRow object into a table7569 /** Insert a single p4SkyfileRow object into a table 7576 7570 * 7577 7571 * This function constructs and inserts a single row based on it's parameters. … … 7580 7574 */ 7581 7575 7582 bool p4S cfileInsertObject(7583 psDB *dbh, ///< Database handle 7584 p4S cfileRow *object ///< p4ScfileRow object7585 ); 7586 7587 /** Insert an array of p4S cfileRow object into a table7576 bool p4SkyfileInsertObject( 7577 psDB *dbh, ///< Database handle 7578 p4SkyfileRow *object ///< p4SkyfileRow object 7579 ); 7580 7581 /** Insert an array of p4SkyfileRow object into a table 7588 7582 * 7589 7583 * This function constructs and inserts multiple rows based on it's parameters. … … 7592 7586 */ 7593 7587 7594 bool p4S cfileInsertObjects(7595 psDB *dbh, ///< Database handle 7596 psArray *objects ///< array of p4S cfileRow objects7597 ); 7598 7599 /** Insert data from a binary FITS table p4S cfileRow into the database7588 bool p4SkyfileInsertObjects( 7589 psDB *dbh, ///< Database handle 7590 psArray *objects ///< array of p4SkyfileRow objects 7591 ); 7592 7593 /** Insert data from a binary FITS table p4SkyfileRow into the database 7600 7594 * 7601 7595 * This function expects a psFits object with a FITS table as the first … … 7607 7601 */ 7608 7602 7609 bool p4S cfileInsertFits(7603 bool p4SkyfileInsertFits( 7610 7604 psDB *dbh, ///< Database handle 7611 7605 const psFits *fits ///< psFits object … … 7622 7616 */ 7623 7617 7624 bool p4S cfileSelectRowsFits(7618 bool p4SkyfileSelectRowsFits( 7625 7619 psDB *dbh, ///< Database handle 7626 7620 psFits *fits, ///< psFits object … … 7629 7623 ); 7630 7624 7631 /** Convert a p4S cfileRow into an equivalent psMetadata7625 /** Convert a p4SkyfileRow into an equivalent psMetadata 7632 7626 * 7633 7627 * @return A psMetadata pointer or NULL on error 7634 7628 */ 7635 7629 7636 psMetadata *p4S cfileMetadataFromObject(7637 const p4S cfileRow *object ///< fooRow to convert into a psMetadata7630 psMetadata *p4SkyfileMetadataFromObject( 7631 const p4SkyfileRow *object ///< fooRow to convert into a psMetadata 7638 7632 ); 7639 7633 7640 7634 /** Convert a psMetadata into an equivalent fooRow 7641 7635 * 7642 * @return A p4S cfileRow pointer or NULL on error7643 */ 7644 7645 p4S cfileRow *p4ScfileObjectFromMetadata(7636 * @return A p4SkyfileRow pointer or NULL on error 7637 */ 7638 7639 p4SkyfileRow *p4SkyfileObjectFromMetadata( 7646 7640 psMetadata *md ///< psMetadata to convert into a fooRow 7647 7641 ); 7648 /** Selects up to limit rows from the database and returns as p4S cfileRow objects in a psArray7642 /** Selects up to limit rows from the database and returns as p4SkyfileRow objects in a psArray 7649 7643 * 7650 7644 * See psDBSelectRows() for documentation on the format of where. … … 7653 7647 */ 7654 7648 7655 psArray *p4S cfileSelectRowObjects(7649 psArray *p4SkyfileSelectRowObjects( 7656 7650 psDB *dbh, ///< Database handle 7657 7651 const psMetadata *where, ///< Row match criteria 7658 7652 unsigned long long limit ///< Maximum number of elements to return 7659 7653 ); 7660 /** Deletes a row from the database coresponding to an p4S cfile7654 /** Deletes a row from the database coresponding to an p4Skyfile 7661 7655 * 7662 7656 * Note that a 'where' search psMetadata is constructed from each object and … … 7666 7660 */ 7667 7661 7668 bool p4S cfileDeleteObject(7669 psDB *dbh, ///< Database handle 7670 const p4S cfileRow *object ///< Object to delete7662 bool p4SkyfileDeleteObject( 7663 psDB *dbh, ///< Database handle 7664 const p4SkyfileRow *object ///< Object to delete 7671 7665 ); 7672 7666 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 7678 7672 */ 7679 7673 7680 long long p4S cfileDeleteRowObjects(7674 long long p4SkyfileDeleteRowObjects( 7681 7675 psDB *dbh, ///< Database handle 7682 7676 const psArray *objects, ///< Array of objects to delete 7683 7677 unsigned long long limit ///< Maximum number of elements to delete 7684 7678 ); 7685 /** Formats and prints an array of p4S cfileRow objects7679 /** Formats and prints an array of p4SkyfileRow objects 7686 7680 * 7687 7681 * When mdcf is set the formated output is in psMetadataConfig … … 7691 7685 */ 7692 7686 7693 bool p4S cfilePrintObjects(7687 bool p4SkyfilePrintObjects( 7694 7688 FILE *stream, ///< a stream 7695 psArray *objects, ///< An array of p4S cfileRow objects7689 psArray *objects, ///< An array of p4SkyfileRow objects 7696 7690 bool mdcf ///< format as mdconfig or simple 7697 7691 ); 7698 /** Formats and prints an p4S cfileRow object7692 /** Formats and prints an p4SkyfileRow object 7699 7693 * 7700 7694 * When mdcf is set the formated output is in psMetadataConfig … … 7704 7698 */ 7705 7699 7706 bool p4S cfilePrintObject(7700 bool p4SkyfilePrintObject( 7707 7701 FILE *stream, ///< a stream 7708 p4S cfileRow *object, ///< an p4ScfileRow object7702 p4SkyfileRow *object, ///< an p4SkyfileRow object 7709 7703 bool mdcf ///< format as mdconfig or simple 7710 7704 ); … … 7720 7714 char *dvodb; 7721 7715 psTime* registered; 7716 char *skycell_id; 7717 char *tess_id; 7722 7718 } p5RunRow; 7723 7719 … … 7732 7728 const char *workdir, 7733 7729 const char *dvodb, 7734 psTime* registered 7730 psTime* registered, 7731 const char *skycell_id, 7732 const char *tess_id 7735 7733 ); 7736 7734 … … 7766 7764 const char *workdir, 7767 7765 const char *dvodb, 7768 psTime* registered 7766 psTime* registered, 7767 const char *skycell_id, 7768 const char *tess_id 7769 7769 ); 7770 7770 … … 7916 7916 bool mdcf ///< format as mdconfig or simple 7917 7917 ); 7918 /** p5InputS cfileRow data structure7919 * 7920 * Structure for representing a single row of p5InputS cfile table data.7918 /** p5InputSkyfileRow data structure 7919 * 7920 * Structure for representing a single row of p5InputSkyfile table data. 7921 7921 */ 7922 7922 … … 7928 7928 char *kind; 7929 7929 bool template; 7930 } p5InputS cfileRow;7931 7932 /** Creates a new p5InputS cfileRow object7933 * 7934 * @return A new p5InputS cfileRow object or NULL on failure.7935 */ 7936 7937 p5InputS cfileRow *p5InputScfileRowAlloc(7930 } p5InputSkyfileRow; 7931 7932 /** Creates a new p5InputSkyfileRow object 7933 * 7934 * @return A new p5InputSkyfileRow object or NULL on failure. 7935 */ 7936 7937 p5InputSkyfileRow *p5InputSkyfileRowAlloc( 7938 7938 psS32 p5_id, 7939 7939 psS32 p4_id, … … 7944 7944 ); 7945 7945 7946 /** Creates a new p5InputS cfile table7947 * 7948 * @return true on success 7949 */ 7950 7951 bool p5InputS cfileCreateTable(7946 /** Creates a new p5InputSkyfile table 7947 * 7948 * @return true on success 7949 */ 7950 7951 bool p5InputSkyfileCreateTable( 7952 7952 psDB *dbh ///< Database handle 7953 7953 ); 7954 7954 7955 /** Deletes a p5InputS cfile table7956 * 7957 * @return true on success 7958 */ 7959 7960 bool p5InputS cfileDropTable(7955 /** Deletes a p5InputSkyfile table 7956 * 7957 * @return true on success 7958 */ 7959 7960 bool p5InputSkyfileDropTable( 7961 7961 psDB *dbh ///< Database handle 7962 7962 ); … … 7969 7969 */ 7970 7970 7971 bool p5InputS cfileInsert(7971 bool p5InputSkyfileInsert( 7972 7972 psDB *dbh, ///< Database handle 7973 7973 psS32 p5_id, … … 7984 7984 */ 7985 7985 7986 long long p5InputS cfileDelete(7986 long long p5InputSkyfileDelete( 7987 7987 psDB *dbh, ///< Database handle 7988 7988 const psMetadata *where, ///< Row match criteria … … 7990 7990 ); 7991 7991 7992 /** Insert a single p5InputS cfileRow object into a table7992 /** Insert a single p5InputSkyfileRow 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 p5InputS cfileInsertObject(8000 psDB *dbh, ///< Database handle 8001 p5InputS cfileRow *object ///< p5InputScfileRow object8002 ); 8003 8004 /** Insert an array of p5InputS cfileRow object into a table7999 bool p5InputSkyfileInsertObject( 8000 psDB *dbh, ///< Database handle 8001 p5InputSkyfileRow *object ///< p5InputSkyfileRow object 8002 ); 8003 8004 /** Insert an array of p5InputSkyfileRow 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 p5InputS cfileInsertObjects(8012 psDB *dbh, ///< Database handle 8013 psArray *objects ///< array of p5InputS cfileRow objects8014 ); 8015 8016 /** Insert data from a binary FITS table p5InputS cfileRow into the database8011 bool p5InputSkyfileInsertObjects( 8012 psDB *dbh, ///< Database handle 8013 psArray *objects ///< array of p5InputSkyfileRow objects 8014 ); 8015 8016 /** Insert data from a binary FITS table p5InputSkyfileRow 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 p5InputS cfileInsertFits(8026 bool p5InputSkyfileInsertFits( 8027 8027 psDB *dbh, ///< Database handle 8028 8028 const psFits *fits ///< psFits object … … 8039 8039 */ 8040 8040 8041 bool p5InputS cfileSelectRowsFits(8041 bool p5InputSkyfileSelectRowsFits( 8042 8042 psDB *dbh, ///< Database handle 8043 8043 psFits *fits, ///< psFits object … … 8046 8046 ); 8047 8047 8048 /** Convert a p5InputS cfileRow into an equivalent psMetadata8048 /** Convert a p5InputSkyfileRow into an equivalent psMetadata 8049 8049 * 8050 8050 * @return A psMetadata pointer or NULL on error 8051 8051 */ 8052 8052 8053 psMetadata *p5InputS cfileMetadataFromObject(8054 const p5InputS cfileRow *object ///< fooRow to convert into a psMetadata8053 psMetadata *p5InputSkyfileMetadataFromObject( 8054 const p5InputSkyfileRow *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 p5InputS cfileRow pointer or NULL on error8060 */ 8061 8062 p5InputS cfileRow *p5InputScfileObjectFromMetadata(8059 * @return A p5InputSkyfileRow pointer or NULL on error 8060 */ 8061 8062 p5InputSkyfileRow *p5InputSkyfileObjectFromMetadata( 8063 8063 psMetadata *md ///< psMetadata to convert into a fooRow 8064 8064 ); 8065 /** Selects up to limit rows from the database and returns as p5InputS cfileRow objects in a psArray8065 /** Selects up to limit rows from the database and returns as p5InputSkyfileRow objects in a psArray 8066 8066 * 8067 8067 * See psDBSelectRows() for documentation on the format of where. … … 8070 8070 */ 8071 8071 8072 psArray *p5InputS cfileSelectRowObjects(8072 psArray *p5InputSkyfileSelectRowObjects( 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 p5InputS cfile8077 /** Deletes a row from the database coresponding to an p5InputSkyfile 8078 8078 * 8079 8079 * Note that a 'where' search psMetadata is constructed from each object and … … 8083 8083 */ 8084 8084 8085 bool p5InputS cfileDeleteObject(8086 psDB *dbh, ///< Database handle 8087 const p5InputS cfileRow *object ///< Object to delete8085 bool p5InputSkyfileDeleteObject( 8086 psDB *dbh, ///< Database handle 8087 const p5InputSkyfileRow *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 p5InputS cfileDeleteRowObjects(8097 long long p5InputSkyfileDeleteRowObjects( 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 p5InputS cfileRow objects8102 /** Formats and prints an array of p5InputSkyfileRow objects 8103 8103 * 8104 8104 * When mdcf is set the formated output is in psMetadataConfig … … 8108 8108 */ 8109 8109 8110 bool p5InputS cfilePrintObjects(8110 bool p5InputSkyfilePrintObjects( 8111 8111 FILE *stream, ///< a stream 8112 psArray *objects, ///< An array of p5InputS cfileRow objects8112 psArray *objects, ///< An array of p5InputSkyfileRow objects 8113 8113 bool mdcf ///< format as mdconfig or simple 8114 8114 ); 8115 /** Formats and prints an p5InputS cfileRow object8115 /** Formats and prints an p5InputSkyfileRow object 8116 8116 * 8117 8117 * When mdcf is set the formated output is in psMetadataConfig … … 8121 8121 */ 8122 8122 8123 bool p5InputS cfilePrintObject(8123 bool p5InputSkyfilePrintObject( 8124 8124 FILE *stream, ///< a stream 8125 p5InputS cfileRow *object, ///< an p5InputScfileRow object8125 p5InputSkyfileRow *object, ///< an p5InputSkyfileRow object 8126 8126 bool mdcf ///< format as mdconfig or simple 8127 8127 ); 8128 /** p5DiffS cfileRow data structure8129 * 8130 * Structure for representing a single row of p5DiffS cfile table data.8128 /** p5DiffSkyfileRow data structure 8129 * 8130 * Structure for representing a single row of p5DiffSkyfile table data. 8131 8131 */ 8132 8132 8133 8133 typedef struct { 8134 8134 psS32 p5_id; 8135 char *skycell_id;8136 char *tess_id;8137 8135 char *uri; 8138 8136 psF64 bg; 8139 8137 psF64 bg_mean_stdev; 8140 } p5DiffS cfileRow;8141 8142 /** Creates a new p5DiffS cfileRow object8143 * 8144 * @return A new p5DiffS cfileRow object or NULL on failure.8145 */ 8146 8147 p5DiffS cfileRow *p5DiffScfileRowAlloc(8138 } p5DiffSkyfileRow; 8139 8140 /** Creates a new p5DiffSkyfileRow object 8141 * 8142 * @return A new p5DiffSkyfileRow object or NULL on failure. 8143 */ 8144 8145 p5DiffSkyfileRow *p5DiffSkyfileRowAlloc( 8148 8146 psS32 p5_id, 8149 const char *skycell_id,8150 const char *tess_id,8151 8147 const char *uri, 8152 8148 psF64 bg, … … 8154 8150 ); 8155 8151 8156 /** Creates a new p5DiffS cfile table8157 * 8158 * @return true on success 8159 */ 8160 8161 bool p5DiffS cfileCreateTable(8152 /** Creates a new p5DiffSkyfile table 8153 * 8154 * @return true on success 8155 */ 8156 8157 bool p5DiffSkyfileCreateTable( 8162 8158 psDB *dbh ///< Database handle 8163 8159 ); 8164 8160 8165 /** Deletes a p5DiffS cfile table8166 * 8167 * @return true on success 8168 */ 8169 8170 bool p5DiffS cfileDropTable(8161 /** Deletes a p5DiffSkyfile table 8162 * 8163 * @return true on success 8164 */ 8165 8166 bool p5DiffSkyfileDropTable( 8171 8167 psDB *dbh ///< Database handle 8172 8168 ); … … 8179 8175 */ 8180 8176 8181 bool p5DiffS cfileInsert(8177 bool p5DiffSkyfileInsert( 8182 8178 psDB *dbh, ///< Database handle 8183 8179 psS32 p5_id, 8184 const char *skycell_id,8185 const char *tess_id,8186 8180 const char *uri, 8187 8181 psF64 bg, … … 8194 8188 */ 8195 8189 8196 long long p5DiffS cfileDelete(8190 long long p5DiffSkyfileDelete( 8197 8191 psDB *dbh, ///< Database handle 8198 8192 const psMetadata *where, ///< Row match criteria … … 8200 8194 ); 8201 8195 8202 /** Insert a single p5DiffS cfileRow object into a table8196 /** Insert a single p5DiffSkyfileRow object into a table 8203 8197 * 8204 8198 * This function constructs and inserts a single row based on it's parameters. … … 8207 8201 */ 8208 8202 8209 bool p5DiffS cfileInsertObject(8210 psDB *dbh, ///< Database handle 8211 p5DiffS cfileRow *object ///< p5DiffScfileRow object8212 ); 8213 8214 /** Insert an array of p5DiffS cfileRow object into a table8203 bool p5DiffSkyfileInsertObject( 8204 psDB *dbh, ///< Database handle 8205 p5DiffSkyfileRow *object ///< p5DiffSkyfileRow object 8206 ); 8207 8208 /** Insert an array of p5DiffSkyfileRow object into a table 8215 8209 * 8216 8210 * This function constructs and inserts multiple rows based on it's parameters. … … 8219 8213 */ 8220 8214 8221 bool p5DiffS cfileInsertObjects(8222 psDB *dbh, ///< Database handle 8223 psArray *objects ///< array of p5DiffS cfileRow objects8224 ); 8225 8226 /** Insert data from a binary FITS table p5DiffS cfileRow into the database8215 bool p5DiffSkyfileInsertObjects( 8216 psDB *dbh, ///< Database handle 8217 psArray *objects ///< array of p5DiffSkyfileRow objects 8218 ); 8219 8220 /** Insert data from a binary FITS table p5DiffSkyfileRow into the database 8227 8221 * 8228 8222 * This function expects a psFits object with a FITS table as the first … … 8234 8228 */ 8235 8229 8236 bool p5DiffS cfileInsertFits(8230 bool p5DiffSkyfileInsertFits( 8237 8231 psDB *dbh, ///< Database handle 8238 8232 const psFits *fits ///< psFits object … … 8249 8243 */ 8250 8244 8251 bool p5DiffS cfileSelectRowsFits(8245 bool p5DiffSkyfileSelectRowsFits( 8252 8246 psDB *dbh, ///< Database handle 8253 8247 psFits *fits, ///< psFits object … … 8256 8250 ); 8257 8251 8258 /** Convert a p5DiffS cfileRow into an equivalent psMetadata8252 /** Convert a p5DiffSkyfileRow into an equivalent psMetadata 8259 8253 * 8260 8254 * @return A psMetadata pointer or NULL on error 8261 8255 */ 8262 8256 8263 psMetadata *p5DiffS cfileMetadataFromObject(8264 const p5DiffS cfileRow *object ///< fooRow to convert into a psMetadata8257 psMetadata *p5DiffSkyfileMetadataFromObject( 8258 const p5DiffSkyfileRow *object ///< fooRow to convert into a psMetadata 8265 8259 ); 8266 8260 8267 8261 /** Convert a psMetadata into an equivalent fooRow 8268 8262 * 8269 * @return A p5DiffS cfileRow pointer or NULL on error8270 */ 8271 8272 p5DiffS cfileRow *p5DiffScfileObjectFromMetadata(8263 * @return A p5DiffSkyfileRow pointer or NULL on error 8264 */ 8265 8266 p5DiffSkyfileRow *p5DiffSkyfileObjectFromMetadata( 8273 8267 psMetadata *md ///< psMetadata to convert into a fooRow 8274 8268 ); 8275 /** Selects up to limit rows from the database and returns as p5DiffS cfileRow objects in a psArray8269 /** Selects up to limit rows from the database and returns as p5DiffSkyfileRow objects in a psArray 8276 8270 * 8277 8271 * See psDBSelectRows() for documentation on the format of where. … … 8280 8274 */ 8281 8275 8282 psArray *p5DiffS cfileSelectRowObjects(8276 psArray *p5DiffSkyfileSelectRowObjects( 8283 8277 psDB *dbh, ///< Database handle 8284 8278 const psMetadata *where, ///< Row match criteria 8285 8279 unsigned long long limit ///< Maximum number of elements to return 8286 8280 ); 8287 /** Deletes a row from the database coresponding to an p5DiffS cfile8281 /** Deletes a row from the database coresponding to an p5DiffSkyfile 8288 8282 * 8289 8283 * Note that a 'where' search psMetadata is constructed from each object and … … 8293 8287 */ 8294 8288 8295 bool p5DiffS cfileDeleteObject(8296 psDB *dbh, ///< Database handle 8297 const p5DiffS cfileRow *object ///< Object to delete8289 bool p5DiffSkyfileDeleteObject( 8290 psDB *dbh, ///< Database handle 8291 const p5DiffSkyfileRow *object ///< Object to delete 8298 8292 ); 8299 8293 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8305 8299 */ 8306 8300 8307 long long p5DiffS cfileDeleteRowObjects(8301 long long p5DiffSkyfileDeleteRowObjects( 8308 8302 psDB *dbh, ///< Database handle 8309 8303 const psArray *objects, ///< Array of objects to delete 8310 8304 unsigned long long limit ///< Maximum number of elements to delete 8311 8305 ); 8312 /** Formats and prints an array of p5DiffS cfileRow objects8306 /** Formats and prints an array of p5DiffSkyfileRow objects 8313 8307 * 8314 8308 * When mdcf is set the formated output is in psMetadataConfig … … 8318 8312 */ 8319 8313 8320 bool p5DiffS cfilePrintObjects(8314 bool p5DiffSkyfilePrintObjects( 8321 8315 FILE *stream, ///< a stream 8322 psArray *objects, ///< An array of p5DiffS cfileRow objects8316 psArray *objects, ///< An array of p5DiffSkyfileRow objects 8323 8317 bool mdcf ///< format as mdconfig or simple 8324 8318 ); 8325 /** Formats and prints an p5DiffS cfileRow object8319 /** Formats and prints an p5DiffSkyfileRow object 8326 8320 * 8327 8321 * When mdcf is set the formated output is in psMetadataConfig … … 8331 8325 */ 8332 8326 8333 bool p5DiffS cfilePrintObject(8327 bool p5DiffSkyfilePrintObject( 8334 8328 FILE *stream, ///< a stream 8335 p5DiffS cfileRow *object, ///< an p5DiffScfileRow object8329 p5DiffSkyfileRow *object, ///< an p5DiffSkyfileRow object 8336 8330 bool mdcf ///< format as mdconfig or simple 8337 8331 ); … … 8347 8341 char *dvodb; 8348 8342 psTime* registered; 8343 char *skycell_id; 8344 char *tess_id; 8349 8345 } p6RunRow; 8350 8346 … … 8359 8355 const char *workdir, 8360 8356 const char *dvodb, 8361 psTime* registered 8357 psTime* registered, 8358 const char *skycell_id, 8359 const char *tess_id 8362 8360 ); 8363 8361 … … 8393 8391 const char *workdir, 8394 8392 const char *dvodb, 8395 psTime* registered 8393 psTime* registered, 8394 const char *skycell_id, 8395 const char *tess_id 8396 8396 ); 8397 8397 … … 8543 8543 bool mdcf ///< format as mdconfig or simple 8544 8544 ); 8545 /** p6InputS cfileRow data structure8546 * 8547 * Structure for representing a single row of p6InputS cfile table data.8545 /** p6InputSkyfileRow data structure 8546 * 8547 * Structure for representing a single row of p6InputSkyfile table data. 8548 8548 */ 8549 8549 … … 8551 8551 psS32 p6_id; 8552 8552 psS32 p4_id; 8553 char *skycell_id; 8554 char *tess_id; 8555 } p6InputScfileRow; 8556 8557 /** Creates a new p6InputScfileRow object 8558 * 8559 * @return A new p6InputScfileRow object or NULL on failure. 8560 */ 8561 8562 p6InputScfileRow *p6InputScfileRowAlloc( 8553 } p6InputSkyfileRow; 8554 8555 /** Creates a new p6InputSkyfileRow object 8556 * 8557 * @return A new p6InputSkyfileRow object or NULL on failure. 8558 */ 8559 8560 p6InputSkyfileRow *p6InputSkyfileRowAlloc( 8563 8561 psS32 p6_id, 8564 psS32 p4_id, 8565 const char *skycell_id, 8566 const char *tess_id 8567 ); 8568 8569 /** Creates a new p6InputScfile table 8570 * 8571 * @return true on success 8572 */ 8573 8574 bool p6InputScfileCreateTable( 8562 psS32 p4_id 8563 ); 8564 8565 /** Creates a new p6InputSkyfile table 8566 * 8567 * @return true on success 8568 */ 8569 8570 bool p6InputSkyfileCreateTable( 8575 8571 psDB *dbh ///< Database handle 8576 8572 ); 8577 8573 8578 /** Deletes a p6InputS cfile table8579 * 8580 * @return true on success 8581 */ 8582 8583 bool p6InputS cfileDropTable(8574 /** Deletes a p6InputSkyfile table 8575 * 8576 * @return true on success 8577 */ 8578 8579 bool p6InputSkyfileDropTable( 8584 8580 psDB *dbh ///< Database handle 8585 8581 ); … … 8592 8588 */ 8593 8589 8594 bool p6InputS cfileInsert(8590 bool p6InputSkyfileInsert( 8595 8591 psDB *dbh, ///< Database handle 8596 8592 psS32 p6_id, 8597 psS32 p4_id, 8598 const char *skycell_id, 8599 const char *tess_id 8593 psS32 p4_id 8600 8594 ); 8601 8595 … … 8605 8599 */ 8606 8600 8607 long long p6InputS cfileDelete(8601 long long p6InputSkyfileDelete( 8608 8602 psDB *dbh, ///< Database handle 8609 8603 const psMetadata *where, ///< Row match criteria … … 8611 8605 ); 8612 8606 8613 /** Insert a single p6InputS cfileRow object into a table8607 /** Insert a single p6InputSkyfileRow object into a table 8614 8608 * 8615 8609 * This function constructs and inserts a single row based on it's parameters. … … 8618 8612 */ 8619 8613 8620 bool p6InputS cfileInsertObject(8621 psDB *dbh, ///< Database handle 8622 p6InputS cfileRow *object ///< p6InputScfileRow object8623 ); 8624 8625 /** Insert an array of p6InputS cfileRow object into a table8614 bool p6InputSkyfileInsertObject( 8615 psDB *dbh, ///< Database handle 8616 p6InputSkyfileRow *object ///< p6InputSkyfileRow object 8617 ); 8618 8619 /** Insert an array of p6InputSkyfileRow object into a table 8626 8620 * 8627 8621 * This function constructs and inserts multiple rows based on it's parameters. … … 8630 8624 */ 8631 8625 8632 bool p6InputS cfileInsertObjects(8633 psDB *dbh, ///< Database handle 8634 psArray *objects ///< array of p6InputS cfileRow objects8635 ); 8636 8637 /** Insert data from a binary FITS table p6InputS cfileRow into the database8626 bool p6InputSkyfileInsertObjects( 8627 psDB *dbh, ///< Database handle 8628 psArray *objects ///< array of p6InputSkyfileRow objects 8629 ); 8630 8631 /** Insert data from a binary FITS table p6InputSkyfileRow into the database 8638 8632 * 8639 8633 * This function expects a psFits object with a FITS table as the first … … 8645 8639 */ 8646 8640 8647 bool p6InputS cfileInsertFits(8641 bool p6InputSkyfileInsertFits( 8648 8642 psDB *dbh, ///< Database handle 8649 8643 const psFits *fits ///< psFits object … … 8660 8654 */ 8661 8655 8662 bool p6InputS cfileSelectRowsFits(8656 bool p6InputSkyfileSelectRowsFits( 8663 8657 psDB *dbh, ///< Database handle 8664 8658 psFits *fits, ///< psFits object … … 8667 8661 ); 8668 8662 8669 /** Convert a p6InputS cfileRow into an equivalent psMetadata8663 /** Convert a p6InputSkyfileRow into an equivalent psMetadata 8670 8664 * 8671 8665 * @return A psMetadata pointer or NULL on error 8672 8666 */ 8673 8667 8674 psMetadata *p6InputS cfileMetadataFromObject(8675 const p6InputS cfileRow *object ///< fooRow to convert into a psMetadata8668 psMetadata *p6InputSkyfileMetadataFromObject( 8669 const p6InputSkyfileRow *object ///< fooRow to convert into a psMetadata 8676 8670 ); 8677 8671 8678 8672 /** Convert a psMetadata into an equivalent fooRow 8679 8673 * 8680 * @return A p6InputS cfileRow pointer or NULL on error8681 */ 8682 8683 p6InputS cfileRow *p6InputScfileObjectFromMetadata(8674 * @return A p6InputSkyfileRow pointer or NULL on error 8675 */ 8676 8677 p6InputSkyfileRow *p6InputSkyfileObjectFromMetadata( 8684 8678 psMetadata *md ///< psMetadata to convert into a fooRow 8685 8679 ); 8686 /** Selects up to limit rows from the database and returns as p6InputS cfileRow objects in a psArray8680 /** Selects up to limit rows from the database and returns as p6InputSkyfileRow objects in a psArray 8687 8681 * 8688 8682 * See psDBSelectRows() for documentation on the format of where. … … 8691 8685 */ 8692 8686 8693 psArray *p6InputS cfileSelectRowObjects(8687 psArray *p6InputSkyfileSelectRowObjects( 8694 8688 psDB *dbh, ///< Database handle 8695 8689 const psMetadata *where, ///< Row match criteria 8696 8690 unsigned long long limit ///< Maximum number of elements to return 8697 8691 ); 8698 /** Deletes a row from the database coresponding to an p6InputS cfile8692 /** Deletes a row from the database coresponding to an p6InputSkyfile 8699 8693 * 8700 8694 * Note that a 'where' search psMetadata is constructed from each object and … … 8704 8698 */ 8705 8699 8706 bool p6InputS cfileDeleteObject(8707 psDB *dbh, ///< Database handle 8708 const p6InputS cfileRow *object ///< Object to delete8700 bool p6InputSkyfileDeleteObject( 8701 psDB *dbh, ///< Database handle 8702 const p6InputSkyfileRow *object ///< Object to delete 8709 8703 ); 8710 8704 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8716 8710 */ 8717 8711 8718 long long p6InputS cfileDeleteRowObjects(8712 long long p6InputSkyfileDeleteRowObjects( 8719 8713 psDB *dbh, ///< Database handle 8720 8714 const psArray *objects, ///< Array of objects to delete 8721 8715 unsigned long long limit ///< Maximum number of elements to delete 8722 8716 ); 8723 /** Formats and prints an array of p6InputS cfileRow objects8717 /** Formats and prints an array of p6InputSkyfileRow objects 8724 8718 * 8725 8719 * When mdcf is set the formated output is in psMetadataConfig … … 8729 8723 */ 8730 8724 8731 bool p6InputS cfilePrintObjects(8725 bool p6InputSkyfilePrintObjects( 8732 8726 FILE *stream, ///< a stream 8733 psArray *objects, ///< An array of p6InputS cfileRow objects8727 psArray *objects, ///< An array of p6InputSkyfileRow objects 8734 8728 bool mdcf ///< format as mdconfig or simple 8735 8729 ); 8736 /** Formats and prints an p6InputS cfileRow object8730 /** Formats and prints an p6InputSkyfileRow object 8737 8731 * 8738 8732 * When mdcf is set the formated output is in psMetadataConfig … … 8742 8736 */ 8743 8737 8744 bool p6InputS cfilePrintObject(8738 bool p6InputSkyfilePrintObject( 8745 8739 FILE *stream, ///< a stream 8746 p6InputS cfileRow *object, ///< an p6InputScfileRow object8740 p6InputSkyfileRow *object, ///< an p6InputSkyfileRow object 8747 8741 bool mdcf ///< format as mdconfig or simple 8748 8742 ); 8749 /** p6SumS cfileRow data structure8750 * 8751 * Structure for representing a single row of p6SumS cfile table data.8743 /** p6SumSkyfileRow data structure 8744 * 8745 * Structure for representing a single row of p6SumSkyfile table data. 8752 8746 */ 8753 8747 8754 8748 typedef struct { 8755 8749 psS32 p6_id; 8756 char *skycell_id;8757 char *tess_id;8758 8750 char *uri; 8759 8751 psF64 bg; 8760 8752 psF64 bg_mean_stdev; 8761 } p6SumS cfileRow;8762 8763 /** Creates a new p6SumS cfileRow object8764 * 8765 * @return A new p6SumS cfileRow object or NULL on failure.8766 */ 8767 8768 p6SumS cfileRow *p6SumScfileRowAlloc(8753 } p6SumSkyfileRow; 8754 8755 /** Creates a new p6SumSkyfileRow object 8756 * 8757 * @return A new p6SumSkyfileRow object or NULL on failure. 8758 */ 8759 8760 p6SumSkyfileRow *p6SumSkyfileRowAlloc( 8769 8761 psS32 p6_id, 8770 const char *skycell_id,8771 const char *tess_id,8772 8762 const char *uri, 8773 8763 psF64 bg, … … 8775 8765 ); 8776 8766 8777 /** Creates a new p6SumS cfile table8778 * 8779 * @return true on success 8780 */ 8781 8782 bool p6SumS cfileCreateTable(8767 /** Creates a new p6SumSkyfile table 8768 * 8769 * @return true on success 8770 */ 8771 8772 bool p6SumSkyfileCreateTable( 8783 8773 psDB *dbh ///< Database handle 8784 8774 ); 8785 8775 8786 /** Deletes a p6SumS cfile table8787 * 8788 * @return true on success 8789 */ 8790 8791 bool p6SumS cfileDropTable(8776 /** Deletes a p6SumSkyfile table 8777 * 8778 * @return true on success 8779 */ 8780 8781 bool p6SumSkyfileDropTable( 8792 8782 psDB *dbh ///< Database handle 8793 8783 ); … … 8800 8790 */ 8801 8791 8802 bool p6SumS cfileInsert(8792 bool p6SumSkyfileInsert( 8803 8793 psDB *dbh, ///< Database handle 8804 8794 psS32 p6_id, 8805 const char *skycell_id,8806 const char *tess_id,8807 8795 const char *uri, 8808 8796 psF64 bg, … … 8815 8803 */ 8816 8804 8817 long long p6SumS cfileDelete(8805 long long p6SumSkyfileDelete( 8818 8806 psDB *dbh, ///< Database handle 8819 8807 const psMetadata *where, ///< Row match criteria … … 8821 8809 ); 8822 8810 8823 /** Insert a single p6SumS cfileRow object into a table8811 /** Insert a single p6SumSkyfileRow object into a table 8824 8812 * 8825 8813 * This function constructs and inserts a single row based on it's parameters. … … 8828 8816 */ 8829 8817 8830 bool p6SumS cfileInsertObject(8831 psDB *dbh, ///< Database handle 8832 p6SumS cfileRow *object ///< p6SumScfileRow object8833 ); 8834 8835 /** Insert an array of p6SumS cfileRow object into a table8818 bool p6SumSkyfileInsertObject( 8819 psDB *dbh, ///< Database handle 8820 p6SumSkyfileRow *object ///< p6SumSkyfileRow object 8821 ); 8822 8823 /** Insert an array of p6SumSkyfileRow object into a table 8836 8824 * 8837 8825 * This function constructs and inserts multiple rows based on it's parameters. … … 8840 8828 */ 8841 8829 8842 bool p6SumS cfileInsertObjects(8843 psDB *dbh, ///< Database handle 8844 psArray *objects ///< array of p6SumS cfileRow objects8845 ); 8846 8847 /** Insert data from a binary FITS table p6SumS cfileRow into the database8830 bool p6SumSkyfileInsertObjects( 8831 psDB *dbh, ///< Database handle 8832 psArray *objects ///< array of p6SumSkyfileRow objects 8833 ); 8834 8835 /** Insert data from a binary FITS table p6SumSkyfileRow into the database 8848 8836 * 8849 8837 * This function expects a psFits object with a FITS table as the first … … 8855 8843 */ 8856 8844 8857 bool p6SumS cfileInsertFits(8845 bool p6SumSkyfileInsertFits( 8858 8846 psDB *dbh, ///< Database handle 8859 8847 const psFits *fits ///< psFits object … … 8870 8858 */ 8871 8859 8872 bool p6SumS cfileSelectRowsFits(8860 bool p6SumSkyfileSelectRowsFits( 8873 8861 psDB *dbh, ///< Database handle 8874 8862 psFits *fits, ///< psFits object … … 8877 8865 ); 8878 8866 8879 /** Convert a p6SumS cfileRow into an equivalent psMetadata8867 /** Convert a p6SumSkyfileRow into an equivalent psMetadata 8880 8868 * 8881 8869 * @return A psMetadata pointer or NULL on error 8882 8870 */ 8883 8871 8884 psMetadata *p6SumS cfileMetadataFromObject(8885 const p6SumS cfileRow *object ///< fooRow to convert into a psMetadata8872 psMetadata *p6SumSkyfileMetadataFromObject( 8873 const p6SumSkyfileRow *object ///< fooRow to convert into a psMetadata 8886 8874 ); 8887 8875 8888 8876 /** Convert a psMetadata into an equivalent fooRow 8889 8877 * 8890 * @return A p6SumS cfileRow pointer or NULL on error8891 */ 8892 8893 p6SumS cfileRow *p6SumScfileObjectFromMetadata(8878 * @return A p6SumSkyfileRow pointer or NULL on error 8879 */ 8880 8881 p6SumSkyfileRow *p6SumSkyfileObjectFromMetadata( 8894 8882 psMetadata *md ///< psMetadata to convert into a fooRow 8895 8883 ); 8896 /** Selects up to limit rows from the database and returns as p6SumS cfileRow objects in a psArray8884 /** Selects up to limit rows from the database and returns as p6SumSkyfileRow objects in a psArray 8897 8885 * 8898 8886 * See psDBSelectRows() for documentation on the format of where. … … 8901 8889 */ 8902 8890 8903 psArray *p6SumS cfileSelectRowObjects(8891 psArray *p6SumSkyfileSelectRowObjects( 8904 8892 psDB *dbh, ///< Database handle 8905 8893 const psMetadata *where, ///< Row match criteria 8906 8894 unsigned long long limit ///< Maximum number of elements to return 8907 8895 ); 8908 /** Deletes a row from the database coresponding to an p6SumS cfile8896 /** Deletes a row from the database coresponding to an p6SumSkyfile 8909 8897 * 8910 8898 * Note that a 'where' search psMetadata is constructed from each object and … … 8914 8902 */ 8915 8903 8916 bool p6SumS cfileDeleteObject(8917 psDB *dbh, ///< Database handle 8918 const p6SumS cfileRow *object ///< Object to delete8904 bool p6SumSkyfileDeleteObject( 8905 psDB *dbh, ///< Database handle 8906 const p6SumSkyfileRow *object ///< Object to delete 8919 8907 ); 8920 8908 /** Deletes up to limit rows from the database and returns the number of rows actually deleted. … … 8926 8914 */ 8927 8915 8928 long long p6SumS cfileDeleteRowObjects(8916 long long p6SumSkyfileDeleteRowObjects( 8929 8917 psDB *dbh, ///< Database handle 8930 8918 const psArray *objects, ///< Array of objects to delete 8931 8919 unsigned long long limit ///< Maximum number of elements to delete 8932 8920 ); 8933 /** Formats and prints an array of p6SumS cfileRow objects8921 /** Formats and prints an array of p6SumSkyfileRow objects 8934 8922 * 8935 8923 * When mdcf is set the formated output is in psMetadataConfig … … 8939 8927 */ 8940 8928 8941 bool p6SumS cfilePrintObjects(8929 bool p6SumSkyfilePrintObjects( 8942 8930 FILE *stream, ///< a stream 8943 psArray *objects, ///< An array of p6SumS cfileRow objects8931 psArray *objects, ///< An array of p6SumSkyfileRow objects 8944 8932 bool mdcf ///< format as mdconfig or simple 8945 8933 ); 8946 /** Formats and prints an p6SumS cfileRow object8934 /** Formats and prints an p6SumSkyfileRow object 8947 8935 * 8948 8936 * When mdcf is set the formated output is in psMetadataConfig … … 8952 8940 */ 8953 8941 8954 bool p6SumS cfilePrintObject(8942 bool p6SumSkyfilePrintObject( 8955 8943 FILE *stream, ///< a stream 8956 p6SumS cfileRow *object, ///< an p6SumScfileRow object8944 p6SumSkyfileRow *object, ///< an p6SumSkyfileRow object 8957 8945 bool mdcf ///< format as mdconfig or simple 8958 8946 ); … … 8964 8952 #endif 8965 8953 8966 #endif // P6SUMS CFILE_DB_H8954 #endif // P6SUMSKYFILE_DB_H -
trunk/ippdb/tests/alloc.c
r11873 r11988 1562 1562 1563 1563 { 1564 p4S cfileRow*object;1565 1566 object = p4S cfileRowAlloc(-32, "a string", "a string", "a string", -32, "a string", 64.64, 64.64 );1564 p4SkyfileRow *object; 1565 1566 object = p4SkyfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64 ); 1567 1567 1568 1568 if (!object) { … … 1582 1582 exit(EXIT_FAILURE); 1583 1583 } 1584 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {1585 psFree(object);1586 exit(EXIT_FAILURE);1587 }1588 if (!object->p3_version == -32) {1589 psFree(object);1590 exit(EXIT_FAILURE);1591 }1592 1584 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 1593 1585 psFree(object); … … 1609 1601 p5RunRow *object; 1610 1602 1611 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z" );1603 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string" ); 1612 1604 1613 1605 if (!object) { … … 1634 1626 exit(EXIT_FAILURE); 1635 1627 } 1636 1637 psFree(object); 1638 } 1639 1640 { 1641 p5InputScfileRow *object; 1642 1643 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true ); 1628 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) { 1629 psFree(object); 1630 exit(EXIT_FAILURE); 1631 } 1632 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) { 1633 psFree(object); 1634 exit(EXIT_FAILURE); 1635 } 1636 1637 psFree(object); 1638 } 1639 1640 { 1641 p5InputSkyfileRow *object; 1642 1643 object = p5InputSkyfileRowAlloc(-32, -32, "a string", "a string", "a string", true ); 1644 1644 1645 1645 if (!object) { … … 1676 1676 1677 1677 { 1678 p5DiffS cfileRow *object;1679 1680 object = p5DiffS cfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64 );1678 p5DiffSkyfileRow *object; 1679 1680 object = p5DiffSkyfileRowAlloc(-32, "a string", 64.64, 64.64 ); 1681 1681 1682 1682 if (!object) { … … 1688 1688 exit(EXIT_FAILURE); 1689 1689 } 1690 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 1691 psFree(object); 1692 exit(EXIT_FAILURE); 1693 } 1694 if (!object->bg == 64.64) { 1695 psFree(object); 1696 exit(EXIT_FAILURE); 1697 } 1698 if (!object->bg_mean_stdev == 64.64) { 1699 psFree(object); 1700 exit(EXIT_FAILURE); 1701 } 1702 1703 psFree(object); 1704 } 1705 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) { 1716 psFree(object); 1717 exit(EXIT_FAILURE); 1718 } 1719 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) { 1720 psFree(object); 1721 exit(EXIT_FAILURE); 1722 } 1723 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 1724 psFree(object); 1725 exit(EXIT_FAILURE); 1726 } 1727 if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) { 1728 psFree(object); 1729 exit(EXIT_FAILURE); 1730 } 1731 psFree(object); 1732 exit(EXIT_FAILURE); 1733 } 1690 1734 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) { 1691 1735 psFree(object); … … 1696 1740 exit(EXIT_FAILURE); 1697 1741 } 1698 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 1699 psFree(object); 1700 exit(EXIT_FAILURE); 1701 } 1702 if (!object->bg == 64.64) { 1703 psFree(object); 1704 exit(EXIT_FAILURE); 1705 } 1706 if (!object->bg_mean_stdev == 64.64) { 1707 psFree(object); 1708 exit(EXIT_FAILURE); 1709 } 1710 1711 psFree(object); 1712 } 1713 1714 { 1715 p6RunRow *object; 1716 1717 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z" ); 1742 1743 psFree(object); 1744 } 1745 1746 { 1747 p6InputSkyfileRow *object; 1748 1749 object = p6InputSkyfileRowAlloc(-32, -32 ); 1718 1750 1719 1751 if (!object) { … … 1725 1757 exit(EXIT_FAILURE); 1726 1758 } 1727 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) { 1728 psFree(object); 1729 exit(EXIT_FAILURE); 1730 } 1731 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 1732 psFree(object); 1733 exit(EXIT_FAILURE); 1734 } 1735 if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) { 1736 psFree(object); 1737 exit(EXIT_FAILURE); 1738 } 1739 psFree(object); 1740 exit(EXIT_FAILURE); 1741 } 1742 1743 psFree(object); 1744 } 1745 1746 { 1747 p6InputScfileRow *object; 1748 1749 object = p6InputScfileRowAlloc(-32, -32, "a string", "a string" ); 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 ); 1750 1771 1751 1772 if (!object) { … … 1754 1775 1755 1776 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 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) {1764 psFree(object);1765 exit(EXIT_FAILURE);1766 }1767 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {1768 psFree(object);1769 exit(EXIT_FAILURE);1770 }1771 1772 psFree(object);1773 }1774 1775 {1776 p6SumScfileRow *object;1777 1778 object = p6SumScfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64 );1779 1780 if (!object) {1781 exit(EXIT_FAILURE);1782 }1783 1784 if (!object->p6_id == -32) {1785 psFree(object);1786 exit(EXIT_FAILURE);1787 }1788 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) {1789 psFree(object);1790 exit(EXIT_FAILURE);1791 }1792 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {1793 1777 psFree(object); 1794 1778 exit(EXIT_FAILURE); -
trunk/ippdb/tests/createtable.c
r11867 r11988 523 523 } 524 524 525 if(!p4S cfileCreateTable(dbh)) {525 if(!p4SkyfileCreateTable(dbh)) { 526 526 exit(EXIT_FAILURE); 527 527 } … … 553 553 } 554 554 555 if(!p5InputS cfileCreateTable(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(!p5DiffS cfileCreateTable(dbh)) {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 571 exit(EXIT_FAILURE); 572 572 } … … 598 598 } 599 599 600 if(!p6InputS cfileCreateTable(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(!p6SumS cfileCreateTable(dbh)) {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)) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/dbcleanup.c
r11867 r11988 45 45 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4InputExp"); 46 46 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4SkyCellMap"); 47 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4S cfile");47 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4Skyfile"); 48 48 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5Run"); 49 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputS cfile");50 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffS cfile");49 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputSkyfile"); 50 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffSkyfile"); 51 51 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run"); 52 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6InputS cfile");53 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6SumS cfile");52 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6InputSkyfile"); 53 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6SumSkyfile"); 54 54 55 55 psDBCleanup(dbh); -
trunk/ippdb/tests/dbsetup.c
r11867 r11988 115 115 p4SkyCellMapCreateTable(dbh); 116 116 117 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4S cfile");118 p4S cfileCreateTable(dbh);117 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p4Skyfile"); 118 p4SkyfileCreateTable(dbh); 119 119 120 120 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5Run"); 121 121 p5RunCreateTable(dbh); 122 122 123 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputS cfile");124 p5InputS cfileCreateTable(dbh);123 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5InputSkyfile"); 124 p5InputSkyfileCreateTable(dbh); 125 125 126 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffS cfile");127 p5DiffS cfileCreateTable(dbh);126 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p5DiffSkyfile"); 127 p5DiffSkyfileCreateTable(dbh); 128 128 129 129 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6Run"); 130 130 p6RunCreateTable(dbh); 131 131 132 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6InputS cfile");133 p6InputS cfileCreateTable(dbh);132 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6InputSkyfile"); 133 p6InputSkyfileCreateTable(dbh); 134 134 135 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6SumS cfile");136 p6SumS cfileCreateTable(dbh);135 p_psDBRunQuery(dbh, "DROP TABLE IF EXISTS p6SumSkyfile"); 136 p6SumSkyfileCreateTable(dbh); 137 137 138 138 psDBCleanup(dbh); -
trunk/ippdb/tests/droptable.c
r11867 r11988 523 523 } 524 524 525 if (!p4S cfileDropTable(dbh)) {525 if (!p4SkyfileDropTable(dbh)) { 526 526 exit(EXIT_FAILURE); 527 527 } … … 553 553 } 554 554 555 if (!p5InputS cfileDropTable(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 (!p5DiffS cfileDropTable(dbh)) {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 571 exit(EXIT_FAILURE); 572 572 } … … 598 598 } 599 599 600 if (!p6InputS cfileDropTable(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 (!p6SumS cfileDropTable(dbh)) {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)) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/insert.c
r11873 r11988 523 523 } 524 524 525 if (!p4S cfileInsert(dbh, -32, "a string", "a string", "a string", -32, "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" )) {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 (!p5InputS cfileInsert(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 (!p5DiffS cfileInsert(dbh, -32, "a string", "a string", "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" )) {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 (!p6InputS cfileInsert(dbh, -32, -32, "a string", "a string")) {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 (!p6SumS cfileInsert(dbh, -32, "a string", "a string", "a string", 64.64, 64.64)) {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)) { 616 616 exit(EXIT_FAILURE); 617 617 } -
trunk/ippdb/tests/insertfits.c
r11867 r11988 908 908 } 909 909 910 if (!p4S cfileInsertFits(dbh, fits)) {910 if (!p4SkyfileInsertFits(dbh, fits)) { 911 911 exit(EXIT_FAILURE); 912 912 } … … 960 960 } 961 961 962 if (!p5InputS cfileInsertFits(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 (!p5DiffS cfileInsertFits(dbh, fits)) {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 989 exit(EXIT_FAILURE); 990 990 } … … 1038 1038 } 1039 1039 1040 if (!p6InputS cfileInsertFits(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 (!p6SumS cfileInsertFits(dbh, fits)) {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)) { 1067 1067 exit(EXIT_FAILURE); 1068 1068 } -
trunk/ippdb/tests/insertobject.c
r11873 r11988 755 755 { 756 756 psDB *dbh; 757 p4S cfileRow*object;758 759 dbh = psDBInit("localhost", "test", NULL, "test"); 760 if (!dbh) { 761 exit(EXIT_FAILURE); 762 } 763 764 object = p4S cfileRowAlloc(-32, "a string", "a string", "a string", -32, "a string", 64.64, 64.64);765 if (!object) { 766 exit(EXIT_FAILURE); 767 } 768 769 if (!p4S cfileInsertObject(dbh, object)) {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 770 exit(EXIT_FAILURE); 771 771 } … … 784 784 } 785 785 786 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z" );786 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 787 787 if (!object) { 788 788 exit(EXIT_FAILURE); … … 799 799 { 800 800 psDB *dbh; 801 p5InputS cfileRow *object;802 803 dbh = psDBInit("localhost", "test", NULL, "test"); 804 if (!dbh) { 805 exit(EXIT_FAILURE); 806 } 807 808 object = p5InputS cfileRowAlloc(-32, -32, "a string", "a string", "a string", true);809 if (!object) { 810 exit(EXIT_FAILURE); 811 } 812 813 if (!p5InputS cfileInsertObject(dbh, object)) {814 exit(EXIT_FAILURE); 815 } 816 817 psFree(object); 818 psDBCleanup(dbh); 819 } 820 821 { 822 psDB *dbh; 823 p5DiffS cfileRow *object;824 825 dbh = psDBInit("localhost", "test", NULL, "test"); 826 if (!dbh) { 827 exit(EXIT_FAILURE); 828 } 829 830 object = p5DiffS cfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64);831 if (!object) { 832 exit(EXIT_FAILURE); 833 } 834 835 if (!p5DiffS cfileInsertObject(dbh, object)) {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 836 exit(EXIT_FAILURE); 837 837 } … … 850 850 } 851 851 852 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z" );852 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 853 853 if (!object) { 854 854 exit(EXIT_FAILURE); … … 865 865 { 866 866 psDB *dbh; 867 p6InputS cfileRow *object;868 869 dbh = psDBInit("localhost", "test", NULL, "test"); 870 if (!dbh) { 871 exit(EXIT_FAILURE); 872 } 873 874 object = p6InputS cfileRowAlloc(-32, -32, "a string", "a string");875 if (!object) { 876 exit(EXIT_FAILURE); 877 } 878 879 if (!p6InputS cfileInsertObject(dbh, object)) {880 exit(EXIT_FAILURE); 881 } 882 883 psFree(object); 884 psDBCleanup(dbh); 885 } 886 887 { 888 psDB *dbh; 889 p6SumS cfileRow*object;890 891 dbh = psDBInit("localhost", "test", NULL, "test"); 892 if (!dbh) { 893 exit(EXIT_FAILURE); 894 } 895 896 object = p6SumS cfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64);897 if (!object) { 898 exit(EXIT_FAILURE); 899 } 900 901 if (!p6SumS cfileInsertObject(dbh, object)) {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)) { 902 902 exit(EXIT_FAILURE); 903 903 } -
trunk/ippdb/tests/metadatafromobject.c
r11873 r11988 1821 1821 { 1822 1822 psMetadata *md; 1823 p4S cfileRow*object;1824 bool status; 1825 1826 object = p4S cfileRowAlloc(-32, "a string", "a string", "a string", -32, "a string", 64.64, 64.64);1827 if (!object) { 1828 exit(EXIT_FAILURE); 1829 } 1830 1831 md = p4S cfileMetadataFromObject(object);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 1832 if (!md) { 1833 1833 exit(EXIT_FAILURE); … … 1848 1848 exit(EXIT_FAILURE); 1849 1849 } 1850 if (strncmp(psMetadataLookupPtr(&status, md, "exp_tag"), "a string", MAX_STRING_LENGTH)) {1851 psFree(md);1852 exit(EXIT_FAILURE);1853 }1854 if (!psMetadataLookupS32(&status, md, "p3_version") == -32) {1855 psFree(md);1856 exit(EXIT_FAILURE);1857 }1858 1850 if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) { 1859 1851 psFree(md); … … 1877 1869 bool status; 1878 1870 1879 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z" );1871 object = p5RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z", "a string", "a string"); 1880 1872 if (!object) { 1881 1873 exit(EXIT_FAILURE); … … 1908 1900 exit(EXIT_FAILURE); 1909 1901 } 1910 1911 psFree(md); 1912 } 1913 1914 { 1915 psMetadata *md; 1916 p5InputScfileRow *object; 1917 bool status; 1918 1919 object = p5InputScfileRowAlloc(-32, -32, "a string", "a string", "a string", true); 1920 if (!object) { 1921 exit(EXIT_FAILURE); 1922 } 1923 1924 md = p5InputScfileMetadataFromObject(object); 1902 if (strncmp(psMetadataLookupPtr(&status, md, "skycell_id"), "a string", MAX_STRING_LENGTH)) { 1903 psFree(md); 1904 exit(EXIT_FAILURE); 1905 } 1906 if (strncmp(psMetadataLookupPtr(&status, md, "tess_id"), "a string", MAX_STRING_LENGTH)) { 1907 psFree(md); 1908 exit(EXIT_FAILURE); 1909 } 1910 1911 psFree(md); 1912 } 1913 1914 { 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 1925 if (!md) { 1926 1926 exit(EXIT_FAILURE); … … 1959 1959 { 1960 1960 psMetadata *md; 1961 p5DiffS cfileRow *object;1962 bool status; 1963 1964 object = p5DiffS cfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64);1965 if (!object) { 1966 exit(EXIT_FAILURE); 1967 } 1968 1969 md = p5DiffS cfileMetadataFromObject(object);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 1970 if (!md) { 1971 1971 exit(EXIT_FAILURE); … … 1978 1978 exit(EXIT_FAILURE); 1979 1979 } 1980 if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) { 1981 psFree(md); 1982 exit(EXIT_FAILURE); 1983 } 1984 if (!psMetadataLookupF64(&status, md, "bg") == 64.64) { 1985 psFree(md); 1986 exit(EXIT_FAILURE); 1987 } 1988 if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) { 1989 psFree(md); 1990 exit(EXIT_FAILURE); 1991 } 1992 1993 psFree(md); 1994 } 1995 1996 { 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) { 2014 psFree(md); 2015 exit(EXIT_FAILURE); 2016 } 2017 if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) { 2018 psFree(md); 2019 exit(EXIT_FAILURE); 2020 } 2021 if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) { 2022 psFree(md); 2023 exit(EXIT_FAILURE); 2024 } 2025 if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) { 2026 psFree(md); 2027 exit(EXIT_FAILURE); 2028 } 2029 psFree(md); 2030 exit(EXIT_FAILURE); 2031 } 1980 2032 if (strncmp(psMetadataLookupPtr(&status, md, "skycell_id"), "a string", MAX_STRING_LENGTH)) { 1981 2033 psFree(md); … … 1986 2038 exit(EXIT_FAILURE); 1987 2039 } 1988 if (strncmp(psMetadataLookupPtr(&status, md, "uri"), "a string", MAX_STRING_LENGTH)) { 1989 psFree(md); 1990 exit(EXIT_FAILURE); 1991 } 1992 if (!psMetadataLookupF64(&status, md, "bg") == 64.64) { 1993 psFree(md); 1994 exit(EXIT_FAILURE); 1995 } 1996 if (!psMetadataLookupF64(&status, md, "bg_mean_stdev") == 64.64) { 1997 psFree(md); 1998 exit(EXIT_FAILURE); 1999 } 2000 2001 psFree(md); 2002 } 2003 2004 { 2005 psMetadata *md; 2006 p6RunRow *object; 2007 bool status; 2008 2009 object = p6RunRowAlloc(-32, "a string", "a string", "a string", "0001-01-01T00:00:00Z"); 2010 if (!object) { 2011 exit(EXIT_FAILURE); 2012 } 2013 2014 md = p6RunMetadataFromObject(object); 2040 2041 psFree(md); 2042 } 2043 2044 { 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); 2015 2055 if (!md) { 2016 2056 exit(EXIT_FAILURE); … … 2023 2063 exit(EXIT_FAILURE); 2024 2064 } 2025 if (strncmp(psMetadataLookupPtr(&status, md, "state"), "a string", MAX_STRING_LENGTH)) { 2026 psFree(md); 2027 exit(EXIT_FAILURE); 2028 } 2029 if (strncmp(psMetadataLookupPtr(&status, md, "workdir"), "a string", MAX_STRING_LENGTH)) { 2030 psFree(md); 2031 exit(EXIT_FAILURE); 2032 } 2033 if (strncmp(psMetadataLookupPtr(&status, md, "dvodb"), "a string", MAX_STRING_LENGTH)) { 2034 psFree(md); 2035 exit(EXIT_FAILURE); 2036 } 2037 psFree(md); 2038 exit(EXIT_FAILURE); 2039 } 2040 2041 psFree(md); 2042 } 2043 2044 { 2045 psMetadata *md; 2046 p6InputScfileRow *object; 2047 bool status; 2048 2049 object = p6InputScfileRowAlloc(-32, -32, "a string", "a string"); 2050 if (!object) { 2051 exit(EXIT_FAILURE); 2052 } 2053 2054 md = p6InputScfileMetadataFromObject(object); 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); 2055 2084 if (!md) { 2056 2085 exit(EXIT_FAILURE); … … 2060 2089 2061 2090 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 if (strncmp(psMetadataLookupPtr(&status, md, "skycell_id"), "a string", MAX_STRING_LENGTH)) {2070 psFree(md);2071 exit(EXIT_FAILURE);2072 }2073 if (strncmp(psMetadataLookupPtr(&status, md, "tess_id"), "a string", MAX_STRING_LENGTH)) {2074 psFree(md);2075 exit(EXIT_FAILURE);2076 }2077 2078 psFree(md);2079 }2080 2081 {2082 psMetadata *md;2083 p6SumScfileRow *object;2084 bool status;2085 2086 object = p6SumScfileRowAlloc(-32, "a string", "a string", "a string", 64.64, 64.64);2087 if (!object) {2088 exit(EXIT_FAILURE);2089 }2090 2091 md = p6SumScfileMetadataFromObject(object);2092 if (!md) {2093 exit(EXIT_FAILURE);2094 }2095 2096 psFree(object);2097 2098 if (!psMetadataLookupS32(&status, md, "p6_id") == -32) {2099 psFree(md);2100 exit(EXIT_FAILURE);2101 }2102 if (strncmp(psMetadataLookupPtr(&status, md, "skycell_id"), "a string", MAX_STRING_LENGTH)) {2103 psFree(md);2104 exit(EXIT_FAILURE);2105 }2106 if (strncmp(psMetadataLookupPtr(&status, md, "tess_id"), "a string", MAX_STRING_LENGTH)) {2107 2091 psFree(md); 2108 2092 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r11873 r11988 2816 2816 { 2817 2817 psMetadata *md; 2818 p4S cfileRow*object;2818 p4SkyfileRow *object; 2819 2819 2820 2820 md = psMetadataAlloc(); … … 2831 2831 exit(EXIT_FAILURE); 2832 2832 } 2833 if (!psMetadataAddStr(md, PS_LIST_TAIL, "exp_tag", 0, NULL, "a string")) {2834 psFree(md);2835 exit(EXIT_FAILURE);2836 }2837 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p3_version", 0, NULL, -32)) {2838 psFree(md);2839 exit(EXIT_FAILURE);2840 }2841 2833 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) { 2842 2834 psFree(md); … … 2852 2844 } 2853 2845 2854 object = p4S cfileObjectFromMetadata(md);2846 object = p4SkyfileObjectFromMetadata(md); 2855 2847 if (!object) { 2856 2848 psFree(md); … … 2872 2864 exit(EXIT_FAILURE); 2873 2865 } 2874 if (strncmp(object->exp_tag, "a string", MAX_STRING_LENGTH)) {2875 psFree(object);2876 exit(EXIT_FAILURE);2877 }2878 if (!object->p3_version == -32) {2879 psFree(object);2880 exit(EXIT_FAILURE);2881 }2882 2866 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 2883 2867 psFree(object); … … 2920 2904 exit(EXIT_FAILURE); 2921 2905 } 2906 if (!psMetadataAddStr(md, PS_LIST_TAIL, "skycell_id", 0, NULL, "a string")) { 2907 psFree(md); 2908 exit(EXIT_FAILURE); 2909 } 2910 if (!psMetadataAddStr(md, PS_LIST_TAIL, "tess_id", 0, NULL, "a string")) { 2911 psFree(md); 2912 exit(EXIT_FAILURE); 2913 } 2922 2914 2923 2915 object = p5RunObjectFromMetadata(md); … … 2948 2940 exit(EXIT_FAILURE); 2949 2941 } 2950 2951 psFree(object); 2952 } 2953 2954 { 2955 psMetadata *md; 2956 p5InputScfileRow *object; 2942 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) { 2943 psFree(object); 2944 exit(EXIT_FAILURE); 2945 } 2946 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) { 2947 psFree(object); 2948 exit(EXIT_FAILURE); 2949 } 2950 2951 psFree(object); 2952 } 2953 2954 { 2955 psMetadata *md; 2956 p5InputSkyfileRow *object; 2957 2957 2958 2958 md = psMetadataAlloc(); … … 2982 2982 } 2983 2983 2984 object = p5InputS cfileObjectFromMetadata(md);2984 object = p5InputSkyfileObjectFromMetadata(md); 2985 2985 if (!object) { 2986 2986 psFree(md); … … 3020 3020 { 3021 3021 psMetadata *md; 3022 p5DiffS cfileRow *object;3022 p5DiffSkyfileRow *object; 3023 3023 3024 3024 md = psMetadataAlloc(); … … 3027 3027 exit(EXIT_FAILURE); 3028 3028 } 3029 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) { 3030 psFree(md); 3031 exit(EXIT_FAILURE); 3032 } 3033 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, 64.64)) { 3034 psFree(md); 3035 exit(EXIT_FAILURE); 3036 } 3037 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, 64.64)) { 3038 psFree(md); 3039 exit(EXIT_FAILURE); 3040 } 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) { 3051 psFree(object); 3052 exit(EXIT_FAILURE); 3053 } 3054 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 3055 psFree(object); 3056 exit(EXIT_FAILURE); 3057 } 3058 if (!object->bg == 64.64) { 3059 psFree(object); 3060 exit(EXIT_FAILURE); 3061 } 3062 if (!object->bg_mean_stdev == 64.64) { 3063 psFree(object); 3064 exit(EXIT_FAILURE); 3065 } 3066 3067 psFree(object); 3068 } 3069 3070 { 3071 psMetadata *md; 3072 p6RunRow *object; 3073 3074 md = psMetadataAlloc(); 3075 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p6_id", 0, NULL, -32)) { 3076 psFree(md); 3077 exit(EXIT_FAILURE); 3078 } 3079 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) { 3080 psFree(md); 3081 exit(EXIT_FAILURE); 3082 } 3083 if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) { 3084 psFree(md); 3085 exit(EXIT_FAILURE); 3086 } 3087 if (!psMetadataAddStr(md, PS_LIST_TAIL, "dvodb", 0, NULL, "a string")) { 3088 psFree(md); 3089 exit(EXIT_FAILURE); 3090 } 3091 psFree(md); 3092 exit(EXIT_FAILURE); 3093 } 3029 3094 if (!psMetadataAddStr(md, PS_LIST_TAIL, "skycell_id", 0, NULL, "a string")) { 3030 3095 psFree(md); … … 3035 3100 exit(EXIT_FAILURE); 3036 3101 } 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) { 3112 psFree(object); 3113 exit(EXIT_FAILURE); 3114 } 3115 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) { 3116 psFree(object); 3117 exit(EXIT_FAILURE); 3118 } 3119 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) { 3120 psFree(object); 3121 exit(EXIT_FAILURE); 3122 } 3123 if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) { 3124 psFree(object); 3125 exit(EXIT_FAILURE); 3126 } 3127 psFree(object); 3128 exit(EXIT_FAILURE); 3129 } 3130 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) { 3131 psFree(object); 3132 exit(EXIT_FAILURE); 3133 } 3134 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) { 3135 psFree(object); 3136 exit(EXIT_FAILURE); 3137 } 3138 3139 psFree(object); 3140 } 3141 3142 { 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)) { 3182 psFree(md); 3183 exit(EXIT_FAILURE); 3184 } 3037 3185 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) { 3038 3186 psFree(md); … … 3048 3196 } 3049 3197 3050 object = p5DiffScfileObjectFromMetadata(md); 3051 if (!object) { 3052 psFree(md); 3053 exit(EXIT_FAILURE); 3054 } 3055 3056 psFree(md); 3057 3058 if (!object->p5_id == -32) { 3059 psFree(object); 3060 exit(EXIT_FAILURE); 3061 } 3062 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) { 3063 psFree(object); 3064 exit(EXIT_FAILURE); 3065 } 3066 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) { 3067 psFree(object); 3068 exit(EXIT_FAILURE); 3069 } 3070 if (strncmp(object->uri, "a string", MAX_STRING_LENGTH)) { 3071 psFree(object); 3072 exit(EXIT_FAILURE); 3073 } 3074 if (!object->bg == 64.64) { 3075 psFree(object); 3076 exit(EXIT_FAILURE); 3077 } 3078 if (!object->bg_mean_stdev == 64.64) { 3079 psFree(object); 3080 exit(EXIT_FAILURE); 3081 } 3082 3083 psFree(object); 3084 } 3085 3086 { 3087 psMetadata *md; 3088 p6RunRow *object; 3089 3090 md = psMetadataAlloc(); 3091 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p6_id", 0, NULL, -32)) { 3092 psFree(md); 3093 exit(EXIT_FAILURE); 3094 } 3095 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, "a string")) { 3096 psFree(md); 3097 exit(EXIT_FAILURE); 3098 } 3099 if (!psMetadataAddStr(md, PS_LIST_TAIL, "workdir", 0, NULL, "a string")) { 3100 psFree(md); 3101 exit(EXIT_FAILURE); 3102 } 3103 if (!psMetadataAddStr(md, PS_LIST_TAIL, "dvodb", 0, NULL, "a string")) { 3104 psFree(md); 3105 exit(EXIT_FAILURE); 3106 } 3107 psFree(md); 3108 exit(EXIT_FAILURE); 3109 } 3110 3111 object = p6RunObjectFromMetadata(md); 3198 object = p6SumSkyfileObjectFromMetadata(md); 3112 3199 if (!object) { 3113 3200 psFree(md); … … 3118 3205 3119 3206 if (!object->p6_id == -32) { 3120 psFree(object);3121 exit(EXIT_FAILURE);3122 }3123 if (strncmp(object->state, "a string", MAX_STRING_LENGTH)) {3124 psFree(object);3125 exit(EXIT_FAILURE);3126 }3127 if (strncmp(object->workdir, "a string", MAX_STRING_LENGTH)) {3128 psFree(object);3129 exit(EXIT_FAILURE);3130 }3131 if (strncmp(object->dvodb, "a string", MAX_STRING_LENGTH)) {3132 psFree(object);3133 exit(EXIT_FAILURE);3134 }3135 psFree(object);3136 exit(EXIT_FAILURE);3137 }3138 3139 psFree(object);3140 }3141 3142 {3143 psMetadata *md;3144 p6InputScfileRow *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 if (!psMetadataAddStr(md, PS_LIST_TAIL, "skycell_id", 0, NULL, "a string")) {3156 psFree(md);3157 exit(EXIT_FAILURE);3158 }3159 if (!psMetadataAddStr(md, PS_LIST_TAIL, "tess_id", 0, NULL, "a string")) {3160 psFree(md);3161 exit(EXIT_FAILURE);3162 }3163 3164 object = p6InputScfileObjectFromMetadata(md);3165 if (!object) {3166 psFree(md);3167 exit(EXIT_FAILURE);3168 }3169 3170 psFree(md);3171 3172 if (!object->p6_id == -32) {3173 psFree(object);3174 exit(EXIT_FAILURE);3175 }3176 if (!object->p4_id == -32) {3177 psFree(object);3178 exit(EXIT_FAILURE);3179 }3180 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) {3181 psFree(object);3182 exit(EXIT_FAILURE);3183 }3184 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {3185 psFree(object);3186 exit(EXIT_FAILURE);3187 }3188 3189 psFree(object);3190 }3191 3192 {3193 psMetadata *md;3194 p6SumScfileRow *object;3195 3196 md = psMetadataAlloc();3197 if (!psMetadataAddS32(md, PS_LIST_TAIL, "p6_id", 0, NULL, -32)) {3198 psFree(md);3199 exit(EXIT_FAILURE);3200 }3201 if (!psMetadataAddStr(md, PS_LIST_TAIL, "skycell_id", 0, NULL, "a string")) {3202 psFree(md);3203 exit(EXIT_FAILURE);3204 }3205 if (!psMetadataAddStr(md, PS_LIST_TAIL, "tess_id", 0, NULL, "a string")) {3206 psFree(md);3207 exit(EXIT_FAILURE);3208 }3209 if (!psMetadataAddStr(md, PS_LIST_TAIL, "uri", 0, NULL, "a string")) {3210 psFree(md);3211 exit(EXIT_FAILURE);3212 }3213 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg", 0, NULL, 64.64)) {3214 psFree(md);3215 exit(EXIT_FAILURE);3216 }3217 if (!psMetadataAddF64(md, PS_LIST_TAIL, "bg_mean_stdev", 0, NULL, 64.64)) {3218 psFree(md);3219 exit(EXIT_FAILURE);3220 }3221 3222 object = p6SumScfileObjectFromMetadata(md);3223 if (!object) {3224 psFree(md);3225 exit(EXIT_FAILURE);3226 }3227 3228 psFree(md);3229 3230 if (!object->p6_id == -32) {3231 psFree(object);3232 exit(EXIT_FAILURE);3233 }3234 if (strncmp(object->skycell_id, "a string", MAX_STRING_LENGTH)) {3235 psFree(object);3236 exit(EXIT_FAILURE);3237 }3238 if (strncmp(object->tess_id, "a string", MAX_STRING_LENGTH)) {3239 3207 psFree(object); 3240 3208 exit(EXIT_FAILURE); -
trunk/ippdb/tests/selectrowsfits.c
r11867 r11988 769 769 } 770 770 771 if (!p4S cfileSelectRowsFits(dbh, fits, NULL, 1)) {771 if (!p4SkyfileSelectRowsFits(dbh, fits, NULL, 1)) { 772 772 exit(EXIT_FAILURE); 773 773 } … … 813 813 } 814 814 815 if (!p5InputS cfileSelectRowsFits(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 (!p5DiffS cfileSelectRowsFits(dbh, fits, NULL, 1)) {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 838 exit(EXIT_FAILURE); 839 839 } … … 879 879 } 880 880 881 if (!p6InputS cfileSelectRowsFits(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 (!p6SumS cfileSelectRowsFits(dbh, fits, NULL, 1)) {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)) { 904 904 exit(EXIT_FAILURE); 905 905 }
Note:
See TracChangeset
for help on using the changeset viewer.
