Changeset 7500 for branches/jhoblitt/ippdb/src/ippdb.c
- Timestamp:
- Jun 9, 2006, 6:22:07 PM (20 years ago)
- File:
-
- 1 edited
-
branches/jhoblitt/ippdb/src/ippdb.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/jhoblitt/ippdb/src/ippdb.c
r7460 r7500 10529 10529 static void detRunRowFree(detRunRow *object); 10530 10530 10531 detRunRow *detRunRowAlloc(const char *det_type )10531 detRunRow *detRunRowAlloc(const char *det_type, psS32 iteration) 10532 10532 { 10533 10533 detRunRow *object; … … 10537 10537 10538 10538 object->det_type = psStringCopy(det_type); 10539 object->iteration = iteration; 10539 10540 10540 10541 return object; … … 10562 10563 return false; 10563 10564 } 10565 if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, 0)) { 10566 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration"); 10567 psFree(md); 10568 return false; 10569 } 10564 10570 10565 10571 status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md); … … 10575 10581 } 10576 10582 10577 bool detRunInsert(psDB * dbh, const char *det_type )10583 bool detRunInsert(psDB * dbh, const char *det_type, psS32 iteration) 10578 10584 { 10579 10585 psMetadata *md; … … 10586 10592 return false; 10587 10593 } 10594 if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, iteration)) { 10595 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration"); 10596 psFree(md); 10597 return false; 10598 } 10588 10599 10589 10600 status = psDBInsertOneRow(dbh, DETRUN_TABLE_NAME, md); … … 10593 10604 } 10594 10605 10595 bool detRunPop(psDB *dbh, char **det_type )10606 bool detRunPop(psDB *dbh, char **det_type, psS32 *iteration) 10596 10607 { 10597 10608 psArray *rowSet; … … 10643 10654 return false; 10644 10655 } 10656 *iteration = psMetadataLookupS32(&status, row, "iteration"); 10657 if (!status) { 10658 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item iteration"); 10659 psFree(row); 10660 return false; 10661 } 10645 10662 10646 10663 psFree(row); … … 10651 10668 bool detRunInsertObject(psDB *dbh, detRunRow *object) 10652 10669 { 10653 return detRunInsert(dbh, object->det_type );10670 return detRunInsert(dbh, object->det_type, object->iteration); 10654 10671 } 10655 10672 … … 10657 10674 { 10658 10675 char det_type[256]; 10659 10660 if (!detRunPop(dbh, (char **)&det_type)) { 10676 psS32 iteration; 10677 10678 if (!detRunPop(dbh, (char **)&det_type, &iteration)) { 10661 10679 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 10662 10680 return NULL; 10663 10681 } 10664 10682 10665 return detRunRowAlloc(det_type );10683 return detRunRowAlloc(det_type, iteration); 10666 10684 } 10667 10685 … … 10767 10785 return NULL; 10768 10786 } 10787 if (!psMetadataAddS32(md, PS_LIST_TAIL, "iteration", 0, NULL, object->iteration)) { 10788 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration"); 10789 psFree(md); 10790 return NULL; 10791 } 10769 10792 10770 10793 return md; … … 10775 10798 bool status; 10776 10799 char *det_type; 10800 psS32 iteration; 10777 10801 10778 10802 det_type = psMetadataLookupPtr(&status, md, "det_type"); … … 10781 10805 return false; 10782 10806 } 10783 10784 return detRunRowAlloc(det_type); 10807 iteration = psMetadataLookupS32(&status, md, "iteration"); 10808 if (!status) { 10809 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item iteration"); 10810 return false; 10811 } 10812 10813 return detRunRowAlloc(det_type, iteration); 10785 10814 } 10786 10815 psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
