| 1949 | // |
| 1950 | |
| 1951 | static act* act_create_shadow() |
| 1952 | { |
| 1953 | gpre_req* request = MSC_request(REQ_ddl); |
| 1954 | if (gpreGlob.isc_databases && !gpreGlob.isc_databases->dbb_next) |
| 1955 | request->req_database = gpreGlob.isc_databases; |
| 1956 | else |
| 1957 | PAR_error("Can only CREATE SHADOW in context of single database"); |
| 1958 | |
| 1959 | act* action = MSC_action(request, ACT_create_shadow); |
| 1960 | action->act_whenever = gen_whenever(); |
| 1961 | const SLONG shadow_number = EXP_USHORT_ordinal(true); |
| 1962 | |
| 1963 | USHORT file_flags = 0; |
| 1964 | |
| 1965 | if (!range_positive_short_integer(shadow_number)) |
| 1966 | PAR_error("Shadow number out of range"); |
| 1967 | |
| 1968 | if (MSC_match(KW_MANUAL)) |
| 1969 | file_flags |= FIL_manual; |
| 1970 | else |
| 1971 | MSC_match(KW_AUTO); |
| 1972 | |
| 1973 | if (MSC_match(KW_CONDITIONAL)) |
| 1974 | file_flags |= FIL_conditional; |
| 1975 | |
| 1976 | gpre_file* file = define_file(); |
| 1977 | gpre_file* file_list = file; |
| 1978 | if (file->fil_start) |
| 1979 | PAR_error("Can not specify file start for first file"); |
| 1980 | |
| 1981 | SLONG length = file->fil_length; |
| 1982 | file->fil_flags = file_flags; |
| 1983 | file->fil_shadow_number = (SSHORT) shadow_number; |
| 1984 | |
| 1985 | while (MSC_match(KW_FILE)) |
| 1986 | { |
| 1987 | file = define_file(); |
| 1988 | if (!length && !file->fil_start) |
| 1989 | { |
| 1990 | TEXT err_string[1024]; |
| 1991 | sprintf(err_string, |
| 1992 | "Preceding file did not specify length, so %s must include starting page number", |
| 1993 | file->fil_name); |
| 1994 | PAR_error(err_string); |
| 1995 | } |
| 1996 | length = file->fil_length; |
| 1997 | file->fil_flags = file_flags; |
| 1998 | file->fil_next = file_list; |
| 1999 | file_list = file; |
| 2000 | } |
| 2001 | action->act_object = (ref*) file_list; |
| 2002 | return action; |
| 2003 | } |
| 2004 | |
| 2005 | |
| 2006 | //____________________________________________________________ |
no test coverage detected