IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 21, 2006, 5:17:21 PM (20 years ago)
Author:
jhoblitt
Message:

partial implementation of pzsearch -copydone

File:
1 edited

Legend:

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

    r6669 r6670  
    77static bool copydoneMode(pxConfig *config);
    88bool summitExpPrint(FILE *stream, summitExpRow *summitExp);
     9psArray *pzsearchPendingImfiles(pxConfig *config);
     10bool pzsearchFlushPendingExp(pxConfig *config);
    911
    1012int main(int argc, char **argv)
     
    8991    PS_ASSERT_PTR_NON_NULL(config, false);
    9092
    91     psArray *new = pzPendingFrameSearch(config);
    92     if (!new) {
     93    psArray *pending = pzPendingFrameSearch(config);
     94    if (!pending) {
    9395        psError(PS_ERR_UNKNOWN, false, "no pzPendingFrames found");
    9496        return false;
    9597    }
    96 
    97     bool status = pzPendingFramePrint(stdout, config, new);
    98     if (!status) {
     98    if (!pzPendingFramePrint(stdout, config, pending)) {
    9999        psError(PS_ERR_UNKNOWN, false, "pzPendingFramePrint() failed");
    100100        return false;
     
    107107{
    108108    PS_ASSERT_PTR_NON_NULL(config, false);
     109
     110    // we don't have to operate on complete frames here as it's ok to start
     111    // downloading the imfiles before the exp has been registered
     112    psArray *pending = pzsearchPendingImfiles(config);
     113    if (!pending) {
     114        psError(PS_ERR_UNKNOWN, false, "no pzPendingImfiles found");
     115        return false;
     116    }
     117
     118    // XXX start transaction
     119
     120    for (long i = 0; i < pending->n; i++) {
     121        pzPendingImfileRow *pendingImfile = pending->data[i];
     122        newImfileRow *newImfile = newImfileRowAlloc(
     123            pendingImfile->exp_id,
     124            pendingImfile->class,
     125            pendingImfile->class_id,
     126            // XXX get this from the CLI
     127            pendingImfile->uri
     128        );
     129
     130        if (!newImfileInsertObject(config->dbh, newImfile)) {
     131            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
     132            return false;
     133        }
     134    }
     135
     136    if (pzPendingImfileDeleteRowObjects(config->dbh, pending, MAX_ROWS)
     137        < 0) {
     138            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
     139            return false;
     140    }
     141
     142    // XXX commit transaction
     143
     144    // check for completed exps
     145    if (!pzsearchFlushPendingExp(config)) {
     146        psError(PS_ERR_UNKNOWN, false, "pzsearchFlushPendingExp() failed");
     147        return false;
     148    }
     149
     150    return true;
    109151}
    110152
     
    124166    return true;
    125167}
     168
     169psArray *pzsearchPendingImfiles(pxConfig *config)
     170{
     171    PS_ASSERT_PTR_NON_NULL(config, NULL);
     172
     173    psArray *imfiles = pzPendingImfileSelectRowObjects(config->dbh,
     174        config->where, MAX_ROWS);
     175    if (!imfiles) {
     176        psError(PS_ERR_UNKNOWN, false, "no pzPendingImfile rows found");
     177
     178        return NULL;
     179    }
     180
     181    return imfiles;
     182}
     183
     184bool pzsearchFlushPendingExp(pxConfig *config)
     185{
     186    PS_ASSERT_PTR_NON_NULL(config, false);
     187
     188    return true;
     189}
Note: See TracChangeset for help on using the changeset viewer.