Changeset 15582 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Nov 9, 2007, 5:56:56 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r15576 r15582 23065 23065 static void flatcorrExpRowFree(flatcorrExpRow *object); 23066 23066 23067 flatcorrExpRow *flatcorrExpRowAlloc(psS64 corr_id, psS64 chip_id , const char *state)23067 flatcorrExpRow *flatcorrExpRowAlloc(psS64 corr_id, psS64 chip_id) 23068 23068 { 23069 23069 flatcorrExpRow *_object; … … 23074 23074 _object->corr_id = corr_id; 23075 23075 _object->chip_id = chip_id; 23076 _object->state = psStringCopy(state);23077 23076 23078 23077 return _object; … … 23081 23080 static void flatcorrExpRowFree(flatcorrExpRow *object) 23082 23081 { 23083 psFree(object->state);23084 23082 } 23085 23083 … … 23087 23085 { 23088 23086 psMetadata *md = psMetadataAlloc(); 23089 if (!psMetadataAdd(md, PS_LIST_TAIL, "corr_id", PS_DATA_S64, "Primary Key ", 0)) {23087 if (!psMetadataAdd(md, PS_LIST_TAIL, "corr_id", PS_DATA_S64, "Primary Key fkey(corr_id) ref flatcorrRun(corr_id)", 0)) { 23090 23088 psError(PS_ERR_UNKNOWN, false, "failed to add item corr_id"); 23091 23089 psFree(md); 23092 23090 return false; 23093 23091 } 23094 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_id", PS_DATA_S64, "Primary Key ", 64)) {23092 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_id", PS_DATA_S64, "Primary Key fkey(chip_id) ref chipRun(chip_id)", 64)) { 23095 23093 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 23096 23094 psFree(md); 23097 23095 return false; 23098 23096 } 23099 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, "fkey(corr_id) ref flatcorrRun(corr_id)", "64")) {23100 psError(PS_ERR_UNKNOWN, false, "failed to add item state");23101 psFree(md);23102 return false;23103 }23104 23097 23105 23098 bool status = psDBCreateTable(dbh, FLATCORREXP_TABLE_NAME, md); … … 23115 23108 } 23116 23109 23117 bool flatcorrExpInsert(psDB * dbh, psS64 corr_id, psS64 chip_id , const char *state)23110 bool flatcorrExpInsert(psDB * dbh, psS64 corr_id, psS64 chip_id) 23118 23111 { 23119 23112 psMetadata *md = psMetadataAlloc(); … … 23125 23118 if (!psMetadataAdd(md, PS_LIST_TAIL, "chip_id", PS_DATA_S64, NULL, chip_id)) { 23126 23119 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 23127 psFree(md);23128 return false;23129 }23130 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, state)) {23131 psError(PS_ERR_UNKNOWN, false, "failed to add item state");23132 23120 psFree(md); 23133 23121 return false; … … 23156 23144 bool flatcorrExpInsertObject(psDB *dbh, flatcorrExpRow *object) 23157 23145 { 23158 return flatcorrExpInsert(dbh, object->corr_id, object->chip_id , object->state);23146 return flatcorrExpInsert(dbh, object->corr_id, object->chip_id); 23159 23147 } 23160 23148 … … 23239 23227 return false; 23240 23228 } 23241 if (!psMetadataAdd(md, PS_LIST_TAIL, "state", PS_DATA_STRING, NULL, object->state)) {23242 psError(PS_ERR_UNKNOWN, false, "failed to add item state");23243 psFree(md);23244 return false;23245 }23246 23229 23247 23230 … … 23263 23246 return false; 23264 23247 } 23265 char* state = psMetadataLookupPtr(&status, md, "state"); 23266 if (!status) { 23267 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state"); 23268 return false; 23269 } 23270 23271 return flatcorrExpRowAlloc(corr_id, chip_id, state); 23248 23249 return flatcorrExpRowAlloc(corr_id, chip_id); 23272 23250 } 23273 23251 psArray *flatcorrExpSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
