Changeset 4272
- Timestamp:
- Jun 15, 2005, 9:53:05 AM (21 years ago)
- Location:
- trunk/psLib/test/dataIO
- Files:
-
- 2 edited
-
tst_psDB.c (modified) (5 diffs)
-
verified/tst_psDB.stderr (modified) (2 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 -
trunk/psLib/test/dataIO/verified/tst_psDB.stderr
r4270 r4272 59 59 60 60 <DATE><TIME>|<HOST>|I|TPDBDropTable 61 psDBDropTable shall create/drop a new table in the new test database.62 <DATE><TIME>|<HOST>|I|TPDBDropTable63 61 psDBDropTable: insert should fail here... 64 62 <DATE><TIME>|<HOST>|E|psDBInsertRows (FILE:LINENO) … … 66 64 <DATE><TIME>|<HOST>|E|psDBInsertOneRow (FILE:LINENO) 67 65 Insert failed. 66 <DATE><TIME>|<HOST>|I|TPDBDropTable 67 Following should generate an error message for NULL database object 68 <DATE><TIME>|<HOST>|E|p_psDBRunQuery (FILE:LINENO) 69 Invalid psDB has been specified. 70 <DATE><TIME>|<HOST>|E|psDBDropTable (FILE:LINENO) 71 Failed to drop table. 72 <DATE><TIME>|<HOST>|I|TPDBDropTable 73 Following should generate an error message for invalid table 74 <DATE><TIME>|<HOST>|E|p_psDBRunQuery (FILE:LINENO) 75 Failed to execute SQL query. Error: Unknown table 'table99' 76 <DATE><TIME>|<HOST>|E|psDBDropTable (FILE:LINENO) 77 Failed to drop table. 78 <DATE><TIME>|<HOST>|I|TPDBDropTable 79 Following should generate an error message for NULL table 80 <DATE><TIME>|<HOST>|E|p_psDBRunQuery (FILE:LINENO) 81 Failed to execute SQL query. Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(null)' at line 1 82 <DATE><TIME>|<HOST>|E|psDBDropTable (FILE:LINENO) 83 Failed to drop table. 68 84 69 85 ---> TESTPOINT PASSED (psDB{dbDropTable} | tst_psDB.c)
Note:
See TracChangeset
for help on using the changeset viewer.
