From: Neil T. <nt...@us...> - 2006-08-26 12:25:37
|
Update of /cvsroot/pgsqlformac/pgCocoaDB/UnitTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28029/UnitTest Modified Files: pgCocoaDBSchemaTest.m Log Message: Add some comments and reformat functions. Index: pgCocoaDBSchemaTest.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/UnitTest/pgCocoaDBSchemaTest.m,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pgCocoaDBSchemaTest.m 19 Aug 2006 12:06:48 -0000 1.14 --- pgCocoaDBSchemaTest.m 26 Aug 2006 12:25:33 -0000 1.15 *************** *** 134,155 **** STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); ! // TODO check if function exists ! sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, "create_time_stamp() RETURNS trigger AS $time_stamp$ \ ! BEGIN \ ! NEW.create_time := current_timestamp; \ ! RETURN NEW; \ ! END; \ ! $time_stamp$ LANGUAGE plpgsql; "]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); - // TODO check if function exists sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "update_time_stamp() RETURNS trigger AS $time_stamp$ \ ! BEGIN \ ! NEW.update_time := current_timestamp; \ ! RETURN NEW; \ ! END; \ ! $time_stamp$ LANGUAGE plpgsql; "]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); --- 134,154 ---- STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); ! sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "create_time_stamp() RETURNS trigger AS $time_stamp$\n\ ! BEGIN\n\ ! NEW.create_time := current_timestamp;\n\ ! RETURN NEW;\n\ ! END;\n\ ! $time_stamp$ LANGUAGE plpgsql;\n"]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "update_time_stamp() RETURNS trigger AS $time_stamp$\n\ ! BEGIN\n\ ! NEW.update_time := current_timestamp;\n\ ! RETURN NEW;\n\ ! END;\n\ ! $time_stamp$ LANGUAGE plpgsql;\n"]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); *************** *** 157,161 **** // for testing query tool sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "sum_n_product(x int, y int, OUT sum int, OUT prod int) AS $$\nBEGIN\n sum := x + y;\n prod := x * y;\nEND; $$ LANGUAGE plpgsql; "]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); --- 156,160 ---- // for testing query tool sql = [NSString stringWithFormat:@"%s%@.%@.%s", "CREATE or REPLACE FUNCTION ", PGCocoaTestDatabase, PGCocoaTestSchema, ! "sum_n_product(x int, y int, OUT sum int, OUT prod int) AS $$\nBEGIN\n sum := x + y;\n prod := x * y;\nEND;\n$$ LANGUAGE plpgsql;\n"]; [conn execQuery:sql]; STAssertTrue([conn errorDescription] == nil, @"Error executing SQL: %@. %@", sql, [conn errorDescription]); |