MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / _db_explain_

Function _db_explain_

dbug/dbug.c:1124–1164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1122 } while (0)
1123
1124int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
1125{
1126 char *start=buf, *end=buf+len-4;
1127
1128 get_code_state_if_not_set_or_return *buf=0;
1129
1130 read_lock_stack(cs);
1131
1132 op_list_to_buf('d', cs->stack->keywords, DEBUGGING);
1133 op_int_to_buf ('D', cs->stack->delay, 0);
1134 op_list_to_buf('f', cs->stack->functions, cs->stack->functions);
1135 op_bool_to_buf('F', cs->stack->flags & FILE_ON);
1136 op_bool_to_buf('i', cs->stack->flags & PID_ON);
1137 op_list_to_buf('g', cs->stack->p_functions, PROFILING);
1138 op_bool_to_buf('L', cs->stack->flags & LINE_ON);
1139 op_bool_to_buf('n', cs->stack->flags & DEPTH_ON);
1140 op_bool_to_buf('N', cs->stack->flags & NUMBER_ON);
1141 op_str_to_buf(
1142 ((cs->stack->flags & FLUSH_ON_WRITE ? 0 : 32) |
1143 (cs->stack->flags & OPEN_APPEND ? 'A' : 'O')),
1144 cs->stack->name, cs->stack->out_file != stderr);
1145 op_list_to_buf('p', cs->stack->processes, cs->stack->processes);
1146 op_bool_to_buf('P', cs->stack->flags & PROCESS_ON);
1147 op_bool_to_buf('r', cs->stack->sub_level != 0);
1148 op_intf_to_buf('t', cs->stack->maxdepth, MAXDEPTH, TRACING);
1149 op_bool_to_buf('T', cs->stack->flags & TIMESTAMP_ON);
1150
1151 unlock_stack(cs);
1152
1153 *buf= '\0';
1154 return 0;
1155
1156overflow:
1157 *end++= '.';
1158 *end++= '.';
1159 *end++= '.';
1160 *end= '\0';
1161
1162 unlock_stack(cs);
1163 return 1;
1164}
1165
1166#undef char_to_buf
1167#undef str_to_buf

Callers 1

_db_explain_init_Function · 0.85

Calls 2

read_lock_stackFunction · 0.85
unlock_stackFunction · 0.85

Tested by

no test coverage detected