File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
src/MySqlConnector/MySqlClient/Results Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ public async Task<ResultSet> ReadResultSetHeaderAsync(IOBehavior ioBehavior)
4040 if ( firstByte == OkPayload . Signature )
4141 {
4242 var ok = OkPayload . Create ( payload ) ;
43- RecordsAffected = ok . AffectedRowCount ;
43+ RecordsAffected + = ok . AffectedRowCount ;
4444 LastInsertId = ok . LastInsertId ;
4545 ColumnDefinitions = null ;
4646 State = ( ok . ServerStatus & ServerStatus . MoreResultsExist ) == 0
Original file line number Diff line number Diff line change @@ -36,6 +36,29 @@ public async Task LastInsertedId()
3636 }
3737 }
3838
39+ [ Fact ]
40+ public async Task RowsAffected ( )
41+ {
42+ await m_database . Connection . ExecuteAsync ( @"drop table if exists insert_rows_affected;
43+ create table insert_rows_affected(id integer not null primary key auto_increment, value text null);" ) ;
44+
45+ try
46+ {
47+ await m_database . Connection . OpenAsync ( ) ;
48+ using ( var command = new MySqlCommand ( @"
49+ INSERT INTO insert_rows_affected (value) VALUES (null);
50+ INSERT INTO insert_rows_affected (value) VALUES (null);" , m_database . Connection ) )
51+ {
52+ var rowsAffected = await command . ExecuteNonQueryAsync ( ) ;
53+ Assert . Equal ( 2 , rowsAffected ) ;
54+ }
55+ }
56+ finally
57+ {
58+ m_database . Connection . Close ( ) ;
59+ }
60+ }
61+
3962 [ Fact ]
4063 public void LastInsertedIdExplicitStart ( )
4164 {
You can’t perform that action at this time.
0 commit comments