Changeset 7424 for trunk/ippTools/src/dettool.c
- Timestamp:
- Jun 7, 2006, 6:44:56 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/dettool.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/dettool.c
r7423 r7424 101 101 return false; 102 102 } 103 104 // grab the 'position' column's value as the new det_id 103 105 detRunInsert(config->dbh, det_type); 104 106 long det_id = psDBLastInsertID(config->dbh); … … 106 108 // we have to support multipe exp_ids 107 109 psMetadataItem *item = psMetadataLookup(config->args, "-exp_id"); 110 if (!item) { 111 // this shouldn't actually happen when using psArgs 112 psError(PS_ERR_UNKNOWN, true, "-exp_id is required"); 113 return false; 114 } 108 115 psMetadata *where = psMetadataAlloc(); 109 116 … … 115 122 while ((mItem = psListGetAndIncrement(iter))) { 116 123 psString exp_id = mItem->data.V; 117 // if exp_id is NULL then it means that -exp_id has not specified 124 // if exp_id is NULL then it means that -exp_id has not been 125 // specified 118 126 if (!exp_id) { 119 127 psError(PS_ERR_UNKNOWN, true, … … 139 147 } 140 148 } 149 psFree(iter); 141 150 } else { 142 151 // rollback … … 1792 1801 } 1793 1802 1794 return true; 1795 } 1803 // we have to support multipe exp_ids 1804 psMetadataItem *item = psMetadataLookup(config->args, "-exp_id"); 1805 if (!item) { 1806 // this shouldn't actually happen when using psArgs 1807 psError(PS_ERR_UNKNOWN, true, "-exp_id is required"); 1808 return false; 1809 } 1810 psMetadata *where = psMetadataAlloc(); 1811 1812 // make sure that -exp_id was parsed correctly 1813 // XXX this can be removed someday 1814 if (item->type == PS_DATA_METADATA_MULTI) { 1815 psListIterator *iter = psListIteratorAlloc(item->data.list, 0, false); 1816 psMetadataItem *mItem = NULL; 1817 while ((mItem = psListGetAndIncrement(iter))) { 1818 psString exp_id = mItem->data.V; 1819 // if exp_id is NULL then it means that -exp_id has not been 1820 // specified 1821 if (!exp_id) { 1822 psError(PS_ERR_UNKNOWN, true, 1823 "at least one -exp_id is required"); 1824 psFree(where); 1825 return false; 1826 } 1827 1828 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 1829 PS_META_DUPLICATE_OK, "==", exp_id)) { 1830 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 1831 psFree(iter); 1832 psFree(where); 1833 return false; 1834 } 1835 } 1836 psFree(iter); 1837 } else { 1838 psAbort(config->argv[0], 1839 "-exp_id was not parsed correctly (this should not happen"); 1840 } 1841 1842 if (where->list->n < 1) { 1843 psFree(where); 1844 where = NULL; 1845 } 1846 1847 // check that the specified exp_ids actually exist in the iteration zero 1848 // detInputExp set 1849 1850 // add the det_id & iteration == 0 to the where claus 1851 if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", 1852 (psS32)atol(det_id))) { 1853 psError(PS_ERR_UNKNOWN, false, "failed to add item det_id"); 1854 psFree(where); 1855 return false; 1856 } 1857 if (!psMetadataAddS32(where, PS_LIST_TAIL, "iteration", 0, "==", 0)) { 1858 psError(PS_ERR_UNKNOWN, false, "failed to add item iteration"); 1859 psFree(where); 1860 return false; 1861 } 1862 1863 psArray *detrendExps = detInputExpSelectRowObjects(config->dbh, where, 0); 1864 psFree(where); 1865 if (!detrendExps) { 1866 psError(PS_ERR_UNKNOWN, false, "no rawDetrendExp rows found"); 1867 return false; 1868 } 1869 1870 return true; 1871 }
Note:
See TracChangeset
for help on using the changeset viewer.
