Skip to content

sql.Result.RowsAffected() can't return correct result when execute multiple sql. #1330

Closed
@guoyuanchao1202

Description

@guoyuanchao1202

Issue description

When execute multiple sql like following

Example code

CREATE TABLE `test_binlog`
(
    `id`          bigint(20) unsigned NOT NULL AUTO_INCREMENT,
    `order_type_unsigned`  tinyint unsigned NOT NULL,
    `order_type`  tinyint NOT NULL,
    PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
result, err := db.Exec("INSERT INTO `test_db`.`test_binlog` VALUES (1,2,3);INSERT INTO `test_db`.`test_binlog` VALUES (2,3,4);" )

Result

if success, then expect result is 2 but return 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions