query builder:包含复合列的IN子句(query builder: IN clause with composite columns)
我需要在多个列上创建一个IN条件,就像这样
... WHERE (order_date, order_number) IN ( ('2016-03-11', 3455453), ('2016-03-18', 83545454), ('2016-06-17', 5354544) )
从这样的数组开始:
$orders = [ ['2016-03-11', 3455453], ['2016-03-18', 83545454], ['2016-06-17', 5354544] ];
使用cake3查询生成器。 我试过了
->where(['(order_date, order_number) IN' => $orders]);
但是我收到一个错误:
无法将值转换为字符串
我知道手动创建操作数组的查询并不难,但我想知道是否有一种方法可以做到这一点。
I need to create a IN conditions on multiple columns, like this
... WHERE (order_date, order_number) IN ( ('2016-03-11', 3455453), ('2016-03-18', 83545454), ('2016-06-17', 5354544) )
starting from an array like this:
$orders = [ ['2016-03-11', 3455453], ['2016-03-18', 83545454], ['2016-06-17', 5354544] ];
using cake3 query builder. I tried with
->where(['(order_date, order_number) IN' => $orders]);
but I get an error:
Cannot convert value to string
I know it's not hard to manually create the query manipulating the array, but I'd like to know if there is a cake way to do it.
原文:https://stackoverflow.com/questions/37919141
最满意答案
范式发生了很大变化。 在OpenLayers 3中,您创建一个具有簇样式的新图层,并将“阈值”设置为图层选项中的maxResolution或minResolution。 如同:
var clusterLayer = new ol.layer.Vector({ visible: true, zIndex: insightMap.totalServcies - element.SortOrder, id: Id, serviceId: element.Id, minResolution: clusteringThreshold, cluster: true, });
您也可以根据文档使用minZoom和maxZoom,但我遇到了一致性问题。
The paradigm has changed considerably. In OpenLayers 3 you create a new layer, with a cluster style, and the "threshold" is set as a maxResolution, or minResolution in the layer's options. Similar to:
var clusterLayer = new ol.layer.Vector({ visible: true, zIndex: insightMap.totalServcies - element.SortOrder, id: Id, serviceId: element.Id, minResolution: clusteringThreshold, cluster: true, });
You can also use minZoom and maxZoom according to the documentaiton, but I've encountered issues with them performing consistently.
相关问答
更多-
OpenLayers使用BBOX策略找出用户的缩放级别(OpenLayers finding out a user's zoom level with the BBOX strategy)[2022-04-03]
默认情况下,您可以覆盖triggerRead函数并自行添加缩放级别。 像这样(未经测试): OpenLayers.Strategy.BBOX.prototype.triggerRead = function() { if (this.response) { this.layer.protocol.abort(this.response); this.layer.events.triggerEvent("loadend"); } this.layer. ... -
我认为这个问题是因为HTTP调用是异步发生的,以填充图层的功能。 因此,在HTTP调用返回之前,您正在点击警报(groups.features.length),因此该层没有任何功能,因此groups.features.length正确为0.如果您想以这种方式查看功能的数量,则需要将函数附加到层loadend事件 ,该事件将在HTTP事件返回后调用,您将能够查询所有功能。 This issue, I think, is because the HTTP call is happening asynchrono ...
-
WKT和openlayers(WKT and openlayers)[2023-07-11]
尝试这个 http://jsfiddle.net/WG8YP/4/ addFeatures需要一系列功能 。 码: var polygonFeature = wkt.read("POLYGON((-15.8203125 2.4609375, -15.8203125 -10.546875, 6.85546875 -11.25, 8.26171875 -3.33984375, -15.8203125 2.4609375))"); polygonFeature.geometry.transform(map.dis ... -
烧瓶和OpenLayers(Flask and OpenLayers)[2022-06-09]
你最好使用theme: null [1]选项来配置你的地图,这将禁用CSS的自动加载,并在页面中自行加载。 1 - http://dev.openlayers.org/docs/files/OpenLayers/Map-js.html#OpenLayers.Map.theme you'd better configure your map with theme: null [1] option, which will disable the autoloading of the css, and load ... -
我从群集策略选项中删除了“群集” // set up cluster strategy and vector layer var strategy = new OpenLayers.Strategy.Cluster({ distance: 15 }); 然后在我将图层添加到地图后添加标记 // add markers layer to the map map.addLayer(markersLayer) ...
-
这就是我现在加载数据的方式,“数据”是我的GJson var wktTraffic = new ol.source.Vector({ }); var trafficLayer = new ol.layer.Vector({ source: wktTraffic, style: new ol.style.Style({ stroke: new ol.style.Stroke({ color: 'blue', width: ...
-
我解决了这个问题 在创建OpenLayers.Format.GeoJSON时,您可以像这样进行特定投影...... var geojs_format = new OpenLayers.Format.GeoJSON({ 'internalProjection': new OpenLayers.Projection("EPSG:900913"), 'externalProjection': new OpenLayers.Projection("EPSG:4326" ...
-
我认为您的代码中存在错误: featureType: "usa:states", //geoserver Layer Name 我认为这应该是 featureType: "states", //geoserver Layer Name 因为前缀已经使用featureNS定义 至于Geoserver中的“要素类型详细信息”:如果您的表格具有“the_geom”或“geom”coloumn并且其类型是几何图形,请检查Postgres。 I think there is a mistake in your c ...
-
范式发生了很大变化。 在OpenLayers 3中,您创建一个具有簇样式的新图层,并将“阈值”设置为图层选项中的maxResolution或minResolution。 如同: var clusterLayer = new ol.layer.Vector({ visible: true, zIndex: insightMap.totalServcies - element.SortOrder, id: Id, ...
-
我的问题解决了,我把输入元素的类型提交到表单元素之外。 有用。 我的初始代码是: 我的惩教鳕鱼是: My ...