Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335707

Summary: TRIM() no longer works on SQL Server
Product: z_Archived Reporter: Mitesh Meswani <mitesh.meswani>
Component: EclipselinkAssignee: Project Inbox <eclipselink.foundation-inbox>
Status: CLOSED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: andrei.ilitchev, david.minsky, tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Suggested patch. none

Description Mitesh Meswani CLA 2011-01-28 12:20:03 EST
SQL Server does not offer TRIM. EclipseLink had a work around in place to use RTRIM(LTRIM() ) instead. A change in https://fisheye2.atlassian.com/changelog/eclipselink/?cs=6761 has removed the work around. This results in JPQL TRIM() not working against SQL Server
Comment 1 Andrei Ilitchev CLA 2011-01-28 15:46:14 EST
Created attachment 187877 [details]
Suggested patch.

Rolled back the code to use leftTrim(rightTrim, again.
Also fixes in JUnitJPQLComplexTestSuite:
  introduced supportsStoredFunction method so that setup passes on SQLServer (which doesn't support stored functions);
  updated variableReferencedOnlyInParameterTest so that it now passes on SQLServer. That's done by excluding the qpql strings known not been supported by the db platform. For SQLSerfver those are:
"SELECT TRIM(LEADING 'A' FROM e.firstName) FROM Employee e"
and
"SELECT TRIM(TRAILING 'A' FROM e.firstName) FROM Employee e"
Comment 2 Andrei Ilitchev CLA 2011-01-28 16:00:11 EST
Fixed in trunk rev.8902 and 2.2 revision: 8903
Comment 3 David Minsky CLA 2011-07-13 16:24:00 EDT
Checked into 2.1 trunk at revision: 9722
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:10:09 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink