Ejemplo n.º 1
0
        SQLColumn CreateForeignKey(SQLTable table, string colName, SQLTable fkTable)
        {
            SQLColumn col = CreateColumn(table, colName);

            col.ForeignKey = fkTable.PrimaryKey;
            return(col);
        }
Ejemplo n.º 2
0
        void BuildHRSchema()
        {
            SQLTable table;

            //tDevDepts
            SQLTable deptTable = CreateTable("tDevDepts", "DeptId");

            CreateColumn(deptTable, "DeptDesc");

            //hr_tEmployees
            SQLTable empTable = CreateTable("hr_tEmployees", "Emp_Id");

            CreateForeignKey(empTable, "DeptId", deptTable);

            {
                //hr_tCustomerPlannerHed
                SQLTable hedTable = CreateTable("hr_tCustomerPlannerHed", "hedid");
                CreateColumn(hedTable, "descr");

                //hr_tCustomerPlannerDet
                table = CreateTable("hr_tCustomerPlannerDet", "detid");
                CreateParentKey(table, "hedid", hedTable);
                CreateForeignKey(table, "Emp_Id", empTable);
            }
        }
Ejemplo n.º 3
0
        SQLColumn CreateColumn(SQLTable table, string colName)
        {
            SQLColumn col = new SQLColumn(table);

            col.Name = colName;
            return(col);
        }
Ejemplo n.º 4
0
        SQLColumn CreateParentKey(SQLTable table, string colName, SQLTable parentTable)
        {
            SQLColumn col = CreateColumn(table, colName);

            table.ParentKey = col;
            col.ForeignKey  = parentTable.PrimaryKey;
            return(col);
        }
Ejemplo n.º 5
0
        SQLTable CreateTable(string tableName, string primaryKey)
        {
            SQLTable table;

            table      = new SQLTable();
            table.Name = tableName;
            m_Tables.Add(tableName, table);
            CreatePrimaryKey(table, primaryKey);
            return(table);
        }
Ejemplo n.º 6
0
        public SQLColumn GetForeignKeyTo(SQLTable table)
        {
            SQLColumn fk = null;

            foreach (var pair in Columns)
            {
                SQLColumn column = pair.Value;
                if (column.ForeignKey != null && column.ForeignKey.Table == table)
                {
                    fk = column;
                    break;
                }
            }
            return(fk);
        }
Ejemplo n.º 7
0
 public SQLColumn(SQLTable table)
 {
     Table = table;
 }
Ejemplo n.º 8
0
 SQLColumn CreatePrimaryKey(SQLTable table, string colName)
 {
     table.PrimaryKey = CreateColumn(table, colName);
     return(table.PrimaryKey);
 }
Ejemplo n.º 9
0
        public SQLTable FindTable(string tableName)
        {
            SQLTable rv = m_Tables[tableName];

            return(rv);
        }
Ejemplo n.º 10
0
 public FreehandSQLColumn(SQLTable table) : base(table)
 {
 }