I'm facing an issue on code scanning. The following code has second order error.
TestList = [SELECT Id, name, address FROM Object__c where Id IN: TestIddSet];
TestList is a list of the Object__c. TestIddSet is a set of ids
I made it into a dynamic query instead, because I found out that using escapeSingleQuotes passes code review.
String queryString = 'SELECT Id, name, address FROM Object__c where Id IN: TestIddSet';
TestList = database.query(String.escapeSingleQuotes(queryString));
Is this the correct approach?