提交 19f3d874 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 e5c25628
...@@ -16,7 +16,6 @@ import java.util.HashMap; ...@@ -16,7 +16,6 @@ import java.util.HashMap;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone; import java.util.TimeZone;
import org.h2.engine.Constants;
import org.h2.engine.Database; import org.h2.engine.Database;
import org.h2.engine.Mode; import org.h2.engine.Mode;
import org.h2.engine.Session; import org.h2.engine.Session;
...@@ -684,7 +683,9 @@ public class Function extends Expression implements FunctionCall { ...@@ -684,7 +683,9 @@ public class Function extends Expression implements FunctionCall {
case DATEDIFF: case DATEDIFF:
return ValueLong.get(datediff(v0.getString(), v1.getTimestampNoCopy(), v2.getTimestampNoCopy())); return ValueLong.get(datediff(v0.getString(), v1.getTimestampNoCopy(), v2.getTimestampNoCopy()));
case DAYNAME: case DAYNAME:
return ValueString.get(FORMAT_DAYNAME.format(v0.getDateNoCopy())); synchronized(FORMAT_DAYNAME) {
return ValueString.get(FORMAT_DAYNAME.format(v0.getDateNoCopy()));
}
case DAYOFMONTH: case DAYOFMONTH:
return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.DAY_OF_MONTH)); return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.DAY_OF_MONTH));
case DAYOFWEEK: case DAYOFWEEK:
...@@ -698,7 +699,9 @@ public class Function extends Expression implements FunctionCall { ...@@ -698,7 +699,9 @@ public class Function extends Expression implements FunctionCall {
case MONTH: case MONTH:
return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.MONTH)); return ValueInt.get(getDatePart(v0.getTimestampNoCopy(), Calendar.MONTH));
case MONTHNAME: case MONTHNAME:
return ValueString.get(FORMAT_MONTHNAME.format(v0.getDateNoCopy())); synchronized(FORMAT_MONTHNAME) {
return ValueString.get(FORMAT_MONTHNAME.format(v0.getDateNoCopy()));
}
case QUARTER: case QUARTER:
return ValueInt.get((getDatePart(v0.getTimestamp(), Calendar.MONTH) - 1) / 3 + 1); return ValueInt.get((getDatePart(v0.getTimestamp(), Calendar.MONTH) - 1) / 3 + 1);
case SECOND: case SECOND:
...@@ -1375,9 +1378,6 @@ public class Function extends Expression implements FunctionCall { ...@@ -1375,9 +1378,6 @@ public class Function extends Expression implements FunctionCall {
precision = 0; precision = 0;
scale = 0; scale = 0;
} }
if(Constants.CHECK && dataType == Value.NULL) {
throw Message.getInternalError("type NULL: " + getSQL());
}
if(allConst) { if(allConst) {
return ValueExpression.get(getValue(session)); return ValueExpression.get(getValue(session));
} }
......
...@@ -114,7 +114,9 @@ public class TraceSystem { ...@@ -114,7 +114,9 @@ public class TraceSystem {
} }
private String format(String module, String s) { private String format(String module, String s) {
return dateFormat.format(new Date()) + module + ": " + s; synchronized(dateFormat) {
return dateFormat.format(new Date()) + module + ": " + s;
}
} }
void write(int l, String module, String s, Throwable t) { void write(int l, String module, String s, Throwable t) {
......
...@@ -69,7 +69,7 @@ public class OdbcServer implements Service { ...@@ -69,7 +69,7 @@ public class OdbcServer implements Service {
} }
} }
org.h2.Driver.load(); org.h2.Driver.load();
url = "tcp://localhost:" + port; url = "odbc://localhost:" + port;
} }
public String getURL() { public String getURL() {
......
...@@ -98,18 +98,26 @@ public class FtpServer implements Service { ...@@ -98,18 +98,26 @@ public class FtpServer implements Service {
buff.append(size); buff.append(size);
buff.append(' '); buff.append(' ');
Date now = new Date(), mod = new Date(f.lastModified()); Date now = new Date(), mod = new Date(f.lastModified());
String date;
if(mod.after(now) || Math.abs((now.getTime() - mod.getTime())/1000/60/60/24) > 180) { if(mod.after(now) || Math.abs((now.getTime() - mod.getTime())/1000/60/60/24) > 180) {
buff.append(dateFormatOld.format(mod)); synchronized(dateFormatOld) {
date = dateFormatOld.format(mod);
}
} else { } else {
buff.append(dateFormatNew.format(mod)); synchronized(dateFormatNew) {
date = dateFormatNew.format(mod);
}
} }
buff.append(date);
buff.append(' '); buff.append(' ');
buff.append(f.getName()); buff.append(f.getName());
buff.append("\r\n"); buff.append("\r\n");
} }
String formatLastModified(FileObject file) { String formatLastModified(FileObject file) {
return dateFormat.format(new Date(file.lastModified())); synchronized(dateFormat) {
return dateFormat.format(new Date(file.lastModified()));
}
} }
FileObject getFile(String path) { FileObject getFile(String path) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论