Which two SOQL queries performed are safe from SOQL injections?

Assuming that ‘name; is a String obtained by an <apex:inputText> tag on a Visualforce page.

Which two SOQL queries performed are safe from SOQL injections? Choose 2 answers
A . String query = ‘SELECT Id FROM Account WHERE Name LIKE ”%’ + name.noQuotes() + ‘%”;
List<Account> results = Database.query(query);
B . String query = ‘SELECT Id FROM Account WHERE Name LIKE ”%’ + String.escapeSingleQuotes(name) + ‘%”;
List<Account> results = Database.query(query);

C . String query = ‘SELECT Id FROM Account WHERE Name LIKE ”%’ + name + ‘%”; List<Account> results = Database.query(query);
D . String query = ‘%’ + name + ‘%’;
List<Account> results = [SELECT Id FROM Account WHERE Name LIKE :query];

Answer: B,D

Latest PDI Dumps Valid Version with 191 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments