Issue Details (XML | Word | Printable)

Key: NUCRDBMS-552
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Daniel Baldes
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

DN does not recognize SQL comments when looking for the ID column

Created: 29/Aug/11 10:31 AM   Updated: 03/Oct/11 07:38 AM   Resolved: 29/Aug/11 08:28 PM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.2

File Attachments: 1. Text File sqlcomments.patch (1 kB)


Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,6830


 Description  « Hide
Comments in SQL queries are not recognized when DataNucleus checks for selection of ID columns in an SQL query with a result class.

This makes it impossible, for example, to add Oracle optimizer hints to a query.

Patch follows.

Daniel Baldes added a comment - 29/Aug/11 10:33 AM - edited
Attached a patch against the trunk which implements very simple comment-removal before PK column recognition. The regex-based approach should be precise enough here as it is only used during PK column recognition.

Daniel Baldes made changes - 29/Aug/11 10:33 AM
Field Original Value New Value
Attachment sqlcomments.patch [ 11490 ]
Daniel Baldes added a comment - 29/Aug/11 10:40 AM
Another possible approach would be to remove the string-based ID column check, and check for existence of the column(s) in the ResultSet. That would be better, as it would leave the parsing to the database, which needs to do that anyway and accepts all possible syntax.

Andy Jefferson added a comment - 29/Aug/11 07:34 PM
The other possible approach is invalid since compile() has to flag missing columns as per the JDO spec, and the JDO TCK would then fail.
I'll review the patch when time. thx

Andy Jefferson added a comment - 29/Aug/11 08:28 PM
SVN trunk now includes this patch, and also drops checks of resultSet presence of version, discriminator, and id since those are checked in the compile step

Andy Jefferson made changes - 29/Aug/11 08:28 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0.2 [ 11310 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 03/Oct/11 07:38 AM
Status Resolved [ 5 ] Closed [ 6 ]