提交 9c3816f0 authored 作者: Thomas Mueller's avatar Thomas Mueller

small improvements

上级 c9400ca5
......@@ -21,16 +21,14 @@
// Copyright (c) 1998, 2006, Oracle. All rights reserved.
package oracle.toplink.essentials.platform.database;
import java.util.*;
import java.io.*;
import java.sql.*;
import oracle.toplink.essentials.exceptions.*;
import oracle.toplink.essentials.queryframework.*;
import oracle.toplink.essentials.internal.helper.*;
import oracle.toplink.essentials.expressions.*;
import oracle.toplink.essentials.internal.expressions.*;
import oracle.toplink.essentials.internal.databaseaccess.*;
import oracle.toplink.essentials.internal.sessions.AbstractSession;
import java.io.IOException;
import java.io.Writer;
import java.util.Hashtable;
import oracle.toplink.essentials.exceptions.ValidationException;
import oracle.toplink.essentials.expressions.ExpressionOperator;
import oracle.toplink.essentials.internal.databaseaccess.FieldTypeDefinition;
import oracle.toplink.essentials.queryframework.ValueReadQuery;
/**
* This platform provides H2 specific behaviour.
......@@ -48,12 +46,9 @@ import oracle.toplink.essentials.internal.sessions.AbstractSession;
* @author Marcio Borges (http://www.marciowb.net/blog/2008_08_01_)
*/
public class H2Platform extends DatabasePlatform {
public H2Platform() {
}
protected Hashtable buildFieldTypes() {
Hashtable fieldTypeMapping;
fieldTypeMapping = super.buildFieldTypes();
fieldTypeMapping.put(Boolean.class, new FieldTypeDefinition("TINYINT", false));
fieldTypeMapping.put(Integer.class, new FieldTypeDefinition("INTEGER", false));
......@@ -74,15 +69,9 @@ public class H2Platform extends DatabasePlatform {
fieldTypeMapping.put(java.sql.Date.class, new FieldTypeDefinition("DATE", false));
fieldTypeMapping.put(java.sql.Time.class, new FieldTypeDefinition("TIME", false));
fieldTypeMapping.put(java.sql.Timestamp.class, new FieldTypeDefinition("TIMESTAMP", false));
return fieldTypeMapping;
}
// public boolean isHSQL() {
// return true;
// }
public boolean isH2() {
return true;
}
......@@ -100,8 +89,6 @@ public class H2Platform extends DatabasePlatform {
buff.append(")");
String sql = buff.toString();
return new ValueReadQuery(sql);
// return new ValueReadQuery("CALL NEXT VALUE FOR " + getQualifiedSequenceName(seqName));
// return new ValueReadQuery("SELECT " + getQualifiedSequenceName(seqName) + ".NEXTVAL FROM DUAL");
}
public boolean supportsNativeSequenceNumbers() {
......@@ -111,9 +98,8 @@ public class H2Platform extends DatabasePlatform {
protected String getQualifiedSequenceName(String seqName) {
if (getTableQualifier().equals("")) {
return seqName;
} else {
return getTableQualifier() + "." + seqName;
}
return getTableQualifier() + "." + seqName;
}
public boolean supportsSelectForUpdateNoWait() {
......@@ -141,4 +127,12 @@ public class H2Platform extends DatabasePlatform {
return new ValueReadQuery("SELECT IDENTITY()");
}
public void printFieldIdentityClause(Writer writer) throws ValidationException {
try {
writer.write(" IDENTITY");
} catch (final IOException ioException) {
throw ValidationException.fileError(ioException);
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论