mysql1_dart icon indicating copy to clipboard operation
mysql1_dart copied to clipboard

update query return result varies from jdbc

Open Rockvole opened this issue 4 years ago • 0 comments

I am converting some code from java to dart. I have found a variation in the way query works in comparison to jdbc.

In Java, I do :

UPDATE water_line_field SET user_id = 0 , local_ts = 242846754  WHERE change_type = 1 AND id = 16777215 AND table_type = 65535
int rowCount=PreparedStatement.executeUpdate();

In this specfic case, I send an update, but it so happens that the set values mean that one row will match, but the values will be unchanged. In other words, I am setting the row to the values it already contains. Under jdbc this query will return a rowCount of 1. The driver I am using is : mariadb-java-client-1.5.6.jar (although the code ran the same previously under a mysql driver).

If I perform the same query in dart mysql1: ^0.17.1

Results results = MySqlConnection.query(sqlString);
results.length returns 0
results.affectedRows returns 0

I realize that this matches what is returned when using the command line sql commands :

Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

I just thought I would point out this variation incase you intended to match jdbc behaviour. It might be nice to have an additonal :

results.matchedRows 

if people require this level of detail.

Rockvole avatar Jun 22 '20 17:06 Rockvole