Avoid raw SQL queries in Maintenance::purgeRedundantText()

Instead use DatabaseBase::select() and DatabaseBase::delete().

Change-Id: I03d007e21c6be5aaa92830807de25990aef2ba03
Merge "Avoid raw SQL queries in Maintenance::purgeRedundantText()"