Which two queries can a developer use in a visualforce controller to - ProProfs Discuss
Topics
Products
Follow Us:

Which two queries can a developer use in a visualforce controller to protect against SOQL injection Vulnerabilities?



This question is part of Platform Dev I
Asked by Yamini, Last updated: Feb 21, 2020

+ Answer
Request
1

4 Answers

skystorm

Skystorm

Answered Jan 21, 2020

The correct answers are: String.escapeSingleQuotes(name) to escape potentially malicious text and using merge variables.

 

sangeeta.sep

Sangeeta.sep

Answered Sep 03, 2019

Correct Answer:

String qryName = '%' + String.escpaeSingleQuotes(name)+ '%'; String qryString = 'SELECT Id FROM Contact WHERE Name LIKE :qryNAme'; List queryResults = Database.query(qryString);

StringqryName = % + String.enforceSecurityChecks(name)+ % ; String qryString = SELECT Id FROM Contact WHERE Name LIKE :qryNAme ;ListqueryResults =Database.query(qryString);
String qryString = SELECT Id FROM Contact WHERE Name LIKE :qryNAme ; List queryResults = Database.query(qryString);

 

Yamini

Yamini

Answered Apr 06, 2019

  • B.

    String qryName = '%' + name '%'; String qryString = 'SELECT Id FROM Contact WHERE Name LIKE :qryNAme'; List queryResults = Database.query(qryString);

  • C.

    String qryName = '%' + String.escpaeSingleQuotes(name)+ '%'; String qryString = 'SELECT Id FROM Contact WHERE Name LIKE :qryNAme'; List queryResults = Database.query(qryString);

 

csouza

Csouza

Answered Jan 31, 2019

String qryName = % + String.enforceSecurityChecks(name)+ % ; String qryString = SELECT Id FROM Contact WHERE Name LIKE :qryNAme ; List queryResults = Database.query(qryString);
String qryString = SELECT Id FROM Contact WHERE Name LIKE :qryNAme ; List queryResults = Database.query(qryString);
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.