Goal :- json_extract does not exist error.
我确实有这样的消息体.
< message type = "chat" to = "socialapp_233@22.52.258.256" from = "socialapp_6@22.52.258.256/9fs4kgn090" > < body > { "opponent_xmpp_id": "socialapp_233@22.52.258.256","latest_message_id": "6233" } < /body><active>http:/ / jabber.org / protocol / chatstates < /active></message >
我试图提取opponent_xmpp_id和latest_message_id.
因为我写了一个像下面的查询.
SELECT LEFT(ExtractValue( stanza,"//@from" ),LOCATE("@",ExtractValue( stanza,"//@from" )) - 1),LEFT(ExtractValue( stanza,"//@to" ),"//@to" )) - 1),ExtractValue(stanza,"//body"),"//@chattype"),TRIM(BOTH '"' FROM json_extract(ExtractValue(stanza,'$.opponent_xmpp_id')) AS opponent_xmpp_id,json_extract(ExtractValue(stanza,'$.latest_message_id') AS latest_message_id FROM ofOffline
导致错误
1305 – FUNCTION databaseName.json_extract does not exist
根据我搜索其支持>仅限MysqL 5.7版本.
那么在MysqL客户端版本中是否有任何函数可以像json_extract一样进行simmilar工作:5.5.52?
MysqL客户端的版本不相关. MysqL服务器中存在(或在您的情况下不存在)功能.因此唯一相关的是MysqL服务器版本.此功能仅在MysqL server 5.7及更高版本中可用.升级客户端无法解决问题,您需要升级服务器.
有工作吗?是. PHP的json_decode
这可以工作,因为您的查询没有WHERE子句.你正在看整个表.因此,您可以轻松获取所有数据和json_decode,然后在PHP代码中进行处理.如果您有大量数据,这将会非常缓慢.