MySQL错误代码:1305.MySQL客户端版本中不存在FUNCTION JSON_EXTRACT:5.5.52 [英] MySQL Error Code: 1305. FUNCTION JSON_EXTRACT does not exist in MySQL client version: 5.5.52

查看:2051
本文介绍了MySQL错误代码:1305.MySQL客户端版本中不存在FUNCTION JSON_EXTRACT:5.5.52的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标:-json_extract不存在错误.

我确实有这样的消息正文.

I do have message body like this.

  < 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 .

为此,我编写了如下查询.

for that i have written a query like below.

SELECT  LEFT(ExtractValue( stanza, "//@from" ),LOCATE("@",ExtractValue( stanza, "//@from" )) - 1),
        LEFT(ExtractValue( stanza, "//@to" ),LOCATE("@",ExtractValue( stanza, "//@to" )) - 1),
        ExtractValue(stanza, "//body"),
        ExtractValue(stanza, "//@chattype"),
        TRIM(BOTH '"' FROM json_extract(ExtractValue(stanza, "//body"), '$.opponent_xmpp_id')) AS opponent_xmpp_id,
        json_extract(ExtractValue(stanza,"//body"),'$.latest_message_id') AS latest_message_id        
FROM
ofOffline

导致错误

1305-FUNCTION databaseName.json_extract不存在

按照我的说法,我仅在> MYsql 5.7版本中搜索了它的支持.

As per i searched its supporting in > MYsql 5.7 version only.

那么在MySQL客户端版本5.5.52中,有没有什么函数可以像json_extract一样进行类似的工作?

So is there any function which do the simmilar job as json_extract in MySQL client version: 5.5.52 ?

推荐答案

mysql客户端的版本不相关.该功能在mysql服务器中存在(或在您的情况下不存在).因此,唯一相关的是mysql服务器版本.并且此功能仅在mysql服务器5.7及更高版本中可用.升级客户端无法解决问题,您需要升级服务器.

The version of mysql client is not relevant. The functionality exists (or in your case does not exist) in the mysql server. Thus the only thing that's relevant is the mysql server version. And this functionality is available only in mysql server 5.7 onwards. Upgrading your client will not solve the problem, you need to upgrade your server.

周围有工作吗?是的. PHP的 json_decode

Is there a work around? yes. PHP's json_decode

这可以工作,因为您的查询没有WHERE子句.您正在看整个桌子.因此,您可以轻松地获取所有数据和json_decode,然后在您的PHP代码中进行处理.如果您有很多数据,这将非常慢.

This can work because your query does not have a WHERE clause. You are looking at the entire table. So you can just as easily fetch all that data and json_decode and then do the processing in your PHP code. This is going to be very slow if you have a lot of data though.

这篇关于MySQL错误代码:1305.MySQL客户端版本中不存在FUNCTION JSON_EXTRACT:5.5.52的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆