Esempio n. 1
0
        public Table(string fileName)
        {
            string[]       lines = File.ReadAllLines(fileName);
            List <Value[]> table = new List <Value[]>(lines.Length);

            for (int i = 0; i < lines.Length; i++)
            {
                string[] columns = lines[i].Split(',');
                Value[]  values  = new Value[columns.Length];
                for (int j = 0; j < columns.Length; j++)
                {
                    string cell = columns[j].Where(x => x != ' ' && x != '\t').Aggregate("", (x, y) => x + y);
                    int    intValue;
                    double realValue;

                    if (Int32.TryParse(cell, out intValue))
                    {
                        values[j] = new DBInteger(intValue);
                    }
                    else if (Double.TryParse(cell, out realValue))
                    {
                        values[j] = new DBReal(realValue);
                    }
                    else if (cell == "NULL")
                    {
                        values[j] = new DBNull();
                    }
                    else
                    {
                        values[j] = new DBString(cell);
                    }
                }
                table.Add(values);
            }
            Rows = table;
        }
Esempio n. 2
0
 public bool IsEmpty(DBString x)
 {
     return false;
 }
Esempio n. 3
0
        public Table(string fileName)
        {
            string[] lines = File.ReadAllLines(fileName);
              List<Value[]> table = new List<Value[]>(lines.Length);
              for (int i = 0; i < lines.Length; i++)
              {
            string[] columns = lines[i].Split(',');
            Value[] values = new Value[columns.Length];
            for (int j = 0; j < columns.Length; j++)
            {
              string cell = columns[j].Where(x => x != ' ' && x != '\t').Aggregate("", (x, y) => x + y);
              int intValue;
              double realValue;

              if (Int32.TryParse(cell, out intValue))
            values[j] = new DBInteger(intValue);
              else if (Double.TryParse(cell, out realValue))
            values[j] = new DBReal(realValue);
              else if (cell == "NULL")
            values[j] = new DBNull();
              else
            values[j] = new DBString(cell);
            }
            table.Add(values);
              }
              Rows = table;
        }
Esempio n. 4
0
 public bool IsEmpty(DBString x)
 {
     return(false);
 }