Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ UpdateRowExecute()

void System.Data.Common.DbDataAdapter.UpdateRowExecute ( RowUpdatedEventArgs rowUpdatedEvent,
IDbCommand dataCommand,
StatementType cmdIndex )
inlineprivate

Definition at line 1310 of file DbDataAdapter.cs.

1311 {
1312 bool flag = true;
1313 UpdateRowSource updatedRowSource = dataCommand.UpdatedRowSource;
1314 if (StatementType.Delete == cmdIndex || (UpdateRowSource.FirstReturnedRecord & updatedRowSource) == 0)
1315 {
1316 int recordsAffected = dataCommand.ExecuteNonQuery();
1317 rowUpdatedEvent.AdapterInit(recordsAffected);
1318 }
1319 else if (StatementType.Insert == cmdIndex || StatementType.Update == cmdIndex)
1320 {
1321 using IDataReader dataReader = dataCommand.ExecuteReader(CommandBehavior.SequentialAccess);
1323 try
1324 {
1325 bool flag2 = false;
1326 do
1327 {
1328 if (0 < dataReaderContainer.FieldCount)
1329 {
1330 flag2 = true;
1331 break;
1332 }
1333 }
1334 while (dataReader.NextResult());
1335 if (flag2 && dataReader.RecordsAffected != 0)
1336 {
1337 SchemaMapping schemaMapping = new SchemaMapping(this, null, rowUpdatedEvent.Row.Table, dataReaderContainer, keyInfo: false, SchemaType.Mapped, rowUpdatedEvent.TableMapping.SourceTable, gettingData: true, null, null);
1338 if (schemaMapping.DataTable != null && schemaMapping.DataValues != null && dataReader.Read())
1339 {
1340 if (StatementType.Insert == cmdIndex && flag)
1341 {
1342 rowUpdatedEvent.Row.AcceptChanges();
1343 flag = false;
1344 }
1345 schemaMapping.ApplyToDataRow(rowUpdatedEvent.Row);
1346 }
1347 }
1348 }
1349 finally
1350 {
1351 dataReader.Close();
1352 int recordsAffected2 = dataReader.RecordsAffected;
1353 rowUpdatedEvent.AdapterInit(recordsAffected2);
1354 }
1355 }
1356 if ((StatementType.Insert == cmdIndex || StatementType.Update == cmdIndex) && (UpdateRowSource.OutputParameters & updatedRowSource) != 0 && rowUpdatedEvent.RecordsAffected != 0)
1357 {
1358 if (StatementType.Insert == cmdIndex && flag)
1359 {
1360 rowUpdatedEvent.Row.AcceptChanges();
1361 }
1362 ParameterOutput(dataCommand.Parameters, rowUpdatedEvent.Row, rowUpdatedEvent.TableMapping);
1363 }
1364 if (rowUpdatedEvent.Status == UpdateStatus.Continue && (uint)(cmdIndex - 2) <= 1u && rowUpdatedEvent.RecordsAffected == 0)
1365 {
1366 rowUpdatedEvent.Errors = ADP.UpdateConcurrencyViolation(cmdIndex, rowUpdatedEvent.RecordsAffected, 1, new DataRow[1] { rowUpdatedEvent.Row });
1367 rowUpdatedEvent.Status = UpdateStatus.ErrorsOccurred;
1368 }
1369 }
virtual bool ReturnProviderSpecificTypes
void ParameterOutput(IDataParameter parameter, DataRow row, DataTableMapping mappings, MissingMappingAction missingMapping, MissingSchemaAction missingSchema)
static DataReaderContainer Create(IDataReader dataReader, bool returnProviderSpecificTypes)

References System.Data.ProviderBase.DataReaderContainer.Create(), System.Data.Common.DbDataAdapter.ParameterOutput(), System.Data.Common.DataAdapter.ReturnProviderSpecificTypes, and System.Data.Common.ADP.UpdateConcurrencyViolation().

Referenced by System.Data.Common.DbDataAdapter.Update().