Given the following query:
public List<Account> selectById(Set<String> names)
{
String query = 'SELECT Id, Name FROM Account WHERE Name IN :names ORDER BY Name';
List<Account> records = Database.query(query);
return records;
}
Should the names
collection be sanitized in the following query before it gets to the query?
for (String name : names)
{
name = String.escapeSingleQuotes(name);
}
Database.query()
to execute it?! You just made my day!!