datagrip bug 小記


datagrip bug 小記

今天遇到了一個小bug,datagrip 2020.1出現

[S1000] Attempt to close streaming result set com.mysql.cj.protocol.a.result.ResultsetRowsStreaming@42b0babe that was not registered.
Only one streaming result set may be open and in use per-connection. Ensure that you have called .close() on any active result sets before attempting more queries.

查了一下,這是個jet brains 全家桶里都有的bug。 bug

怎么復現

非常簡單: 在存儲過程里然后個循環,然后循環里執行select 查詢,然后將結果賦值給另一個變量,call自定義函數。

CREATE PROCEDURE test_loop()
BEGIN
    declare p1 bigint;
    declare total bigint;
    declare current varchar(100);
    set p1 = 0;
    select count(*) into total from A_table;

    label1: 
    LOOP
        IF p1 >= total THEN
            leave label1;
        END IF;

        select id into current from A_table order by id limit 1 offset p1;

        select test_func(current);

        SET p1 = p1 + 1;
        ITERATE label1;
    END LOOP label1;
    SET @x = p1;
END;

-- table 

create table A_table
(
    id   varchar(100),
    create_time datetime default CURRENT_TIMESTAMP,
    index idx_id (id)
);

-- function

create
    definer = root@`%` function test_func(id varchar(50)) returns varchar(50)
begin
    return id;
end;

如何修復

這里我用的是mysql 5.7 所以一下方案只對mysql 5.7 管用:

更改mysql的驅動,默認選中的是mysql, 要手動改為mysql 5.1


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM