public void CopyParameters(SQLCommand command) { Command.Parameters.AddRange(command.Command.Parameters.ToArray()); }
public void CopyParameters(SQLCommand command) { foreach(object o in command.Command.Parameters) Command.Parameters.Add(o); }
void PerformAutomaticUpdates() { while (true) { Thread.Sleep(ServiceConfiguration.AutomaticUpdateInterval * 1000); lock (AutomaticUpdateJobs) { if (AutomaticUpdateJobs.Count == 0) { using (NpgsqlConnection database = DatabaseProvider.GetConnection()) { SQLCommand command = new SQLCommand("select account_id from summoner where region = cast(:region as region_type) and update_automatically = true", database); command.Set("region", GetRegionEnum()); using (NpgsqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { int accountId = (int)reader[0]; AccountIdJob job = new AccountIdJob(accountId); AutomaticUpdateJobs.Enqueue(job); } } } if (AutomaticUpdateJobs.Count > 0) { ActivateWorkers(); WriteLine("Performing automatic updates for {0} summoner(s)", AutomaticUpdateJobs.Count); } else WriteLine("There are no automatic updates to be performed"); } else WriteLine("There are still automatic updates in progress, not adding any new ones"); } } }