Issue Details (XML | Word | Printable)

Key: NUCRDBMS-672
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Ivan Badia
Votes: 0
Watchers: 0
Operations

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

Error evaluating {dateExpr}.getHour(),{dateExpr}.getMinute(),{dateExpr}.getSecond() using SQLServer

Created: 08/May/13 06:37 PM   Updated: 15/May/13 09:32 AM   Resolved: 08/May/13 08:49 PM
Component/s: None
Affects Version/s: 3.2.0.release
Fix Version/s: 3.2.2

File Attachments: 1. File datanucleus_sqlserver_datepart.diff (4 kB)


Datastore: Microsoft SQL Server


 Description  « Hide
DateGetHour4Method returns the NumericExpression DATEPART('hh', expr) which is not valid.

The correct expression is DATEPART(hh, expr).

To fix the issue is necessary to add the next line to generate the expression without quotes:

        ((StringLiteral)hh).generateStatementWithoutQuotes();


DateGetMinute4Method and DateGetSecond4Method are affected by the same issue.

Thanks in advance.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 08/May/13 07:04 PM
Since you have that datastore then it would be an easy job for you to get the code for the RDBMS plugin and update those methods, test them, and attach a patch here. That's the only way it can work. Awaiting your patch

Ivan Badia added a comment - 08/May/13 07:32 PM
Attached patch with the changes in DateGetHour4Method, DateGetMinute4Method and DateGetSecond4Method

Andy Jefferson added a comment - 08/May/13 08:49 PM
SVN trunk has this now. Thx