private void BoxSqlCurrentSubQuery_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { if (QBuilder.ActiveUnionSubQuery == null) { return; } try { ErrorBox.Show(null, QBuilder.SyntaxProvider); QBuilder.ActiveUnionSubQuery.ParentSubQuery.SQL = ((TextBox)sender).Text; var sql = QBuilder.ActiveUnionSubQuery.ParentSubQuery.GetResultSQL(QBuilder.SQLFormattingOptions); _transformerSql.Query = new SQLQuery(QBuilder.ActiveUnionSubQuery.SQLContext) { SQL = sql }; _lastValidText1 = ((TextBox)sender).Text; } catch (SQLParsingException ex) { ErrorBox2.Show(ex.Message, QBuilder.SyntaxProvider); _errorPosition1 = ex.ErrorPos.pos; } }
private void SetSqlTextCurrentSubQuery() { ErrorBox2.Show(null, QBuilder.SyntaxProvider); if (_transformerSql == null) { return; } var activeUnionSubQuery = QBuilder.ActiveUnionSubQuery; if (activeUnionSubQuery == null || QBuilder.SleepMode) { BoxSqlCurrentSubQuery.Text = ""; _transformerSql.Query = null; return; } var parentSubQuery = activeUnionSubQuery.ParentSubQuery; var sqlForDataPreview = parentSubQuery.GetSqlForDataPreview(); _transformerSql.Query = new SQLQuery(activeUnionSubQuery.SQLContext) { SQL = sqlForDataPreview }; var sql = parentSubQuery.GetResultSQL(QBuilder.SQLFormattingOptions); BoxSqlCurrentSubQuery.Text = sql; }
private void TextBox2_OnLostKeyboardFocus(object sender, RoutedEventArgs routedEventArgs) { try { // Update the query builder with manually edited query text: QueryBuilder1.SQL = TextBox2.Text; // Hide error banner if any ErrorBox2.Show(null, QueryBuilder1.SyntaxProvider); _lastValidSql2 = TextBox2.Text; _errorPosition2 = -1; } catch (SQLParsingException ex) { // Set caret to error position TextBox2.SelectionStart = ex.ErrorPos.pos; // Show banner with error text ErrorBox2.Show(ex.Message, QueryBuilder1.SyntaxProvider); _errorPosition2 = ex.ErrorPos.pos; } }
private void ErrorBox2_OnRevertValidTextEvent(object sender, EventArgs e) { TextBox2.Text = _lastValidSql2; ErrorBox2.Show(null, QueryBuilder1.SyntaxProvider); TextBox2.Focus(); }
private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { ErrorBox1.Show(null, QueryBuilder1.SyntaxProvider); ErrorBox2.Show(null, QueryBuilder1.SyntaxProvider); }