private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { if (gridViewPackets.IsGroupRow(e.FocusedRowHandle)) { txtCallStack.Text = string.Empty; esParametersBindingSource.DataSource = null; txtSQL.Text = string.Empty; txtException.Text = string.Empty; return; } int index = gridViewPackets.ViewRowHandleToDataSourceIndex(e.FocusedRowHandle); esTracePacket packet = currentChannel.ChannelData[index]; txtSQL.Text = packet.Sql; SetParserSyntax(packet.Syntax); parser.SqlText.Text = packet.Sql; txtSQL.Rtf = parser.ToRTF(TOutputFmt.ofrtf); txtException.Text = packet.Exception; txtCallStack.Text = packet.CallStack; if (packet.SqlParameters != null) { esParametersBindingSource.DataSource = packet.SqlParameters; } } catch { } }
private void btnExecute_Click(object sender, EventArgs e) { try { txtSQL.Text = ""; txtSQL.Rtf = ""; txtSQL.Update(); CSharpExecuter executer = new CSharpExecuter(referenceList); object[] result = executer.Execute(syntaxEditor.Text, txtConnectionString.Text, cbxProviders.Text, txtProviderMetadataKey.Text, this.txtNamespaces.Text, false); if (result != null) { gridView1.Columns.Clear(); grid.DataSource = null; grid.DataSource = result[0]; grid.RefreshDataSource(); grid.Update(); txtSQL.Text = (string)result[1]; SetParserSyntax(cbxProviders.Text); parser.SqlText.Text = txtSQL.Text; txtSQL.Rtf = parser.ToRTF(TOutputFmt.ofrtf); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnFormatSQLInRTF_Click(object sender, EventArgs e) { tbCtrlStage.SelectedIndex = 2; setupformatoptions(); setuphighlighterAttributes(); TGSqlParser sqlparser = new TGSqlParser(getDBVendor()); sqlparser.SqlText.Text = inputsql.Text; //richTextBox1.Text = sqlparser.ToRTF(TOutputFmt.ofrtf); richTextBox1.Rtf = sqlparser.ToRTF(TOutputFmt.ofrtf); }
private void analyseRequest() { Cursor.Current = Cursors.WaitCursor; //for more format options, please check document lzbasetype.gFmtOpt.Select_Columnlist_Style = TAlignStyle.asStacked; lzbasetype.gFmtOpt.Select_Columnlist_Comma = TLinefeedsCommaOption.lfAfterComma; lzbasetype.gFmtOpt.SelectItemInNewLine = false; lzbasetype.gFmtOpt.AlignAliasInSelectList = true; lzbasetype.gFmtOpt.TreatDistinctAsVirtualColumn = false; //setup more format options ... lzbasetype.gFmtOpt.linenumber_enabled = false; lzbasetype.gFmtOpt.HighlightingFontname = "Courier New"; lzbasetype.gFmtOpt.HighlightingFontsize = 10; //for other elements you want to customize, please check document lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkIdentifer].SetForegroundInRGB("#008000"); lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkIdentifer].StyleBold = true; lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkIdentifer].StyleItalic = false; lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkIdentifer].StyleStrikeout = false; lzbasetype.gFmtOpt.HighlightingElements[(int)TLzHighlightingElement.sfkIdentifer].StyleUnderline = false; TGSqlParser parser = new TGSqlParser(TDbVendor.DbVOracle); parser.SqlText.Text = rtbEditor.Text; int i = parser.PrettyPrint(); if (i == 0) { rtbEditor.Rtf = parser.ToRTF(TOutputFmt.ofrtf); } Cursor.Current = Cursors.Default; }