Example #1
0
        private TextualTable parseShowTables()
        {
            var result = new TextualTable(database, database.Name);

            result.AddColumn("table");
            result.AddColumn("columns");
            result.AddColumn("rowCount");

            foreach (var pair in database.Tables)
            {
                var row = new TextualRow(result);
                row.SetValueOrdered(pair.Key);

                var sb = new StringBuilder();
                foreach (var column in pair.Value.Columns)
                {
                    sb.AppendFormat("{0} ", column);
                }
                row.SetValueOrdered(sb.ToString());

                row.SetValueOrdered(pair.Value.Rows.Count);

                result.AddRow(row);
            }

            return(result);
        }
        public TextualSelectOperation(TextualTable table, params string[] columns)
        {
            Result     = new TextualTable(table.ParentDatabase, table.Name);
            this.table = table;

            if (columns.Length == 0)
            {
                columns = table.Columns.ToArray();
            }

            foreach (var column in columns)
            {
                Result.AddColumn(column);
            }
            foreach (var srcRow in table.Rows)
            {
                Result.AddRow(srcRow);
            }
        }
Example #3
0
        private TextualTable parseShowColumns()
        {
            // IN table
            expectToken(TokenType.Identifier, "IN");
            string table = expectToken(TokenType.Identifier).Value;

            var result = new TextualTable(database, table);

            result.AddColumn("column");

            foreach (var column in database.GetTable(table).Columns)
            {
                var row = new TextualRow(result);
                row.SetValueOrdered(column);
                result.AddRow(row);
            }

            return(result);
        }
 public void Execute(string name, int index = -1)
 {
     table.AddColumn(name, index);
 }