IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10405


Ignore:
Timestamp:
Dec 1, 2006, 2:31:01 PM (20 years ago)
Author:
jhoblitt
Message:

add DataStore file_id support

File:
1 edited

Legend:

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

    r10119 r10405  
    215215    {
    216216        char *query =
    217             "CREATE TEMPORARY TABLE incoming (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope, class, class_id)) ENGINE=MEMORY";
     217            "CREATE TEMPORARY TABLE incoming (exp_id VARCHAR(64), camera VARCHAR(64), telescope VARCHAR(64), file_id VARCHAR(64), bytes INT, md5sum VARCHAR(32), class VARCHAR(64), class_id VARCHAR(64), uri VARCHAR(255), PRIMARY KEY(exp_id, camera, telescope, class, class_id)) ENGINE=MEMORY";
    218218
    219219        if (!p_psDBRunQuery(config->dbh, query)) {
     
    230230    // load the imfiles (files) into the temp table
    231231    {
    232         char *query = "INSERT INTO incoming (exp_id, camera, telescope, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
     232        char *query = "INSERT INTO incoming (exp_id, camera, telescope, file_id, bytes, md5sum, class, class_id, uri) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
    233233
    234234        long inserted = p_psDBRunQueryPrepared(config->dbh, newImfiles, query);
     
    303303            "       incoming.bytes,"
    304304            "       incoming.md5sum,"
     305            "       incoming.file_id,"
    305306            "       incoming.class,"
    306307            "       incoming.class_id,"
     
    569570        // check that we have the right number of tokens
    570571        // print "# uri fileid bytes md5sum type \n";
    571         if (psListLength(tokens) != 5) {
     572        if (!psListLength(tokens) > 5) {
    572573            psError(PS_ERR_UNKNOWN, true, "invalid line format: %s", line);
     574            psFree(tokens);
     575            psFree(pzPendingImfiles);               
     576            psFree(lineCursor);
     577            psFree(doc);
    573578            return false;
    574579        }
     
    577582        psListIterator *tokenCursor = psListIteratorAlloc(tokens, 0, false);
    578583        char *uri       = psListGetAndIncrement(tokenCursor);
    579         char *class_id  = psListGetAndIncrement(tokenCursor); // fileid
     584        char *file_id   = psListGetAndIncrement(tokenCursor); // fileid
    580585        char *bytes     = psListGetAndIncrement(tokenCursor); // bytes
    581586        char *md5sum    = psListGetAndIncrement(tokenCursor); // md5sum
    582587        char *class     = psListGetAndIncrement(tokenCursor); // type
     588        char *class_id  = psListGetAndIncrement(tokenCursor); // chipname
    583589
    584590        // create a new metadata to represent this line and it's values
     
    600606        if (!psMetadataAddStr(md, PS_LIST_TAIL, "telescope", 0, NULL, telescope)) {
    601607            psError(PS_ERR_UNKNOWN, false, "failed to add item telescope");
     608            psFree(md);
     609            psFree(tokenCursor);
     610            psFree(tokens);
     611            return NULL;
     612        }
     613        if (!psMetadataAddStr(md, PS_LIST_TAIL, "file_id", 0, NULL, file_id)) {
     614            psError(PS_ERR_UNKNOWN, false, "failed to add item bytes");
    602615            psFree(md);
    603616            psFree(tokenCursor);
Note: See TracChangeset for help on using the changeset viewer.