Example #1
0
        internal void AddReferencedFromCol(int colindex)
        {
            string col = m_table.Columns[colindex].ColumnName;
            var    fk  = m_table.GetKeyWithColumn <IForeignKey>(m_table.Columns[colindex]);

            m_frame.AddTable(fk.PrimaryKeyTable, this, fk);
        }
Example #2
0
        public Column_TreeNode(ITableSource conn, ITableStructure table, IColumnStructure column, ITreeNode parent)
            : base(conn, parent, column.ColumnName)
        {
            m_column = column;
            m_table  = table;
            m_conn   = conn;

            m_ispk = m_table.GetKeyWithColumn <IPrimaryKey>(m_column) != null;
            m_isfk = m_table.GetKeyWithColumn <IForeignKey>(m_column) != null;
            StringBuilder res = new StringBuilder(m_column.ColumnName);

            res.Append(" (");
            if (m_ispk)
            {
                res.Append("PK, ");
            }
            if (m_isfk)
            {
                res.Append("FK, ");
            }
            if (m_conn.Database.Dialect != null)
            {
                res.Append(m_conn.Database.Dialect.GenericTypeToSpecific(m_column.DataType).ToString().ToLower());
            }
            else
            {
                res.Append(m_column.DataType.ToString().ToLower());
            }
            res.Append(", ");
            if (m_column.IsNullable)
            {
                res.Append("null");
            }
            else
            {
                res.Append("not null");
            }
            res.Append(")");
            m_title = res.ToString();

            var appobj = new ColumnAppObject();

            appobj.FillFromTable(conn);
            appobj.Column = new ColumnStructure(column);
            appobj.FillRelatedConstraints(table.Constraints);
            SetAppObject(appobj);
        }
Example #3
0
        public override DataTable GetSchemaTable()
        {
            DataTable res = ConnTools.SchemaFromStructure(m_structure);

            for (int i = 0; i < m_structure.Columns.Count; i++)
            {
                DataRow row = res.Rows[i];
                row[SchemaTableColumn.BaseTableName] = m_structure.FullName != null ? m_structure.FullName.Name : null;
                row[SchemaTableColumn.IsKey]         = m_structure.GetKeyWithColumn <IPrimaryKey>(m_structure.Columns[i]) != null;
            }
            return(res);
        }