Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#116 added datediff and dateadd support
- Loading branch information
Showing
4 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
querydsl-sql/src/main/java/com/mysema/query/sql/mssql/DatePart.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.mysema.query.sql.mssql; | ||
|
||
public enum DatePart { | ||
year, | ||
quarter, | ||
month, | ||
dayofyear, | ||
day, | ||
week, | ||
hour, | ||
minute, | ||
second, | ||
millisecond, | ||
microsecond, | ||
nanosecond | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
querydsl-sql/src/test/java/com/mysema/query/_mssql/SQLServerGrammarTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mysema.query._mssql; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Test; | ||
|
||
import com.mysema.query.sql.mssql.DatePart; | ||
import com.mysema.query.sql.mssql.SQLServerGrammar; | ||
|
||
public class SQLServerGrammarTest { | ||
|
||
@Test | ||
public void Datediff() { | ||
assertEquals("datediff('day',start,end)", | ||
SQLServerGrammar.datediff(DatePart.day, "start", "end").toString()); | ||
} | ||
|
||
@Test | ||
public void Dateadd() { | ||
assertEquals("dateadd('hour',3,start)", | ||
SQLServerGrammar.dateadd(DatePart.hour, 3, "start").toString()); | ||
} | ||
|
||
} |