Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
guoyuanchao1202 opened this issue May 9, 2022 · 3 comments
Milestone

Comments

@guoyuanchao1202
Copy link

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

@guoyuanchao1202
Copy link
Author

image

Hi, masters Do we accumulate each read instead of equal? Or give a configuration for the user to choose? Because in some scenarios we really need the summed result, thanks

@methane
Copy link
Member

methane commented May 10, 2022

#1309 will solve this issue. I just not have time to review it carefully for now.
Please wait.

@guoyuanchao1202
Copy link
Author

okay, see it, thanks:)

@methane methane added this to the v1.8.0 milestone May 24, 2023
@methane methane closed this as completed Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants