首页 \ 问答 \ query builder:包含复合列的IN子句(query builder: IN clause with composite columns)

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
更新时间:2023-12-30 11:12

最满意答案

范式发生了很大变化。 在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.

相关问答

更多
  • 默认情况下,您可以覆盖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 ...
  • 尝试这个 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 ...
  • 你最好使用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, ...
  • 我的问题解决了,我把输入元素的类型提交到表单元素之外。 有用。 我的初始代码是:
    Other code
    我的惩教鳕鱼是:
    Other code
    My ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)