IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 5, 2009, 9:35:41 AM (17 years ago)
Author:
bills
Message:

Changed the way image ids are handled. For chip and warp new tables are
added the sole purpose of which are to create the image ids before
the images are created. For diff the id is added to diffInputSkyfile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pxchip.c

    r20750 r21308  
    235235    PS_ASSERT_PTR_NON_NULL(config, false);
    236236
     237    if (!psDBTransaction(config->dbh)) {
     238        psError(PS_ERR_UNKNOWN, false, "database error");
     239        return false;
     240    }
     241
     242
    237243    // create a chipRun
    238244    if (!chipRunInsert(config->dbh,
     
    249255            end_stage)
    250256    ) {
     257        if (!psDBRollback(config->dbh)) {
     258            psError(PS_ERR_UNKNOWN, false, "database error failed to rollback transaction");
     259        }
    251260        psError(PS_ERR_UNKNOWN, false, "database error");
    252261        return 0;
    253262    }
    254263
    255     return psDBLastInsertID(config->dbh);
    256 }
    257 
     264    psS64 chip_id =  psDBLastInsertID(config->dbh);
     265
     266    // Create rows in chipImfile table for each input exposure.
     267    // This creates the chip_image_id values
     268    psString query = "INSERT INTO chipImfile "
     269                     "SELECT %" PRId64 ", class_id, 0 FROM rawImfile WHERE exp_id = %" PRId64;
     270
     271    if (!p_psDBRunQuery(config->dbh, query, chip_id, exp_id)) {
     272        psError(PS_ERR_UNKNOWN, false, "database error");
     273        // rollback
     274        if (!psDBRollback(config->dbh)) {
     275            psError(PS_ERR_UNKNOWN, false, "database error");
     276        }
     277        psError(PS_ERR_UNKNOWN, false, "database error");
     278        return 0;
     279    }
     280    if (!psDBCommit(config->dbh)) {
     281        psError(PS_ERR_UNKNOWN, false, "database error");
     282        return 0;
     283    }
     284   
     285    return chip_id;
     286}
     287
Note: See TracChangeset for help on using the changeset viewer.