JSON中的SQL通配符替换

时间:2012-07-24 13:14:10

标签: mysql sql

在漂亮的泛洪表中使用REPLACE语句时遇到一些麻烦。示例表如下所示:

 {
    "ce8bf08f-e9b7-4283-b70a-c331055e7e60":  {
        "0":  {
            "value": "9\/16 x 3-1\/2"
        }
    },
    "7edd3ae1-7ce6-41d2-a88e-f5389fe2a4e4":  {
        "option":  {
            "0": "pine",
            "1": "primed"
        }
    },
    "c0794696-a5d2-4df9-b20f-f23b0f94a41b":  {
        "file": "images\/stories\/moldings\/molding-profiles\/thumb\/m-b1371.gif",
        "width": "41",
        "height": "137"
    },
    "246e955a-5a57-4ad0-ad8c-c15fc7bfccb6":  {
        "file": "images\/stories\/moldings\/molding-profiles\/full\/m-b1371.gif",
        "link": "",
        "target": "",
        "rel": "",
        "width": "82",
        "height": "274"
    },
    "95bdb077-091b-47f3-99ad-da6b42f6195b":  {
        "file": "M-B1371.dwg",
        "download_limit": "",
        "hits": "35",
        "size": "2350728"
    },
    "1e40d254-b751-46bd-9872-65248bbd343b":  {
        "file": "M-B1371.dxf",
        "download_limit": "",
        "hits": "42",
        "size": "5189493"
    },
    "32f5fb4b-19f5-46c0-9680-02c9ba3fd8e9":  {
        "file": "M-B1371.pdf",
        "download_limit": "",
        "hits": "40",
        "size": "140091"
    },
    "64c188a6-cf2f-4895-8879-8b67a58b6780":  {

    }
}

我最终尝试定位/更改的是.dwg, .dxf and .pdf文件路径。所以,我的目标是转向(例如):

M-B1371.dxf

images\/stories\/moldings\/molding-profiles\/cad\/all\/M-B1371.dxf

我尝试了以下内容:

update jos_zoo_item set elements = replace(elements, 'file": "%.dxf', 'file": "images\/stories\/moldings\/molding-profiles\/cad\/all\/%.dxf’);

但似乎没有找到正确的文字 - 这里有没有人有任何建议 - 有点困惑?谢谢!

0 个答案:

没有答案