How to use the mysql.client.escape function in mysql

To help you get started, we’ve selected a few mysql examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pita / primarywall / WallManager.js View on Github external
var wallJSON = JSON.parse(results[0].JSON);
        
        //there is no note, so we should try to access createdAt, if this doesn't exist too, set it to zero
        if(wallJSON.notes.length == 0)
        {
          lastEdit = wallJSON.createdAt ? wallJSON.createdAt : 0;
          callback("stop");
        }
        //Build the sql with all notes
        else
        {
          var sql = "SELECT JSON FROM `primarywall`.`note` WHERE ";
          
          for(var i=0;i
github Pita / primarywall / DomainManager.js View on Github external
function(callback){
            //build sql
            var sql = "SELECT * FROM `note` WHERE ";
            for(var i=0;i
github Pita / primarywall / DomainManager.js View on Github external
exports.getDomainWalls = function (domain, callback)
{
  var escapedDomain = client.escape(domain);
  escapedDomain = escapedDomain.substring(1,escapedDomain.length-1);

  client.query("SELECT wallID FROM `primarywall`.`wall` WHERE `wallID` LIKE  '" + escapedDomain + "$%'", [], function (err, results, fields)
  {
    var success=err == null;
    var walls = [];
    //var walls = {};
  
    if(success)
    {
      //map all walls in a object
      for(var i in results)
      {
        //walls[results[i].wallID] = JSON.parse(results[i].JSON);
        walls.push(results[i].wallID);
      }