Commit 5152b380 authored by François Cartegnie's avatar François Cartegnie 🤞
Browse files

sql_lite: If query is not a LIKE % search use = .

Sqlite can't make use of indexes on LIKE queries.
It always results in a full table scan.
parent c60b89f4
......@@ -887,7 +887,8 @@ case casestr: \
assert( tree->comp == ML_COMP_HAS || tree->comp == ML_COMP_EQUAL \
|| tree->comp == ML_COMP_STARTS_WITH \
|| tree->comp == ML_COMP_ENDS_WITH ); \
*ppsz_where = sql_Printf( p_ml->p_sys->p_sql, "%s LIKE '%s%q%s'", fmt, \
*ppsz_where = sql_Printf( p_ml->p_sys->p_sql, "%s %s '%s%q%s'", fmt, \
(ML_COMP_EQUAL)?"=":"LIKE", \
tree->comp == ML_COMP_HAS \
|| tree->comp == ML_COMP_STARTS_WITH? "%%" : "", \
tree->value.str, \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment