Exemple #1
0
        public static FieldType ToFieldType(MG_FieldDBType dbtype)
        {
            FieldType type = FieldType.OFTString;

            if (dbtype == MG_FieldDBType.VARCHAR)
            {
                type = FieldType.OFTString;
            }
            else if (dbtype == MG_FieldDBType.INTEGER)
            {
                type = FieldType.OFTInteger;
            }
            else if (dbtype == MG_FieldDBType.FLOAT8)
            {
                type = FieldType.OFTReal;
            }
            else if (dbtype == MG_FieldDBType.DATE)
            {
                type = FieldType.OFTDate;
            }
            else if (dbtype == MG_FieldDBType.TIME)
            {
                type = FieldType.OFTTime;
            }
            else if (dbtype == MG_FieldDBType.TIMESTAMP)
            {
                type = FieldType.OFTDateTime;
            }
            return(type);
        }
Exemple #2
0
 public MG_Field(MG_Field f)
 {
     this.Name = f.Name;
     this.Type = f.Type;
     this.Width = f.Width;
     this.Precision = f.Precision;
 }
Exemple #3
0
        public static MG_FieldDBType AsFieldDBType(FieldType type)
        {
            MG_FieldDBType dbtype = MG_FieldDBType.VARCHAR;

            if (type == FieldType.OFTString)
            {
                dbtype = MG_FieldDBType.VARCHAR;
            }
            else if (type == FieldType.OFTInteger)
            {
                dbtype = MG_FieldDBType.INTEGER;
            }
            else if (type == FieldType.OFTReal)
            {
                dbtype = MG_FieldDBType.FLOAT8;
            }
            else if (type == FieldType.OFTDate)
            {
                dbtype = MG_FieldDBType.DATE;
            }
            else if (type == FieldType.OFTTime)
            {
                dbtype = MG_FieldDBType.TIME;
            }
            else if (type == FieldType.OFTDateTime)
            {
                dbtype = MG_FieldDBType.TIMESTAMP;
            }
            return(dbtype);
        }
Exemple #4
0
 public MG_Field(MG_Field f)
 {
     this.Name      = f.Name;
     this.Type      = f.Type;
     this.Width     = f.Width;
     this.Precision = f.Precision;
 }
Exemple #5
0
 public MG_Field(string name, MG_FieldDBType type, int width, int precision)
 {
     this.Name = name;
     this.Type = type;
     this.Width = width;
     this.Precision = precision;
 }
Exemple #6
0
 public MG_Field(string name, MG_FieldDBType type, int width, int precision)
 {
     this.Name      = name;
     this.Type      = type;
     this.Width     = width;
     this.Precision = precision;
 }
Exemple #7
0
 public void InitializeFieldTypes()
 {
     this.comboBox1_fieldType.Items.Add(MG_FieldDBType.VARCHAR);
     this.comboBox1_fieldType.Items.Add(MG_FieldDBType.INTEGER);
     this.comboBox1_fieldType.Items.Add(MG_FieldDBType.FLOAT8);
     this.comboBox1_fieldType.SelectedIndex = 0;
     this.fieldType = (MG_FieldDBType)this.comboBox1_fieldType.SelectedItem;
 }
Exemple #8
0
 public void InitializeFieldTypes()
 {
     this.comboBox1_fieldType.Items.Add(MG_FieldDBType.VARCHAR);
     this.comboBox1_fieldType.Items.Add(MG_FieldDBType.INTEGER);
     this.comboBox1_fieldType.Items.Add(MG_FieldDBType.FLOAT8);
     this.comboBox1_fieldType.SelectedIndex = 0;
     this.fieldType = (MG_FieldDBType)this.comboBox1_fieldType.SelectedItem;
 }
Exemple #9
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string name = this.textBox1_fieldName.Text.Trim().ToString();
            if (!name.Equals(""))
            {
                this.fieldName = name;
            }

            int index = this.comboBox1_fieldType.SelectedIndex;
            if (index>=0)
            {
                this.fieldType = (MG_FieldDBType)this.comboBox1_fieldType.SelectedItem;
            }
            this.Close();
        }
        protected MG_FieldSet GetFieldSet(string table)
        {
            ArrayList columns = this.GetColumnNames(table);
            ArrayList types   = this.GetColumnTypes(table);

            if (columns == null || types == null)
            {
                return(null);
            }
            int columnCount = columns.Count;
            int typeCount   = types.Count;

            if (columnCount != typeCount)
            {
                return(null);
            }
            MG_FieldSet fieldSet = new MG_FieldSet(table);

            // oid .... geom
            for (int i = 0; i < columnCount; i++)
            {
                string column = columns[i].ToString();
                string type   = types[i].ToString();
                if (!column.Equals("oid") && !column.Equals("geom"))
                {
                    // oid      name                geom         no       length
                    // integer character varying  USER-DEFINED  integer double precision
                    MG_FieldDBType dbType = MG_FieldDBType.VARCHAR;
                    if (type.Equals("integer"))
                    {
                        dbType = MG_FieldDBType.INTEGER;
                    }
                    else if (type.Equals("character varying"))
                    {
                        dbType = MG_FieldDBType.VARCHAR;
                    }
                    else if (type.Equals("double precision"))
                    {
                        dbType = MG_FieldDBType.FLOAT8;
                    }

                    MG_Field field = new MG_Field(column, dbType);
                    fieldSet.Add(field);
                }
            }

            return(fieldSet);
        }
Exemple #11
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string name = this.textBox1_fieldName.Text.Trim().ToString();

            if (!name.Equals(""))
            {
                this.fieldName = name;
            }

            int index = this.comboBox1_fieldType.SelectedIndex;

            if (index >= 0)
            {
                this.fieldType = (MG_FieldDBType)this.comboBox1_fieldType.SelectedItem;
            }
            this.Close();
        }
Exemple #12
0
 public MG_Field(string name, MG_FieldDBType type)
 {
     this.Name = name;
     this.Type = type;
 }
Exemple #13
0
 public MG_Field(string name, MG_FieldDBType type)
 {
     this.Name = name;
     this.Type = type;
 }