@@ -143,64 +143,26 @@ public async Task UpdateRowsDapperAsync(bool useAffectedRows, int oldValue, int
143143 }
144144
145145 [ Fact ]
146- public async Task UpdateDapperNoColumnsWereSelected ( )
146+ public void UpdateFieldCount ( )
147147 {
148- await m_database . Connection . ExecuteAsync ( @"drop table if exists update_station;
149- create table update_station (
150- SID bigint unsigned,
151- name text,
152- stationType_SID bigint unsigned not null,
153- geoPosition_SID bigint unsigned,
154- service_start datetime,
155- service_end datetime,
156- deleted boolean,
157- created_on datetime not null,
158- externalWebsite text,
159- externalTitle text
160- );
161- insert into update_station values(1, 'name', 2, null, null, null, false, '2016-09-07 06:28:00', 'https://github.com/mysql-net/MySqlConnector/issues/44', 'Issue #44');
162- " ) . ConfigureAwait ( false ) ;
163-
164- var queryString = @"UPDATE update_station SET name=@name,stationType_SID=@stationType_SID,geoPosition_SID=@geoPosition_SID,service_start=@service_start,service_end=@service_end,deleted=@deleted,created_on=@created_on,externalWebsite=@externalWebsite,externalTitle=@externalTitle WHERE SID=@SID" ;
165- var station = new Station
166- {
167- SID = 1 ,
168- name = "new name" ,
169- stationType_SID = 3 ,
170- geoPosition_SID = null ,
171- service_start = new ( 2016 , 1 , 1 ) ,
172- service_end = new ( 2017 , 12 , 31 ) ,
173- deleted = true ,
174- created_on = new ( 2000 , 1 , 1 ) ,
175- externalWebsite = null ,
176- externalTitle = null ,
177- } ;
178-
179- try
148+ using ( var cmd = m_database . Connection . CreateCommand ( ) )
180149 {
181- await m_database . Connection . QueryAsync < Station > ( queryString , station ) . ConfigureAwait ( false ) ;
182- Assert . True ( false , "Should throw InvalidOperationException" ) ;
150+ cmd . CommandText = @"drop table if exists update_rows_reader;
151+ create table update_rows_reader(id integer not null primary key auto_increment, value text not null);
152+ insert into update_rows_reader (value) VALUES ('one'), ('two'), ('one'), ('four');
153+ " ;
154+ cmd . ExecuteNonQuery ( ) ;
183155 }
184- catch ( InvalidOperationException ex )
156+
157+ using ( var cmd = new MySqlCommand ( @"UPDATE update_rows_reader SET value = 'three' WHERE id = 3;" , m_database . Connection ) )
158+ using ( var reader = cmd . ExecuteReader ( ) )
185159 {
186- Assert . Equal ( "No columns were selected" , ex . Message ) ;
160+ Assert . Equal ( 0 , reader . FieldCount ) ;
161+ Assert . False ( reader . HasRows ) ;
162+ Assert . False ( reader . Read ( ) ) ;
187163 }
188164 }
189165
190- public class Station
191- {
192- public ulong ? SID { get ; set ; }
193- public string name { get ; set ; }
194- public ulong stationType_SID { get ; set ; }
195- public ulong ? geoPosition_SID { get ; set ; }
196- public DateTime ? service_start { get ; set ; }
197- public DateTime ? service_end { get ; set ; }
198- public bool ? deleted { get ; set ; }
199- public DateTime created_on { get ; set ; }
200- public string externalWebsite { get ; set ; }
201- public string externalTitle { get ; set ; }
202- }
203-
204166 readonly DatabaseFixture m_database ;
205167 }
206168}
0 commit comments