Changeset 3963
- Timestamp:
- May 18, 2005, 1:41:06 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataIO/tst_psDB.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataIO/tst_psDB.c
r3962 r3963 9 9 * @author Aaron Culliney, MHPCC 10 10 * 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 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 476 476 psS32 TPDBSelectRows( void ) 477 477 { 478 int i; 478 479 psS32 failed = 0; 479 480 psDB *dbh = NULL; 480 481 const char* table = "table5"; 481 psArray *ary =NULL;482 psArray *ary=NULL, *ary1=NULL, *ary2=NULL; 482 483 psMetadata *where=NULL, *row=NULL, *md = _get_CreateTableMetadata(); 483 484 psMetadataItem *item = NULL; … … 507 508 if (!failed) { 508 509 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 */ 510 512 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) { 524 516 failed = 1; 525 517 } 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); 527 534 } 528 529 psFree(ary);530 535 } 531 536 }
Note:
See TracChangeset
for help on using the changeset viewer.
