Changeset 14252 for trunk/ippdb/src
- Timestamp:
- Jul 16, 2007, 5:10:27 PM (19 years ago)
- Location:
- trunk/ippdb/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.
