[Tests] TestPurgeDocument now passes.

Extracted the parameter processing logic from RawSQL to method.
Added a call to that method to ExecSQL.