Question: bool run_query (sqlite3* db, const std :: string & sql, std :: vector < user_record >& records) { // clear any prior results records.clear(); char

  bool run_query(sqlite3* db, const std::string& sql, std::vector< user_record >& records) {  // clear any prior results  records.clear();  char* error_message;  if(sqlite3_exec(db, sql.c_str(), callback, &records, &error_message) != SQLITE_OK)  {   std::cout << "Data failed to be queried from USERS table. ERROR = " << error_message << std::endl;   sqlite3_free(error_message);   return false;  }  return true; } 

How do I edit this code to exit with an error if there is an SQL injection?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!