Exemplo n.º 1
0
    internal View(string viewName, DbConnection connection, ViewDesignerDoc parent)
    {
      _owner = parent;
      _name = viewName;
      _oldname = viewName;
      _catalog = connection.Database;
      _connection = connection;
      _owner.Name = _name;

      if (String.IsNullOrEmpty(viewName) == false)
      {
        using (DataTable tbl = connection.GetSchema("Views", new string[] { Catalog, null, Name }))
        {
          if (tbl.Rows.Count > 0)
          {
            _sql = tbl.Rows[0]["VIEW_DEFINITION"].ToString();

            StringBuilder builder = new StringBuilder();
            builder.Append(_sql);
            builder.AppendLine(";");

            _triggers.Clear();
            _oldtriggers.Clear();

            using (DataTable ttbl = _connection.GetSchema("Triggers", new string[] { Catalog, null, Name }))
            {
              foreach (DataRow row in ttbl.Rows)
              {
                ViewTrigger t = new ViewTrigger(this, row);
                _triggers.Add(t);
                _oldtriggers.Add(((ICloneable)t).Clone() as ViewTrigger);

                builder.AppendFormat("{0};\r\n", t.OriginalSql);
              }
            }
            _oldsql = builder.ToString();
          }
          else
          {
            _oldname = null;
          }
        }
      }
    }
Exemplo n.º 2
0
        internal View(string viewName, DbConnection connection, ViewDesignerDoc parent)
        {
            _owner      = parent;
            _name       = viewName;
            _oldname    = viewName;
            _catalog    = connection.Database;
            _connection = connection;
            _owner.Name = _name;

            if (String.IsNullOrEmpty(viewName) == false)
            {
                using (DataTable tbl = connection.GetSchema("Views", new string[] { Catalog, null, Name }))
                {
                    if (tbl.Rows.Count > 0)
                    {
                        _sql = tbl.Rows[0]["VIEW_DEFINITION"].ToString();

                        StringBuilder builder = new StringBuilder();
                        builder.Append(_sql);
                        builder.AppendLine(";");

                        _triggers.Clear();
                        _oldtriggers.Clear();

                        using (DataTable ttbl = _connection.GetSchema("Triggers", new string[] { Catalog, null, Name }))
                        {
                            foreach (DataRow row in ttbl.Rows)
                            {
                                ViewTrigger t = new ViewTrigger(this, row);
                                _triggers.Add(t);
                                _oldtriggers.Add(((ICloneable)t).Clone() as ViewTrigger);

                                builder.AppendFormat("{0};\r\n", t.OriginalSql);
                            }
                        }
                        _oldsql = builder.ToString();
                    }
                    else
                    {
                        _oldname = null;
                    }
                }
            }
        }
Exemplo n.º 3
0
 internal ViewTrigger(ViewTrigger source)
     : base(source)
 {
     _triggerOccurs = (int)ViewTriggerOccurs.InsteadOf;
 }
Exemplo n.º 4
0
 internal ViewTrigger(ViewTrigger source)
   : base(source)
 {
   _triggerOccurs = (int)ViewTriggerOccurs.InsteadOf;
 }