PDO without JSON support

Asked

Viewed 72 times

4

I need to return a line in JSON, but the PDO does not seem to give full support to operations. Always the error message type 245.

PDO::prepare(): Unknown type 245 sent by the server. Please send a report to the Developers


I tested in PDO a simple select SELECT JSON_ARRAY('a', 1, NOW()) and only get the error without further descriptions, nor find anything in the DOC. The same select in the command line in MYSQL returns what is expected:

["a", 1, "2017-07-18 00:11:06.000000"]


Does anyone have a reference to help solve this?

  • What version of PHP and of MySQL?

  • I went to test the function here on the company server, but here and mariadb version 10.1, https://mariadb.com/kb/en/mariadb/json_array/ so don’t even try to help kkk

  • @Marcelodeandrade PHP Version 5.5.0, MYSQL 5.7.13

  • @Marceloboni, no problem rs. I played in the sqlfiddle to test and also returns error.

  • 2

    The sqlfiddle version is 5.6, the functions with support for JSON were implemented from mysql 5.7 according to the documentation

1 answer

2


As you can see in bug tracking #70384, has been fixed in PHP-5.6, PHP-7.0 and master versions (PHP-7.1).

What you can do to resolve momentarily is a CAST on the return of JSON:

SELECT CAST(JSON_ARRAY('a', 1, NOW()) AS CHAR(255))
  • 1

    I confess that I did not know this. Solved well

  • Know if update only the DLL resolves?

  • 1

    I believe so, in the searches I saw found something about the outdated libs. I’ll try to find to link here.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.