| 1106 | // |
| 1107 | |
| 1108 | static act* act_alter_database() |
| 1109 | { |
| 1110 | gpre_req* request = MSC_request(REQ_ddl); |
| 1111 | if (gpreGlob.isc_databases && !gpreGlob.isc_databases->dbb_next) |
| 1112 | request->req_database = gpreGlob.isc_databases; |
| 1113 | else |
| 1114 | PAR_error("Can only alter database in context of single database"); |
| 1115 | |
| 1116 | PAR_get_token(); |
| 1117 | |
| 1118 | // create action block |
| 1119 | act* action = MSC_action(request, ACT_alter_database); |
| 1120 | action->act_whenever = gen_whenever(); |
| 1121 | gpre_dbb* database = (gpre_dbb*) MSC_alloc(DBB_LEN); |
| 1122 | action->act_object = (ref*) database; |
| 1123 | |
| 1124 | bool logdefined = false; // this var was undefined |
| 1125 | |
| 1126 | while (true) |
| 1127 | { |
| 1128 | if (MSC_match(KW_DROP)) |
| 1129 | { |
| 1130 | if (MSC_match(KW_LOG_FILE)) |
| 1131 | ; // ignore DROP LOG database->dbb_flags |= DBB_drop_log; |
| 1132 | else if (MSC_match(KW_CASCADE)) |
| 1133 | ; // ignore DROP CASCADE database->dbb_flags |= DBB_cascade; |
| 1134 | else |
| 1135 | PAR_error("only log file can be dropped"); |
| 1136 | } |
| 1137 | else if (MSC_match(KW_ADD)) |
| 1138 | { |
| 1139 | if (MSC_match(KW_FILE)) |
| 1140 | { |
| 1141 | do { |
| 1142 | gpre_file* file = define_file(); |
| 1143 | file->fil_next = database->dbb_files; |
| 1144 | database->dbb_files = file; |
| 1145 | } while (MSC_match(KW_FILE)); |
| 1146 | } |
| 1147 | else if (MSC_match(KW_LOG_FILE)) |
| 1148 | { |
| 1149 | if (logdefined) |
| 1150 | PAR_error("log redefinition"); |
| 1151 | logdefined = true; |
| 1152 | if (MSC_match(KW_LEFT_PAREN)) |
| 1153 | { |
| 1154 | while (true) |
| 1155 | { |
| 1156 | gpre_file* logfile = define_log_file(); |
| 1157 | logfile->fil_next = database->dbb_logfiles; |
| 1158 | database->dbb_logfiles = logfile; |
| 1159 | if (!MSC_match(KW_COMMA)) |
| 1160 | { |
| 1161 | EXP_match_paren(); |
| 1162 | break; |
| 1163 | } |
| 1164 | } |
| 1165 |
no test coverage detected