MySQLi - Server returned unknown type 246

前端 未结 3 2022
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-16 06:30

I\'ve been working on a content managed site that\'s been working fine on localhost. I\'ve just uploaded the files to my mediatemple server.. and am seeing some pretty inter

3条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 06:48

    In MySQL 5.0.3, a new field type was introduced, to support fixed-point math with more accuracy. This new field type is identified in the MySQL protocol with a numeric value 246.

    If you have a MySQL server running 5.0.x or higher, and you use the NUMERIC or DECIMAL, it's incompatible with the DECIMAL field type used in the MySQL 4.x client.

    http://dev.mysql.com/doc/refman/5.0/en/upgrading-from-previous-series.html says:

    Because the MySQL 5.0 server has a new implementation of the DECIMAL data type, a problem may occur if the server is used by older clients that still are linked against MySQL 4.1 client libraries. If a client uses the binary client/server protocol to execute prepared statements that generate result sets containing numeric values, an error will be raised: 'Using unsupported buffer type: 246'

    This error occurs because the 4.1 client libraries do not support the new MYSQL_TYPE_NEWDECIMAL type value added in 5.0. There is no way to disable the new DECIMAL data type on the server side. You can avoid the problem by relinking the application with the client libraries from MySQL 5.0.

    Also see http://bugs.php.net/bug.php?id=35536

    You should be able to resolve this issue by upgrading your MySQL client library in PHP. Either rebuild PHP, or else just drop in a new MySQL client binary.

    Best of all would be to use the newer mysqlnd library, which gives you a lot of benefits to performance and functionality. That library is included in the source distribution of PHP 5.3 and later. It states in the FAQ that it requires PHP 5.3, which actually surprises me, but that's what they say.

提交回复
热议问题