MCPcopy Create free account
hub / github.com/MariaDB/server / get_create_event

Method get_create_event

sql/event_data_objects.cc:1205–1266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203*/
1204
1205int
1206Event_timed::get_create_event(THD *thd, String *buf)
1207{
1208 char tmp_buf[2 * STRING_BUFFER_USUAL_SIZE];
1209 String expr_buf(tmp_buf, sizeof(tmp_buf), system_charset_info);
1210 expr_buf.length(0);
1211
1212 DBUG_ENTER("get_create_event");
1213 DBUG_PRINT("ret_info",("body_len=[%d]body=[%s]",
1214 (int) body.length, body.str));
1215
1216 if (expression && Events::reconstruct_interval_expression(&expr_buf, interval,
1217 expression))
1218 DBUG_RETURN(EVEX_MICROSECOND_UNSUP);
1219
1220 buf->append(STRING_WITH_LEN("CREATE "));
1221 append_definer(thd, buf, &definer_user, &definer_host);
1222 buf->append(STRING_WITH_LEN("EVENT "));
1223 append_identifier(thd, buf, &name);
1224
1225 if (expression)
1226 {
1227 buf->append(STRING_WITH_LEN(" ON SCHEDULE EVERY "));
1228 buf->append(expr_buf);
1229 buf->append(' ');
1230 LEX_CSTRING *ival= &interval_type_to_name[interval];
1231 buf->append(ival->str, ival->length);
1232
1233 if (!starts_null)
1234 append_datetime(buf, time_zone, starts, STRING_WITH_LEN("STARTS"));
1235
1236 if (!ends_null)
1237 append_datetime(buf, time_zone, ends, STRING_WITH_LEN("ENDS"));
1238 }
1239 else
1240 {
1241 append_datetime(buf, time_zone, execute_at,
1242 STRING_WITH_LEN("ON SCHEDULE AT"));
1243 }
1244
1245 if (on_completion == Event_parse_data::ON_COMPLETION_DROP)
1246 buf->append(STRING_WITH_LEN(" ON COMPLETION NOT PRESERVE "));
1247 else
1248 buf->append(STRING_WITH_LEN(" ON COMPLETION PRESERVE "));
1249
1250 if (status == Event_parse_data::ENABLED)
1251 buf->append(STRING_WITH_LEN("ENABLE"));
1252 else if (status == Event_parse_data::SLAVESIDE_DISABLED)
1253 buf->append(STRING_WITH_LEN("DISABLE ON SLAVE"));
1254 else
1255 buf->append(STRING_WITH_LEN("DISABLE"));
1256
1257 if (comment.length)
1258 {
1259 buf->append(STRING_WITH_LEN(" COMMENT "));
1260 append_unescaped(buf, comment.str, comment.length);
1261 }
1262 buf->append(STRING_WITH_LEN(" DO "));

Callers 1

send_show_create_eventFunction · 0.80

Calls 6

append_definerFunction · 0.85
append_datetimeFunction · 0.85
append_unescapedFunction · 0.85
append_identifierFunction · 0.70
lengthMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected