Changeset 8266 for trunk/ippdb/src/ippdb.c
- Timestamp:
- Aug 9, 2006, 7:18:19 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippdb/src/ippdb.c (modified) (44 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippdb/src/ippdb.c
r8228 r8266 718 718 return returnSet; 719 719 } 720 bool weatherDeleteObject(psDB *dbh, const weatherRow *object) 721 { 722 psMetadata *where = weatherMetadataFromObject(object); 723 long long count = psDBDeleteRows(dbh, WEATHER_TABLE_NAME, where, 0); 724 psFree(where) 725 if (count < 0) { 726 psError(PS_ERR_UNKNOWN, true, "failed to delete row from weather"); 727 return false; 728 } 729 if (count > 1) { 730 // XXX should this be a psAbort() instead? It is possible that 731 // having an object match multiple rows was by design. 732 psError(PS_ERR_UNKNOWN, true, "weatherRow object matched more then one row. Check your database schema"); 733 return false; 734 } 735 736 return true; 737 } 720 738 long long weatherDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 721 739 { … … 1248 1266 return returnSet; 1249 1267 } 1268 bool skyp_transparencyDeleteObject(psDB *dbh, const skyp_transparencyRow *object) 1269 { 1270 psMetadata *where = skyp_transparencyMetadataFromObject(object); 1271 long long count = psDBDeleteRows(dbh, SKYP_TRANSPARENCY_TABLE_NAME, where, 0); 1272 psFree(where) 1273 if (count < 0) { 1274 psError(PS_ERR_UNKNOWN, true, "failed to delete row from skyp_transparency"); 1275 return false; 1276 } 1277 if (count > 1) { 1278 // XXX should this be a psAbort() instead? It is possible that 1279 // having an object match multiple rows was by design. 1280 psError(PS_ERR_UNKNOWN, true, "skyp_transparencyRow object matched more then one row. Check your database schema"); 1281 return false; 1282 } 1283 1284 return true; 1285 } 1250 1286 long long skyp_transparencyDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 1251 1287 { … … 1836 1872 return returnSet; 1837 1873 } 1874 bool skyp_absorptionDeleteObject(psDB *dbh, const skyp_absorptionRow *object) 1875 { 1876 psMetadata *where = skyp_absorptionMetadataFromObject(object); 1877 long long count = psDBDeleteRows(dbh, SKYP_ABSORPTION_TABLE_NAME, where, 0); 1878 psFree(where) 1879 if (count < 0) { 1880 psError(PS_ERR_UNKNOWN, true, "failed to delete row from skyp_absorption"); 1881 return false; 1882 } 1883 if (count > 1) { 1884 // XXX should this be a psAbort() instead? It is possible that 1885 // having an object match multiple rows was by design. 1886 psError(PS_ERR_UNKNOWN, true, "skyp_absorptionRow object matched more then one row. Check your database schema"); 1887 return false; 1888 } 1889 1890 return true; 1891 } 1838 1892 long long skyp_absorptionDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 1839 1893 { … … 2337 2391 return returnSet; 2338 2392 } 2393 bool skyp_emissionDeleteObject(psDB *dbh, const skyp_emissionRow *object) 2394 { 2395 psMetadata *where = skyp_emissionMetadataFromObject(object); 2396 long long count = psDBDeleteRows(dbh, SKYP_EMISSION_TABLE_NAME, where, 0); 2397 psFree(where) 2398 if (count < 0) { 2399 psError(PS_ERR_UNKNOWN, true, "failed to delete row from skyp_emission"); 2400 return false; 2401 } 2402 if (count > 1) { 2403 // XXX should this be a psAbort() instead? It is possible that 2404 // having an object match multiple rows was by design. 2405 psError(PS_ERR_UNKNOWN, true, "skyp_emissionRow object matched more then one row. Check your database schema"); 2406 return false; 2407 } 2408 2409 return true; 2410 } 2339 2411 long long skyp_emissionDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 2340 2412 { … … 2867 2939 return returnSet; 2868 2940 } 2941 bool dimmDeleteObject(psDB *dbh, const dimmRow *object) 2942 { 2943 psMetadata *where = dimmMetadataFromObject(object); 2944 long long count = psDBDeleteRows(dbh, DIMM_TABLE_NAME, where, 0); 2945 psFree(where) 2946 if (count < 0) { 2947 psError(PS_ERR_UNKNOWN, true, "failed to delete row from dimm"); 2948 return false; 2949 } 2950 if (count > 1) { 2951 // XXX should this be a psAbort() instead? It is possible that 2952 // having an object match multiple rows was by design. 2953 psError(PS_ERR_UNKNOWN, true, "dimmRow object matched more then one row. Check your database schema"); 2954 return false; 2955 } 2956 2957 return true; 2958 } 2869 2959 long long dimmDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 2870 2960 { … … 3367 3457 return returnSet; 3368 3458 } 3459 bool skyp_irDeleteObject(psDB *dbh, const skyp_irRow *object) 3460 { 3461 psMetadata *where = skyp_irMetadataFromObject(object); 3462 long long count = psDBDeleteRows(dbh, SKYP_IR_TABLE_NAME, where, 0); 3463 psFree(where) 3464 if (count < 0) { 3465 psError(PS_ERR_UNKNOWN, true, "failed to delete row from skyp_ir"); 3466 return false; 3467 } 3468 if (count > 1) { 3469 // XXX should this be a psAbort() instead? It is possible that 3470 // having an object match multiple rows was by design. 3471 psError(PS_ERR_UNKNOWN, true, "skyp_irRow object matched more then one row. Check your database schema"); 3472 return false; 3473 } 3474 3475 return true; 3476 } 3369 3477 long long skyp_irDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 3370 3478 { … … 3809 3917 return returnSet; 3810 3918 } 3919 bool domeDeleteObject(psDB *dbh, const domeRow *object) 3920 { 3921 psMetadata *where = domeMetadataFromObject(object); 3922 long long count = psDBDeleteRows(dbh, DOME_TABLE_NAME, where, 0); 3923 psFree(where) 3924 if (count < 0) { 3925 psError(PS_ERR_UNKNOWN, true, "failed to delete row from dome"); 3926 return false; 3927 } 3928 if (count > 1) { 3929 // XXX should this be a psAbort() instead? It is possible that 3930 // having an object match multiple rows was by design. 3931 psError(PS_ERR_UNKNOWN, true, "domeRow object matched more then one row. Check your database schema"); 3932 return false; 3933 } 3934 3935 return true; 3936 } 3811 3937 long long domeDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 3812 3938 { … … 4281 4407 return returnSet; 4282 4408 } 4409 bool telescopeDeleteObject(psDB *dbh, const telescopeRow *object) 4410 { 4411 psMetadata *where = telescopeMetadataFromObject(object); 4412 long long count = psDBDeleteRows(dbh, TELESCOPE_TABLE_NAME, where, 0); 4413 psFree(where) 4414 if (count < 0) { 4415 psError(PS_ERR_UNKNOWN, true, "failed to delete row from telescope"); 4416 return false; 4417 } 4418 if (count > 1) { 4419 // XXX should this be a psAbort() instead? It is possible that 4420 // having an object match multiple rows was by design. 4421 psError(PS_ERR_UNKNOWN, true, "telescopeRow object matched more then one row. Check your database schema"); 4422 return false; 4423 } 4424 4425 return true; 4426 } 4283 4427 long long telescopeDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 4284 4428 { … … 4757 4901 return returnSet; 4758 4902 } 4903 bool summitExpDeleteObject(psDB *dbh, const summitExpRow *object) 4904 { 4905 psMetadata *where = summitExpMetadataFromObject(object); 4906 long long count = psDBDeleteRows(dbh, SUMMITEXP_TABLE_NAME, where, 0); 4907 psFree(where) 4908 if (count < 0) { 4909 psError(PS_ERR_UNKNOWN, true, "failed to delete row from summitExp"); 4910 return false; 4911 } 4912 if (count > 1) { 4913 // XXX should this be a psAbort() instead? It is possible that 4914 // having an object match multiple rows was by design. 4915 psError(PS_ERR_UNKNOWN, true, "summitExpRow object matched more then one row. Check your database schema"); 4916 return false; 4917 } 4918 4919 return true; 4920 } 4759 4921 long long summitExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 4760 4922 { … … 5232 5394 return returnSet; 5233 5395 } 5396 bool pzPendingExpDeleteObject(psDB *dbh, const pzPendingExpRow *object) 5397 { 5398 psMetadata *where = pzPendingExpMetadataFromObject(object); 5399 long long count = psDBDeleteRows(dbh, PZPENDINGEXP_TABLE_NAME, where, 0); 5400 psFree(where) 5401 if (count < 0) { 5402 psError(PS_ERR_UNKNOWN, true, "failed to delete row from pzPendingExp"); 5403 return false; 5404 } 5405 if (count > 1) { 5406 // XXX should this be a psAbort() instead? It is possible that 5407 // having an object match multiple rows was by design. 5408 psError(PS_ERR_UNKNOWN, true, "pzPendingExpRow object matched more then one row. Check your database schema"); 5409 return false; 5410 } 5411 5412 return true; 5413 } 5234 5414 long long pzPendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 5235 5415 { … … 5737 5917 return returnSet; 5738 5918 } 5919 bool pzPendingImfileDeleteObject(psDB *dbh, const pzPendingImfileRow *object) 5920 { 5921 psMetadata *where = pzPendingImfileMetadataFromObject(object); 5922 long long count = psDBDeleteRows(dbh, PZPENDINGIMFILE_TABLE_NAME, where, 0); 5923 psFree(where) 5924 if (count < 0) { 5925 psError(PS_ERR_UNKNOWN, true, "failed to delete row from pzPendingImfile"); 5926 return false; 5927 } 5928 if (count > 1) { 5929 // XXX should this be a psAbort() instead? It is possible that 5930 // having an object match multiple rows was by design. 5931 psError(PS_ERR_UNKNOWN, true, "pzPendingImfileRow object matched more then one row. Check your database schema"); 5932 return false; 5933 } 5934 5935 return true; 5936 } 5739 5937 long long pzPendingImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 5740 5938 { … … 6212 6410 return returnSet; 6213 6411 } 6412 bool newExpDeleteObject(psDB *dbh, const newExpRow *object) 6413 { 6414 psMetadata *where = newExpMetadataFromObject(object); 6415 long long count = psDBDeleteRows(dbh, NEWEXP_TABLE_NAME, where, 0); 6416 psFree(where) 6417 if (count < 0) { 6418 psError(PS_ERR_UNKNOWN, true, "failed to delete row from newExp"); 6419 return false; 6420 } 6421 if (count > 1) { 6422 // XXX should this be a psAbort() instead? It is possible that 6423 // having an object match multiple rows was by design. 6424 psError(PS_ERR_UNKNOWN, true, "newExpRow object matched more then one row. Check your database schema"); 6425 return false; 6426 } 6427 6428 return true; 6429 } 6214 6430 long long newExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 6215 6431 { … … 6658 6874 return returnSet; 6659 6875 } 6876 bool newImfileDeleteObject(psDB *dbh, const newImfileRow *object) 6877 { 6878 psMetadata *where = newImfileMetadataFromObject(object); 6879 long long count = psDBDeleteRows(dbh, NEWIMFILE_TABLE_NAME, where, 0); 6880 psFree(where) 6881 if (count < 0) { 6882 psError(PS_ERR_UNKNOWN, true, "failed to delete row from newImfile"); 6883 return false; 6884 } 6885 if (count > 1) { 6886 // XXX should this be a psAbort() instead? It is possible that 6887 // having an object match multiple rows was by design. 6888 psError(PS_ERR_UNKNOWN, true, "newImfileRow object matched more then one row. Check your database schema"); 6889 return false; 6890 } 6891 6892 return true; 6893 } 6660 6894 long long newImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 6661 6895 { … … 7308 7542 return returnSet; 7309 7543 } 7544 bool rawDetrendExpDeleteObject(psDB *dbh, const rawDetrendExpRow *object) 7545 { 7546 psMetadata *where = rawDetrendExpMetadataFromObject(object); 7547 long long count = psDBDeleteRows(dbh, RAWDETRENDEXP_TABLE_NAME, where, 0); 7548 psFree(where) 7549 if (count < 0) { 7550 psError(PS_ERR_UNKNOWN, true, "failed to delete row from rawDetrendExp"); 7551 return false; 7552 } 7553 if (count > 1) { 7554 // XXX should this be a psAbort() instead? It is possible that 7555 // having an object match multiple rows was by design. 7556 psError(PS_ERR_UNKNOWN, true, "rawDetrendExpRow object matched more then one row. Check your database schema"); 7557 return false; 7558 } 7559 7560 return true; 7561 } 7310 7562 long long rawDetrendExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 7311 7563 { … … 7957 8209 7958 8210 return returnSet; 8211 } 8212 bool rawScienceExpDeleteObject(psDB *dbh, const rawScienceExpRow *object) 8213 { 8214 psMetadata *where = rawScienceExpMetadataFromObject(object); 8215 long long count = psDBDeleteRows(dbh, RAWSCIENCEEXP_TABLE_NAME, where, 0); 8216 psFree(where) 8217 if (count < 0) { 8218 psError(PS_ERR_UNKNOWN, true, "failed to delete row from rawScienceExp"); 8219 return false; 8220 } 8221 if (count > 1) { 8222 // XXX should this be a psAbort() instead? It is possible that 8223 // having an object match multiple rows was by design. 8224 psError(PS_ERR_UNKNOWN, true, "rawScienceExpRow object matched more then one row. Check your database schema"); 8225 return false; 8226 } 8227 8228 return true; 7959 8229 } 7960 8230 long long rawScienceExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) … … 8753 9023 return returnSet; 8754 9024 } 9025 bool rawImfileDeleteObject(psDB *dbh, const rawImfileRow *object) 9026 { 9027 psMetadata *where = rawImfileMetadataFromObject(object); 9028 long long count = psDBDeleteRows(dbh, RAWIMFILE_TABLE_NAME, where, 0); 9029 psFree(where) 9030 if (count < 0) { 9031 psError(PS_ERR_UNKNOWN, true, "failed to delete row from rawImfile"); 9032 return false; 9033 } 9034 if (count > 1) { 9035 // XXX should this be a psAbort() instead? It is possible that 9036 // having an object match multiple rows was by design. 9037 psError(PS_ERR_UNKNOWN, true, "rawImfileRow object matched more then one row. Check your database schema"); 9038 return false; 9039 } 9040 9041 return true; 9042 } 8755 9043 long long rawImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 8756 9044 { … … 9462 9750 return returnSet; 9463 9751 } 9752 bool p1PendingExpDeleteObject(psDB *dbh, const p1PendingExpRow *object) 9753 { 9754 psMetadata *where = p1PendingExpMetadataFromObject(object); 9755 long long count = psDBDeleteRows(dbh, P1PENDINGEXP_TABLE_NAME, where, 0); 9756 psFree(where) 9757 if (count < 0) { 9758 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p1PendingExp"); 9759 return false; 9760 } 9761 if (count > 1) { 9762 // XXX should this be a psAbort() instead? It is possible that 9763 // having an object match multiple rows was by design. 9764 psError(PS_ERR_UNKNOWN, true, "p1PendingExpRow object matched more then one row. Check your database schema"); 9765 return false; 9766 } 9767 9768 return true; 9769 } 9464 9770 long long p1PendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 9465 9771 { … … 10200 10506 return returnSet; 10201 10507 } 10508 bool p2PendingExpDeleteObject(psDB *dbh, const p2PendingExpRow *object) 10509 { 10510 psMetadata *where = p2PendingExpMetadataFromObject(object); 10511 long long count = psDBDeleteRows(dbh, P2PENDINGEXP_TABLE_NAME, where, 0); 10512 psFree(where) 10513 if (count < 0) { 10514 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingExp"); 10515 return false; 10516 } 10517 if (count > 1) { 10518 // XXX should this be a psAbort() instead? It is possible that 10519 // having an object match multiple rows was by design. 10520 psError(PS_ERR_UNKNOWN, true, "p2PendingExpRow object matched more then one row. Check your database schema"); 10521 return false; 10522 } 10523 10524 return true; 10525 } 10202 10526 long long p2PendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 10203 10527 { … … 10704 11028 return returnSet; 10705 11029 } 11030 bool p2PendingImfileDeleteObject(psDB *dbh, const p2PendingImfileRow *object) 11031 { 11032 psMetadata *where = p2PendingImfileMetadataFromObject(object); 11033 long long count = psDBDeleteRows(dbh, P2PENDINGIMFILE_TABLE_NAME, where, 0); 11034 psFree(where) 11035 if (count < 0) { 11036 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2PendingImfile"); 11037 return false; 11038 } 11039 if (count > 1) { 11040 // XXX should this be a psAbort() instead? It is possible that 11041 // having an object match multiple rows was by design. 11042 psError(PS_ERR_UNKNOWN, true, "p2PendingImfileRow object matched more then one row. Check your database schema"); 11043 return false; 11044 } 11045 11046 return true; 11047 } 10706 11048 long long p2PendingImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 10707 11049 { … … 11442 11784 return returnSet; 11443 11785 } 11786 bool p2DoneExpDeleteObject(psDB *dbh, const p2DoneExpRow *object) 11787 { 11788 psMetadata *where = p2DoneExpMetadataFromObject(object); 11789 long long count = psDBDeleteRows(dbh, P2DONEEXP_TABLE_NAME, where, 0); 11790 psFree(where) 11791 if (count < 0) { 11792 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2DoneExp"); 11793 return false; 11794 } 11795 if (count > 1) { 11796 // XXX should this be a psAbort() instead? It is possible that 11797 // having an object match multiple rows was by design. 11798 psError(PS_ERR_UNKNOWN, true, "p2DoneExpRow object matched more then one row. Check your database schema"); 11799 return false; 11800 } 11801 11802 return true; 11803 } 11444 11804 long long p2DoneExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 11445 11805 { … … 11946 12306 return returnSet; 11947 12307 } 12308 bool p2DoneImfileDeleteObject(psDB *dbh, const p2DoneImfileRow *object) 12309 { 12310 psMetadata *where = p2DoneImfileMetadataFromObject(object); 12311 long long count = psDBDeleteRows(dbh, P2DONEIMFILE_TABLE_NAME, where, 0); 12312 psFree(where) 12313 if (count < 0) { 12314 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p2DoneImfile"); 12315 return false; 12316 } 12317 if (count > 1) { 12318 // XXX should this be a psAbort() instead? It is possible that 12319 // having an object match multiple rows was by design. 12320 psError(PS_ERR_UNKNOWN, true, "p2DoneImfileRow object matched more then one row. Check your database schema"); 12321 return false; 12322 } 12323 12324 return true; 12325 } 11948 12326 long long p2DoneImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 11949 12327 { … … 12654 13032 return returnSet; 12655 13033 } 13034 bool p3PendingExpDeleteObject(psDB *dbh, const p3PendingExpRow *object) 13035 { 13036 psMetadata *where = p3PendingExpMetadataFromObject(object); 13037 long long count = psDBDeleteRows(dbh, P3PENDINGEXP_TABLE_NAME, where, 0); 13038 psFree(where) 13039 if (count < 0) { 13040 psError(PS_ERR_UNKNOWN, true, "failed to delete row from p3PendingExp"); 13041 return false; 13042 } 13043 if (count > 1) { 13044 // XXX should this be a psAbort() instead? It is possible that 13045 // having an object match multiple rows was by design. 13046 psError(PS_ERR_UNKNOWN, true, "p3PendingExpRow object matched more then one row. Check your database schema"); 13047 return false; 13048 } 13049 13050 return true; 13051 } 12656 13052 long long p3PendingExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 12657 13053 { … … 13039 13435 return returnSet; 13040 13436 } 13437 bool detRunDeleteObject(psDB *dbh, const detRunRow *object) 13438 { 13439 psMetadata *where = detRunMetadataFromObject(object); 13440 long long count = psDBDeleteRows(dbh, DETRUN_TABLE_NAME, where, 0); 13441 psFree(where) 13442 if (count < 0) { 13443 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detRun"); 13444 return false; 13445 } 13446 if (count > 1) { 13447 // XXX should this be a psAbort() instead? It is possible that 13448 // having an object match multiple rows was by design. 13449 psError(PS_ERR_UNKNOWN, true, "detRunRow object matched more then one row. Check your database schema"); 13450 return false; 13451 } 13452 13453 return true; 13454 } 13041 13455 long long detRunDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 13042 13456 { … … 13747 14161 return returnSet; 13748 14162 } 14163 bool detInputExpDeleteObject(psDB *dbh, const detInputExpRow *object) 14164 { 14165 psMetadata *where = detInputExpMetadataFromObject(object); 14166 long long count = psDBDeleteRows(dbh, DETINPUTEXP_TABLE_NAME, where, 0); 14167 psFree(where) 14168 if (count < 0) { 14169 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detInputExp"); 14170 return false; 14171 } 14172 if (count > 1) { 14173 // XXX should this be a psAbort() instead? It is possible that 14174 // having an object match multiple rows was by design. 14175 psError(PS_ERR_UNKNOWN, true, "detInputExpRow object matched more then one row. Check your database schema"); 14176 return false; 14177 } 14178 14179 return true; 14180 } 13749 14181 long long detInputExpDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 13750 14182 { … … 14222 14654 return returnSet; 14223 14655 } 14656 bool detProcessedImfileDeleteObject(psDB *dbh, const detProcessedImfileRow *object) 14657 { 14658 psMetadata *where = detProcessedImfileMetadataFromObject(object); 14659 long long count = psDBDeleteRows(dbh, DETPROCESSEDIMFILE_TABLE_NAME, where, 0); 14660 psFree(where) 14661 if (count < 0) { 14662 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detProcessedImfile"); 14663 return false; 14664 } 14665 if (count > 1) { 14666 // XXX should this be a psAbort() instead? It is possible that 14667 // having an object match multiple rows was by design. 14668 psError(PS_ERR_UNKNOWN, true, "detProcessedImfileRow object matched more then one row. Check your database schema"); 14669 return false; 14670 } 14671 14672 return true; 14673 } 14224 14674 long long detProcessedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 14225 14675 { … … 14696 15146 return returnSet; 14697 15147 } 15148 bool detStackedImfileDeleteObject(psDB *dbh, const detStackedImfileRow *object) 15149 { 15150 psMetadata *where = detStackedImfileMetadataFromObject(object); 15151 long long count = psDBDeleteRows(dbh, DETSTACKEDIMFILE_TABLE_NAME, where, 0); 15152 psFree(where) 15153 if (count < 0) { 15154 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detStackedImfile"); 15155 return false; 15156 } 15157 if (count > 1) { 15158 // XXX should this be a psAbort() instead? It is possible that 15159 // having an object match multiple rows was by design. 15160 psError(PS_ERR_UNKNOWN, true, "detStackedImfileRow object matched more then one row. Check your database schema"); 15161 return false; 15162 } 15163 15164 return true; 15165 } 14698 15166 long long detStackedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 14699 15167 { … … 15170 15638 return returnSet; 15171 15639 } 15640 bool detNormalizedImfileDeleteObject(psDB *dbh, const detNormalizedImfileRow *object) 15641 { 15642 psMetadata *where = detNormalizedImfileMetadataFromObject(object); 15643 long long count = psDBDeleteRows(dbh, DETNORMALIZEDIMFILE_TABLE_NAME, where, 0); 15644 psFree(where) 15645 if (count < 0) { 15646 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detNormalizedImfile"); 15647 return false; 15648 } 15649 if (count > 1) { 15650 // XXX should this be a psAbort() instead? It is possible that 15651 // having an object match multiple rows was by design. 15652 psError(PS_ERR_UNKNOWN, true, "detNormalizedImfileRow object matched more then one row. Check your database schema"); 15653 return false; 15654 } 15655 15656 return true; 15657 } 15172 15658 long long detNormalizedImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 15173 15659 { … … 15584 16070 return returnSet; 15585 16071 } 16072 bool detMasterFrameDeleteObject(psDB *dbh, const detMasterFrameRow *object) 16073 { 16074 psMetadata *where = detMasterFrameMetadataFromObject(object); 16075 long long count = psDBDeleteRows(dbh, DETMASTERFRAME_TABLE_NAME, where, 0); 16076 psFree(where) 16077 if (count < 0) { 16078 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detMasterFrame"); 16079 return false; 16080 } 16081 if (count > 1) { 16082 // XXX should this be a psAbort() instead? It is possible that 16083 // having an object match multiple rows was by design. 16084 psError(PS_ERR_UNKNOWN, true, "detMasterFrameRow object matched more then one row. Check your database schema"); 16085 return false; 16086 } 16087 16088 return true; 16089 } 15586 16090 long long detMasterFrameDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 15587 16091 { … … 16029 16533 return returnSet; 16030 16534 } 16535 bool detMasterImfileDeleteObject(psDB *dbh, const detMasterImfileRow *object) 16536 { 16537 psMetadata *where = detMasterImfileMetadataFromObject(object); 16538 long long count = psDBDeleteRows(dbh, DETMASTERIMFILE_TABLE_NAME, where, 0); 16539 psFree(where) 16540 if (count < 0) { 16541 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detMasterImfile"); 16542 return false; 16543 } 16544 if (count > 1) { 16545 // XXX should this be a psAbort() instead? It is possible that 16546 // having an object match multiple rows was by design. 16547 psError(PS_ERR_UNKNOWN, true, "detMasterImfileRow object matched more then one row. Check your database schema"); 16548 return false; 16549 } 16550 16551 return true; 16552 } 16031 16553 long long detMasterImfileDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 16032 16554 { … … 16593 17115 return returnSet; 16594 17116 } 17117 bool detResidImfileAnalysisDeleteObject(psDB *dbh, const detResidImfileAnalysisRow *object) 17118 { 17119 psMetadata *where = detResidImfileAnalysisMetadataFromObject(object); 17120 long long count = psDBDeleteRows(dbh, DETRESIDIMFILEANALYSIS_TABLE_NAME, where, 0); 17121 psFree(where) 17122 if (count < 0) { 17123 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detResidImfileAnalysis"); 17124 return false; 17125 } 17126 if (count > 1) { 17127 // XXX should this be a psAbort() instead? It is possible that 17128 // having an object match multiple rows was by design. 17129 psError(PS_ERR_UNKNOWN, true, "detResidImfileAnalysisRow object matched more then one row. Check your database schema"); 17130 return false; 17131 } 17132 17133 return true; 17134 } 16595 17135 long long detResidImfileAnalysisDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit) 16596 17136 { … … 16645 17185 static void detResidExpAnalysisRowFree(detResidExpAnalysisRow *object); 16646 17186 16647 detResidExpAnalysisRow *detResidExpAnalysisRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *recipe, bool accept)17187 detResidExpAnalysisRow *detResidExpAnalysisRowAlloc(psS32 det_id, psS32 iteration, const char *exp_id, const char *recipe, bool keep, bool accept) 16648 17188 { 16649 17189 detResidExpAnalysisRow *object; … … 16656 17196 object->exp_id = psStringCopy(exp_id); 16657 17197 object->recipe = psStringCopy(recipe); 17198 object->keep = keep; 16658 17199 object->accept = accept; 16659 17200 … … 16698 17239 return false; 16699 17240 } 17241 if (!psMetadataAdd(md, PS_LIST_TAIL, "keep", PS_DATA_BOOL, NULL, false)) { 17242 psError(PS_ERR_UNKNOWN, false, "failed to add item keep"); 17243 psFree(md); 17244 return false; 17245 } 16700 17246 if (!psMetadataAdd(md, PS_LIST_TAIL, "accept", PS_DATA_BOOL, NULL, false)) { 16701 17247 psError(PS_ERR_UNKNOWN, false, "failed to add item accept"); … … 16716 17262 } 16717 17263 16718 bool detResidExpAnalysisInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *recipe, bool accept)17264 bool detResidExpAnalysisInsert(psDB * dbh, psS32 det_id, psS32 iteration, const char *exp_id, const char *recipe, bool keep, bool accept) 16719 17265 { 16720 17266 psMetadata *md; … … 16739 17285 if (!psMetadataAddStr(md, PS_LIST_TAIL, "recipe", 0, NULL, recipe)) { 16740 17286 psError(PS_ERR_UNKNOWN, false, "failed to add item recipe"); 17287 psFree(md); 17288 return false; 17289 } 17290 if (!psMetadataAdd(md, PS_LIST_TAIL, "keep", PS_DATA_BOOL, NULL, keep)) { 17291 psError(PS_ERR_UNKNOWN, false, "failed to add item keep"); 16741 17292 psFree(md); 16742 17293 return false; … … 16768 17319 return deleted; 16769 17320 } 16770 bool detResidExpAnalysisPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **recipe, bool * accept)17321 bool detResidExpAnalysisPop(psDB *dbh, psS32 *det_id, psS32 *iteration, char **exp_id, char **recipe, bool *keep, bool *accept) 16771 17322 { 16772 17323 psArray *rowSet; … … 16836 17387 return false; 16837 17388 } 17389 *keep = psMetadataLookupBool(&status, row, "keep"); 17390 if (!status) { 17391 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item keep"); 17392 psFree(row); 17393 return false; 17394 } 16838 17395 *accept = psMetadataLookupBool(&status, row, "accept"); 16839 17396 if (!status) { … … 16850 17407 bool detResidExpAnalysisInsertObject(psDB *dbh, detResidExpAnalysisRow *object) 16851 17408 { 16852 return detResidExpAnalysisInsert(dbh, object->det_id, object->iteration, object->exp_id, object->recipe, object-> accept);17409 return detResidExpAnalysisInsert(dbh, object->det_id, object->iteration, object->exp_id, object->recipe, object->keep, object->accept); 16853 17410 } 16854 17411 … … 16859 17416 char exp_id[256]; 16860 17417 char recipe[256]; 17418 bool keep; 16861 17419 bool accept; 16862 17420 16863 if (!detResidExpAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&recipe, & accept)) {17421 if (!detResidExpAnalysisPop(dbh, &det_id, &iteration, (char **)&exp_id, (char **)&recipe, &keep, &accept)) { 16864 17422 psError(PS_ERR_UNKNOWN, false, "failed to pop a database row"); 16865 17423 return NULL; 16866 17424 } 16867 17425 16868 return detResidExpAnalysisRowAlloc(det_id, iteration, exp_id, recipe, accept);17426 return detResidExpAnalysisRowAlloc(det_id, iteration, exp_id, recipe, keep, accept); 16869 17427 } 16870 17428 … … 16985 17543 return NULL; 16986 17544 } 17545 if (!psMetadataAdd(md, PS_LIST_TAIL, "keep", PS_DATA_BOOL, NULL, object->keep)) { 17546 psError(PS_ERR_UNKNOWN, false, "failed to add item keep"); 17547 psFree(md); 17548 return NULL; 17549 } 16987 17550 if (!psMetadataAdd(md, PS_LIST_TAIL, "accept", PS_DATA_BOOL, NULL, object->accept)) { 16988 17551 psError(PS_ERR_UNKNOWN, false, "failed to add item accept"); … … 17001 17564 char *exp_id; 17002 17565 char *recipe; 17566 bool keep; 17003 17567 bool accept; 17004 17568 … … 17023 17587 return false; 17024 17588 } 17589 keep = psMetadataLookupBool(&status, md, "keep"); 17590 if (!status) { 17591 psError(PS_ERR_UNKNOWN, true, "failed to lookup value for item keep"); 17592 return false; 17593 } 17025 17594 accept = psMetadataLookupBool(&status, md, "accept"); 17026 17595 if (!status) { … … 17029 17598 } 17030 17599 17031 return detResidExpAnalysisRowAlloc(det_id, iteration, exp_id, recipe, accept);17600 return detResidExpAnalysisRowAlloc(det_id, iteration, exp_id, recipe, keep, accept); 17032 17601 } 17033 17602 psArray *detResidExpAnalysisSelectRowObjects(psDB *dbh, const psMetadata *where, unsigned long long limit) … … 17065 17634 17066 17635 return returnSet; 17636 } 17637 bool detResidExpAnalysisDeleteObject(psDB *dbh, const detResidExpAnalysisRow *object) 17638 { 17639 psMetadata *where = detResidExpAnalysisMetadataFromObject(object); 17640 long long count = psDBDeleteRows(dbh, DETRESIDEXPANALYSIS_TABLE_NAME, where, 0); 17641 psFree(where) 17642 if (count < 0) { 17643 psError(PS_ERR_UNKNOWN, true, "failed to delete row from detResidExpAnalysis"); 17644 return false; 17645 } 17646 if (count > 1) { 17647 // XXX should this be a psAbort() instead? It is possible that 17648 // having an object match multiple rows was by design. 17649 psError(PS_ERR_UNKNOWN, true, "detResidExpAnalysisRow object matched more then one row. Check your database schema"); 17650 return false; 17651 } 17652 17653 return true; 17067 17654 } 17068 17655 long long detResidExpAnalysisDeleteRowObjects(psDB *dbh, const psArray *objects, unsigned long long limit)
Note:
See TracChangeset
for help on using the changeset viewer.
