예제 #1
0
        public void Perform(string catalog, long loginId)
        {
            string sql = "VACUUM ANALYZE VERBOSE;";
            Task vacuumAnalyzeTask;
            Task eodTask;

            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                command.CommandTimeout = 3600;

                DbOperation operation = new DbOperation();
                operation.Listen += this.Listen;
                vacuumAnalyzeTask = operation.ListenNonQuery(catalog, command);
            }


            sql = "SELECT * FROM transactions.perform_eod_operation(@LoginId::bigint);";

            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                command.Parameters.AddWithValue("@LoginId", loginId);
                command.CommandTimeout = 3600;

                DbOperation operation = new DbOperation();
                operation.Listen += this.Listen;
                eodTask = operation.ListenNonQuery(catalog, command);
            }
            try
            {
                vacuumAnalyzeTask.Start();

                vacuumAnalyzeTask.ContinueWith(delegate
                {
                    eodTask.Start();
                });
            }
            catch (Exception ex)
            {
                this.Listen(this, new DbNotificationArgs
                {
                    Message = ex.Message
                });
            }
        }
예제 #2
0
        public void Perform(string catalog, long loginId)
        {
            const string sql = "SELECT * FROM transactions.perform_eod_operation(@LoginId::bigint);";

            using (NpgsqlCommand command = new NpgsqlCommand(sql))
            {
                command.Parameters.AddWithValue("@LoginId", loginId);
                command.CommandTimeout = 3600;

                DbOperation operation = new DbOperation();
                operation.Listen += this.Listen;
                operation.ListenNonQuery(catalog, command);
            }
        }