IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 28, 2007, 6:44:37 PM (19 years ago)
Author:
jhoblitt
Message:

rename all *_version fields to be *_id
change chip* tables to use a chip_id
change cam* tables to use a cam_id
change all *_id fields to be S64

File:
1 edited

Legend:

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

    r12093 r12131  
    100100            "   rawExp.workdir"
    101101            " FROM camPendingExp"
     102            " JOIN chipProcessedExp"
     103            "   USING(chip_id)"
    102104            " JOIN rawExp"
    103             "   USING(exp_tag)"
     105            "   ON chipProcessedExp.exp_tag = rawExp.exp_tag"
    104106            " LEFT JOIN camProcessedExp"
    105             "   USING(exp_tag)"
     107            "   on camPendingExp.cam_id = camPendingExp.cam_id"
    106108            " LEFT JOIN camMask"
    107109            "   ON camPendingExp.label = camMask.label"
    108110            " WHERE"
    109             "   camProcessedExp.exp_tag IS NULL"
     111            "   camProcessedExp.cam_id IS NULL"
    110112            "   AND camMask.label IS NULL"
    111113    );
     
    152154    }
    153155
     156    if (!convertIdToStr(output)) {
     157        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     158        psFree(output);
     159        return false;
     160    }
     161
    154162    // negate simple so the default is true
    155163    if (!ippdbPrintMetadatas(stdout, output, "camPendingExp", !simple)) {
     
    170178    psString query = psStringCopy(
    171179            "SELECT"
     180            "   camPendingExp.cam_id,"
    172181            "   chipProcessedImfile.*,"
    173182            "   rawExp.camera,"
     
    175184            " FROM camPendingExp"
    176185            " JOIN chipProcessedImfile"
    177             "   USING(exp_tag, chip_version)"
     186            "   USING(chip_id)"
    178187            " JOIN rawExp"
    179             "   USING(exp_tag)"
     188            "   ON chipProcessedImfile.exp_tag = rawExp.exp_tag"
    180189            " LEFT JOIN camProcessedExp"
    181             "   USING(exp_tag)"
     190            "   ON camPendingExp.cam_id = camProcessedExp.cam_id"
    182191            " LEFT JOIN camMask"
    183192            "   ON camPendingExp.label = camMask.label"
    184193            " WHERE"
    185             "   camProcessedExp.exp_tag IS NULL"
     194            "   camProcessedExp.cam_id IS NULL"
    186195            "   AND camMask.label IS NULL"
    187196    );
     
    221230    }
    222231
     232    if (!convertIdToStr(output)) {
     233        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     234        psFree(output);
     235        return false;
     236    }
     237
     238    if (!convertIdToStr(output)) {
     239        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     240        psFree(output);
     241        return false;
     242    }
     243
     244    if (!convertIdToStr(output)) {
     245        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     246        psFree(output);
     247        return false;
     248    }
     249
     250    if (!convertIdToStr(output)) {
     251        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     252        psFree(output);
     253        return false;
     254    }
     255
    223256    // negate simple so the default is true
    224257    if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
     
    237270    PS_ASSERT_PTR_NON_NULL(config, false);
    238271
    239     // det_id, exp_tag, recip
    240     // are required
    241272    bool status = false;
    242     psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
    243     if (!status) {
    244         psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
    245         return false;
    246     }
    247     if (!exp_tag) {
    248         psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
    249         return false;
    250     }
     273    psString cam_id = psMetadataLookupStr(&status, config->args, "-cam_id");
     274    if (!status) {
     275        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_id");
     276        return false;
     277    }
     278    if (!cam_id) {
     279        psError(PS_ERR_UNKNOWN, true, "-cam_id is required");
     280        return false;
     281    }
     282
    251283    psString uri = psMetadataLookupStr(&status, config->args, "-uri");
    252284    if (!status) {
     
    258290        return false;
    259291    }
     292
    260293    psString recipe = psMetadataLookupStr(&status, config->args, "-recip");
    261294    if (!status) {
     
    267300        return false;
    268301    }
     302
    269303    psF64 bg = psMetadataLookupF64(&status, config->args, "-bg");
    270304    if (!status) {
     
    272306        return false;
    273307    }
     308
    274309    psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev");
    275310    if (!status) {
     
    277312        return false;
    278313    }
     314
    279315    psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg_mean_stdev");
    280316    if (!status) {
     
    282318        return false;
    283319    }
     320
    284321    psF32 sigma_ra = psMetadataLookupF32(&status, config->args, "-sigma_ra");
    285322    if (!status) {
     
    291328        return false;
    292329    }
     330
    293331    psF32 sigma_dec = psMetadataLookupF32(&status, config->args, "-sigma_dec");
    294332    if (!status) {
     
    300338        return false;
    301339    }
     340
    302341    psS32 nastro = psMetadataLookupS32(&status, config->args, "-nastro");
    303342    if (!status) {
     
    309348        return false;
    310349    }
     350
    311351    psF32 zp_mean = psMetadataLookupF32(&status, config->args, "-zp_mean");
    312352    if (!status) {
     
    318358        return false;
    319359    }
     360
    320361    psF32 zp_stdev = psMetadataLookupF32(&status, config->args, "-zp_stdev");
    321362    if (!status) {
     
    346387        " FROM camPendingExp"
    347388        " LEFT JOIN camProcessedExp"
    348         "   USING(exp_tag)"
     389        "   USING(cam_id)"
    349390        " WHERE"
    350         "   camProcessedExp.exp_tag IS NULL"
    351         "   AND camPendingExp.exp_tag = '%s'"
     391        "   camProcessedExp.cam_id IS NULL"
     392        "   AND camPendingExp.cam_id = '%s'"
    352393    );
    353394
    354     if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
     395    if (!p_psDBRunQuery(config->dbh, query, cam_id)) {
    355396        psError(PS_ERR_UNKNOWN, false, "database error");
    356397        psFree(query);
     
    382423    // create a new camProcessedImfile object
    383424    camProcessedExpRow *row = camProcessedExpRowAlloc(
    384         exp_tag,
    385         pendingRow->cam_version,
    386         pendingRow->chip_version,
     425        pendingRow->cam_id,
     426        pendingRow->chip_id,
    387427        pendingRow->label,
    388428        uri,
     
    437477}
    438478
     479
    439480static bool processedexpMode(pxConfig *config)
    440481{
     
    460501            "   rawExp.workdir"
    461502            " FROM camProcessedExp"
     503            " JOIN chipProcessedExp"
     504            "   USING(chip_id)"
    462505            " JOIN rawExp"
    463             "   USING(exp_tag)"
     506            "   chipProcessedExp.exp_tag = rawExp.exp_tag"
    464507            " WHERE"
    465             "   camProcessedExp.exp_tag IS NOT NULL"
     508            "   camProcessedExp.cam_id IS NOT NULL" // bongus
    466509    );
    467510
     
    515558    }
    516559
     560    if (!convertIdToStr(output)) {
     561        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     562        psFree(output);
     563        return false;
     564    }
     565
     566    if (!convertIdToStr(output)) {
     567        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     568        psFree(output);
     569        return false;
     570    }
     571
     572    if (!convertIdToStr(output)) {
     573        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     574        psFree(output);
     575        return false;
     576    }
     577
     578    if (!convertIdToStr(output)) {
     579        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     580        psFree(output);
     581        return false;
     582    }
     583
    517584    // negate simple so the default is true
    518585    if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) {
     
    570637    return true;
    571638}
     639
    572640
    573641static bool maskedMode(pxConfig *config)
     
    605673    }
    606674
     675    if (!convertIdToStr(output)) {
     676        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
     677        psFree(output);
     678        return false;
     679    }
     680
    607681    // negative simple so the default is true
    608682    if (!ippdbPrintMetadatas(stdout, output, "camMask", !simple)) {
     
    617691}
    618692
     693
    619694static bool unblockMode(pxConfig *config)
    620695{
Note: See TracChangeset for help on using the changeset viewer.