| 1948 | |
| 1949 | |
| 1950 | bool VIO_erase(thread_db* tdbb, record_param* rpb, jrd_tra* transaction) |
| 1951 | { |
| 1952 | /************************************** |
| 1953 | * |
| 1954 | * V I O _ e r a s e |
| 1955 | * |
| 1956 | ************************************** |
| 1957 | * |
| 1958 | * Functional description |
| 1959 | * Erase an existing record. |
| 1960 | * |
| 1961 | * This routine is entered with an inactive |
| 1962 | * record_param and leaves having created an erased |
| 1963 | * stub. |
| 1964 | * |
| 1965 | **************************************/ |
| 1966 | MetaName object_name, package_name; |
| 1967 | |
| 1968 | SET_TDBB(tdbb); |
| 1969 | Request* request = tdbb->getRequest(); |
| 1970 | jrd_rel* relation = rpb->rpb_relation; |
| 1971 | |
| 1972 | #ifdef VIO_DEBUG |
| 1973 | VIO_trace(DEBUG_WRITES, |
| 1974 | "VIO_erase (rel_id %u, record_param %" QUADFORMAT"d, transaction %" SQUADFORMAT")\n", |
| 1975 | relation->rel_id, rpb->rpb_number.getValue(), transaction->tra_number); |
| 1976 | |
| 1977 | VIO_trace(DEBUG_WRITES_INFO, |
| 1978 | " record %" SLONGFORMAT":%d, rpb_trans %" SQUADFORMAT |
| 1979 | ", flags %d, back %" SLONGFORMAT":%d, fragment %" SLONGFORMAT":%d\n", |
| 1980 | rpb->rpb_page, rpb->rpb_line, rpb->rpb_transaction_nr, |
| 1981 | rpb->rpb_flags, rpb->rpb_b_page, rpb->rpb_b_line, |
| 1982 | rpb->rpb_f_page, rpb->rpb_f_line); |
| 1983 | |
| 1984 | #endif |
| 1985 | |
| 1986 | // If the stream was sorted, the various fields in the rpb are |
| 1987 | // probably junk. Just to make sure that everything is cool, refetch the record. |
| 1988 | |
| 1989 | if (rpb->rpb_runtime_flags & (RPB_refetch | RPB_undo_read)) |
| 1990 | { |
| 1991 | VIO_refetch_record(tdbb, rpb, transaction, false, true); |
| 1992 | rpb->rpb_runtime_flags &= ~RPB_refetch; |
| 1993 | fb_assert(!(rpb->rpb_runtime_flags & RPB_undo_read)); |
| 1994 | } |
| 1995 | |
| 1996 | // Special case system transaction |
| 1997 | |
| 1998 | if (transaction->tra_flags & TRA_system) |
| 1999 | { |
| 2000 | // hvlad: what if record was created\modified by user tx also, |
| 2001 | // i.e. if there is backversion ??? |
| 2002 | VIO_backout(tdbb, rpb, transaction); |
| 2003 | return true; |
| 2004 | } |
| 2005 | |
| 2006 | transaction->tra_flags |= TRA_write; |
| 2007 |
no test coverage detected