Exemple #1
0
        public void SetAndExecuteSql(string sql = "")
        {
            if (!sqlManager.isConnected)
            {
                MessageBox.Show($"{formBar.SVCombo.Text}との接続が開かれていません。", "Reseacher");
                return;
            }

            if (sql != "")
            {
                tabGrid.CurrentQuery.Text = sql;
            }

            SqlRule      rule      = new SqlRule();
            SqlFormatter formatter = new SqlFormatter(rule);

            try
            {
                var xml = new XmlManager();
                if (xml[new List <string>()
                        {
                            "format"
                        }, "False"].ToUpper().Equals("TRUE"))
                {
                    TabGrid.CurrentQuery.Text = formatter.Format(TabGrid.CurrentQuery.Text);
                }
            }
            catch { /* ignore */ }

            sqlManager.ExecuteSqlToServer(tabGrid.CurrentQuery.Text, tabGrid.CurrentTabIndex.ToString());
            tabGrid.CurrentGridView.DataSource = sqlManager.Tables[tabGrid.CurrentTabIndex.ToString()];

            tabGrid.CurrentQuery.SetSelection(tabGrid.CurrentQuery.Text.Length, tabGrid.CurrentQuery.Text.Length);
            RecCount = $"Rows : {TabGrid.CurrentGridView.Rows.Count} / Columns : {TabGrid.CurrentGridView.Columns.Count} ";
        }
Exemple #2
0
        public static string Format(string query)
        {
            var rule      = new SqlRule();
            var formatter = new SqlFormatter(rule);

            return(formatter.Format(query));
        }
Exemple #3
0
        private void SqlQueryBtn_Click(object sender, EventArgs e)
        {
            var s      = ClipboardManager.GetClipboardContent();
            var result = SqlFormatter.Format(s);

            ClipboardManager.InsertClipboardText(result);
            Close();
        }
Exemple #4
0
        public void FormatText(bool isUseNewline = false)
        {
            var rule = new SqlRule();

            rule.IndentString = isUseNewline ? "    " : "";
            var formatter     = new SqlFormatter(rule);
            var formattedText = formatter.Format(Text);

            if (!isUseNewline)
            {
                formattedText = formattedText.Replace(System.Environment.NewLine, " ");
            }
            ;
            Text = formattedText;
        }
 /// <summary>
 /// Tranfors the <see cref="object"/> value to a sql formatted string
 /// </summary>
 /// <param name="value">The value to transformed</param>
 /// <returns>The formatted sql string</returns>
 public static string ToSql(this object value)
 {
     return(SqlFormatter.Format(null, value));
 }
Exemple #6
0
 /// <summary>
 /// Formats the query.
 /// </summary>
 /// <param name="query">The query.</param>
 /// <returns></returns>
 protected virtual string FormatQuery(Expression query)
 {
     return(SqlFormatter.Format(query));
 }
 /// <summary>
 /// Converts the query expression into text of this query language
 /// </summary>
 /// <param name="expression"></param>
 /// <returns></returns>
 public virtual string Format(Expression expression)
 {
     // use common SQL formatter by default
     return(SqlFormatter.Format(expression));
 }