Bug #82265 Error when mysqlx tries to parse expression (Nodejs)

Submitted: 18 Jul 2016 11:11 Modified: 23 Mar 2018 10:56
Reporter: Okeke Paul Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Connectors: Document Store: DevAPI Severity:S1 (Critical)
Version:Ver 14.14 Distrib 5.7.13 OS:Fedora (Fedora 23)
Assigned to: CPU Architecture:Any
Tags: DevAPI, mysqlx, node, NodeJS, X-Plugin

[18 Jul 2016 11:11] Okeke Paul
Description:
Source Code Implementation:

VieDAO.prototype.selectByObject = function (data) {
    //convert data to where query
    return new Promise((resolve, reject)=> {
        this.dbConnection((session, err)=> {
            if(!session) reject(err);
            var resultSet = this._tableModel.select(['id','name'])
                .where('name like :name').bind('name', "nigeria")
                .execute(function(row){
                    console.log(row);
                });
            resultSet.then(result=>{
               console.log(result);
            }).catch(err=>{
                session.close();
                console.log(err);
            });
        });
    })
};

Error Thrown:

Error: Parse error on line 1:
name like :name
-----^
Expecting '.', '(', got 'like'
    at Object.parseError (~/node_modules/mysqlx/lib/Expressions/parser.js:262:15)
    at Object.parse (~/project/node_modules/mysqlx/lib/Expressions/parser.js:327:22)
    at Object.exports.parse (~/project/node_modules/mysqlx/lib/Expressions/parser.js:950:51)
    at Object.module.exports.parse (~/project/node_modules/mysqlx/lib/Expressions/index.js:32:26)
    at Client.crudFind (~/project/node_modules/mysqlx/lib/Protocol/Client.js:309:28)
    at TableSelect.execute (~/project/node_modules/mysqlx/lib/DevAPI/TableSelect.js:137:10)
    at dbConnection (~/project/vie_core/VieDAO.js:67:18)
    at Promise.all.then.exists (~/project/vie_core/VieDAO.js:51:13)
    at process._tickCallback (internal/process/next_tick.js:103:7)

How to repeat:
Try querying with an expression on mysqlx NodeJS.

Example:

this._tableModel.select(['id','name'])
       .where('name like :name').bind('name', "nigeria")
         .execute(function(row){
             console.log(row);
   });
[18 Jul 2016 16:14] Okeke Paul
Please!!! How soon can this be solved... I have tried reading the Parser.js and tried to see how possible this can be solved, but i just can't get to understand the number combinations and all... PLEASE i need this functionality to work, PLEASE!!! PLEASE!!!.... I'm stuck
[2 Feb 2018 18:44] Rui Quelhas
There were definitely some parser issues on older versions of the connector and this was one of them.

Before, the correct pattern would be "$.name like :name". However, with the latest version - 8.0.9 - the pattern used in the test case should also work.
[23 Mar 2018 10:56] Chiranjeevi Battula
Hello Okeke Paul,

Thank you for the bug report.
Issue was fixed in MySQL Connector/Node.js 8.0.9.
Please feel free to reopen this bug report if you encounter this issue again.

Thank you for your interest in MySQL.

Thanks,
Chiranjeevi.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.