示例#1
0
        private static void _DisplayTable(UniqueTable udt, bool more, ApplicationCommand cmd)
        {
            DataTable table = udt.Table;

            if (table == null)
            {
                return;
            }

            if (cmd.Has("json"))
            {
                cout.WriteLine(table.WriteJson(JsonStyle.Normal, excludeTableName: false));
                return;
            }

#if WINDOWS
            if (cmd.Has("edit"))
            {
                var editor = new Windows.TableEditor(udt);
                editor.ShowDialog();
                return;
            }
#endif

            int maxColumnWidth = Config.console.table.grid.MaxColumnWidth;

            table.ToConsole(vertical: cmd.IsVertical, more: more, outputDbNull: true, maxColumnWidth);
        }
示例#2
0
        private static void _DisplayTable(UniqueTable udt, bool more, Command cmd)
        {
            DataTable table = udt.Table;

            if (table == null)
                return;

            if (cmd.ToJson)
            {
                stdio.WriteLine(ToJson(table));
                return;
            }

            if (cmd.ToCSharp)
            {
                string clss = cmd.GetValue("class");

                stdio.WriteLine(ToCSharp(table, clss));
                return;
            }

            if (cmd.Has("edit"))
            {
                var editor = new Windows.TableEditor(cmd.Configuration, udt);
                editor.ShowDialog();
                return;
            }

            if (cmd.IsVertical)
                table.ToVConsole(more);
            else
                table.ToConsole(more);
        }
示例#3
0
        public void OpenEditor()
        {
            DataTable dt = null;
            if (SqlShell.LastResult is DataTable)
            {
                dt = SqlShell.LastResult as DataTable;
            }

            if (dt == null)
            {
                stdio.ErrorFormat("select table first");
                return;
            }

            var editor = new Windows.TableEditor(mgr.Configuration, new UniqueTable(null, dt));

            editor.ShowDialog();
        }