如果其中一列的数据超过 1024 个字符,则不返回任何记录集 Mysql 8.0 和经典 ASP

No recordset is returned if one of the column has data more than 1024 characters Mysql 8.0 and Classic ASP

我正在使用 32 位 MySQL ODBC 连接器 8.19 与经典 asp MYSQL 服务器是 8。 CHARACTER 是 latin1,COLLATE 是 latin1_swedish_ci 连接字符串有 OPTION=3 存储引擎是 InnoDB

以下是table结构

CREATE TABLE Data_temp
(
ROWGUID varchar(36) default (UUID()) NOT NULL ,
col_desc varchar(10) NOT NULL ,
History varchar (4000),
PRIMARY KEY Data_temp_P_KEY(ROWGUID)
) ;

使用 Adodb 命令 运行 查询

Select * from Data_temp WHERE col_desc=?

参数由 adodb create parameter 提供。

结果在 adodb 记录集中返回为

set recordset=command.execute method

如果历史记录列的数据超过 1024 个字符,则不返回记录集

如果相同查询在以下情况下为 运行 作为 ,

  1. Select col_desc,Rowguid 
    from Data_temp 
    WHERE col_desc=? 
    

    即列列表不包含该大数据列,则返回记录集

  2. Select col_desc,Rowguid,substring(history,1,1024) 
    from Data_temp 
    WHERE col_desc=? 
    

    也有效。

  3. 通过将列设为 TEXT 数据类型而不是 varchar

可能是什么原因?

返回列数据有限制吗? 如果查询 运行 直接使用查询本身的值

,则再观察一次而不是使用参数化查询
Select * from Data_temp WHERE Col_Desc='aa' 

没有参数则返回记录集

提前致谢

看看这些类似的问题:

https://bugs.mysql.com/bug.php?id=92078
https://bugs.mysql.com/bug.php?id=93895
https://bugs.mysql.com/bug.php?id=94545

以及官方推荐:

Source: https://dev.mysql.com/doc/relnotes/connector-odbc/en/news-8-0-16.html

An exception was emitted when fetching contents of a BLOB/TEXT records after executing a statement as a server-side prepared statement with a bound parameter.

The workaround is not using parameters or specifying NO_SSPS=1 in the connection string; this allows the driver to fetch the data.

In Connector/ODBC 5.2 and after, by default, server-side prepared statements are used. When this option is set to a non-zero value, prepared statements are emulated on the client side, which is the same behavior as in 5.1 and 3.51. Added in 5.2.0.

推荐的解决方法是在连接字符串中指定 NO_SSPS=1,我确认它有效。