BEGIN; SELECT plan(4); ---------------------------------- -- Setup Test environment and data ---------------------------------- -- create bib 70,000 INSERT into biblio.record_entry (id, marc, last_xact_id) VALUES (70000, $$ 00934|jm a2200241 a 450003-000374519991118131708.0971016n nyuuuu eng 4539Bartók, Béla,1881-1945.Concertos,piano,no. 1,Sz. 83(1926) Concertos,piano,no. 1,Sz. 83,(1926)Piano concerto no. 1 (1926) ; Rhapsody, op. 1 (1904)New York, NY :Vox $$, 'PGTAP' ); ----------------------------------- -- Test biblio.set_record_status_in_leader() ----------------------------------- -- initially the status is undefined so now it should be 'n' SELECT is((SELECT SUBSTR(ARRAY_TO_STRING(oils_xpath('//*[local-name()="leader"]/text()',marc),''),6,1) FROM biblio.record_entry WHERE id = 70000), 'n', 'Record is marked new.'); -- check to see if it sets to 'c' correctly upon editing UPDATE biblio.record_entry SET marc = REPLACE(marc,'piano','dydraulophone') WHERE id = 70000; SELECT is((SELECT SUBSTR(ARRAY_TO_STRING(oils_xpath('//*[local-name()="leader"]/text()',marc),''),6,1) FROM biblio.record_entry WHERE id = 70000), 'c', 'Record is marked updated.'); -- see if the record correctly marks as deleted 'd' UPDATE biblio.record_entry SET deleted = TRUE WHERE id = 70000; SELECT is((SELECT SUBSTR(ARRAY_TO_STRING(oils_xpath('//*[local-name()="leader"]/text()',marc),''),6,1) FROM biblio.record_entry WHERE id = 70000), 'd', 'Record is marked deleted.'); -- see if the record is correctly set to 'c' when undeleted UPDATE biblio.record_entry SET deleted = FALSE WHERE id = 70000; SELECT is((SELECT SUBSTR(ARRAY_TO_STRING(oils_xpath('//*[local-name()="leader"]/text()',marc),''),6,1) FROM biblio.record_entry WHERE id = 70000), 'c', 'Record is marked updated.'); SELECT * FROM finish(); ROLLBACK;