Orient DB funcation has error when it call form node js Unhandled rejection OrientDB.RequestError

126 views
Skip to first unread message

Abhijit Shivathare

unread,
Aug 17, 2016, 12:06:26 AM8/17/16
to orient-...@googlegroups.com
Error is : Unhandled rejection OrientDB.RequestError: Lexical error at line 1, column 35.  Encountered: "\\" (92), after : "

When I Try to pass the JSON value as parameter to Orient DB function.

var vkS = JSON.stringify(data.parameter.videokloojj);
  odb.open().then(function() {
        console.log('db connection open' + data.parameter.videokloojj.userPhotoUrl + '  ');
        odb.query('SELECT addVideoKloojj(:uId, :userFullName, :userPhotoUrl , :vkId , :vkString)', {
              params: {
                  uId : data.parameter.videokloojj.userId,
                  userFullName : data.parameter.videokloojj.userFullName,
                  userPhotoUrl : data.parameter.videokloojj.userPhotoUrl,
                  vkId : data.parameter.videokloojj._id,
                  vkString : vks
              }
          }).then(function (response){
              console.log(response);
              data.return.data = {};
              data.return.status = 'success';
              eventEmitter.emit('methodComplete', data);
       });

Luigi Dell'Aquila

unread,
Aug 17, 2016, 3:10:27 AM8/17/16
to orient-...@googlegroups.com
Hi Abhijit,

Do you have a test case to reproduce the problem?

Thanks

Luigi


2016-08-17 6:00 GMT+02:00 Abhijit Shivathare <abhijit.s...@anzu.org>:
Error is : Unhandled rejection OrientDB.RequestError: Lexical error at line 1, column 35.  Encountered: "\\" (92), after : "
when I call it from node.js 

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-database+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Abhijit Shivathare

unread,
Aug 18, 2016, 5:36:33 AM8/18/16
to OrientDB
Thanks Luigi,

I have did the some changes to resolve above issue in orient DB function ,

But it gives me Error parsing query issue 


// vkString - is json object
var db = orient.getGraph();
var vkQuery = "CREATE VERTEX post CONTENT { thumbnail:'" + vkString.thumbnail +"',comments:'"+ vkString.comments + "',origin:'"+vkString.origin +"',";
            vkQuery
= vkQuery + "userFullName : '"+ vkString.userFullName +"',title: '"+ vkString.title +"',userId:'"+ vkString.userId +"',";
            vkQuery
= vkQuery + "userPhotoUrl:'"+ vkString.userPhotoUrl +"',_id:'"+vkString._id+"',desc: '"+vkString.desc +"'}";
var vkInsert = db.command("sql",vkQuery);


 


[ { '@type': 'd',
    addpost: 'error com.orientechnologies.orient.core.sql.OCommandSQLParsingException: Error parsing query:\nCREATE VERTEX post CONTENT { thumbnail:\'fbf77d24-effb-a6a0-8140-d8f5d96f8b0a.jpeg\',comments:\'Quick post\',userFullName : \'Abhijit Shivathare\',title: \'new modern agriculture technology compilation​​ - amazing farm equipment machinery\',userId:\'zXTmt3rmJfuRjPp77\',userPhotoUrl:\'https://dasdas asda\',_id:\'fbf77d24-effb-a6a0-8140-d8f5d96f8b0a\',desc: \'Here is a best video of modern agricultural technology compilation...\n                                ^\nPlease SUBCRIBE - LIKE - COMMENT / ...Thanks \nDisclaimer:  if the owner\'s videos...thank you\'}\nEncountered " <CONTENT> "CONTENT "" at line 1, column 27.\nWas expecting one of:\n    <EOF> \n    <RETURN> ...\n    ";" ...\n    <CLUSTER> ...\n    <CLUSTER> ...\n    <RETURN> ...\n    \r\n\tDB name="Dev"',
    '@rid': { cluster: -2, position: 1 },
    '@version': 0 } ]




On Wednesday, August 17, 2016 at 12:40:27 PM UTC+5:30, Luigi Dell'Aquila wrote:
Hi Abhijit,

Do you have a test case to reproduce the problem?

Thanks

Luigi

2016-08-17 6:00 GMT+02:00 Abhijit Shivathare <abhijit.s...@anzu.org>:
Error is : Unhandled rejection OrientDB.RequestError: Lexical error at line 1, column 35.  Encountered: "\\" (92), after : "
when I call it from node.js 

--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.

alessand...@gmail.com

unread,
Aug 18, 2016, 6:12:32 AM8/18/16
to OrientDB
Hi,
you could use

var vkQuery = "CREATE VERTEX post CONTENT { 'thumbnail' : '" + vkString.thumbnail +"','comments' : '"+ vkString.comments + "','origin' : '"+vkString.origin +"','";


vkQuery
= vkQuery + "userFullName' : '"+ vkString.userFullName +"','title' : '"+ vkString.title +"','userId' : '"+ vkString.userId +"',";


vkQuery
= vkQuery + "'userPhotoUrl' : '"+ vkString.userPhotoUrl +"','_id' : '"+vkString._id+"','desc' : '"+vkString.desc +"'}";


var vkInsert = db.command("sql",vkQuery);

Hope it helps,
Alessandro

Abhijit Shivathare

unread,
Aug 18, 2016, 7:01:42 AM8/18/16
to OrientDB
Thanks Alessandro,

It helps, It works for me.

Reply all
Reply to author
Forward
0 new messages