Changeset 14252
- Timestamp:
- Jul 16, 2007, 5:10:27 PM (19 years ago)
- Location:
- trunk/ippdb
- Files:
-
- 8 edited
-
configure.ac (modified) (1 diff)
-
src/ippdb.c (modified) (12 diffs)
-
src/ippdb.h (modified) (3 diffs)
-
tests/alloc.c (modified) (3 diffs)
-
tests/insert.c (modified) (1 diff)
-
tests/insertobject.c (modified) (1 diff)
-
tests/metadatafromobject.c (modified) (3 diffs)
-
tests/objectfrommetadata.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/configure.ac
r14232 r14252 7 7 AC_PREREQ(2.61) 8 8 9 AC_INIT([ippdb], [1.1.2 5], [pan-starrs.ifa.hawaii.edu])9 AC_INIT([ippdb], [1.1.26], [pan-starrs.ifa.hawaii.edu]) 10 10 AC_CONFIG_SRCDIR([ippdb.pc.in]) 11 11 -
trunk/ippdb/src/ippdb.c
r14232 r14252 10135 10135 static void diffInputSkyfileRowFree(diffInputSkyfileRow *object); 10136 10136 10137 diffInputSkyfileRow *diffInputSkyfileRowAlloc(psS64 diff_id, psS64 warp_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)10137 diffInputSkyfileRow *diffInputSkyfileRowAlloc(psS64 diff_id, bool template, psS64 stack_id, psS64 warp_id, const char *skycell_id, const char *tess_id, const char *kind) 10138 10138 { 10139 10139 diffInputSkyfileRow *_object; … … 10143 10143 10144 10144 _object->diff_id = diff_id; 10145 _object->template = template; 10146 _object->stack_id = stack_id; 10145 10147 _object->warp_id = warp_id; 10146 10148 _object->skycell_id = psStringCopy(skycell_id); 10147 10149 _object->tess_id = psStringCopy(tess_id); 10148 10150 _object->kind = psStringCopy(kind); 10149 _object->template = template;10150 10151 10151 10152 return _object; … … 10167 10168 return false; 10168 10169 } 10169 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S64, "Primary Key fkey(warp_id, skycell_id, tess_id) ref warpSkyfile(warp_id, skycell_id, tess_id)", 0)) { 10170 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, "Primary Key", 0)) { 10171 psError(PS_ERR_UNKNOWN, false, "failed to add item template"); 10172 psFree(md); 10173 return false; 10174 } 10175 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S64, "fkey(stack_id) ref stackSumSkyfile(stack_id)", 0)) { 10176 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 10177 psFree(md); 10178 return false; 10179 } 10180 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S64, "fkey(warp_id, skycell_id, tess_id) ref warpSkyfile(warp_id, skycell_id, tess_id)", 0)) { 10170 10181 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); 10171 10182 psFree(md); 10172 10183 return false; 10173 10184 } 10174 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, " PrimaryKey", "64")) {10185 if (!psMetadataAdd(md, PS_LIST_TAIL, "skycell_id", PS_DATA_STRING, "Key", "64")) { 10175 10186 psError(PS_ERR_UNKNOWN, false, "failed to add item skycell_id"); 10176 10187 psFree(md); 10177 10188 return false; 10178 10189 } 10179 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, " PrimaryKey", "64")) {10190 if (!psMetadataAdd(md, PS_LIST_TAIL, "tess_id", PS_DATA_STRING, "Key", "64")) { 10180 10191 psError(PS_ERR_UNKNOWN, false, "failed to add item tess_id"); 10181 10192 psFree(md); … … 10187 10198 return false; 10188 10199 } 10189 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, 0)) {10190 psError(PS_ERR_UNKNOWN, false, "failed to add item template");10191 psFree(md);10192 return false;10193 }10194 10200 10195 10201 bool status = psDBCreateTable(dbh, DIFFINPUTSKYFILE_TABLE_NAME, md); … … 10205 10211 } 10206 10212 10207 bool diffInputSkyfileInsert(psDB * dbh, psS64 diff_id, psS64 warp_id, const char *skycell_id, const char *tess_id, const char *kind, bool template)10213 bool diffInputSkyfileInsert(psDB * dbh, psS64 diff_id, bool template, psS64 stack_id, psS64 warp_id, const char *skycell_id, const char *tess_id, const char *kind) 10208 10214 { 10209 10215 psMetadata *md = psMetadataAlloc(); … … 10213 10219 return false; 10214 10220 } 10221 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, template)) { 10222 psError(PS_ERR_UNKNOWN, false, "failed to add item template"); 10223 psFree(md); 10224 return false; 10225 } 10226 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S64, NULL, stack_id)) { 10227 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 10228 psFree(md); 10229 return false; 10230 } 10215 10231 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S64, NULL, warp_id)) { 10216 10232 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); … … 10230 10246 if (!psMetadataAdd(md, PS_LIST_TAIL, "kind", PS_DATA_STRING, NULL, kind)) { 10231 10247 psError(PS_ERR_UNKNOWN, false, "failed to add item kind"); 10232 psFree(md);10233 return false;10234 }10235 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, template)) {10236 psError(PS_ERR_UNKNOWN, false, "failed to add item template");10237 10248 psFree(md); 10238 10249 return false; … … 10261 10272 bool diffInputSkyfileInsertObject(psDB *dbh, diffInputSkyfileRow *object) 10262 10273 { 10263 return diffInputSkyfileInsert(dbh, object->diff_id, object-> warp_id, object->skycell_id, object->tess_id, object->kind, object->template);10274 return diffInputSkyfileInsert(dbh, object->diff_id, object->template, object->stack_id, object->warp_id, object->skycell_id, object->tess_id, object->kind); 10264 10275 } 10265 10276 … … 10339 10350 return false; 10340 10351 } 10352 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, object->template)) { 10353 psError(PS_ERR_UNKNOWN, false, "failed to add item template"); 10354 psFree(md); 10355 return false; 10356 } 10357 if (!psMetadataAdd(md, PS_LIST_TAIL, "stack_id", PS_DATA_S64, NULL, object->stack_id)) { 10358 psError(PS_ERR_UNKNOWN, false, "failed to add item stack_id"); 10359 psFree(md); 10360 return false; 10361 } 10341 10362 if (!psMetadataAdd(md, PS_LIST_TAIL, "warp_id", PS_DATA_S64, NULL, object->warp_id)) { 10342 10363 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id"); … … 10359 10380 return false; 10360 10381 } 10361 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, object->template)) {10362 psError(PS_ERR_UNKNOWN, false, "failed to add item template");10363 psFree(md);10364 return false;10365 }10366 10382 10367 10383 … … 10378 10394 return false; 10379 10395 } 10396 bool template = psMetadataLookupBool(&status, md, "template"); 10397 if (!status) { 10398 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item template"); 10399 return false; 10400 } 10401 psS64 stack_id = psMetadataLookupS64(&status, md, "stack_id"); 10402 if (!status) { 10403 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item stack_id"); 10404 return false; 10405 } 10380 10406 psS64 warp_id = psMetadataLookupS64(&status, md, "warp_id"); 10381 10407 if (!status) { … … 10398 10424 return false; 10399 10425 } 10400 bool template = psMetadataLookupBool(&status, md, "template"); 10401 if (!status) { 10402 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item template"); 10403 return false; 10404 } 10405 10406 return diffInputSkyfileRowAlloc(diff_id, warp_id, skycell_id, tess_id, kind, template); 10426 10427 return diffInputSkyfileRowAlloc(diff_id, template, stack_id, warp_id, skycell_id, tess_id, kind); 10407 10428 } 10408 10429 psArray *diffInputSkyfileSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) -
trunk/ippdb/src/ippdb.h
r14169 r14252 4962 4962 typedef struct { 4963 4963 psS64 diff_id; 4964 bool template; 4965 psS64 stack_id; 4964 4966 psS64 warp_id; 4965 4967 char *skycell_id; 4966 4968 char *tess_id; 4967 4969 char *kind; 4968 bool template;4969 4970 } diffInputSkyfileRow; 4970 4971 … … 4976 4977 diffInputSkyfileRow *diffInputSkyfileRowAlloc( 4977 4978 psS64 diff_id, 4979 bool template, 4980 psS64 stack_id, 4978 4981 psS64 warp_id, 4979 4982 const char *skycell_id, 4980 4983 const char *tess_id, 4981 const char *kind, 4982 bool template 4984 const char *kind 4983 4985 ); 4984 4986 … … 5011 5013 psDB *dbh, ///< Database handle 5012 5014 psS64 diff_id, 5015 bool template, 5016 psS64 stack_id, 5013 5017 psS64 warp_id, 5014 5018 const char *skycell_id, 5015 5019 const char *tess_id, 5016 const char *kind, 5017 bool template 5020 const char *kind 5018 5021 ); 5019 5022 -
trunk/ippdb/tests/alloc.c
r14169 r14252 1100 1100 diffInputSkyfileRow *object; 1101 1101 1102 object = diffInputSkyfileRowAlloc(-64, -64, "a string", "a string", "a string", true);1102 object = diffInputSkyfileRowAlloc(-64, true, -64, -64, "a string", "a string", "a string" ); 1103 1103 1104 1104 if (!object) { … … 1110 1110 exit(EXIT_FAILURE); 1111 1111 } 1112 if (!object->template == true) { 1113 psFree(object); 1114 exit(EXIT_FAILURE); 1115 } 1116 if (!object->stack_id == -64) { 1117 psFree(object); 1118 exit(EXIT_FAILURE); 1119 } 1112 1120 if (!object->warp_id == -64) { 1113 1121 psFree(object); … … 1123 1131 } 1124 1132 if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) { 1125 psFree(object);1126 exit(EXIT_FAILURE);1127 }1128 if (!object->template == true) {1129 1133 psFree(object); 1130 1134 exit(EXIT_FAILURE); -
trunk/ippdb/tests/insert.c
r14169 r14252 343 343 } 344 344 345 if (!diffInputSkyfileInsert(dbh, -64, -64, "a string", "a string", "a string", true)) {345 if (!diffInputSkyfileInsert(dbh, -64, true, -64, -64, "a string", "a string", "a string")) { 346 346 exit(EXIT_FAILURE); 347 347 } -
trunk/ippdb/tests/insertobject.c
r14169 r14252 498 498 } 499 499 500 object = diffInputSkyfileRowAlloc(-64, -64, "a string", "a string", "a string", true);500 object = diffInputSkyfileRowAlloc(-64, true, -64, -64, "a string", "a string", "a string"); 501 501 if (!object) { 502 502 exit(EXIT_FAILURE); -
trunk/ippdb/tests/metadatafromobject.c
r14169 r14252 1249 1249 bool status; 1250 1250 1251 object = diffInputSkyfileRowAlloc(-64, -64, "a string", "a string", "a string", true);1251 object = diffInputSkyfileRowAlloc(-64, true, -64, -64, "a string", "a string", "a string"); 1252 1252 if (!object) { 1253 1253 exit(EXIT_FAILURE); … … 1264 1264 exit(EXIT_FAILURE); 1265 1265 } 1266 if (!psMetadataLookupBool(&status, md, "template") == true) { 1267 psFree(md); 1268 exit(EXIT_FAILURE); 1269 } 1270 psFree(md); 1271 exit(EXIT_FAILURE); 1272 } 1266 1273 psFree(md); 1267 1274 exit(EXIT_FAILURE); … … 1276 1283 } 1277 1284 if (strncmp(psMetadataLookupPtr(&status, md, "kind"), "a string", MAX_STRING_LENGTH)) { 1278 psFree(md);1279 exit(EXIT_FAILURE);1280 }1281 if (!psMetadataLookupBool(&status, md, "template") == true) {1282 1285 psFree(md); 1283 1286 exit(EXIT_FAILURE); -
trunk/ippdb/tests/objectfrommetadata.c
r14169 r14252 1960 1960 exit(EXIT_FAILURE); 1961 1961 } 1962 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, true)) { 1963 psFree(md); 1964 exit(EXIT_FAILURE); 1965 } 1966 psFree(md); 1967 exit(EXIT_FAILURE); 1968 } 1962 1969 psFree(md); 1963 1970 exit(EXIT_FAILURE); … … 1975 1982 exit(EXIT_FAILURE); 1976 1983 } 1977 if (!psMetadataAdd(md, PS_LIST_TAIL, "template", PS_DATA_BOOL, NULL, true)) {1978 psFree(md);1979 exit(EXIT_FAILURE);1980 }1981 1984 1982 1985 object = diffInputSkyfileObjectFromMetadata(md); … … 1991 1994 exit(EXIT_FAILURE); 1992 1995 } 1996 if (!object->template == true) { 1997 psFree(object); 1998 exit(EXIT_FAILURE); 1999 } 2000 psFree(object); 2001 exit(EXIT_FAILURE); 2002 } 1993 2003 psFree(object); 1994 2004 exit(EXIT_FAILURE); … … 2003 2013 } 2004 2014 if (strncmp(object->kind, "a string", MAX_STRING_LENGTH)) { 2005 psFree(object);2006 exit(EXIT_FAILURE);2007 }2008 if (!object->template == true) {2009 2015 psFree(object); 2010 2016 exit(EXIT_FAILURE);
Note:
See TracChangeset
for help on using the changeset viewer.
