You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.5 KiB
47 lines
1.5 KiB
using System.Data.SqlClient;
|
|
using OpenDBDiff.SqlServer.Schema.Model;
|
|
|
|
namespace OpenDBDiff.SqlServer.Schema.Generates
|
|
{
|
|
public class GenerateRules
|
|
{
|
|
private Generate root;
|
|
|
|
public GenerateRules(Generate root)
|
|
{
|
|
this.root = root;
|
|
}
|
|
|
|
private static string GetSQL()
|
|
{
|
|
return SQLQueries.SQLQueryFactory.Get("GetRules");
|
|
}
|
|
|
|
public void Fill(Database database, string connectionString)
|
|
{
|
|
if (database.Options.Ignore.FilterRules)
|
|
{
|
|
using (SqlConnection conn = new SqlConnection(connectionString))
|
|
{
|
|
using (SqlCommand command = new SqlCommand(GetSQL(), conn))
|
|
{
|
|
conn.Open();
|
|
using (SqlDataReader reader = command.ExecuteReader())
|
|
{
|
|
while (reader.Read())
|
|
{
|
|
Rule item = new Rule(database);
|
|
item.Id = (int)reader["object_id"];
|
|
item.Name = reader["Name"].ToString();
|
|
item.Owner = reader["Owner"].ToString();
|
|
item.Text = reader["Definition"].ToString();
|
|
database.Rules.Add(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|