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

Function is_like_pre

sqladvisor/main.cc:1112–1132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1110}
1111
1112bool is_like_pre(char * field_ptr) {
1113 bool meet_space = false;
1114 char *substr = strdup(" LIKE");
1115 char *s = strcasestr(field_ptr, substr);
1116 if (s != NULL) {
1117 int i;
1118 for (i = 0; i < strlen(s); i++) {
1119 if (!meet_space) {
1120 if (s[i] == ' ' && i > 0) {
1121 meet_space = true;
1122 }
1123 } else {
1124 if (s[i] != ' ') {
1125 return s[i + 1] == '%' ? true : false;
1126 }
1127 }
1128 }
1129 }
1130 if(substr) free(substr);
1131 return false;
1132}
1133
1134bool is_not_tmp_table(TABLE_LIST * table){
1135 if (strcasecmp(table->db,"") == 0 && strcasecmp(table->table_name,"*") == 0){

Callers 1

mysql_sql_parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected