Changeset 9173 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Oct 3, 2006, 4:59:05 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r9149 r9173 12770 12770 static void detRunRowFree(detRunRow *object); 12771 12771 12772 detRunRow *detRunRowAlloc(psS32 iteration, const char *det_type )12772 detRunRow *detRunRowAlloc(psS32 iteration, const char *det_type, const char *state) 12773 12773 { 12774 12774 detRunRow *object; … … 12779 12779 object->iteration = iteration; 12780 12780 object->det_type = psStringCopy(det_type); 12781 object->state = psStringCopy(state); 12781 12782 12782 12783 return object; … … 12786 12787 { 12787 12788 psFree(object->det_type); 12789 psFree(object->state); 12788 12790 } 12789 12791 … … 12809 12811 return false; 12810 12812 } 12813 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, "Key", "64")) { 12814 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 12815 psFree(md); 12816 return false; 12817 } 12811 12818 12812 12819 status = psDBCreateTable(dbh, DETRUN_TABLE_NAME, md); … … 12822 12829 } 12823 12830 12824 bool detRunInsert(psDB * dbh, psS32 iteration, const char *det_type )12831 bool detRunInsert(psDB * dbh, psS32 iteration, const char *det_type, const char *state) 12825 12832 { 12826 12833 psMetadata *md; … … 12835 12842 if (!psMetadataAddStr(md, PS_LIST_TAIL, "det_type", 0, NULL, det_type)) { 12836 12843 psError(PS_ERR_UNKNOWN, false, "failed to add item det_type"); 12844 psFree(md); 12845 return false; 12846 } 12847 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, state)) { 12848 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 12837 12849 psFree(md); 12838 12850 return false; … … 12859 12871 return deleted; 12860 12872 } 12861 bool detRunPop(psDB *dbh, psS32 *iteration, char **det_type )12873 bool detRunPop(psDB *dbh, psS32 *iteration, char **det_type, char **state) 12862 12874 { 12863 12875 psArray *rowSet; … … 12915 12927 return false; 12916 12928 } 12929 *state = psMetadataLookupPtr(&status, row, "state"); 12930 if (!status) { 12931 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state"); 12932 psFree(row); 12933 return false; 12934 } 12917 12935 12918 12936 psFree(row); … … 12923 12941 bool detRunInsertObject(psDB *dbh, detRunRow *object) 12924 12942 { 12925 return detRunInsert(dbh, object->iteration, object->det_type );12943 return detRunInsert(dbh, object->iteration, object->det_type, object->state); 12926 12944 } 12927 12945 … … 12941 12959 psS32 iteration; 12942 12960 char det_type[256]; 12943 12944 if (!detRunPop(dbh, &iteration, (char **)&det_type)) { 12961 char state[256]; 12962 12963 if (!detRunPop(dbh, &iteration, (char **)&det_type, (char **)&state)) { 12945 12964 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 12946 12965 return NULL; 12947 12966 } 12948 12967 12949 return detRunRowAlloc(iteration, det_type );12968 return detRunRowAlloc(iteration, det_type, state); 12950 12969 } 12951 12970 … … 13056 13075 return NULL; 13057 13076 } 13077 if (!psMetadataAddStr(md, PS_LIST_TAIL, "state", 0, NULL, object->state)) { 13078 psError(PS_ERR_UNKNOWN, false, "failed to add item state"); 13079 psFree(md); 13080 return NULL; 13081 } 13058 13082 13059 13083 return md; … … 13065 13089 psS32 iteration; 13066 13090 char *det_type; 13091 char *state; 13067 13092 13068 13093 iteration = psMetadataLookupS32(&status, md, "iteration"); … … 13076 13101 return false; 13077 13102 } 13078 13079 return detRunRowAlloc(iteration, det_type); 13103 state = psMetadataLookupPtr(&status, md, "state"); 13104 if (!status) { 13105 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item state"); 13106 return false; 13107 } 13108 13109 return detRunRowAlloc(iteration, det_type, state); 13080 13110 } 13081 13111 psArray *detRunSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
