我们如何通过RedQueryBuilder以JSON格式加载已保存的搜索

时间:2013-11-07 01:05:07

标签: redquerybuilder

当我们将结果保存为像这样的已保存搜索

[
  {
    "label": "Cities in the UK",
    "sql": "SELECT \"x0\".\"ID\", \"x0\".\"NAME\", \"x0\".\"COUNTRYCODE\", \"x0\".\"DISTRICT\", \"x0\".\"POPULATION\" FROM \"CITY\" \"x0\" INNER JOIN \"COUNTRY\" \"x1\" ON \"x0\".\"COUNTRYCODE\" = \"x1\".\"CODE\" WHERE (\"x1\".\"NAME\" = ?)",
    "args": [
      "United Kingdom"
    ]
  },
  {
    "label": "Large cities in the UK plus Oxford",
    "sql": "SELECT \"x0\".\"ID\", \"x0\".\"NAME\", \"x0\".\"COUNTRYCODE\", \"x0\".\"DISTRICT\", \"x0\".\"POPULATION\" FROM \"CITY\" \"x0\" INNER JOIN \"COUNTRY\" \"x1\" ON \"x0\".\"COUNTRYCODE\" = \"x1\".\"CODE\" WHERE ((\"x1\".\"NAME\" = ?) AND ((\"x0\".\"POPULATION\" > ?) OR (\"x0\".\"NAME\" = ?)))",
    "args": [
      "United Kingdom",
      "100000",
      "Oxford"
    ]
  },
  {
    "label": "Official languages",
    "sql": "SELECT \"x0\".\"COUNTRYCODE\", \"x0\".\"LANGUAGE\", \"x0\".\"ISOFFICIAL\", \"x0\".\"PERCENTAGE\" FROM \"COUNTRYLANGUAGE\" \"x0\" WHERE (\"x0\".\"ISOFFICIAL\" = ?)",
    "args": [
      "T"
    ]
  }
]

我们如何在加载RedQueryBuilder时加载它

1 个答案:

答案 0 :(得分:2)

create方法可以将sql和args作为第二个和第三个参数。因此,只要您在创建窗口小部件之前获得上述数据,就可以使用您喜欢的任何内容启动它。

jsdocs在拉链中。如果错误不明显或明确,请提出错误。