[Rt-commit] rt branch, 4.4/fromsql-query-validation, created. rt-4.4.1-95-g7d8d5f6
Dustin Graves
dustin at bestpractical.com
Wed Aug 3 17:27:22 EDT 2016
The branch, 4.4/fromsql-query-validation has been created
at 7d8d5f6838ff707d4bc8c8c787868718a75562ff (commit)
- Log -----------------------------------------------------------------
commit 7d8d5f6838ff707d4bc8c8c787868718a75562ff
Author: Dustin Graves <dustin at bestpractical.com>
Date: Wed Aug 3 21:22:06 2016 +0000
fix RT::Tickets->FromSQL query validation
commit b68c84f0 broke this feature by changing FromSQL to use the
RT::SQL::Parse call in RT::Interface::Web::QueryBuilder::Tree->ParseSQL
which defines an Error callback
this callback swallows the expected exceptions and causes FromSQL to
erroneously return 'Valid Query'
this commit adds a way to skip defining the error callback when calling
RT::Interface::Web::QueryBuilder::Tree->ParseSQL
Fixes: I#32231
diff --git a/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 4f1bf2e..f5d8dd4 100644
--- a/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -246,6 +246,7 @@ sub ParseSQL {
my %args = (
Query => '',
CurrentUser => '', #XXX: Hack
+ UseErrorCallback => 1,
@_
);
my $string = $args{'Query'};
@@ -281,7 +282,7 @@ sub ParseSQL {
Op => $op, Value => $value };
$node->addChild( __PACKAGE__->new( $clause ) );
};
- $callback{'Error'} = sub { push @results, @_ };
+ $callback{'Error'} = sub { push @results, @_ } if $args{UseErrorCallback};
require RT::SQL;
RT::SQL::Parse($string, \%callback);
diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 64b0646..ef2dd1b 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -2983,6 +2983,7 @@ sub _parser {
$tree->ParseSQL(
Query => $string,
CurrentUser => $self->CurrentUser,
+ UseErrorCallback => 0,
);
state ( $active_status_node, $inactive_status_node );
-----------------------------------------------------------------------
More information about the rt-commit
mailing list