-exact Search the block lists for exact domain matches
-all Return all query matches within a block list
-h, --help Show this help dialog"
@ -64,7 +63,6 @@ fi
if[["${options}"== *"-bp"* ]];then
exact="exact";blockpage=true
else
[["${options}"== *"-adlist"* ]]&&adlist=true
[["${options}"== *"-all"* ]]&&all=true
if[["${options}"== *"-exact"* ]];then
exact="exact";matchType="exact ${matchType}"
@ -99,10 +97,17 @@ scanDatabaseTable() {
# Underscores are SQLite wildcards matching exactly one character. We obviously want to suppress this
# behavior. The "ESCAPE '\'" clause specifies that an underscore preceded by an '\' should be matched
# as a literal underscore character. We pretreat the $domain variable accordingly to escape underscores.
case"${type}" in
"exact")querystr="SELECT domain FROM vw_${table} WHERE domain = '${domain}'";;
* )querystr="SELECT domain FROM vw_${table} WHERE domain LIKE '%${domain//_/\\_}%' ESCAPE '\\'";;
esac
if[["${table}"=="gravity"]];then
case"${type}" in
"exact")querystr="SELECT gravity.domain,adlist.address FROM gravity LEFT JOIN adlist ON adlist.id = gravity.adlist_id WHERE domain = '${domain}'";;
* )querystr="SELECT gravity.domain,adlist.address FROM gravity LEFT JOIN adlist ON adlist.id = gravity.adlist_id WHERE domain LIKE '%${domain//_/\\_}%' ESCAPE '\\'";;
esac
else
case"${type}" in
"exact")querystr="SELECT domain FROM ${table} WHERE domain = '${domain}'";;
* )querystr="SELECT domain FROM ${table} WHERE domain LIKE '%${domain//_/\\_}%' ESCAPE '\\'";;