Where the sentence looks for everything if there is a `` '' character at the end
I am trying to run a simple command select
in sqlite3
and get weird result. I want to search for a column and display all rows that have a row dockerhosts
. But the result shows strings without dockerhosts
string in it.
For example search dockerhosts
:
sqlite> SELECT command FROM history WHERE command like '%dockerhosts%' ORDER BY id DESC limit 50;
git status
git add --all v1 v2
git status
If I remove s
from the end, I get what I need:
sqlite> SELECT command FROM history WHERE command like '%dockerhost%' ORDER BY id DESC limit 50;
git checkout -b hotfix/collapse-else-if-in-dockerhost
vi opt/dockerhosts/Docker
aws s3 cp dockerhosts.json s3://xxxxx/dockerhosts.json --profile dev
aws s3 cp dockerhosts.json s3://xxxxx/dockerhosts.json --profile dev
history | grep dockerhost | grep prod
history | grep dockerhosts.json
What am I missing?
source to share
I see a note here that there are custom limits for the LIKE pattern - sqlite.org/limits.html ... 10 seems pretty short, but it's possible that you are working.
The pattern matching algorithm used in the standard LIKE and GLOB SQLite implementations can perform O (N²) (where N is the number of characters in the pattern) for some pathological cases. To avoid denial of service attacks from attackers who may specify their own LIKE or GLOB patterns, the LIKE or GLOB pattern length is limited to SQLITE_MAX_LIKE_PATTERN_LENGTH bytes. the default for this limit is 50,000. A modern workstation can evaluate even pathological LIKE or GLOB patterns of 50,000 bytes relatively quickly. The denial of service issue only comes into play when the template length hits millions of bytes. however, since most useful LIKE or GLOB patterns are no more than a few tens of bytes in length,paranoid application developers may want to reduce this parameter by a few hundred if they know that external users can generate arbitrary templates.
The maximum length of a LIKE or GLOB pattern can be reduced at runtime using sqlite3_limit (db, SQLITE_LIMIT_LIKE_PATTERN_LENGTH, size).
source to share