Skip to content

Commit

Permalink
LDEV-4867 include cause for QoQ Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jul 2, 2024
1 parent 5efb5c0 commit 54e4e80
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
3 changes: 2 additions & 1 deletion core/src/main/java/lucee/runtime/db/HSQLDBHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ public QueryImpl execute(PageContext pc, final SQL sql, int maxrows, int fetchsi

}
catch (ParseException e) {
throw new DatabaseException(e.getMessage(), null, sql, null);
throw (IllegalQoQException) (new IllegalQoQException("QoQ: error executing sql statement on query, " + e.getMessage(), null, sql, null).initCause(e));
//throw new DatabaseException(e.getMessage(), e, sql, null);
}

}
Expand Down
4 changes: 2 additions & 2 deletions test/_testRunner.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ component {
*/
}
if ( !isNull( specStat.error.sql ) && !isEmpty( trim(specStat.error.sql) ) ){
systemOutput( TAB & "SQL: " & specStat.error.Detail, true );
systemOutput( TAB & "SQL: [" & specStat.error.sql & "]", true );
}
if ( !isNull( specStat.error.StackTrace ) && !isEmpty( specStat.error.StackTrace ) ){
systemOutput( TAB & specStat.error.type, true );
Expand All @@ -233,7 +233,7 @@ component {
systemOutput( NL );
}

// systemOutput(NL & serialize(specStat.error), true);
//systemOutput(NL & serializeJson(specStat.error), true);

} // if !isNull
}
Expand Down
32 changes: 24 additions & 8 deletions test/tickets/LDEV4867.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,60 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="query" {
};

function run( testResults , testBox ) {
describe( title='LDEV-4867' , body=function(){
describe( title='LDEV-4867', body=function(){

it( title='test query parsing, removing comments' , body=function() {
it( title='test query parsing, removing comments', body=function() {
doTest( ["-- foo", "/* bar */", "SELECT engine from qry where id = :id "]
,[ "-- foo" , "/* bar */" ]
);
});

it( title='test query parsing, with a ? in a comment' , body=function() {
it( title='test query parsing, mixed nested comments', body=function() {
doTest( ["/* bar -- foo */", "SELECT engine from qry where id = :id ", "/* bar -- foo */"]
,[ "/* bar -- foo */" ]
);
doTest( ["--foo /* bar */", "SELECT engine from qry where id = :id ", "--foo /* bar */"]
,[ "--foo /* bar */" ]
);
});

it( title='test query parsing, nested comment blocks', skip=true, body=function() {
// Nested comments aren't generally supported anyway....
doTest( ["/* bar /* #LF# -- foo #LF# */ */", "SELECT engine from qry where id = :id "]
,[ "/* bar /* #LF# -- foo #LF# */ */" ]
);
});

it( title='test query parsing, with a ? in a comment', body=function() {
doTest( [ "-- foo", "/* bar? */", "SELECT engine"," from qry", "where id = :id" ]
,[ "-- foo", "/* bar? */" ]
);
});

it( title='test query parsing, with a ? in a /* */ comment' , body=function() {
it( title='test query parsing, with a ? in a /* */ comment', body=function() {
doTest( [ "-- foo", "/* bar? */", "SELECT engine"," from qry", "where id = :id" ],
[ "-- foo", "/* bar? */" ] );
});

it( title='test query parsing, with a ? and : in a comment' , body=function() {
it( title='test query parsing, with a ? and : in a comment', body=function() {
doTest( [ "-- foo ? :do", "/* bar? :*/", "SELECT engine"," from qry", "where id = :id" ],
[ "-- foo ? :do", "/* bar? :*/" ]
);
});

it( title='test query parsing, with a ? in a comment' , body=function() {
it( title='test query parsing, with a ? in a comment', body=function() {
doTest( [ "-- foo ? :do", "/* bar? :*/", "SELECT engine"," from qry", "where id = :id" ],
[ "-- foo ? :do", "/* bar? :*/" ]
);
});

it( title='test query parsing, with a ? in a trailing line comment' , body=function() {
it( title='test query parsing, with a ? in a trailing line comment', body=function() {
doTest( [ "SELECT engine"," from qry", "where id = :id", "-- foo ? :do" ],
[ "-- foo ? :do" ]
);
});

it( title='test query parsing, with a ? in a trailing comment block' , body=function() {
it( title='test query parsing, with a ? in a trailing comment block', body=function() {
doTest( [ "SELECT engine"," from qry", "where id = :id", "/* foo ? :do */" ],
[ "/* foo ? :do */" ]
);
Expand Down

0 comments on commit 54e4e80

Please sign in to comment.