IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3963


Ignore:
Timestamp:
May 18, 2005, 1:41:06 PM (21 years ago)
Author:
asc
Message:

test limit param for psDBSelectRows

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataIO/tst_psDB.c

    r3962 r3963  
    99 *  @author Aaron Culliney, MHPCC
    1010 *
    11  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-05-18 23:22:02 $
     11 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-18 23:41:06 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    476476psS32 TPDBSelectRows( void )
    477477{
     478    int i;
    478479    psS32 failed = 0;
    479480    psDB *dbh = NULL;
    480481    const char* table = "table5";
    481     psArray *ary = NULL;
     482    psArray *ary=NULL, *ary1=NULL, *ary2=NULL;
    482483    psMetadata *where=NULL, *row=NULL, *md = _get_CreateTableMetadata();
    483484    psMetadataItem *item = NULL;
     
    507508        if (!failed) {
    508509            where = _get_where();
    509             ary = psDBSelectRows(dbh, table, /*NULL*/where, 0);
     510            ary1 = psDBSelectRows(dbh, table, where, 0);
     511            ary2 = psDBSelectRows(dbh, table, where, 1); /* specify limit */
    510512            psFree(where);
    511             if (ary == NULL) {
    512                 failed = 1;
    513             } else {
    514                 row = (psMetadata*)psArrayGet(ary, 0);
    515                 _print_row(row);
    516 
    517                 item = psMetadataLookup(row, "key_s32");
    518                 if (item == NULL) {
    519                     psLogMsg( __func__, PS_LOG_INFO, "oops, key_s32 not found!\n" );
    520                     failed = 1;
    521                 } else if (item->data.S32 != S32_1) {
    522                     psLogMsg( __func__, PS_LOG_INFO, "oops, did not find expected output (%d vs %d)!\n",
    523                               item->data.S32,S32_1);
     513            for (i=0; i<2; i++) {
     514                ary = i ? ary2 : ary1;
     515                if (ary == NULL) {
    524516                    failed = 1;
    525517                } else {
    526                     psLogMsg( __func__, PS_LOG_INFO, "found expected output.\n" );
     518                    row = (psMetadata*)psArrayGet(ary, 0);
     519                    _print_row(row);
     520
     521                    item = psMetadataLookup(row, "key_s32");
     522                    if (item == NULL) {
     523                        psLogMsg( __func__, PS_LOG_INFO, "oops, key_s32 not found!\n" );
     524                        failed = 1;
     525                    } else if (item->data.S32 != S32_1) {
     526                        psLogMsg( __func__, PS_LOG_INFO, "oops, did not find expected output (%d vs %d)!\n",
     527                                  item->data.S32,S32_1);
     528                        failed = 1;
     529                    } else {
     530                        psLogMsg( __func__, PS_LOG_INFO, "found expected output.\n" );
     531                    }
     532
     533                    psFree(ary);
    527534                }
    528 
    529                 psFree(ary);
    530535            }
    531536        }
Note: See TracChangeset for help on using the changeset viewer.