IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6341


Ignore:
Timestamp:
Feb 7, 2006, 10:36:15 AM (20 years ago)
Author:
jhoblitt
Message:

rename pxConfig database -> dbh

Location:
trunk/ippTools/src
Files:
13 edited

Legend:

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

    r6261 r6341  
    7676    // frames from the raw set.  This may not be quiet right as it's
    7777    // possible (likely?) that a rawScienceExp is inserted into the
    78     // database prior to /ALL/ of that exposure's Imfiles
     78    // dbh prior to /ALL/ of that exposure's Imfiles
    7979    if (pendingFrames) {
    8080        for (int i = 0; i < rawFrames->n; i++) {
     
    164164    psArray *doneImfiles = p2pendingToDoneImfile(pendingImfiles);
    165165    for (int i = 0; i < doneImfiles->n; i++) {
    166         if (!p2DoneImfileInsertObject(config->database, doneImfiles->data[i])) {
    167             psError(PS_ERR_UNKNOWN, false, "database access failed");
     166        if (!p2DoneImfileInsertObject(config->dbh, doneImfiles->data[i])) {
     167            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    168168            return false;
    169169        }
    170170    }
    171171    // delete from pending
    172     if (p2PendingImfileDeleteRowObjects(config->database, pendingImfiles, MAX_ROWS) < 0) {
     172    if (p2PendingImfileDeleteRowObjects(config->dbh, pendingImfiles, MAX_ROWS) < 0) {
    173173        // there must be atleast 1 Imfile to get this far
    174         psError(PS_ERR_UNKNOWN, false, "database access failed");
     174        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    175175        return false;
    176176    }
     
    188188        psMetadata *where = psMetadataAlloc();
    189189        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", pendingExp->exp_id);
    190         psArray *pendingImfiles = p2PendingImfileSelectRowObjects(config->database, where, MAX_ROWS);
     190        psArray *pendingImfiles = p2PendingImfileSelectRowObjects(config->dbh, where, MAX_ROWS);
    191191        psFree(where)
    192192        if (!pendingImfiles) {
     
    195195            nukeMe->n = 0;
    196196            psArrayAdd(nukeMe, 0, pendingExp);
    197             bool status = p2PendingExpDeleteRowObjects(config->database, nukeMe, MAX_ROWS);
     197            bool status = p2PendingExpDeleteRowObjects(config->dbh, nukeMe, MAX_ROWS);
    198198            psFree(nukeMe);
    199199            if (!status) {
    200                 psError(PS_ERR_UNKNOWN, false, "database access failed");
     200                psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    201201                return false;
    202202            }
     
    208208                return false;
    209209            }
    210             if (!p2DoneExpInsertObject(config->database, doneExp)) {
    211                 psError(PS_ERR_UNKNOWN, false, "database access failed");
     210            if (!p2DoneExpInsertObject(config->dbh, doneExp)) {
     211                psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    212212                return false;
    213213            }
  • trunk/ippTools/src/chiptoolConfig.c

    r6261 r6341  
    163163
    164164    // define Database handle, if used
    165     config->database = pmConfigDB(config->site);
     165    config->dbh = pmConfigDB(config->site);
    166166
    167167    return true;
  • trunk/ippTools/src/p2insertPendingFrames.c

    r6336 r6341  
    1919        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", PS_META_REPLACE, "==",
    2020            rawFrame->exposure->exp_id);
    21         psArray *exposures = p2PendingExpSelectRowObjects(config->database,
     21        psArray *exposures = p2PendingExpSelectRowObjects(config->dbh,
    2222            where, MAX_ROWS);
    2323        psFree(where);
     
    6767        }
    6868       
    69         if (!p2PendingExpInsertObject(config->database, pendingExposure)) {
    70             psError(PS_ERR_UNKNOWN, false, "database access failed");
     69        if (!p2PendingExpInsertObject(config->dbh, pendingExposure)) {
     70            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    7171            return false;
    7272        }
    7373
    7474        for (int i = 0; i < pendingImages->n; i++) {
    75             if (!p2PendingImfileInsertObject(config->database,
     75            if (!p2PendingImfileInsertObject(config->dbh,
    7676                    pendingImages->data[i])) {
    77                 psError(PS_ERR_UNKNOWN, false, "database access failed");
     77                psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    7878                return false;
    7979            }
  • trunk/ippTools/src/p2searchDoneFrames.c

    r6221 r6341  
    55    PS_ASSERT_PTR_NON_NULL(config, NULL);
    66
    7     psArray *exposures = p2DoneExpSelectRowObjects(config->database,
     7    psArray *exposures = p2DoneExpSelectRowObjects(config->dbh,
    88        config->where, MAX_ROWS);
    99    if (!exposures) {
     
    2525            exposure->exp_id);
    2626
    27         psArray *images = p2DoneImfileSelectRowObjects(config->database, where,
     27        psArray *images = p2DoneImfileSelectRowObjects(config->dbh, where,
    2828            MAX_ROWS);
    2929        psFree(where);
    3030        if (!images) {
    31             psError(PS_ERR_UNKNOWN, false, "database access failed");
     31            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    3232
    3333            return NULL;
  • trunk/ippTools/src/p2searchPendingFrames.c

    r6258 r6341  
    55    PS_ASSERT_PTR_NON_NULL(config, NULL);
    66
    7     psArray *exposures = p2PendingExpSelectRowObjects(config->database,
     7    psArray *exposures = p2PendingExpSelectRowObjects(config->dbh,
    88        config->where, MAX_ROWS);
    99    if (!exposures) {
     
    2525        psMetadataAddS32(where, PS_LIST_TAIL, "p2_version", PS_META_REPLACE, "==", exposure->p2_version);
    2626
    27         psArray *images = p2PendingImfileSelectRowObjects(config->database, where, MAX_ROWS);
     27        psArray *images = p2PendingImfileSelectRowObjects(config->dbh, where, MAX_ROWS);
    2828
    2929        p2PendingFrame *frame = p2PendingFrameAlloc(exposure, images);
     
    4343    PS_ASSERT_PTR_NON_NULL(config, NULL);
    4444
    45     psArray *imfiles = p2PendingImfileSelectRowObjects(config->database,
     45    psArray *imfiles = p2PendingImfileSelectRowObjects(config->dbh,
    4646        config->where, MAX_ROWS);
    4747    if (!imfiles) {
     
    5858    PS_ASSERT_PTR_NON_NULL(config, NULL);
    5959
    60     psArray *exps = p2PendingExpSelectRowObjects(config->database,
     60    psArray *exps = p2PendingExpSelectRowObjects(config->dbh,
    6161        config->where,
    6262        MAX_ROWS);
  • trunk/ippTools/src/p2updatePending.c

    r6336 r6341  
    1010    // select all of the exposures which are still pending
    1111    psMetadataAddS32 (where, PS_LIST_TAIL, "STATE", 0, "==", PX_MODE_PENDING);
    12     psArray *exposures = p2PendingExpSelectRowObjects (config->database, where, MAX_ROWS);
     12    psArray *exposures = p2PendingExpSelectRowObjects (config->dbh, where, MAX_ROWS);
    1313
    1414    // we will now select all of the matching images which are done
     
    2020        psMetadataAddStr (where, PS_LIST_TAIL, "EXP_ID",     PS_META_REPLACE, "==", exposure->exp_id);
    2121        psMetadataAddS32 (where, PS_LIST_TAIL, "P2_VERSION", PS_META_REPLACE, "==", exposure->p2_version);
    22         psArray *images = p2PendingImfileSelectRowObjects (config->database, where, MAX_ROWS);
     22        psArray *images = p2PendingImfileSelectRowObjects (config->dbh, where, MAX_ROWS);
    2323        if (images->n != exposure->imfiles) {
    2424            // free things
     
    2828        // XXX add P2 stats here?
    2929//      exposure->state = PX_MODE_DONE;
    30 //      p2PendingExposureUpdateRows (config->database, exposure);
     30//      p2PendingExposureUpdateRows (config->dbh, exposure);
    3131    }
    3232    return true;
  • trunk/ippTools/src/pxadminConfig.c

    r6261 r6341  
    7373
    7474    // define Database handle, if used
    75     config->database = pmConfigDB(config->site);
     75    config->dbh = pmConfigDB(config->site);
    7676    return true;
    7777}
  • trunk/ippTools/src/pxconfig.c

    r6339 r6341  
    1616    config->camera_name     = NULL;
    1717    config->filter          = NULL;
    18     config->database        = NULL;
     18    config->dbh        = NULL;
    1919    config->site            = NULL;
    2020    config->recipe          = NULL;
     
    3737    psFree(config->camera_name);
    3838    psFree(config->filter);
    39     psFree(config->database);
     39    psFree(config->dbh);
    4040    psFree(config->site);
    4141    psFree(config->recipe);
  • trunk/ippTools/src/pxframes.c

    r6337 r6341  
    7979    PS_ASSERT_PTR_NON_NULL(config, NULL); \
    8080 \
    81     psArray *exposures = exptype##SelectRowObjects(config->database, \
     81    psArray *exposures = exptype##SelectRowObjects(config->dbh, \
    8282        config->where, MAX_ROWS); \
    8383    if (!exposures) { \
     
    9797            exposure->exp_id); \
    9898 \
    99         psArray *images = imfiletype##SelectRowObjects(config->database, where, \
     99        psArray *images = imfiletype##SelectRowObjects(config->dbh, where, \
    100100            MAX_ROWS); \
    101101        psFree(where); \
     
    155155{
    156156    PS_ASSERT_PTR_NON_NULL(config, false);
    157     PS_ASSERT_PTR_NON_NULL(config->database, false);
     157    PS_ASSERT_PTR_NON_NULL(config->dbh, false);
    158158    PS_ASSERT_PTR_NON_NULL(frame, false);
    159159
    160     psDB *dbh = config->database;
     160    psDB *dbh = config->dbh;
    161161
    162162    if (!rawScienceExpInsertObject(dbh, frame->exposure)) {
    163         psError(PS_ERR_UNKNOWN, false, "database access failed");
     163        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    164164        return false;
    165165    }
     
    168168    for (long i = 0; i < images->n; i++) {
    169169        if (!rawImfileInsertObject(dbh, images->data[i])) {
    170             psError(PS_ERR_UNKNOWN, false, "database access failed");
     170            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    171171            return false;
    172172        }
     
    214214{
    215215    PS_ASSERT_PTR_NON_NULL(config, false);
    216     PS_ASSERT_PTR_NON_NULL(config->database, false);
     216    PS_ASSERT_PTR_NON_NULL(config->dbh, false);
    217217    PS_ASSERT_PTR_NON_NULL(frame, false);
    218218
    219     psDB *dbh = config->database;
     219    psDB *dbh = config->dbh;
    220220
    221221    if (!rawDetrendExpInsertObject(dbh, frame->exposure)) {
    222         psError(PS_ERR_UNKNOWN, false, "database access failed");
     222        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    223223        return false;
    224224    }
     
    227227    for (long i = 0; i < images->n; i++) {
    228228        if (!rawImfileInsertObject(dbh, images->data[i])) {
    229             psError(PS_ERR_UNKNOWN, false, "database access failed");
     229            psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    230230            return false;
    231231        }
  • trunk/ippTools/src/pxtables.c

    r6336 r6341  
    66    PS_ASSERT_PTR_NON_NULL(config, false);
    77
    8     if (!newExpCreateTable(config->database)) {
    9         psError(PS_ERR_UNKNOWN, false, "database access failed");
     8    if (!newExpCreateTable(config->dbh)) {
     9        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    1010        status = false;
    1111    }
    12     if (!newImfileCreateTable(config->database)) {
    13         psError(PS_ERR_UNKNOWN, false, "database access failed");
     12    if (!newImfileCreateTable(config->dbh)) {
     13        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    1414        status = false;
    1515    }
    16     if (!rawScienceExpCreateTable(config->database)) {
    17         psError(PS_ERR_UNKNOWN, false, "database access failed");
     16    if (!rawScienceExpCreateTable(config->dbh)) {
     17        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    1818        status = false;
    1919    }
    20     if (!rawImfileCreateTable(config->database)) {
    21         psError(PS_ERR_UNKNOWN, false, "database access failed");
     20    if (!rawImfileCreateTable(config->dbh)) {
     21        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    2222        status = false;
    2323    }
    24     if (!rawDetrendExpCreateTable(config->database)) {
    25         psError(PS_ERR_UNKNOWN, false, "database access failed");
     24    if (!rawDetrendExpCreateTable(config->dbh)) {
     25        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    2626        status = false;
    2727    }
    28     if (!p1PendingExpCreateTable(config->database)) {
    29         psError(PS_ERR_UNKNOWN, false, "database access failed");
     28    if (!p1PendingExpCreateTable(config->dbh)) {
     29        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    3030        status = false;
    3131    }
    32     if (!p2PendingExpCreateTable(config->database)) {
    33         psError(PS_ERR_UNKNOWN, false, "database access failed");
     32    if (!p2PendingExpCreateTable(config->dbh)) {
     33        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    3434        status = false;
    3535    }
    36     if (!p2PendingImfileCreateTable(config->database)) {
    37         psError(PS_ERR_UNKNOWN, false, "database access failed");
     36    if (!p2PendingImfileCreateTable(config->dbh)) {
     37        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    3838        status = false;
    3939    }
    40     if (!p2DoneExpCreateTable(config->database)) {
    41         psError(PS_ERR_UNKNOWN, false, "database access failed");
     40    if (!p2DoneExpCreateTable(config->dbh)) {
     41        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    4242        status = false;
    4343    }
    44     if (!p2DoneImfileCreateTable(config->database)) {
    45         psError(PS_ERR_UNKNOWN, false, "database access failed");
     44    if (!p2DoneImfileCreateTable(config->dbh)) {
     45        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    4646        status = false;
    4747    }
    48     if (!p3PendingExpCreateTable(config->database)) {
    49         psError(PS_ERR_UNKNOWN, false, "database access failed");
     48    if (!p3PendingExpCreateTable(config->dbh)) {
     49        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    5050        status = false;
    5151    }
    52     if (!masterDetrendFramesCreateTable(config->database)) {
    53         psError(PS_ERR_UNKNOWN, false, "database access failed");
     52    if (!masterDetrendFramesCreateTable(config->dbh)) {
     53        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    5454        status = false;
    5555    }
    56     if (!masterDetrendImfileCreateTable(config->database)) {
    57         psError(PS_ERR_UNKNOWN, false, "database access failed");
     56    if (!masterDetrendImfileCreateTable(config->dbh)) {
     57        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    5858        status = false;
    5959    }
     
    7777    if (strcmp (answer, "YES")) goto escape;
    7878
    79     fprintf (stdout, "enter database connection password: ");
     79    fprintf (stdout, "enter dbh connection password: ");
    8080    fgets (line, 128, stdin);
    8181    sscanf (line, "%s", answer);
     
    8888    }
    8989
    90     if (!newExpDropTable(config->database)) {
    91         psError(PS_ERR_UNKNOWN, false, "database access failed");
     90    if (!newExpDropTable(config->dbh)) {
     91        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    9292        status = false;
    9393    }
    94     if (!newImfileDropTable(config->database)) {
    95         psError(PS_ERR_UNKNOWN, false, "database access failed");
     94    if (!newImfileDropTable(config->dbh)) {
     95        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    9696        status = false;
    9797    }
    98     if (!rawScienceExpDropTable(config->database)) {
    99         psError(PS_ERR_UNKNOWN, false, "database access failed");
     98    if (!rawScienceExpDropTable(config->dbh)) {
     99        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    100100        status = false;
    101101    }
    102     if (!rawImfileDropTable(config->database)) {
    103         psError(PS_ERR_UNKNOWN, false, "database access failed");
     102    if (!rawImfileDropTable(config->dbh)) {
     103        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    104104        status = false;
    105105    }
    106     if (!rawDetrendExpDropTable(config->database)) {
    107         psError(PS_ERR_UNKNOWN, false, "database access failed");
     106    if (!rawDetrendExpDropTable(config->dbh)) {
     107        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    108108        status = false;
    109109    }
    110     if (!p1PendingExpDropTable(config->database)) {
    111         psError(PS_ERR_UNKNOWN, false, "database access failed");
     110    if (!p1PendingExpDropTable(config->dbh)) {
     111        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    112112        status = false;
    113113    }
    114     if (!p2PendingExpDropTable(config->database)) {
    115         psError(PS_ERR_UNKNOWN, false, "database access failed");
     114    if (!p2PendingExpDropTable(config->dbh)) {
     115        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    116116        status = false;
    117117    }
    118     if (!p2PendingImfileDropTable(config->database)) {
    119         psError(PS_ERR_UNKNOWN, false, "database access failed");
     118    if (!p2PendingImfileDropTable(config->dbh)) {
     119        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    120120        status = false;
    121121    }
    122     if (!p2DoneExpDropTable(config->database)) {
    123         psError(PS_ERR_UNKNOWN, false, "database access failed");
     122    if (!p2DoneExpDropTable(config->dbh)) {
     123        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    124124        status = false;
    125125    }
    126     if (!p2DoneImfileDropTable(config->database)) {
    127         psError(PS_ERR_UNKNOWN, false, "database access failed");
     126    if (!p2DoneImfileDropTable(config->dbh)) {
     127        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    128128        status = false;
    129129    }
    130     if (!p3PendingExpDropTable(config->database)) {
    131         psError(PS_ERR_UNKNOWN, false, "database access failed");
     130    if (!p3PendingExpDropTable(config->dbh)) {
     131        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    132132        status = false;
    133133    }
    134     if (!masterDetrendFramesDropTable(config->database)) {
    135         psError(PS_ERR_UNKNOWN, false, "database access failed");
     134    if (!masterDetrendFramesDropTable(config->dbh)) {
     135        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    136136        status = false;
    137137    }
    138     if (!masterDetrendImfileDropTable(config->database)) {
    139         psError(PS_ERR_UNKNOWN, false, "database access failed");
     138    if (!masterDetrendImfileDropTable(config->dbh)) {
     139        psError(PS_ERR_UNKNOWN, false, "dbh access failed");
    140140        status = false;
    141141    }
  • trunk/ippTools/src/pxtools.h

    r6338 r6341  
    3636    char *camera_name;
    3737    char *filter;
    38     psDB *database;
     38    psDB *dbh;
    3939    psMetadata *site;
    4040    psMetadata *recipe;
  • trunk/ippTools/src/regtool.c

    r6338 r6341  
    8686            psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, NULL,
    8787                newFrame->exposure->camera);
    88             psArray *configs = p0CameraConfigSelectRowObjects(config->database, where, MAX_ROWS);
     88            psArray *configs = p0CameraConfigSelectRowObjects(config->dbh, where, MAX_ROWS);
    8989            psFree(where);
    9090            // if there is no match then we default to sending into into p2
     
    9494                    newFrame->exposure
    9595                );
    96                 p2PendingExpInsertObject(config->database, p2PendingExp);
     96                p2PendingExpInsertObject(config->dbh, p2PendingExp);
    9797                psFree(p2PendingExp);
    9898                continue;
     
    108108                        newFrame->exposure
    109109                    );
    110                     p1PendingExpInsertObject(config->database, p1PendingExp);
     110                    p1PendingExpInsertObject(config->dbh, p1PendingExp);
    111111                    psFree(p1PendingExp);
    112112                }
     
    118118                        newFrame->exposure
    119119                    );
    120                     p2PendingExpInsertObject(config->database, p2PendingExp);
     120                    p2PendingExpInsertObject(config->dbh, p2PendingExp);
    121121                    psFree(p2PendingExp);
    122122                }
  • trunk/ippTools/src/regtoolConfig.c

    r6340 r6341  
    136136
    137137    // define Database handle, if used
    138     config->database = pmConfigDB(config->site);
     138    config->dbh = pmConfigDB(config->site);
    139139
    140140    return true;
Note: See TracChangeset for help on using the changeset viewer.