Intland's free requirements, development and test management hosting.
This server hosts 100.000+ users on the cloud!
StringIndexOutOfBoundsException when parsing SQL statements with ternary expressions#52891/v3
more
Tags:  v1.1

StringIndexOutOfBoundsException when parsing SQL statements with ternary expressions[BUG-52891]

Tracker: Bugs Priority: NormalNormal Assigned to: --
Submitted by: ejboy Jul 27, 2012 05:23 Status: Resolved Category: --
Severity: --
Relations
Loading...
Description
Currently, the following statement cannot be parsed:
?{dateofbirth==null?sysdate:dateofbirth}
StringIndexOutOfBoundsException occurs in SqlParserBase, because parsing logic does not handle ternary expressions properly. In the example above "?sysdate" is mistakenly treated as a next expression, although it is just a part of the ternary condition of the first expression.

Extra whitespaces can be added as a workaround, .e.g.

?{dateofbirth==null ? sysdate : dateofbirth}
Alternatively a GNU C extension syntax can be used:
?{dateofbirth?:sysdate} 

Reported at: https://groups.google.com/forum/?fromgroups#!topic/scriptella/Mccbkdd-JLk

Details
Comments & Attachments (0)
Associations (0)
Children (0)
References (0)
SCM Commits (2)
All (2)

Submitter Association Comment
Nothing found to display.