コード例 #1
0
ファイル: DBCommands.cs プロジェクト: onixion/MAD
        public override string Execute(int consoleWidth)
        {
            using (DataTable _table = _db.GetSummaryTable(GetSQLSubCommand("SummaryTable", true)))
            {
                DataColumnCollection _columns = _table.Columns;
                DataRowCollection    _rows    = _table.Rows;

                output += "<color><yellow>" + ConsoleTable.GetSplitline(consoleWidth);
                output += ConsoleTable.FormatStringArray(consoleWidth, DBCLIHelper.GetColumnNames(_columns));
                output += ConsoleTable.GetSplitline(consoleWidth) + "<color><white>";

                for (int i = 0; i < _rows.Count; i++)
                {
                    output += ConsoleTable.FormatStringArray(consoleWidth, DBCLIHelper.GetRowValues(_columns, _rows[i]));
                }

                return(output);
            }
        }
コード例 #2
0
ファイル: DBCommands.cs プロジェクト: onixion/MAD
        public override string Execute(int consoleWidth)
        {
            if (!OParUsed("t"))
            {
                using (DataTable _table = _db.ReadTables())
                {
                    DataColumnCollection _columns = _table.Columns;
                    DataRowCollection    _rows    = _table.Rows;

                    output += "<color><yellow>" + ConsoleTable.GetSplitline(consoleWidth);
                    output += ConsoleTable.FormatStringArray(consoleWidth, DBCLIHelper.GetColumnNames(_columns));
                    output += ConsoleTable.GetSplitline(consoleWidth) + "<color><white>";

                    for (int i = 0; i < _rows.Count; i++)
                    {
                        output += ConsoleTable.FormatStringArray(consoleWidth, DBCLIHelper.GetRowValues(_columns, _rows[i]));
                    }
                }
            }
            else
            {
                string _dataTable = (string)pars.GetPar("t").argValues[0];

                using (DataTable _table = _db.SelectAllFromTable(_dataTable + GetSQLSubCommand(_dataTable, false)))
                {
                    DataColumnCollection _columns = _table.Columns;
                    DataRowCollection    _rows    = _table.Rows;

                    output += "<color><yellow>" + ConsoleTable.GetSplitline(consoleWidth);
                    output += ConsoleTable.FormatStringArray(consoleWidth, DBCLIHelper.GetColumnNames(_columns));
                    output += ConsoleTable.GetSplitline(consoleWidth) + "<color><white>";

                    for (int i = 0; i < _rows.Count; i++)
                    {
                        output += ConsoleTable.FormatStringArray(consoleWidth, DBCLIHelper.GetRowValues(_columns, _rows[i]));
                    }
                }
            }

            return(output);
        }