Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#1461 closed enhancement (fixed)

Do not parse unusable JEP functions in dynamic queries

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: minor Milestone: BASE 2.15
Component: core Version:
Keywords: Cc:

Description

There are various types of dynamic queries, eg. DynamicSpotQuery, DynamicPositionQuery, DynamicExtraValueQuery, etc... The BioAssaySetUtil contains functions for parsing a JEP expressions into Query API Restricion:s and Expression:s. The problem is that it registers a lot of custom functions that may or may not be applicable to a specific query. For example, The 'raw()' function can't be used with a DynamicPositionQuery. It results in a error like:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:
Unknown column 'raw.position' in 'field list'

(See http://www.mail-archive.com/basedb-users@lists.sourceforge.net/msg01927.html)

It would be better if this error was catched by the parser instead of having the Query API generate invalid SQL.

Change History (3)

comment:1 by Nicklas Nordborg, 15 years ago

Owner: changed from everyone to Nicklas Nordborg
Status: newassigned

comment:2 by Nicklas Nordborg, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [5258]) Fixes #1461: Do not parse unusable JEP functions in dynamic queries

This was a lot more work than expected. Partly because I also wanted the JEP parser to generate a better error message. When it encounters an unknown function it says: Syntax error (implicit multiplication not enabled)

which is a lot worse than what we got from MySQL: Unknown column 'raw.position' in 'field list'

By subclassing the JEP class it was possible to create a better error message: Unknown function: raw() in formula raw('position')

comment:3 by Nicklas Nordborg, 15 years ago

(In [5259]) References #1461: Do not parse unusable JEP functions in dynamic queries

Forgot to include the new file.

Note: See TracTickets for help on using tickets.