0

I am using simpldb and am trying to save rahul' mehta in simpledb but it is giving me error below : Code :

   function htmlEscape(text) {
     return text.replace(/&/g,'&').
         replace(/</g,'&lt;').
         replace(/"/g,'&quot;').
         replace(/'/g,'&#039;');
    }
    console.log(params.filename);

  if (params.filename!=undefined) params.filename=htmlEscape(params.filename);
    console.log(sys.inspect(params));
  sdb.putItem(domain, params.objectid, params, function( error ) {
  });

Output :

rahul' mehta

{ 
  filename: 'rahul&#039; mehta',
  }

Error :

   {"event":"error","errno":"InvalidQueryExpression","message":"The specified query expression syntax is not valid.","queueno":7}

Why this error is coming , how can i solve it ?

XMen
  • 29,384
  • 41
  • 99
  • 151

1 Answers1

1

This error is because you are trying to run Amazon SimpleDB SELECT Query and syntax of that query is wrong. This may be because in query -- Attribute Value -- must be unclosed with single quotes i.e. 'Attribute Value', and again if -- Domain Name -- and -- Attribute Name -- contains any special characters then they must be unclosed with acute i.e Domain Name OR Attribute Name. I think you are able to save rahul' mehta but when you are trying to get that saved attribute-value, you are getting this error. There is nothing wrong this with string you can see it has been saved successfully using SDB Explorer http://www.sdbexplorer.com/

Ashish Pancholi
  • 4,569
  • 13
  • 50
  • 88