IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10118


Ignore:
Timestamp:
Nov 20, 2006, 4:24:42 PM (20 years ago)
Author:
jhoblitt
Message:

change to using pxGenExpTag() to generate exp_tags

File:
1 edited

Legend:

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

    r10063 r10118  
    2626#include <stdlib.h>
    2727
     28#include "pxtag.h"
    2829#include "pxtools.h"
    2930#include "pzgetimfiles.h"
     
    361362    // copy the summitExp row into newExp in order to create a new exp_tag
    362363    {
     364        psString exp_tag = pxGenExpTag(config, filesetid);
     365        if (!exp_tag) {
     366            // rollback
     367            if (!psDBRollback(config->dbh)) {
     368                psError(PS_ERR_UNKNOWN, false, "database error");
     369            }
     370            psError(PS_ERR_UNKNOWN, false, "database error");
     371            return false;
     372        }
     373
    363374        char *query =
    364375            "INSERT INTO newExp"
    365376            "   SElECT"
    366             "       NULL," // exp_tag
     377            "       '%s'," // exp_tag
    367378            "       summitExp.exp_id,"
    368379            "       summitExp.camera,"
     
    377388            "       AND summitExp.telescope = '%s'";
    378389
    379         if (!p_psDBRunQuery(config->dbh, query)) {
    380             // rollback
    381             if (!psDBRollback(config->dbh)) {
    382                 psError(PS_ERR_UNKNOWN, false, "database error");
    383             }
    384             psError(PS_ERR_UNKNOWN, false, "database error");
    385             return false;
    386         }
     390        if (!p_psDBRunQuery(config->dbh, query, exp_tag, filesetid, camera, telescope)) {
     391            // rollback
     392            if (!psDBRollback(config->dbh)) {
     393                psError(PS_ERR_UNKNOWN, false, "database error");
     394            }
     395            psError(PS_ERR_UNKNOWN, false, "database error");
     396            psFree(exp_tag);
     397            return false;
     398        }
     399        psFree(exp_tag);
    387400
    388401        // sanity check: we should have inserted only one row
     
    403416        char *query =
    404417            "UPDATE pzPendingImfile"
    405             " SET exp_tag = LAST_INSERT_ID()"
     418            " SET exp_tag = (SELECT exp_tag from newExp"
     419            "                WHERE exp_id = '%s'"
     420            "                AND camera = '%s'"
     421            "                AND telescope = '%s')"
    406422            " WHERE"
    407423            "   exp_id = '%s'"
    408424            "   AND camera = '%s'"
    409425            "   AND telescope = '%s'";
    410         if (!p_psDBRunQuery(config->dbh, query, filesetid, camera, telescope)) {
     426        if (!p_psDBRunQuery(config->dbh, query, filesetid, camera, telescope, filesetid, camera, telescope)) {
    411427            // rollback
    412428            if (!psDBRollback(config->dbh)) {
Note: See TracChangeset for help on using the changeset viewer.