Question

This line in my JS file:

RedQueryBuilderFactory.create(config, 
  'SELECT "x0"."title", "x0"."priority" FROM "ticket" "x0" WHERE ("x0"."status" = (?))',
  []
);

works fine witih an empty array as the 3rd parameter. This parameter is supposed to be an array of strings according to the documentation and any sample code I can find. When I pass a string in the array it fails:

RedQueryBuilderFactory.create(config, 
  'SELECT "x0"."title", "x0"."priority" FROM "ticket" "x0" WHERE ("x0"."status" = (?))',
  ['in_process']
);

I get java.lang.ClassCastException in the Safari console. Here's the related part of the config if it's relevant:

var config = {
    meta : {
        tables : [ {
            "name" : "ticket",
            "label" : "Ticket",
            "columns" : [ {
                "name" : "title",
                "label" : "Title",
                "type" : "STRING",
                "size" : 255
            }, {
                "name" : "priority",
                "label" : "Priority",
                "type" : "REF"
            }  ],
            fks : []
        } ],

        types : [ {
            "name" : "REF",
            "editor" : "SELECT",
            "operators" : [ {
                "name" : "IN",
                "label" : "any of",
                "cardinality" : "MULTI"
            }]
        }  ]
    }
};
Was it helpful?

Solution

Looks like this is a bug in passing in parameter values. Internally it is expecting a collection but this is not happening.

Best if you raise a https://github.com/salk31/RedQueryBuilder bug report here?

NB Should be "IN" not "="

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top