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

--no commit message

--no commit message
上级 51343b61
......@@ -68,6 +68,7 @@ package org.h2.engine;
* - Add to freshmeat
* - Upload to http://code.google.com/p/h2database/downloads/list
* - 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.
......
......@@ -165,12 +165,16 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
* @return the connection
*/
public Connection getConnection(String user, String password) throws SQLException {
if (debug()) {
debugCode("getConnection("+quote(user)+", "+quote(password)+");");
}
return getJdbcConnection(user, password);
}
private JdbcConnection getJdbcConnection(String user, String password) throws SQLException {
if (debug()) {
debugCode("getJdbcConnection("+quote(user)+", "+quote(password)+");");
}
Properties info = new Properties();
info.setProperty("user", user);
info.setProperty("password", password);
......@@ -278,7 +282,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
//#ifdef JDK14
public XAConnection getXAConnection(String user, String password) throws SQLException {
if (debug()) {
debugCode("getXAConnection("+quote(user)+", "+quote(password)+");");
}
int id = getNextId(XA_DATA_SOURCE);
return new JdbcXAConnection(factory, id, url, user, password);
}
......@@ -306,7 +312,9 @@ implements XADataSource, DataSource, ConnectionPoolDataSource, Serializable, Ref
*/
//#ifdef JDK14
public PooledConnection getPooledConnection(String user, String password) throws SQLException {
if (debug()) {
debugCode("getPooledConnection("+quote(user)+", "+quote(password)+");");
}
return getXAConnection(user, password);
}
//#endif
......
......@@ -59,7 +59,9 @@ implements ObjectFactory
*/
//#ifdef JDK14
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
if (trace.debug()) {
trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment);
}
Reference ref = (Reference) obj;
if (ref.getClassName().equals(JdbcDataSource.class.getName())) {
JdbcDataSource dataSource = new JdbcDataSource();
......
......@@ -123,7 +123,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public void addConnectionEventListener(ConnectionEventListener listener) {
debugCode("addConnectionEventListener(listener)");
debugCode("addConnectionEventListener(listener);");
listeners.add(listener);
if (conn != null) {
conn.setJdbcConnectionListener(this);
......@@ -138,7 +138,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public void removeConnectionEventListener(ConnectionEventListener listener) {
debugCode("removeConnectionEventListener(listener)");
debugCode("removeConnectionEventListener(listener);");
listeners.remove(listener);
}
//#endif
......@@ -148,7 +148,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
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++) {
ConnectionEventListener listener = (ConnectionEventListener) listeners.get(i);
ConnectionEvent event = new ConnectionEvent(this, e);
......@@ -163,7 +163,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public void closed(JdbcConnection conn) {
debugCode("closed(conn)");
debugCode("closed(conn);");
for (int i = 0; i < listeners.size(); i++) {
ConnectionEventListener listener = (ConnectionEventListener) listeners.get(i);
ConnectionEvent event = new ConnectionEvent(this);
......@@ -205,7 +205,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public boolean isSameRM(XAResource xares) throws XAException {
debugCode("isSameRM(xares)");
debugCode("isSameRM(xares);");
return xares == this;
}
//#endif
......@@ -253,7 +253,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public int prepare(Xid xid) throws XAException {
debugCode("prepare("+quoteXid(xid)+")");
if (debug()) {
debugCode("prepare("+quoteXid(xid)+");");
}
checkOpen();
if (!currentTransaction.equals(xid)) {
getTrace().debug("throw XAException.XAER_INVAL");
......@@ -282,7 +284,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public void forget(Xid xid) throws XAException {
debugCode("forget("+quoteXid(xid)+")");
if (debug()) {
debugCode("forget("+quoteXid(xid)+");");
}
}
//#endif
......@@ -293,7 +297,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public void rollback(Xid xid) throws XAException {
debugCode("rollback("+quoteXid(xid)+")");
if (debug()) {
debugCode("rollback("+quoteXid(xid)+");");
}
try {
conn.rollback();
} catch (SQLException e) {
......@@ -312,7 +318,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
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
if (flags == TMSUSPEND) {
return;
......@@ -332,7 +340,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
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) {
return;
}
......@@ -358,7 +368,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
*/
//#ifdef JDK14
public void commit(Xid xid, boolean onePhase) throws XAException {
debugCode("commit("+quoteXid(xid)+", "+onePhase+")");
if (debug()) {
debugCode("commit("+quoteXid(xid)+", "+onePhase+");");
}
Statement stat = null;
try {
if (onePhase) {
......@@ -430,7 +442,9 @@ implements XAConnection, XAResource, JdbcConnectionListener
}
private XAException convertException(SQLException e) {
getTrace().debug("throw XAException("+e.getMessage()+")");
if (debug()) {
getTrace().debug("throw XAException("+e.getMessage()+");");
}
return new XAException(e.getMessage());
}
......
......@@ -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.
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.
This setting can be appended to the database URL: jdbc:h2:test;TRACE_LEVEL_SYSTEM_OUT=3
","
......@@ -1517,7 +1517,8 @@ A digit.
"Data Types","INT Type","
INT | INTEGER | MEDIUMINT | INT4 | SIGNED
","
Possible values: -2147483648 to 2147483647
Possible values: -2147483648 to 2147483647.
See also java.lang.Integer.
","
INT
"
......@@ -1525,7 +1526,8 @@ INT
"Data Types","BOOLEAN Type","
BOOLEAN | BIT | BOOL
","
Possible values: TRUE and FALSE
Possible values: TRUE and FALSE.
See also java.lang.Boolean.
","
BOOLEAN
"
......@@ -1533,7 +1535,8 @@ BOOLEAN
"Data Types","TINYINT Type","
TINYINT
","
Possible values are: -128 to 127
Possible values are: -128 to 127.
See also java.lang.Byte.
","
TINYINT
"
......@@ -1541,7 +1544,8 @@ TINYINT
"Data Types","SMALLINT Type","
SMALLINT | INT2 | YEAR
","
Possible values: -32768 to 32767
Possible values: -32768 to 32767.
See also java.lang.Short.
","
SMALLINT
"
......@@ -1549,7 +1553,8 @@ SMALLINT
"Data Types","BIGINT Type","
BIGINT | INT8
","
Possible values: -9223372036854775808 to 9223372036854775807
Possible values: -9223372036854775808 to 9223372036854775807.
See also java.lang.Long.
","
BIGINT
"
......@@ -1558,7 +1563,8 @@ BIGINT
IDENTITY
","
Auto-Increment value.
Possible values: -9223372036854775808 to 9223372036854775807
Possible values: -9223372036854775808 to 9223372036854775807.
See also java.lang.Long.
","
IDENTITY
"
......@@ -1568,6 +1574,7 @@ IDENTITY
","
Data type with fixed precision and scale.
This data type is recommended for storing currency values.
See also java.math.BigDecimal.
","
DECIMAL(20, 2)
"
......@@ -1575,8 +1582,9 @@ DECIMAL(20, 2)
"Data Types","DOUBLE Type","
{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.
See also java.lang.Double.
","
DOUBLE
"
......@@ -1584,8 +1592,9 @@ DOUBLE
"Data Types","REAL Type","
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.
See also java.lang.Float.
","
REAL
"
......@@ -1594,6 +1603,7 @@ REAL
TIME
","
The format is hh:mm:ss.
See also java.sql.Time.
","
TIME
"
......@@ -1602,6 +1612,7 @@ TIME
DATE
","
The format is yyyy-MM-dd.
See also java.sql.Date.
","
DATE
"
......@@ -1610,6 +1621,7 @@ DATE
{TIMESTAMP | DATETIME | SMALLDATETIME}
","
The format is yyyy-MM-dd hh:mm:ss[.nnnnnnnnn].
See also java.sql.Timestamp.
","
TIMESTAMP
"
......@@ -1646,6 +1658,7 @@ VARCHAR2 | NVARCHAR | NVARCHAR2 | VARCHAR_CASESENSITIVE}
Unicode String. Use two single quotes ('') to create a quote.
There is no maximum precision. The maximum size is the memory available.
For large text data CLOB should be used.
See also java.lang.String.
","
VARCHAR(255)
"
......
......@@ -25,7 +25,7 @@ public class Constant extends SchemaObjectBase {
private ValueExpression expression;
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) {
......
......@@ -50,7 +50,7 @@ public class Schema extends DbObjectBase {
private HashSet temporaryUniqueNames = new HashSet();
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.system = system;
}
......
......@@ -14,8 +14,8 @@ public abstract class SchemaObjectBase extends DbObjectBase implements SchemaObj
private Schema schema;
protected SchemaObjectBase(Schema schema, int id, String name, String traceModule) {
super(schema.getDatabase(), id, name, traceModule);
protected void initSchemaObjectBase(Schema schema, int id, String name, String traceModule) {
initDbObjectBase(schema.getDatabase(), id, name, traceModule);
this.schema = schema;
}
......
......@@ -27,7 +27,7 @@ public class Sequence extends SchemaObjectBase {
private 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;
}
......
......@@ -39,7 +39,7 @@ public class TriggerObject extends SchemaObjectBase {
private Trigger triggerCallback;
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;
setTemporary(table.getTemporary());
}
......
......@@ -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 PostgreSQL|org.postgresql.Driver|jdbc:postgresql:<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 (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
"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 {
} else {
if (SysProperties.REUSE_SPACE_QUICKLY) {
potentiallyFreePages.add(ObjectUtils.getInteger(page));
reuseSpace();
}
}
}
......
......@@ -207,7 +207,7 @@ public abstract class Table extends SchemaObjectBase {
public abstract long getRowCount(Session session) throws SQLException;
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;
}
......@@ -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'
*/
public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException {
......
......@@ -21,7 +21,6 @@ import org.h2.index.Cursor;
import org.h2.index.HashIndex;
import org.h2.index.Index;
import org.h2.index.IndexType;
import org.h2.index.LinearHashIndex;
import org.h2.index.MultiVersionIndex;
import org.h2.index.ScanIndex;
import org.h2.index.TreeIndex;
......@@ -157,11 +156,7 @@ public class TableData extends Table implements RecordReader {
}
Index index;
if (isPersistent() && indexType.isPersistent()) {
if (indexType.isHash()) {
index = new LinearHashIndex(session, this, indexId, indexName, cols, indexType);
} else {
index = new BtreeIndex(session, this, indexId, indexName, cols, indexType, headPos);
}
} else {
if (indexType.isHash()) {
index = new HashIndex(this, indexId, indexName, cols, indexType);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论