提交 f6c0d229 authored 作者: Thomas Mueller's avatar Thomas Mueller

Formatting

上级 f5c57431
......@@ -1241,8 +1241,19 @@ public class Function extends Expression implements FunctionCall {
return ts;
}
/**
* Calculate the number of crossed unit boundaries between two timestamps.
* This method is supported for MS SQL Server compatibility.
* <pre>
* DATEDIFF(YEAR, '2004-12-31', '2005-01-01') = 1
* </pre>
*
* @param part the part
* @param d1 the first date
* @param d2 the second date
* @return the number of crossed boundaries
*/
private static long datediff(String part, Timestamp d1, Timestamp d2) {
// diff (yy, 31.12.2004, 1.1.2005) = 1
int field = getDatePart(part);
Calendar calendar = Calendar.getInstance();
long t1 = d1.getTime(), t2 = d2.getTime();
......
......@@ -84,7 +84,7 @@ public class JavaFunction extends Expression implements FunctionCall {
public String getSQL() {
StatementBuilder buff = new StatementBuilder();
// TODO always append the schema once FUNCTIONS_IN_SCHEMA is enabled
if (SysProperties.FUNCTIONS_IN_SCHEMA ||
if (SysProperties.FUNCTIONS_IN_SCHEMA ||
!functionAlias.getSchema().getName().equals(Constants.SCHEMA_MAIN)) {
buff.append(Parser.quoteIdentifier(functionAlias.getSchema().getName())).append('.');
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论