Пример #1
0
 public Tree()
 {
     GrowthState = GrowthStateEnum.None;
     Orientation = OrientationEnum.Vertical;
     Level.Last = -1;
     Schema = Def.Schema;
 }
Пример #2
0
 public TableMap(Node _node)
 {
     node = _node;
     schema = Def.Schema;
     rowCount = (int) Def.Db.GetNumber("Select count(*) from " + Def.DbTrTb + node.Id);
 }
Пример #3
0
        public bool SchemaFill(Schema sch)
        {
            OdbcCommand cmd = null;
            cmd = new OdbcCommand("select * from  " + Def.DbBsTb + " Limit 1", con);
            SchemaVariable var;
            OdbcDataReader reader = cmd.ExecuteReader();
            bool r = false;
            string typeName;
            try {

                reader.Read();
                for (int x = 0; x < reader.FieldCount; ++x) {
                    var = new SchemaVariable();
                    var.Name = reader.GetName(x).ToLowerInvariant();
                    if (var.Name == Def.DbTableIdName) {
                        continue;
                    }
                    typeName = reader.GetDataTypeName(x).ToLowerInvariant();
                    if (typeName == "float4" || typeName == "float8" || typeName == "real" || typeName == "dbtype_i2" || typeName == "dbtype_i4" || typeName == "dbtype_ui1" || typeName == "dbtype_r8" || typeName == "dbtype_r4" || typeName == "dbtype_numeric" || typeName == "integer" || typeName == "float" || typeName == "numeric" || typeName == "number") {
                        var.DataType = SchemaVariable.DataTypeEnum.Number;
                        var.VariableTypeDetected = SchemaVariable.VariableTypeEnum.Continuous;
                        var.VariableTypeUserSet = SchemaVariable.VariableTypeEnum.Continuous;
                    } else {
                        //if (typeName == "date")
                        //    continue;
                        var.DataType = SchemaVariable.DataTypeEnum.Text;
                        var.VariableTypeDetected = SchemaVariable.VariableTypeEnum.Categorical;
                        var.VariableTypeUserSet = SchemaVariable.VariableTypeEnum.Categorical;
                    }
                    Def.Schema.VariableLst.Add(var);
                    r = true;
                }
            } catch (Exception ex) {
                MessageBox.Show(ex.Message, "Error! in SchemaFill() Database.cs");
            } finally {
                reader.Close();
            }
            return r;
        }