MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / extract_sqlcache_hint

Function extract_sqlcache_hint

db/sql_stmt_cache.c:358–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

356}
357
358int extract_sqlcache_hint(const char *sql, char *hint, int hintlen)
359{
360 const char *start = NULL;
361 const char *end = NULL;
362 int length;
363 int ret;
364
365 ret = has_sqlcache_hint(sql, &start, &end);
366
367 if (ret) {
368 length = end - start;
369 if (length >= hintlen) {
370 logmsg(LOGMSG_WARN, "Query has very long hint! \"%s\"\n", sql);
371 length = hintlen - 1;
372 }
373 strncpy(hint, start, length);
374 hint[length] = '\0';
375 }
376 return ret;
377}
378
379static int find_sql_hint_table(char *sql_hint, char **sql_str, void **dta,
380 int *dta_sz)

Callers 1

stmt_cache_getFunction · 0.85

Calls 1

logmsgFunction · 0.50

Tested by

no test coverage detected