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:
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
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")

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.


       .where('name like :name').bind('name', "nigeria")
[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.