882 {
883 long scopeId = DataCommonEventSource.Log.EnterScope(
"<comm.DbDataAdapter.Update|API> {0}, dataRows[], tableMapping",
base.ObjectID);
884 try
885 {
886 int num = 0;
887 IDbConnection[]
array =
new IDbConnection[5];
892 {
894 if (
array[0] !=
null)
895 {
898 }
899 }
902 {
904 }
905 BatchCommandInfo[]
array3 =
new BatchCommandInfo[
num2];
908 try
909 {
910 try
911 {
913 {
915 }
919 {
921 {
922 continue;
923 }
924 bool flag = false;
927 {
929 {
930 continue;
931 }
933 {
935 }
938 }
939 else if (
rowState != DataRowState.Deleted)
940 {
941 if (
rowState != DataRowState.Modified)
942 {
944 }
947 }
948 else
949 {
952 }
954 try
955 {
956 dataRow.RowError = null;
958 {
960 }
961 }
962 catch (Exception
ex)
when (ADP.IsCatchableExceptionType(
ex))
963 {
964 ADP.TraceExceptionForCapture(
ex);
965 rowUpdatingEventArgs.Errors =
ex;
966 rowUpdatingEventArgs.Status = UpdateStatus.ErrorsOccurred;
967 }
974 if (status != 0)
975 {
976 if (UpdateStatus.ErrorsOccurred == status)
977 {
979 continue;
980 }
981 if (UpdateStatus.SkipCurrentRow == status)
982 {
983 if (DataRowState.Unchanged ==
dataRow.RowState)
984 {
985 num++;
986 }
987 continue;
988 }
989 if (UpdateStatus.SkipAllRemainingRows == status)
990 {
991 if (DataRowState.Unchanged ==
dataRow.RowState)
992 {
993 num++;
994 }
995 break;
996 }
997 throw ADP.InvalidUpdateStatus(status);
998 }
1002 {
1004 {
1005 array3[0]._commandIdentifier = 0;
1009 }
1013 }
1014 else
1015 {
1016 Exception
ex2 =
null;
1017 try
1018 {
1020 {
1021 if ((UpdateRowSource.FirstReturnedRecord &
dbCommand.UpdatedRowSource) == 0)
1022 {
1031 {
1032 continue;
1033 }
1034 }
1035 else
1036 {
1037 ex2 = ADP.ResultsNotAllowedDuringBatch();
1038 }
1039 }
1040 else
1041 {
1043 }
1044 }
1045 catch (Exception
ex3)
when (ADP.IsCatchableExceptionType(
ex3))
1046 {
1047 ADP.TraceExceptionForCapture(
ex3);
1049 }
1051 {
1053 rowUpdatedEventArgs.Errors =
ex2;
1054 rowUpdatedEventArgs.Status = UpdateStatus.ErrorsOccurred;
1057 {
1059 {
1061 }
1062 }
1065 {
1066 break;
1067 }
1068 continue;
1069 }
1070 }
1072 try
1073 {
1075 {
1080 {
1082 }
1083 else
1084 {
1086 rowUpdatedEventArgs.Status = UpdateStatus.ErrorsOccurred;
1087 }
1088 }
1090 {
1094 {
1097 array3[0]._errors =
null;
1098 }
1099 else
1100 {
1102 rowUpdatedEventArgs.Status = UpdateStatus.ErrorsOccurred;
1103 }
1104 }
1105 else
1106 {
1107 rowUpdatedEventArgs.Errors = ADP.UpdateRequiresCommand(
statementType, flag);
1108 rowUpdatedEventArgs.Status = UpdateStatus.ErrorsOccurred;
1109 }
1110 }
1111 catch (Exception
ex4)
when (ADP.IsCatchableExceptionType(
ex4))
1112 {
1113 ADP.TraceExceptionForCapture(
ex4);
1114 rowUpdatedEventArgs.Errors =
ex4;
1115 rowUpdatedEventArgs.Status = UpdateStatus.ErrorsOccurred;
1116 }
1121 {
1123 {
1125 }
1126 }
1129 {
1131 {
1134 }
1135 break;
1136 }
1138 {
1141 }
1143 {
1144 array3[
l] =
default(BatchCommandInfo);
1145 }
1147 continue;
1149 throw ADP.InvalidDataRowState(
dataRow.RowState);
1150 }
1152 {
1154 try
1155 {
1160 {
1163 }
1166 {
1168 }
1169 else
1170 {
1172 rowUpdatedEventArgs2.Status = UpdateStatus.ErrorsOccurred;
1173 }
1174 }
1175 catch (Exception
ex5)
when (ADP.IsCatchableExceptionType(
ex5))
1176 {
1177 ADP.TraceExceptionForCapture(
ex5);
1178 rowUpdatedEventArgs2.Errors =
ex5;
1179 rowUpdatedEventArgs2.Status = UpdateStatus.ErrorsOccurred;
1180 }
1184 {
1186 {
1188 }
1189 }
1191 }
1192 }
1193 finally
1194 {
1196 {
1198 }
1199 }
1200 }
1201 finally
1202 {
1203 for (
int n = 0;
n <
array.Length;
n++)
1204 {
1206 }
1207 }
1208 return num;
1209 }
1210 finally
1211 {
1212 DataCommonEventSource.Log.ExitScope(scopeId);
1213 }
1214 }
void UpdateRowExecute(RowUpdatedEventArgs rowUpdatedEvent, IDbCommand dataCommand, StatementType cmdIndex)
virtual RowUpdatedEventArgs CreateRowUpdatedEvent(DataRow dataRow, IDbCommand? command, StatementType statementType, DataTableMapping tableMapping)
virtual int UpdateBatchSize
virtual void OnRowUpdated(RowUpdatedEventArgs value)
virtual void TerminateBatching()
virtual void ClearBatch()
static IDbConnection GetConnection4(DbDataAdapter adapter, IDbCommand command, StatementType statementType, bool isCommandFromRowUpdating)
virtual void OnRowUpdating(RowUpdatingEventArgs value)
ConnectionState UpdateConnectionOpen(IDbConnection connection, StatementType statementType, IDbConnection[] connections, ConnectionState[] connectionStates, bool useSelectConnectionState)
static void QuietClose(IDbConnection connection, ConnectionState originalState)
virtual int AddToBatch(IDbCommand command)
virtual RowUpdatingEventArgs CreateRowUpdatingEvent(DataRow dataRow, IDbCommand? command, StatementType statementType, DataTableMapping tableMapping)
void UpdateBatchExecute(BatchCommandInfo[] batchCommands, int commandCount, RowUpdatedEventArgs rowUpdatedEvent)
static IDbConnection GetConnection1(DbDataAdapter adapter)
void ParameterInput(IDataParameterCollection parameters, StatementType typeIndex, DataRow row, DataTableMapping mappings)
virtual void InitializeBatching()
void UpdatingRowStatusErrors(RowUpdatingEventArgs rowUpdatedEvent, DataRow dataRow)
int UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, int commandCount)
IDbDataAdapter _IDbDataAdapter
IDbCommand? UpdateCommand
IDbCommand? InsertCommand
IDbCommand? DeleteCommand
IDbCommand? SelectCommand