internal static void SetParameterValue(IDbCommand command, string parameterName, object value) { DbParameter parameter = SyncUtil.GetParameter(command, parameterName); if (parameter == null) { return; } parameter.Value = value; }
internal static int GetSyncIntOutParameter(string parameter, IDbCommand command, out bool found) { found = true; DbParameter parameter1 = SyncUtil.GetParameter(command, parameter); if (parameter1 != null && parameter1.Value != null && !string.IsNullOrEmpty(parameter1.Value.ToString())) { return(int.Parse(parameter1.Value.ToString(), (IFormatProvider)CultureInfo.InvariantCulture)); } found = false; return(0); }
//internal static IDataReader ExecuteDataReader(IDbCommand command, bool closeConnection, CommandFailureInjector.InjectCommandFailure injectCommandFailure, CommandFailureInjector.InjectCommandFailureRetryResponse failurecommandResponse) //{ // IDataReader dataReader = (IDataReader)null; // for (int retryAttempts = 0; retryAttempts < 6; ++retryAttempts) // { // try // { // if (injectCommandFailure != null) // injectCommandFailure(); // if (retryAttempts > 0) // { // SyncTracer.Info("Retrying SyncUtil.ExecuteDataReader, attempt {0} of {1}.", new object[2] // { // (object) retryAttempts, // (object) 5 // }); // SyncUtil.OpenConnection(command.Connection); // } // dataReader = !closeConnection ? command.ExecuteReader() : command.ExecuteReader(CommandBehavior.CloseConnection); // if (failurecommandResponse != null) // failurecommandResponse(retryAttempts); // return dataReader; // } // catch (DbException ex) // { // if (retryAttempts == 5) // { // SyncTracer.Error("Retrying SyncUtil.ExecuteDataReader failed after max retry attempts, due to exception: {0}", new object[1] // { // (object) ex.Message // }); // throw; // } // else // { // SyncTracer.Warning("SyncUtil.ExecuteDataReader failed on attempt {0} of {1}, due to retryable exception: {2}", (object)retryAttempts, (object)5, (object)ex.Message); // Thread.Sleep(100 * (int)Math.Pow(2.0, (double)retryAttempts)); // } // } // } // return dataReader; //} internal static object GetSyncObjectOutParameter(string parameter, IDbCommand command, out bool found) { found = true; DbParameter parameter1 = SyncUtil.GetParameter(command, parameter); if (parameter1 != null) { return(parameter1.Value); } found = false; return((object)null); }