Changeset 4272 for trunk/psLib/test/dataIO/tst_psDB.c
- Timestamp:
- Jun 15, 2005, 9:53:05 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/dataIO/tst_psDB.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/dataIO/tst_psDB.c
r4270 r4272 9 9 * @author Aaron Culliney, MHPCC 10 10 * 11 * @version $Revision: 1.1 5$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-06-15 03:20:36$11 * @version $Revision: 1.16 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-06-15 19:53:05 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 73 73 {TPDBChange, 842, "dbChange", 0, false}, 74 74 {TPDBCreateTable, 843, "dbCreateTable", 0, false}, 75 {TPDBDropTable, -4, "dbDropTable", 0, false},75 {TPDBDropTable, 844, "dbDropTable", 0, false}, 76 76 {TPDBSelectColumn, -5, "dbSelectColumn", 0, false}, 77 77 {TPDBSelectColumnNum, -6, "dbSelectColumnNum", 0, false}, … … 405 405 } 406 406 407 // Testpoint # XXX, psDBDropTable shall create tables in the test database ...407 // Testpoint #844, psDBDropTable shall remove tables in the test database ... 408 408 psS32 TPDBDropTable( void ) 409 409 { … … 411 411 psDB *dbh = NULL; 412 412 const char* table = "table2"; 413 414 // Create table definition metadata 413 415 psMetadata *row=NULL, *md = _get_CreateTableMetadata(); 414 416 415 dbh = _init_psDB(); 416 if (dbh == NULL) { 417 return 1; 418 } 419 420 psLogMsg( __func__, PS_LOG_INFO, "psDBDropTable shall create/drop a new table in the new test database.\n" ); 421 417 // Initialize database connection 418 dbh = _init_psDB(); 419 if (dbh == NULL) { 420 psError(PS_ERR_UNKNOWN,true,"Did not expect NULL return to initialize database"); 421 return 1; 422 } 423 424 // Create table in database 422 425 failed = ! psDBCreateTable(dbh, table, md); 423 426 if (!failed) { 427 428 // Drop table with valid arguments 424 429 failed = ! psDBDropTable(dbh, table); 425 430 426 // insert should fail ...431 // insert should fail since the table has been drop from database 427 432 psLogMsg( __func__, PS_LOG_INFO, "psDBDropTable: insert should fail here...\n" ); 428 433 row = _get_row(); … … 432 437 } 433 438 psFree(row); 439 } 440 441 // Attempt to drop table from NULL psDB object 442 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL database object"); 443 if(psDBDropTable(NULL,table)) { 444 psError(PS_ERR_UNKNOWN,true,"Did not return false as expected for NULL database object"); 445 return 2; 446 } 447 448 // Attempt to drop table from valid psDB but invalid table 449 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for invalid table"); 450 if(psDBDropTable(dbh,"table99")) { 451 psError(PS_ERR_UNKNOWN,true,"Did not return false as expected for invalid table"); 452 return 3; 453 } 454 455 // Attempt to drop table from valid psDB but NULL table 456 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL table"); 457 if(psDBDropTable(dbh,NULL)) { 458 psError(PS_ERR_UNKNOWN,true,"Did not return false as expected for NULL table"); 459 return 4; 434 460 } 435 461
Note:
See TracChangeset
for help on using the changeset viewer.
