Skip to content

ROW_COUNT() does not work ›for MariaDB #1110

Description

@SmokeGlider

Steps to reproduce this issue

Step 1: Start up HeidiSQL and connect to MariaDB and open a new query tab

Step 2: On the Query tab add the following code and run it

CREATE DATABASE IF NOT EXISTS bug_test_db
  CHARACTER SET = 'latin1'
  COLLATE = 'latin1_general_ci';	

USE bug_test_db;

CREATE TABLE IF NOT EXISTS bug_test_table
(	
	id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
	`name` VARCHAR(30) NOT NULL
);


INSERT INTO bug_test_table(`name`) VALUES ('Test Row');

INSERT INTO bug_test_table(`name`) VALUES ('Test Row 2'), ('Test ROW 3');
SELECT ROW_COUNT();

UPDATE bug_test_table
SET `name` = 'Test Row Again'
WHERE id IN (1);
SELECT ROW_COUNT();

DELETE 
FROM bug_test_table
WHERE id IN (1,2,3);
SELECT ROW_COUNT();

Step 3: Then look at results panes

in the Results #1 pane you get

ROW_COUNT()
0

in the Results #2 pane you get

ROW_COUNT()
0

In the Results #3 pane you get

ROW_COUNT()
0

Current behavior

For INSERT, UPDATES and DELETES, ROW_COUNT returns 0

Expected behavior

As per the description of ROW_COUNT() on MariaDB documentation page:

https://mariadb.com/kb/en/row_count/

ROW_COUNT() returns the number of rows updated, inserted or deleted by the preceding statement.

Therefore,

Results #1 pane should be displaying

ROW_COUNT()
2

Results #2 pane should be displaying

ROW_COUNT()
1

Results #3 pane should be displaying
ROW_COUNT()
3

Expected the results would be a positive integer representing the row count of the affects rows due to the statements executed and only be zero if no rows were affected. See attached screen shot when using MariaDB's command line interface. The results of an INSERT statement are as expected.

Possible solution

I don't know. Code fix?

Environment

I'm running a clean install of windows 10 pro
Screen Shot 2020-07-30 at 3 40 22 PM
and newly install MariaDB and HeidiSQL.

  • HeidiSQL version:

Version 11.0.0.6062 (32 bit)
Compiled on 2020-07-29 05:40:33

  • Database system and version:

MariaDB

10.5.4-MariaDB

  • Operating system:

Windows 10 Pro with latest updates

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedIssue verified by project membernettype-mysqlMySQL and/or MariaDB specific issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions