Skip to content

Error with getRulesFromSQL(): data.left.values is undefined #452

@gordon-matt

Description

@gordon-matt

First off, excellent work on the query builder. I've just recently discovered it and it's very nice indeed.

However, I have discovered a problem with getRulesFromSQL when passing in a string.

I am passing in the following string:

"BookingsCount" = 200 (The quotation marks are there due to my using PostgreSQL; I set the field names on the quotation marks)

The error message I get is as follows:

data.left.values is undefined (line 4791)

I can see in your code (query-builder.standalone.js) that you do the following if a string is passed in:

if (typeof data == 'string') {
            data = { sql: data };
        }

So you turn it into an object, but only give it the "sql" property and then you go on to use other properties below in the code, like data.operation, data.left and data.right when they don't exist.

Can this be easily fixed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIdentified bug which needs a fix

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions