Which two queries can a developer use in a visualforce controller to - ProProfs Discuss
Cancel
TopicsDown
Products Down
Follow Us:
FacebookTwitter
Advertisement

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: Sep 25, 2020

+ Answer
Request
Question menu
Vote up Vote down 2

4 Answers

skystorm1204

skystorm

skystorm1204
Skystorm

Answered Jan 21, 2020

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

upvote downvote
Reply 

sangeeta.sep

sangeeta.sep

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);

upvote downvote
Reply 

Yamini

Yamini

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);

upvote downvote
Reply 

csouza718

csouza

csouza718
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);
upvote downvote
Reply 

Advertisement
Advertisement
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader
Image Preview
Search for Google images Google Image Icon
Select a recommended image
Upload from your computer Loader

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