提交 3169053d authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 51343b61
...@@ -68,6 +68,7 @@ package org.h2.engine; ...@@ -68,6 +68,7 @@ package org.h2.engine;
* - Add to freshmeat * - Add to freshmeat
* - Upload to http://code.google.com/p/h2database/downloads/list * - Upload to http://code.google.com/p/h2database/downloads/list
* - http://en.wikipedia.org/wiki/H2_%28DBMS%29 (change version) * - http://en.wikipedia.org/wiki/H2_%28DBMS%29 (change version)
* - http://www.heise.de/software/
*/ */
/** /**
* Constants are fixed values that are used in the whole database code. * Constants are fixed values that are used in the whole database code.
......
...@@ -165,12 +165,16 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -165,12 +165,16 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @return the connection * @return the connection
*/ */
public Connection getConnection(String user, String password) throws SQLException { public Connection getConnection(String user, String password) throws SQLException {
debugCode("getConnection("+quote(user)+", "+quote(password)+");"); if (debug()) {
debugCode("getConnection("+quote(user)+", "+quote(password)+");");
}
return getJdbcConnection(user, password); return getJdbcConnection(user, password);
} }
private JdbcConnection getJdbcConnection(String user, String password) throws SQLException { private JdbcConnection getJdbcConnection(String user, String password) throws SQLException {
debugCode("getJdbcConnection("+quote(user)+", "+quote(password)+");"); if (debug()) {
debugCode("getJdbcConnection("+quote(user)+", "+quote(password)+");");
}
Properties info = new Properties(); Properties info = new Properties();
info.setProperty("user", user); info.setProperty("user", user);
info.setProperty("password", password); info.setProperty("password", password);
...@@ -278,7 +282,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -278,7 +282,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/ */
//#ifdef JDK14 //#ifdef JDK14
public XAConnection getXAConnection(String user, String password) throws SQLException { public XAConnection getXAConnection(String user, String password) throws SQLException {
debugCode("getXAConnection("+quote(user)+", "+quote(password)+");"); if (debug()) {
debugCode("getXAConnection("+quote(user)+", "+quote(password)+");");
}
int id = getNextId(XA_DATA_SOURCE); int id = getNextId(XA_DATA_SOURCE);
return new JdbcXAConnection(factory, id, url, user, password); return new JdbcXAConnection(factory, id, url, user, password);
} }
...@@ -306,7 +312,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref ...@@ -306,7 +312,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/ */
//#ifdef JDK14 //#ifdef JDK14
public PooledConnection getPooledConnection(String user, String password) throws SQLException { public PooledConnection getPooledConnection(String user, String password) throws SQLException {
debugCode("getPooledConnection("+quote(user)+", "+quote(password)+");"); if (debug()) {
debugCode("getPooledConnection("+quote(user)+", "+quote(password)+");");
}
return getXAConnection(user, password); return getXAConnection(user, password);
} }
//#endif //#endif
......
...@@ -59,7 +59,9 @@ implements ObjectFactory ...@@ -59,7 +59,9 @@ implements ObjectFactory
*/ */
//#ifdef JDK14 //#ifdef JDK14
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment); if (trace.debug()) {
trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment);
}
Reference ref = (Reference) obj; Reference ref = (Reference) obj;
if (ref.getClassName().equals(JdbcDataSource.class.getName())) { if (ref.getClassName().equals(JdbcDataSource.class.getName())) {
JdbcDataSource dataSource = new JdbcDataSource(); JdbcDataSource dataSource = new JdbcDataSource();
......
...@@ -123,7 +123,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -123,7 +123,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void addConnectionEventListener(ConnectionEventListener listener) { public void addConnectionEventListener(ConnectionEventListener listener) {
debugCode("addConnectionEventListener(listener)"); debugCode("addConnectionEventListener(listener);");
listeners.add(listener); listeners.add(listener);
if (conn != null) { if (conn != null) {
conn.setJdbcConnectionListener(this); conn.setJdbcConnectionListener(this);
...@@ -138,7 +138,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -138,7 +138,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void removeConnectionEventListener(ConnectionEventListener listener) { public void removeConnectionEventListener(ConnectionEventListener listener) {
debugCode("removeConnectionEventListener(listener)"); debugCode("removeConnectionEventListener(listener);");
listeners.remove(listener); listeners.remove(listener);
} }
//#endif //#endif
...@@ -148,7 +148,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -148,7 +148,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void fatalErrorOccurred(JdbcConnection conn, SQLException e) throws SQLException { public void fatalErrorOccurred(JdbcConnection conn, SQLException e) throws SQLException {
debugCode("fatalErrorOccurred(conn, e)"); debugCode("fatalErrorOccurred(conn, e);");
for (int i = 0; i < listeners.size(); i++) { for (int i = 0; i < listeners.size(); i++) {
ConnectionEventListener listener = (ConnectionEventListener) listeners.get(i); ConnectionEventListener listener = (ConnectionEventListener) listeners.get(i);
ConnectionEvent event = new ConnectionEvent(this, e); ConnectionEvent event = new ConnectionEvent(this, e);
...@@ -163,7 +163,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -163,7 +163,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void closed(JdbcConnection conn) { public void closed(JdbcConnection conn) {
debugCode("closed(conn)"); debugCode("closed(conn);");
for (int i = 0; i < listeners.size(); i++) { for (int i = 0; i < listeners.size(); i++) {
ConnectionEventListener listener = (ConnectionEventListener) listeners.get(i); ConnectionEventListener listener = (ConnectionEventListener) listeners.get(i);
ConnectionEvent event = new ConnectionEvent(this); ConnectionEvent event = new ConnectionEvent(this);
...@@ -205,7 +205,7 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -205,7 +205,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public boolean isSameRM(XAResource xares) throws XAException { public boolean isSameRM(XAResource xares) throws XAException {
debugCode("isSameRM(xares)"); debugCode("isSameRM(xares);");
return xares == this; return xares == this;
} }
//#endif //#endif
...@@ -253,7 +253,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -253,7 +253,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public int prepare(Xid xid) throws XAException { public int prepare(Xid xid) throws XAException {
debugCode("prepare("+quoteXid(xid)+")"); if (debug()) {
debugCode("prepare("+quoteXid(xid)+");");
}
checkOpen(); checkOpen();
if (!currentTransaction.equals(xid)) { if (!currentTransaction.equals(xid)) {
getTrace().debug("throw XAException.XAER_INVAL"); getTrace().debug("throw XAException.XAER_INVAL");
...@@ -282,7 +284,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -282,7 +284,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void forget(Xid xid) throws XAException { public void forget(Xid xid) throws XAException {
debugCode("forget("+quoteXid(xid)+")"); if (debug()) {
debugCode("forget("+quoteXid(xid)+");");
}
} }
//#endif //#endif
...@@ -293,7 +297,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -293,7 +297,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void rollback(Xid xid) throws XAException { public void rollback(Xid xid) throws XAException {
debugCode("rollback("+quoteXid(xid)+")"); if (debug()) {
debugCode("rollback("+quoteXid(xid)+");");
}
try { try {
conn.rollback(); conn.rollback();
} catch (SQLException e) { } catch (SQLException e) {
...@@ -312,7 +318,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -312,7 +318,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void end(Xid xid, int flags) throws XAException { public void end(Xid xid, int flags) throws XAException {
debugCode("end("+quoteXid(xid)+", "+quoteFlags(flags)+")"); if (debug()) {
debugCode("end("+quoteXid(xid)+", "+quoteFlags(flags)+");");
}
// TODO transaction end: implement this method // TODO transaction end: implement this method
if (flags == TMSUSPEND) { if (flags == TMSUSPEND) {
return; return;
...@@ -332,7 +340,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -332,7 +340,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void start(Xid xid, int flags) throws XAException { public void start(Xid xid, int flags) throws XAException {
debugCode("start("+quoteXid(xid)+", "+quoteFlags(flags)+")"); if (debug()) {
debugCode("start("+quoteXid(xid)+", "+quoteFlags(flags)+");");
}
if (flags == TMRESUME) { if (flags == TMRESUME) {
return; return;
} }
...@@ -358,7 +368,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -358,7 +368,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/ */
//#ifdef JDK14 //#ifdef JDK14
public void commit(Xid xid, boolean onePhase) throws XAException { public void commit(Xid xid, boolean onePhase) throws XAException {
debugCode("commit("+quoteXid(xid)+", "+onePhase+")"); if (debug()) {
debugCode("commit("+quoteXid(xid)+", "+onePhase+");");
}
Statement stat = null; Statement stat = null;
try { try {
if (onePhase) { if (onePhase) {
...@@ -430,7 +442,9 @@ implements XAConnection, XAResource, JdbcConnectionListener ...@@ -430,7 +442,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
} }
private XAException convertException(SQLException e) { private XAException convertException(SQLException e) {
getTrace().debug("throw XAException("+e.getMessage()+")"); if (debug()) {
getTrace().debug("throw XAException("+e.getMessage()+");");
}
return new XAException(e.getMessage()); return new XAException(e.getMessage());
} }
......
...@@ -1109,7 +1109,7 @@ SET {TRACE_LEVEL_FILE | TRACE_LEVEL_SYSTEM_OUT} int ...@@ -1109,7 +1109,7 @@ SET {TRACE_LEVEL_FILE | TRACE_LEVEL_SYSTEM_OUT} int
"," ","
Sets the trace level for file the file or system out stream. Sets the trace level for file the file or system out stream.
Levels: 0=off, 1=error, 2=info, 3=debug. Levels: 0=off, 1=error, 2=info, 3=debug.
This setting is persistent. This setting is not persistent.
Admin rights are required to execute this command. Admin rights are required to execute this command.
This setting can be appended to the database URL: jdbc:h2:test;TRACE_LEVEL_SYSTEM_OUT=3 This setting can be appended to the database URL: jdbc:h2:test;TRACE_LEVEL_SYSTEM_OUT=3
"," ","
...@@ -1517,7 +1517,8 @@ A digit. ...@@ -1517,7 +1517,8 @@ A digit.
"Data Types","INT Type"," "Data Types","INT Type","
INT | INTEGER | MEDIUMINT | INT4 | SIGNED INT | INTEGER | MEDIUMINT | INT4 | SIGNED
"," ","
Possible values: -2147483648 to 2147483647 Possible values: -2147483648 to 2147483647.
See also java.lang.Integer.
"," ","
INT INT
" "
...@@ -1525,7 +1526,8 @@ INT ...@@ -1525,7 +1526,8 @@ INT
"Data Types","BOOLEAN Type"," "Data Types","BOOLEAN Type","
BOOLEAN | BIT | BOOL BOOLEAN | BIT | BOOL
"," ","
Possible values: TRUE and FALSE Possible values: TRUE and FALSE.
See also java.lang.Boolean.
"," ","
BOOLEAN BOOLEAN
" "
...@@ -1533,7 +1535,8 @@ BOOLEAN ...@@ -1533,7 +1535,8 @@ BOOLEAN
"Data Types","TINYINT Type"," "Data Types","TINYINT Type","
TINYINT TINYINT
"," ","
Possible values are: -128 to 127 Possible values are: -128 to 127.
See also java.lang.Byte.
"," ","
TINYINT TINYINT
" "
...@@ -1541,7 +1544,8 @@ TINYINT ...@@ -1541,7 +1544,8 @@ TINYINT
"Data Types","SMALLINT Type"," "Data Types","SMALLINT Type","
SMALLINT | INT2 | YEAR SMALLINT | INT2 | YEAR
"," ","
Possible values: -32768 to 32767 Possible values: -32768 to 32767.
See also java.lang.Short.
"," ","
SMALLINT SMALLINT
" "
...@@ -1549,7 +1553,8 @@ SMALLINT ...@@ -1549,7 +1553,8 @@ SMALLINT
"Data Types","BIGINT Type"," "Data Types","BIGINT Type","
BIGINT | INT8 BIGINT | INT8
"," ","
Possible values: -9223372036854775808 to 9223372036854775807 Possible values: -9223372036854775808 to 9223372036854775807.
See also java.lang.Long.
"," ","
BIGINT BIGINT
" "
...@@ -1558,7 +1563,8 @@ BIGINT ...@@ -1558,7 +1563,8 @@ BIGINT
IDENTITY IDENTITY
"," ","
Auto-Increment value. Auto-Increment value.
Possible values: -9223372036854775808 to 9223372036854775807 Possible values: -9223372036854775808 to 9223372036854775807.
See also java.lang.Long.
"," ","
IDENTITY IDENTITY
" "
...@@ -1568,6 +1574,7 @@ IDENTITY ...@@ -1568,6 +1574,7 @@ IDENTITY
"," ","
Data type with fixed precision and scale. Data type with fixed precision and scale.
This data type is recommended for storing currency values. This data type is recommended for storing currency values.
See also java.math.BigDecimal.
"," ","
DECIMAL(20, 2) DECIMAL(20, 2)
" "
...@@ -1575,8 +1582,9 @@ DECIMAL(20, 2) ...@@ -1575,8 +1582,9 @@ DECIMAL(20, 2)
"Data Types","DOUBLE Type"," "Data Types","DOUBLE Type","
{DOUBLE [PRECISION] | FLOAT | FLOAT4 | FLOAT8} {DOUBLE [PRECISION] | FLOAT | FLOAT4 | FLOAT8}
"," ","
Floating point number (java.lang.Double). Floating point number.
Should not be used to represent currency values, because of rounding problems. Should not be used to represent currency values, because of rounding problems.
See also java.lang.Double.
"," ","
DOUBLE DOUBLE
" "
...@@ -1584,8 +1592,9 @@ DOUBLE ...@@ -1584,8 +1592,9 @@ DOUBLE
"Data Types","REAL Type"," "Data Types","REAL Type","
REAL REAL
"," ","
Single precision floating point number (java.lang.Float). Single precision floating point number.
Should not be used to represent currency values, because of rounding problems. Should not be used to represent currency values, because of rounding problems.
See also java.lang.Float.
"," ","
REAL REAL
" "
...@@ -1594,6 +1603,7 @@ REAL ...@@ -1594,6 +1603,7 @@ REAL
TIME TIME
"," ","
The format is hh:mm:ss. The format is hh:mm:ss.
See also java.sql.Time.
"," ","
TIME TIME
" "
...@@ -1602,6 +1612,7 @@ TIME ...@@ -1602,6 +1612,7 @@ TIME
DATE DATE
"," ","
The format is yyyy-MM-dd. The format is yyyy-MM-dd.
See also java.sql.Date.
"," ","
DATE DATE
" "
...@@ -1610,6 +1621,7 @@ DATE ...@@ -1610,6 +1621,7 @@ DATE
{TIMESTAMP | DATETIME | SMALLDATETIME} {TIMESTAMP | DATETIME | SMALLDATETIME}
"," ","
The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn]. The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
See also java.sql.Timestamp.
"," ","
TIMESTAMP TIMESTAMP
" "
...@@ -1646,6 +1658,7 @@ VARCHAR2 | NVARCHAR | NVARCHAR2 | VARCHAR_CASESENSITIVE} ...@@ -1646,6 +1658,7 @@ VARCHAR2 | NVARCHAR | NVARCHAR2 | VARCHAR_CASESENSITIVE}
Unicode String. Use two single quotes ('') to create a quote. Unicode String. Use two single quotes ('') to create a quote.
There is no maximum precision. The maximum size is the memory available. There is no maximum precision. The maximum size is the memory available.
For large text data CLOB should be used. For large text data CLOB should be used.
See also java.lang.String.
"," ","
VARCHAR(255) VARCHAR(255)
" "
......
...@@ -25,7 +25,7 @@ public class Constant extends SchemaObjectBase { ...@@ -25,7 +25,7 @@ public class Constant extends SchemaObjectBase {
private ValueExpression expression; private ValueExpression expression;
public Constant(Schema schema, int id, String name) { public Constant(Schema schema, int id, String name) {
super(schema, id, name, Trace.SCHEMA); initSchemaObjectBase(schema, id, name, Trace.SCHEMA);
} }
public String getCreateSQLForCopy(Table table, String quotedName) { public String getCreateSQLForCopy(Table table, String quotedName) {
......
...@@ -50,7 +50,7 @@ public class Schema extends DbObjectBase { ...@@ -50,7 +50,7 @@ public class Schema extends DbObjectBase {
private HashSet temporaryUniqueNames = new HashSet(); private HashSet temporaryUniqueNames = new HashSet();
public Schema(Database database, int id, String schemaName, User owner, boolean system) { public Schema(Database database, int id, String schemaName, User owner, boolean system) {
super(database, id, schemaName, Trace.SCHEMA); initDbObjectBase(database, id, schemaName, Trace.SCHEMA);
this.owner = owner; this.owner = owner;
this.system = system; this.system = system;
} }
......
...@@ -14,8 +14,8 @@ public abstract class SchemaObjectBase extends DbObjectBase implements SchemaObj ...@@ -14,8 +14,8 @@ public abstract class SchemaObjectBase extends DbObjectBase implements SchemaObj
private Schema schema; private Schema schema;
protected SchemaObjectBase(Schema schema, int id, String name, String traceModule) { protected void initSchemaObjectBase(Schema schema, int id, String name, String traceModule) {
super(schema.getDatabase(), id, name, traceModule); initDbObjectBase(schema.getDatabase(), id, name, traceModule);
this.schema = schema; this.schema = schema;
} }
......
...@@ -27,7 +27,7 @@ public class Sequence extends SchemaObjectBase { ...@@ -27,7 +27,7 @@ public class Sequence extends SchemaObjectBase {
private boolean belongsToTable; private boolean belongsToTable;
public Sequence(Schema schema, int id, String name, boolean belongsToTable) { public Sequence(Schema schema, int id, String name, boolean belongsToTable) {
super(schema, id, name, Trace.SEQUENCE); initSchemaObjectBase(schema, id, name, Trace.SEQUENCE);
this.belongsToTable = belongsToTable; this.belongsToTable = belongsToTable;
} }
......
...@@ -39,7 +39,7 @@ public class TriggerObject extends SchemaObjectBase { ...@@ -39,7 +39,7 @@ public class TriggerObject extends SchemaObjectBase {
private Trigger triggerCallback; private Trigger triggerCallback;
public TriggerObject(Schema schema, int id, String name, Table table) { public TriggerObject(Schema schema, int id, String name, Table table) {
super(schema, id, name, Trace.TRIGGER); initSchemaObjectBase(schema, id, name, Trace.TRIGGER);
this.table = table; this.table = table;
setTemporary(table.getTemporary()); setTemporary(table.getTemporary());
} }
......
...@@ -76,11 +76,12 @@ public class WebServer implements Service { ...@@ -76,11 +76,12 @@ public class WebServer implements Service {
"Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc:sqlserver://localhost;DatabaseName=test|sa", "Generic MS SQL Server 2005|com.microsoft.sqlserver.jdbc.SQLServerDriver|jdbc:sqlserver://localhost;DatabaseName=test|sa",
"Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:<db>|" , "Generic PostgreSQL|org.postgresql.Driver|jdbc:postgresql:<db>|" ,
"Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://<host>:<port>/<db>|" , "Generic MySQL|com.mysql.jdbc.Driver|jdbc:mysql://<host>:<port>/<db>|" ,
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa" ,
"Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc:derby://localhost:1527/test;create=true|sa", "Generic Derby (Server)|org.apache.derby.jdbc.ClientDriver|jdbc:derby://localhost:1527/test;create=true|sa",
"Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc:derby:test;create=true|sa", "Generic Derby (Embedded)|org.apache.derby.jdbc.EmbeddedDriver|jdbc:derby:test;create=true|sa",
"Generic HSQLDB|org.hsqldb.jdbcDriver|jdbc:hsqldb:test;hsqldb.default_table_type=cached|sa" , "Generic H2 (Server)|org.h2.Driver|jdbc:h2:tcp://localhost/~/test|sa",
// this will be listed on top for new installations // this will be listed on top for new installations
"Generic H2|org.h2.Driver|jdbc:h2:~/test|sa", "Generic H2 (Embedded)|org.h2.Driver|jdbc:h2:~/test|sa",
}; };
/* /*
......
...@@ -645,7 +645,6 @@ public class DiskFile implements CacheWriter { ...@@ -645,7 +645,6 @@ public class DiskFile implements CacheWriter {
} else { } else {
if (SysProperties.REUSE_SPACE_QUICKLY) { if (SysProperties.REUSE_SPACE_QUICKLY) {
potentiallyFreePages.add(ObjectUtils.getInteger(page)); potentiallyFreePages.add(ObjectUtils.getInteger(page));
reuseSpace();
} }
} }
} }
......
...@@ -207,7 +207,7 @@ public abstract class Table extends SchemaObjectBase { ...@@ -207,7 +207,7 @@ public abstract class Table extends SchemaObjectBase {
public abstract long getRowCount(Session session) throws SQLException; public abstract long getRowCount(Session session) throws SQLException;
public Table(Schema schema, int id, String name, boolean persistent) { public Table(Schema schema, int id, String name, boolean persistent) {
super(schema, id, name, Trace.TABLE); initSchemaObjectBase(schema, id, name, Trace.TABLE);
this.persistent = persistent; this.persistent = persistent;
} }
...@@ -420,6 +420,8 @@ public abstract class Table extends SchemaObjectBase { ...@@ -420,6 +420,8 @@ public abstract class Table extends SchemaObjectBase {
} }
/** /**
* Get the best plan for the given search mask.
*
* @param masks - null means 'always false' * @param masks - null means 'always false'
*/ */
public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException { public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException {
......
...@@ -21,7 +21,6 @@ import org.h2.index.Cursor; ...@@ -21,7 +21,6 @@ import org.h2.index.Cursor;
import org.h2.index.HashIndex; import org.h2.index.HashIndex;
import org.h2.index.Index; import org.h2.index.Index;
import org.h2.index.IndexType; import org.h2.index.IndexType;
import org.h2.index.LinearHashIndex;
import org.h2.index.MultiVersionIndex; import org.h2.index.MultiVersionIndex;
import org.h2.index.ScanIndex; import org.h2.index.ScanIndex;
import org.h2.index.TreeIndex; import org.h2.index.TreeIndex;
...@@ -157,11 +156,7 @@ public class TableData extends Table implements RecordReader { ...@@ -157,11 +156,7 @@ public class TableData extends Table implements RecordReader {
} }
Index index; Index index;
if (isPersistent() && indexType.isPersistent()) { if (isPersistent() && indexType.isPersistent()) {
if (indexType.isHash()) { index = new BtreeIndex(session, this, indexId, indexName, cols, indexType, headPos);
index = new LinearHashIndex(session, this, indexId, indexName, cols, indexType);
} else {
index = new BtreeIndex(session, this, indexId, indexName, cols, indexType, headPos);
}
} else { } else {
if (indexType.isHash()) { if (indexType.isHash()) {
index = new HashIndex(this, indexId, indexName, cols, indexType); index = new HashIndex(this, indexId, indexName, cols, indexType);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论