提交 96ab15f8 authored 作者: thomasmueller's avatar thomasmueller

Merge branch 'master' of https://github.com/h2database/h2database

...@@ -21,14 +21,24 @@ Change Log ...@@ -21,14 +21,24 @@ Change Log
<h2>Next Version (unreleased)</h2> <h2>Next Version (unreleased)</h2>
<ul> <ul>
<li>- <li>PR #989: Fix more issues with range table and improve its documentation
</li> </li>
</ul> </ul>
<h2>Version 1.4.197 (2018-03-18)</h2> <h2>Version 1.4.197 (2018-03-18)</h2>
<ul> <ul>
<li>PR #988: Fix RangeTable.getRowCount() for non-default step
</li>
<li>PR #987: ValueBoolean constants are not cleared and may be used directly
</li>
<li>PR #986: Check parameters in JdbcPreparedStatement.addBatch()
</li>
<li>PR #984: Minor refactorings in Parser <li>PR #984: Minor refactorings in Parser
</li> </li>
<li>PR #983: Code cleanups via IntelliJ IDEA inspections
</li>
<li>Issue #960: Implement remaining time unit in "date_trunc" function
</li>
<li>Issue #933: MVStore background writer endless loop <li>Issue #933: MVStore background writer endless loop
</li> </li>
<li>PR #981: Reorganize date-time functions <li>PR #981: Reorganize date-time functions
......
...@@ -37,12 +37,27 @@ of all tables in the database as well as the current settings. ...@@ -37,12 +37,27 @@ of all tables in the database as well as the current settings.
<h2 id="range_table" class="notranslate">Range Table</h2> <h2 id="range_table" class="notranslate">Range Table</h2>
<p> <p>
The range table is a dynamic system table that contains all values from a start to an end value. The range table is a dynamic system table that contains all values from a start to an end value.
The table contains one column called X. Both the start and end values are included in the result. Non-zero step value may be also specified, default is 1.
Start value, end value, and optional step value are converted to BIGINT data type.
The table contains one column called X.
If start value is greater than end value and step is positive the result is empty.
If start value is less than end value and step is negative the result is empty too.
If start value is equal to end value the result contains only start value.
Start value, start value plus step, start value plus step multiplied by two and so on are included in result.
If step is positive the last value is less than or equal to the specified end value.
If step in negative the last value is greater than or equal to the specified end value.
The table is used as follows: The table is used as follows:
</p> </p>
<p>Example:</p> <p>Examples:</p>
<pre> <pre>
SELECT X FROM SYSTEM_RANGE(1, 10); SELECT X FROM SYSTEM_RANGE(1, 10);
-- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
SELECT X FROM SYSTEM_RANGE(1, 10, 2);
-- 1, 3, 5, 7, 9
SELECT X FROM SYSTEM_RANGE(1, 10, -1);
-- No rows
SELECT X FROM SYSTEM_RANGE(10, 2, -2);
-- 10, 8, 6, 4, 2
</pre> </pre>
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html> <!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>
...@@ -101,7 +101,7 @@ public class Constants { ...@@ -101,7 +101,7 @@ public class Constants {
/** /**
* The TCP protocol version number 17. * The TCP protocol version number 17.
* @since 1.4.197 (TODO) * @since 1.4.197 (2018-03-18)
*/ */
public static final int TCP_PROTOCOL_VERSION_17 = 17; public static final int TCP_PROTOCOL_VERSION_17 = 17;
......
...@@ -73,7 +73,6 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -73,7 +73,6 @@ public class SessionRemote extends SessionWithState implements DataHandler {
private ArrayList<Transfer> transferList = New.arrayList(); private ArrayList<Transfer> transferList = New.arrayList();
private int nextId; private int nextId;
private boolean autoCommit = true; private boolean autoCommit = true;
private CommandInterface autoCommitFalse, autoCommitTrue;
private ConnectionInfo connectionInfo; private ConnectionInfo connectionInfo;
private String databaseName; private String databaseName;
private String cipher; private String cipher;
...@@ -246,31 +245,15 @@ public class SessionRemote extends SessionWithState implements DataHandler { ...@@ -246,31 +245,15 @@ public class SessionRemote extends SessionWithState implements DataHandler {
} }
private synchronized void setAutoCommitSend(boolean autoCommit) { private synchronized void setAutoCommitSend(boolean autoCommit) {
if (clientVersion >= Constants.TCP_PROTOCOL_VERSION_8) { for (int i = 0, count = 0; i < transferList.size(); i++) {
for (int i = 0, count = 0; i < transferList.size(); i++) { Transfer transfer = transferList.get(i);
Transfer transfer = transferList.get(i); try {
try { traceOperation("SESSION_SET_AUTOCOMMIT", autoCommit ? 1 : 0);
traceOperation("SESSION_SET_AUTOCOMMIT", autoCommit ? 1 : 0); transfer.writeInt(SessionRemote.SESSION_SET_AUTOCOMMIT).
transfer.writeInt(SessionRemote.SESSION_SET_AUTOCOMMIT). writeBoolean(autoCommit);
writeBoolean(autoCommit); done(transfer);
done(transfer); } catch (IOException e) {
} catch (IOException e) { removeServer(e, i--, ++count);
removeServer(e, i--, ++count);
}
}
} else {
if (autoCommit) {
if (autoCommitTrue == null) {
autoCommitTrue = prepareCommand(
"SET AUTOCOMMIT TRUE", Integer.MAX_VALUE);
}
autoCommitTrue.executeUpdate(false);
} else {
if (autoCommitFalse == null) {
autoCommitFalse = prepareCommand(
"SET AUTOCOMMIT FALSE", Integer.MAX_VALUE);
}
autoCommitFalse.executeUpdate(false);
} }
} }
} }
......
...@@ -244,7 +244,7 @@ public class Comparison extends Condition { ...@@ -244,7 +244,7 @@ public class Comparison extends Condition {
result = l == ValueNull.INSTANCE; result = l == ValueNull.INSTANCE;
break; break;
case IS_NOT_NULL: case IS_NOT_NULL:
result = !(l == ValueNull.INSTANCE); result = l != ValueNull.INSTANCE;
break; break;
default: default:
throw DbException.throwInternalError("type=" + compareType); throw DbException.throwInternalError("type=" + compareType);
...@@ -275,7 +275,7 @@ public class Comparison extends Condition { ...@@ -275,7 +275,7 @@ public class Comparison extends Condition {
return ValueBoolean.get(result); return ValueBoolean.get(result);
} }
private String[] getEnumerators(Value left, Value right) { private static String[] getEnumerators(Value left, Value right) {
if (left.getType() == Value.ENUM) { if (left.getType() == Value.ENUM) {
return ((ValueEnum) left).getEnumerators(); return ((ValueEnum) left).getEnumerators();
} else if (right.getType() == Value.ENUM) { } else if (right.getType() == Value.ENUM) {
......
...@@ -956,7 +956,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -956,7 +956,7 @@ public class Function extends Expression implements FunctionCall {
result = v0; result = v0;
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
Value v = getNullOrValue(session, args, values, i); Value v = getNullOrValue(session, args, values, i);
if (!(v == ValueNull.INSTANCE)) { if (v != ValueNull.INSTANCE) {
result = v.convertTo(dataType); result = v.convertTo(dataType);
break; break;
} }
...@@ -968,7 +968,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -968,7 +968,7 @@ public class Function extends Expression implements FunctionCall {
result = ValueNull.INSTANCE; result = ValueNull.INSTANCE;
for (int i = 0; i < args.length; i++) { for (int i = 0; i < args.length; i++) {
Value v = getNullOrValue(session, args, values, i); Value v = getNullOrValue(session, args, values, i);
if (!(v == ValueNull.INSTANCE)) { if (v != ValueNull.INSTANCE) {
v = v.convertTo(dataType); v = v.convertTo(dataType);
if (result == ValueNull.INSTANCE) { if (result == ValueNull.INSTANCE) {
result = v; result = v;
...@@ -1005,7 +1005,7 @@ public class Function extends Expression implements FunctionCall { ...@@ -1005,7 +1005,7 @@ public class Function extends Expression implements FunctionCall {
// (expr, when, then, else) // (expr, when, then, else)
// (expr, when, then, when, then) // (expr, when, then, when, then)
// (expr, when, then, when, then, else) // (expr, when, then, when, then, else)
if (!(v0 == ValueNull.INSTANCE)) { if (v0 != ValueNull.INSTANCE) {
for (int i = 1, len = args.length - 1; i < len; i += 2) { for (int i = 1, len = args.length - 1; i < len; i += 2) {
Value when = args[i].getValue(session); Value when = args[i].getValue(session);
if (database.areEqual(v0, when)) { if (database.areEqual(v0, when)) {
......
...@@ -90,7 +90,7 @@ public class HashIndex extends BaseIndex { ...@@ -90,7 +90,7 @@ public class HashIndex extends BaseIndex {
@Override @Override
public long getRowCount(Session session) { public long getRowCount(Session session) {
return getRowCountApproximation(); return rows.size();
} }
@Override @Override
......
...@@ -47,20 +47,34 @@ public class RangeIndex extends BaseIndex { ...@@ -47,20 +47,34 @@ public class RangeIndex extends BaseIndex {
@Override @Override
public Cursor find(Session session, SearchRow first, SearchRow last) { public Cursor find(Session session, SearchRow first, SearchRow last) {
long min = rangeTable.getMin(session), start = min; long min = rangeTable.getMin(session);
long max = rangeTable.getMax(session), end = max; long max = rangeTable.getMax(session);
long step = rangeTable.getStep(session); long step = rangeTable.getStep(session);
try { try {
start = Math.max(min, first == null ? min : first.getValue(0).getLong()); long v = first.getValue(0).getLong();
if (step > 0) {
if (v > min) {
min += (v - min + step - 1) / step * step;
}
} else if (v > max) {
max = v;
}
} catch (Exception e) { } catch (Exception e) {
// error when converting the value - ignore // error when converting the value - ignore
} }
try { try {
end = Math.min(max, last == null ? max : last.getValue(0).getLong()); long v = last.getValue(0).getLong();
if (step > 0) {
if (v < max) {
max = v;
}
} else if (v < min) {
min -= (min - v - step - 1) / step * step;
}
} catch (Exception e) { } catch (Exception e) {
// error when converting the value - ignore // error when converting the value - ignore
} }
return new RangeCursor(session, start, end, step); return new RangeCursor(session, min, max, step);
} }
@Override @Override
...@@ -108,7 +122,7 @@ public class RangeIndex extends BaseIndex { ...@@ -108,7 +122,7 @@ public class RangeIndex extends BaseIndex {
@Override @Override
public long getRowCount(Session session) { public long getRowCount(Session session) {
return rangeTable.getRowCountApproximation(); return rangeTable.getRowCount(session);
} }
@Override @Override
......
...@@ -143,19 +143,44 @@ public class JdbcDatabaseMetaData extends TraceObject implements ...@@ -143,19 +143,44 @@ public class JdbcDatabaseMetaData extends TraceObject implements
", " + quoteArray(types) + ");"); ", " + quoteArray(types) + ");");
} }
checkClosed(); checkClosed();
String tableType; int typesLength = types != null ? types.length : 0;
if (types != null && types.length > 0) { boolean includeSynonyms = types == null || Arrays.asList(types).contains("SYNONYM");
StatementBuilder buff = new StatementBuilder("TABLE_TYPE IN(");
for (String ignored : types) {
buff.appendExceptFirst(", ");
buff.append('?');
}
tableType = buff.append(')').toString();
} else {
tableType = "TRUE";
}
String tableSelect = "SELECT " // (1024 - 16) is enough for the most cases
StringBuilder select = new StringBuilder(1008);
if (includeSynonyms) {
select.append("SELECT "
+ "TABLE_CAT, "
+ "TABLE_SCHEM, "
+ "TABLE_NAME, "
+ "TABLE_TYPE, "
+ "REMARKS, "
+ "TYPE_CAT, "
+ "TYPE_SCHEM, "
+ "TYPE_NAME, "
+ "SELF_REFERENCING_COL_NAME, "
+ "REF_GENERATION, "
+ "SQL "
+ "FROM ("
+ "SELECT "
+ "SYNONYM_CATALOG TABLE_CAT, "
+ "SYNONYM_SCHEMA TABLE_SCHEM, "
+ "SYNONYM_NAME as TABLE_NAME, "
+ "TYPE_NAME AS TABLE_TYPE, "
+ "REMARKS, "
+ "TYPE_NAME TYPE_CAT, "
+ "TYPE_NAME TYPE_SCHEM, "
+ "TYPE_NAME AS TYPE_NAME, "
+ "TYPE_NAME SELF_REFERENCING_COL_NAME, "
+ "TYPE_NAME REF_GENERATION, "
+ "NULL AS SQL "
+ "FROM INFORMATION_SCHEMA.SYNONYMS "
+ "WHERE SYNONYM_CATALOG LIKE ?1 ESCAPE ?4 "
+ "AND SYNONYM_SCHEMA LIKE ?2 ESCAPE ?4 "
+ "AND SYNONYM_NAME LIKE ?3 ESCAPE ?4 "
+ "UNION ");
}
select.append("SELECT "
+ "TABLE_CATALOG TABLE_CAT, " + "TABLE_CATALOG TABLE_CAT, "
+ "TABLE_SCHEMA TABLE_SCHEM, " + "TABLE_SCHEMA TABLE_SCHEM, "
+ "TABLE_NAME, " + "TABLE_NAME, "
...@@ -168,58 +193,30 @@ public class JdbcDatabaseMetaData extends TraceObject implements ...@@ -168,58 +193,30 @@ public class JdbcDatabaseMetaData extends TraceObject implements
+ "TYPE_NAME REF_GENERATION, " + "TYPE_NAME REF_GENERATION, "
+ "SQL " + "SQL "
+ "FROM INFORMATION_SCHEMA.TABLES " + "FROM INFORMATION_SCHEMA.TABLES "
+ "WHERE TABLE_CATALOG LIKE ? ESCAPE ? " + "WHERE TABLE_CATALOG LIKE ?1 ESCAPE ?4 "
+ "AND TABLE_SCHEMA LIKE ? ESCAPE ? " + "AND TABLE_SCHEMA LIKE ?2 ESCAPE ?4 "
+ "AND TABLE_NAME LIKE ? ESCAPE ? " + "AND TABLE_NAME LIKE ?3 ESCAPE ?4");
+ "AND (" + tableType + ") "; if (typesLength > 0) {
select.append(" AND TABLE_TYPE IN(");
boolean includeSynonyms = types == null || Arrays.asList(types).contains("SYNONYM"); for (int i = 0; i < typesLength; i++) {
String synonymSelect = "SELECT " if (i > 0) {
+ "SYNONYM_CATALOG TABLE_CAT, " select.append(", ");
+ "SYNONYM_SCHEMA TABLE_SCHEM, " }
+ "SYNONYM_NAME as TABLE_NAME, " select.append('?').append(i + 5);
+ "TYPE_NAME AS TABLE_TYPE, " }
+ "REMARKS, " select.append(')');
+ "TYPE_NAME TYPE_CAT, " }
+ "TYPE_NAME TYPE_SCHEM, " if (includeSynonyms) {
+ "TYPE_NAME AS TYPE_NAME, " select.append(')');
+ "TYPE_NAME SELF_REFERENCING_COL_NAME, " }
+ "TYPE_NAME REF_GENERATION, " PreparedStatement prep = conn.prepareAutoCloseStatement(
+ "NULL AS SQL " select.append(" ORDER BY TABLE_TYPE, TABLE_SCHEM, TABLE_NAME").toString());
+ "FROM INFORMATION_SCHEMA.SYNONYMS "
+ "WHERE SYNONYM_CATALOG LIKE ? ESCAPE ? "
+ "AND SYNONYM_SCHEMA LIKE ? ESCAPE ? "
+ "AND SYNONYM_NAME LIKE ? ESCAPE ? "
+ "AND (" + includeSynonyms + ") ";
PreparedStatement prep = conn.prepareAutoCloseStatement("SELECT "
+ "TABLE_CAT, "
+ "TABLE_SCHEM, "
+ "TABLE_NAME, "
+ "TABLE_TYPE, "
+ "REMARKS, "
+ "TYPE_CAT, "
+ "TYPE_SCHEM, "
+ "TYPE_NAME, "
+ "SELF_REFERENCING_COL_NAME, "
+ "REF_GENERATION, "
+ "SQL "
+ "FROM (" + synonymSelect + " UNION " + tableSelect + ") "
+ "ORDER BY TABLE_TYPE, TABLE_SCHEM, TABLE_NAME");
prep.setString(1, getCatalogPattern(catalogPattern)); prep.setString(1, getCatalogPattern(catalogPattern));
prep.setString(2, "\\"); prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getSchemaPattern(schemaPattern)); prep.setString(3, getPattern(tableNamePattern));
prep.setString(4, "\\"); prep.setString(4, "\\");
prep.setString(5, getPattern(tableNamePattern)); for (int i = 0; i < typesLength; i++) {
prep.setString(6, "\\"); prep.setString(5 + i, types[i]);
prep.setString(7, getCatalogPattern(catalogPattern));
prep.setString(8, "\\");
prep.setString(9, getSchemaPattern(schemaPattern));
prep.setString(10, "\\");
prep.setString(11, getPattern(tableNamePattern));
prep.setString(12, "\\");
for (int i = 0; types != null && i < types.length; i++) {
prep.setString(13 + i, types[i]);
} }
return prep.executeQuery(); return prep.executeQuery();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -1250,7 +1250,6 @@ public class JdbcPreparedStatement extends JdbcStatement implements ...@@ -1250,7 +1250,6 @@ public class JdbcPreparedStatement extends JdbcStatement implements
@Override @Override
public int[] executeBatch() throws SQLException { public int[] executeBatch() throws SQLException {
try { try {
int id = getNextId(TraceObject.PREPARED_STATEMENT);
debugCodeCall("executeBatch"); debugCodeCall("executeBatch");
if (batchParameters == null) { if (batchParameters == null) {
// TODO batch: check what other database do if no parameters are // TODO batch: check what other database do if no parameters are
......
...@@ -222,8 +222,7 @@ public class MVStoreTool { ...@@ -222,8 +222,7 @@ public class MVStoreTool {
if (mapId == 0 && details) { if (mapId == 0 && details) {
ByteBuffer data; ByteBuffer data;
if (compressed) { if (compressed) {
boolean fast = !((type & DataUtils.PAGE_COMPRESSED_HIGH) == boolean fast = (type & DataUtils.PAGE_COMPRESSED_HIGH) != DataUtils.PAGE_COMPRESSED_HIGH;
DataUtils.PAGE_COMPRESSED_HIGH);
Compressor compressor = getCompressor(fast); Compressor compressor = getCompressor(fast);
int lenAdd = DataUtils.readVarInt(chunk); int lenAdd = DataUtils.readVarInt(chunk);
int compLen = pageSize + start - chunk.position(); int compLen = pageSize + start - chunk.position();
......
...@@ -177,7 +177,7 @@ public class JdbcUtils { ...@@ -177,7 +177,7 @@ public class JdbcUtils {
if (classFactory.match(className)) { if (classFactory.match(className)) {
try { try {
Class<?> userClass = classFactory.loadClass(className); Class<?> userClass = classFactory.loadClass(className);
if (!(userClass == null)) { if (userClass != null) {
return (Class<Z>) userClass; return (Class<Z>) userClass;
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -716,11 +716,7 @@ public abstract class TestBase { ...@@ -716,11 +716,7 @@ public abstract class TestBase {
* @throws AssertionError if the values are not equal * @throws AssertionError if the values are not equal
*/ */
public void assertEquals(Object expected, Object actual) { public void assertEquals(Object expected, Object actual) {
if (expected == null || actual == null) { if (!Objects.equals(expected, actual)) {
assertTrue(expected == actual);
return;
}
if (!expected.equals(actual)) {
fail(" expected: " + expected + " actual: " + actual); fail(" expected: " + expected + " actual: " + actual);
} }
} }
...@@ -961,7 +957,9 @@ public abstract class TestBase { ...@@ -961,7 +957,9 @@ public abstract class TestBase {
* @throws AssertionError if the condition is false * @throws AssertionError if the condition is false
*/ */
public void assertTrue(boolean condition) { public void assertTrue(boolean condition) {
assertTrue("Expected: true got: false", condition); if (!condition) {
fail("Expected: true got: false");
}
} }
/** /**
...@@ -976,6 +974,31 @@ public abstract class TestBase { ...@@ -976,6 +974,31 @@ public abstract class TestBase {
} }
} }
/**
* Check that the passed object is not null.
*
* @param obj the object
* @throws AssertionError if the condition is false
*/
public void assertNotNull(Object obj) {
if (obj == null) {
fail("Expected: not null got: null");
}
}
/**
* Check that the passed object is not null.
*
* @param message the message to print if the condition is false
* @param obj the object
* @throws AssertionError if the condition is false
*/
public void assertNotNull(String message, Object obj) {
if (obj == null) {
fail(message);
}
}
/** /**
* Check that the passed boolean is true. * Check that the passed boolean is true.
* *
...@@ -996,7 +1019,9 @@ public abstract class TestBase { ...@@ -996,7 +1019,9 @@ public abstract class TestBase {
* @throws AssertionError if the condition is true * @throws AssertionError if the condition is true
*/ */
protected void assertFalse(boolean value) { protected void assertFalse(boolean value) {
assertFalse("Expected: false got: true", value); if (value) {
fail("Expected: false got: true");
}
} }
/** /**
......
...@@ -57,7 +57,7 @@ public abstract class AbstractBaseForCommonTableExpressions extends TestBase { ...@@ -57,7 +57,7 @@ public abstract class AbstractBaseForCommonTableExpressions extends TestBase {
rs = prep.executeQuery(); rs = prep.executeQuery();
for (int columnIndex = 1; columnIndex <= rs.getMetaData().getColumnCount(); columnIndex++) { for (int columnIndex = 1; columnIndex <= rs.getMetaData().getColumnCount(); columnIndex++) {
assertTrue(rs.getMetaData().getColumnLabel(columnIndex) != null); assertNotNull(rs.getMetaData().getColumnLabel(columnIndex));
assertEquals(expectedColumnNames[columnIndex - 1], rs.getMetaData().getColumnLabel(columnIndex)); assertEquals(expectedColumnNames[columnIndex - 1], rs.getMetaData().getColumnLabel(columnIndex));
assertEquals( assertEquals(
"wrong type of column " + rs.getMetaData().getColumnLabel(columnIndex) + " on iteration #" "wrong type of column " + rs.getMetaData().getColumnLabel(columnIndex) + " on iteration #"
......
...@@ -390,7 +390,7 @@ public class TestDeadlock extends TestBase { ...@@ -390,7 +390,7 @@ public class TestDeadlock extends TestBase {
} }
private void checkDeadlock() throws SQLException { private void checkDeadlock() throws SQLException {
assertTrue(lastException != null); assertNotNull(lastException);
assertKnownException(lastException); assertKnownException(lastException);
assertEquals(ErrorCode.DEADLOCK_1, lastException.getErrorCode()); assertEquals(ErrorCode.DEADLOCK_1, lastException.getErrorCode());
SQLException e2 = lastException.getNextException(); SQLException e2 = lastException.getNextException();
......
...@@ -520,7 +520,7 @@ public class TestFunctions extends TestBase implements AggregateFunction { ...@@ -520,7 +520,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
stat.execute("delete from test"); stat.execute("delete from test");
rs = stat.executeQuery("call transaction_id()"); rs = stat.executeQuery("call transaction_id()");
rs.next(); rs.next();
assertTrue(rs.getString(1) != null); assertNotNull(rs.getString(1));
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
} }
......
...@@ -130,7 +130,7 @@ public class TestReadOnly extends TestBase { ...@@ -130,7 +130,7 @@ public class TestReadOnly extends TestBase {
File f = File.createTempFile("test", "temp"); File f = File.createTempFile("test", "temp");
assertTrue(f.canWrite()); assertTrue(f.canWrite());
f.setReadOnly(); f.setReadOnly();
assertTrue(!f.canWrite()); assertFalse(f.canWrite());
f.delete(); f.delete();
f = File.createTempFile("test", "temp"); f = File.createTempFile("test", "temp");
...@@ -138,7 +138,7 @@ public class TestReadOnly extends TestBase { ...@@ -138,7 +138,7 @@ public class TestReadOnly extends TestBase {
r.write(1); r.write(1);
f.setReadOnly(); f.setReadOnly();
r.close(); r.close();
assertTrue(!f.canWrite()); assertFalse(f.canWrite());
f.delete(); f.delete();
deleteDb("readonlyFiles"); deleteDb("readonlyFiles");
...@@ -147,7 +147,7 @@ public class TestReadOnly extends TestBase { ...@@ -147,7 +147,7 @@ public class TestReadOnly extends TestBase {
stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR)");
stat.execute("INSERT INTO TEST VALUES(1, 'Hello')"); stat.execute("INSERT INTO TEST VALUES(1, 'Hello')");
stat.execute("INSERT INTO TEST VALUES(2, 'World')"); stat.execute("INSERT INTO TEST VALUES(2, 'World')");
assertTrue(!conn.isReadOnly()); assertFalse(conn.isReadOnly());
conn.close(); conn.close();
if (setReadOnly) { if (setReadOnly) {
......
...@@ -350,7 +350,7 @@ public class TestRunscript extends TestBase implements Trigger { ...@@ -350,7 +350,7 @@ public class TestRunscript extends TestBase implements Trigger {
Thread.sleep(200); Thread.sleep(200);
stat.cancel(); stat.cancel();
SQLException e = (SQLException) task.getException(); SQLException e = (SQLException) task.getException();
assertTrue(e != null); assertNotNull(e);
assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode()); assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode());
stat.execute("set throttle 1000"); stat.execute("set throttle 1000");
...@@ -367,7 +367,7 @@ public class TestRunscript extends TestBase implements Trigger { ...@@ -367,7 +367,7 @@ public class TestRunscript extends TestBase implements Trigger {
Thread.sleep(200); Thread.sleep(200);
stat.cancel(); stat.cancel();
e = (SQLException) task.getException(); e = (SQLException) task.getException();
assertTrue(e != null); assertNotNull(e);
assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode()); assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode());
conn.close(); conn.close();
......
...@@ -914,7 +914,7 @@ public class TestSpatial extends TestBase { ...@@ -914,7 +914,7 @@ public class TestSpatial extends TestBase {
count++; count++;
int id = rs.getInt(1); int id = rs.getInt(1);
if (id == 3 || id == 6) { if (id == 3 || id == 6) {
assertTrue(rs.getObject(2) != null); assertNotNull(rs.getObject(2));
} else { } else {
assertNull(rs.getObject(2)); assertNull(rs.getObject(2));
} }
...@@ -933,7 +933,7 @@ public class TestSpatial extends TestBase { ...@@ -933,7 +933,7 @@ public class TestSpatial extends TestBase {
count = 0; count = 0;
while (rs.next()) { while (rs.next()) {
count++; count++;
assertTrue(rs.getObject(2) != null); assertNotNull(rs.getObject(2));
} }
assertEquals(2, count); assertEquals(2, count);
......
...@@ -184,7 +184,7 @@ public class TestSynonymForTable extends TestBase { ...@@ -184,7 +184,7 @@ public class TestSynonymForTable extends TestBase {
assertEquals("BACKINGTABLE", synonyms.getString("SYNONYM_FOR")); assertEquals("BACKINGTABLE", synonyms.getString("SYNONYM_FOR"));
assertEquals("VALID", synonyms.getString("STATUS")); assertEquals("VALID", synonyms.getString("STATUS"));
assertEquals("", synonyms.getString("REMARKS")); assertEquals("", synonyms.getString("REMARKS"));
assertTrue(synonyms.getString("ID") != null); assertNotNull(synonyms.getString("ID"));
assertFalse(synonyms.next()); assertFalse(synonyms.next());
conn.close(); conn.close();
} }
......
...@@ -507,7 +507,7 @@ public class TestTableEngines extends TestBase { ...@@ -507,7 +507,7 @@ public class TestTableEngines extends TestBase {
stat.executeUpdate("CREATE TABLE T(ID INT AFFINITY PRIMARY KEY, NAME VARCHAR, AGE INT)" + stat.executeUpdate("CREATE TABLE T(ID INT AFFINITY PRIMARY KEY, NAME VARCHAR, AGE INT)" +
" ENGINE \"" + AffinityTableEngine.class.getName() + "\""); " ENGINE \"" + AffinityTableEngine.class.getName() + "\"");
Table tbl = AffinityTableEngine.createdTbl; Table tbl = AffinityTableEngine.createdTbl;
assertTrue(tbl != null); assertNotNull(tbl);
assertEquals(3, tbl.getIndexes().size()); assertEquals(3, tbl.getIndexes().size());
Index aff = tbl.getIndexes().get(2); Index aff = tbl.getIndexes().get(2);
assertTrue(aff.getIndexType().isAffinity()); assertTrue(aff.getIndexType().isAffinity());
......
...@@ -75,7 +75,7 @@ public class UpdateTest extends TestBase { ...@@ -75,7 +75,7 @@ public class UpdateTest extends TestBase {
Order ourUpdatedOrder = db.from(o).where(o.orderDate) Order ourUpdatedOrder = db.from(o).where(o.orderDate)
.is(valueOf("2007-01-03")).selectFirst(); .is(valueOf("2007-01-03")).selectFirst();
assertTrue("updated order not found", ourUpdatedOrder != null); assertNotNull("updated order not found", ourUpdatedOrder);
// undo update // undo update
ourOrder.orderDate = valueOf("2007-01-02"); ourOrder.orderDate = valueOf("2007-01-02");
...@@ -113,7 +113,7 @@ public class UpdateTest extends TestBase { ...@@ -113,7 +113,7 @@ public class UpdateTest extends TestBase {
Order ourUpdatedOrder = db.from(o).where(o.orderDate) Order ourUpdatedOrder = db.from(o).where(o.orderDate)
.is(valueOf("2007-01-03")).selectFirst(); .is(valueOf("2007-01-03")).selectFirst();
assertTrue("updated order not found", ourUpdatedOrder != null); assertNotNull("updated order not found", ourUpdatedOrder);
// undo update // undo update
ourOrder.orderDate = valueOf("2007-01-02"); ourOrder.orderDate = valueOf("2007-01-02");
......
...@@ -79,13 +79,13 @@ public class TestBatchUpdates extends TestBase { ...@@ -79,13 +79,13 @@ public class TestBatchUpdates extends TestBase {
} catch (SQLException e) { } catch (SQLException e) {
assertContains(e.toString(), "TEST_Y"); assertContains(e.toString(), "TEST_Y");
e = e.getNextException(); e = e.getNextException();
assertTrue(e != null); assertNotNull(e);
assertContains(e.toString(), "TEST_Y"); assertContains(e.toString(), "TEST_Y");
e = e.getNextException(); e = e.getNextException();
assertTrue(e != null); assertNotNull(e);
assertContains(e.toString(), "TEST_X"); assertContains(e.toString(), "TEST_X");
e = e.getNextException(); e = e.getNextException();
assertTrue(e == null); assertNull(e);
} }
stat.execute("create table test(id int)"); stat.execute("create table test(id int)");
PreparedStatement prep = conn.prepareStatement("insert into test values(?)"); PreparedStatement prep = conn.prepareStatement("insert into test values(?)");
...@@ -98,13 +98,13 @@ public class TestBatchUpdates extends TestBase { ...@@ -98,13 +98,13 @@ public class TestBatchUpdates extends TestBase {
} catch (SQLException e) { } catch (SQLException e) {
assertContains(e.toString(), "TEST_Y"); assertContains(e.toString(), "TEST_Y");
e = e.getNextException(); e = e.getNextException();
assertTrue(e != null); assertNotNull(e);
assertContains(e.toString(), "TEST_Y"); assertContains(e.toString(), "TEST_Y");
e = e.getNextException(); e = e.getNextException();
assertTrue(e != null); assertNotNull(e);
assertContains(e.toString(), "TEST_X"); assertContains(e.toString(), "TEST_X");
e = e.getNextException(); e = e.getNextException();
assertTrue(e == null); assertNull(e);
} }
stat.execute("drop table test"); stat.execute("drop table test");
conn.close(); conn.close();
...@@ -542,7 +542,7 @@ public class TestBatchUpdates extends TestBase { ...@@ -542,7 +542,7 @@ public class TestBatchUpdates extends TestBase {
trace("Count val is: " + count); trace("Count val is: " + count);
// make sure that we have the correct error code for // make sure that we have the correct error code for
// the failed update. // the failed update.
if (!(batchUpdates[1] == -3 && count == 1)) { if (batchUpdates[1] != -3 || count != 1) {
fail("insert failed"); fail("insert failed");
} }
} }
......
...@@ -143,7 +143,7 @@ public class TestDatabaseEventListener extends TestBase { ...@@ -143,7 +143,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener.class.getName()); MyDatabaseEventListener.class.getName());
conn = org.h2.Driver.load().connect(url, p); conn = org.h2.Driver.load().connect(url, p);
conn.close(); conn.close();
assertTrue(!calledCreateIndex); assertFalse(calledCreateIndex);
} }
private void testIndexNotRebuilt() throws SQLException { private void testIndexNotRebuilt() throws SQLException {
...@@ -176,7 +176,7 @@ public class TestDatabaseEventListener extends TestBase { ...@@ -176,7 +176,7 @@ public class TestDatabaseEventListener extends TestBase {
MyDatabaseEventListener.class.getName()); MyDatabaseEventListener.class.getName());
conn = org.h2.Driver.load().connect(url, p); conn = org.h2.Driver.load().connect(url, p);
conn.close(); conn.close();
assertTrue(!calledCreateIndex); assertFalse(calledCreateIndex);
} }
private void testCloseLog0(boolean shutdown) throws SQLException { private void testCloseLog0(boolean shutdown) throws SQLException {
...@@ -205,7 +205,7 @@ public class TestDatabaseEventListener extends TestBase { ...@@ -205,7 +205,7 @@ public class TestDatabaseEventListener extends TestBase {
conn = org.h2.Driver.load().connect(url, p); conn = org.h2.Driver.load().connect(url, p);
conn.close(); conn.close();
if (calledOpened) { if (calledOpened) {
assertTrue(!calledScan); assertFalse(calledScan);
} }
} }
......
...@@ -130,19 +130,19 @@ public class TestGetGeneratedKeys extends TestBase { ...@@ -130,19 +130,19 @@ public class TestGetGeneratedKeys extends TestBase {
rs.next(); rs.next();
assertEquals(1L, rs.getLong(1)); assertEquals(1L, rs.getLong(1));
UUID u1 = (UUID) rs.getObject(2); UUID u1 = (UUID) rs.getObject(2);
assertTrue(u1 != null); assertNotNull(u1);
rs.next(); rs.next();
assertEquals(2L, rs.getLong(1)); assertEquals(2L, rs.getLong(1));
UUID u2 = (UUID) rs.getObject(2); UUID u2 = (UUID) rs.getObject(2);
assertTrue(u2 != null); assertNotNull(u2);
rs.next(); rs.next();
assertEquals(3L, rs.getLong(1)); assertEquals(3L, rs.getLong(1));
UUID u3 = (UUID) rs.getObject(2); UUID u3 = (UUID) rs.getObject(2);
assertTrue(u3 != null); assertNotNull(u3);
rs.next(); rs.next();
assertEquals(4L, rs.getLong(1)); assertEquals(4L, rs.getLong(1));
UUID u4 = (UUID) rs.getObject(2); UUID u4 = (UUID) rs.getObject(2);
assertTrue(u4 != null); assertNotNull(u4);
assertFalse(rs.next()); assertFalse(rs.next());
assertFalse(u1.equals(u2)); assertFalse(u1.equals(u2));
assertFalse(u2.equals(u3)); assertFalse(u2.equals(u3));
......
...@@ -127,7 +127,7 @@ public class TestMetaData extends TestBase { ...@@ -127,7 +127,7 @@ public class TestMetaData extends TestBase {
rs = stat.executeQuery("select 1 from dual"); rs = stat.executeQuery("select 1 from dual");
rs.next(); rs.next();
rsMeta = rs.getMetaData(); rsMeta = rs.getMetaData();
assertTrue(rsMeta.getCatalogName(1) != null); assertNotNull(rsMeta.getCatalogName(1));
assertEquals("1", rsMeta.getColumnLabel(1)); assertEquals("1", rsMeta.getColumnLabel(1));
assertEquals("1", rsMeta.getColumnName(1)); assertEquals("1", rsMeta.getColumnName(1));
assertEquals("", rsMeta.getSchemaName(1)); assertEquals("", rsMeta.getSchemaName(1));
...@@ -367,7 +367,7 @@ public class TestMetaData extends TestBase { ...@@ -367,7 +367,7 @@ public class TestMetaData extends TestBase {
assertTrue(dr.jdbcCompliant()); assertTrue(dr.jdbcCompliant());
assertEquals(0, dr.getPropertyInfo(null, null).length); assertEquals(0, dr.getPropertyInfo(null, null).length);
assertTrue(dr.connect("jdbc:test:false", null) == null); assertNull(dr.connect("jdbc:test:false", null));
assertTrue(meta.getNumericFunctions().length() > 0); assertTrue(meta.getNumericFunctions().length() > 0);
assertTrue(meta.getStringFunctions().length() > 0); assertTrue(meta.getStringFunctions().length() > 0);
...@@ -994,9 +994,9 @@ public class TestMetaData extends TestBase { ...@@ -994,9 +994,9 @@ public class TestMetaData extends TestBase {
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR }, null, null); Types.VARCHAR, Types.VARCHAR, Types.VARCHAR }, null, null);
assertTrue(conn.getWarnings() == null); assertNull(conn.getWarnings());
conn.clearWarnings(); conn.clearWarnings();
assertTrue(conn.getWarnings() == null); assertNull(conn.getWarnings());
conn.close(); conn.close();
} }
...@@ -1050,7 +1050,7 @@ public class TestMetaData extends TestBase { ...@@ -1050,7 +1050,7 @@ public class TestMetaData extends TestBase {
rs = meta.getTables(null, Constants.SCHEMA_MAIN, rs = meta.getTables(null, Constants.SCHEMA_MAIN,
null, new String[] { "TABLE" }); null, new String[] { "TABLE" });
assertTrue(rs.getStatement() == null); assertNull(rs.getStatement());
rs.next(); rs.next();
assertEquals("TEST", rs.getString("TABLE_NAME")); assertEquals("TEST", rs.getString("TABLE_NAME"));
assertFalse(rs.next()); assertFalse(rs.next());
......
...@@ -404,7 +404,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -404,7 +404,7 @@ public class TestPreparedStatement extends TestBase {
Thread.sleep(100); Thread.sleep(100);
prep.cancel(); prep.cancel();
SQLException e = (SQLException) t.getException(); SQLException e = (SQLException) t.getException();
assertTrue(e != null); assertNotNull(e);
assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode()); assertEquals(ErrorCode.STATEMENT_WAS_CANCELED, e.getErrorCode());
prep.setInt(1, 1); prep.setInt(1, 1);
prep.setInt(2, 1); prep.setInt(2, 1);
...@@ -618,7 +618,7 @@ public class TestPreparedStatement extends TestBase { ...@@ -618,7 +618,7 @@ public class TestPreparedStatement extends TestBase {
rs.next(); rs.next();
Object o = rs.getObject(2); Object o = rs.getObject(2);
assertTrue(o instanceof byte[]); assertTrue(o instanceof byte[]);
assertTrue(rs.getObject(3) == null); assertNull(rs.getObject(3));
rs.next(); rs.next();
o = rs.getObject(2); o = rs.getObject(2);
assertTrue(o instanceof byte[]); assertTrue(o instanceof byte[]);
...@@ -1446,9 +1446,9 @@ public class TestPreparedStatement extends TestBase { ...@@ -1446,9 +1446,9 @@ public class TestPreparedStatement extends TestBase {
assertEquals(ascii2, rs.getString(3)); assertEquals(ascii2, rs.getString(3));
assertFalse(rs.next()); assertFalse(rs.next());
assertTrue(prep.getWarnings() == null); assertNull(prep.getWarnings());
prep.clearWarnings(); prep.clearWarnings();
assertTrue(prep.getWarnings() == null); assertNull(prep.getWarnings());
assertTrue(conn == prep.getConnection()); assertTrue(conn == prep.getConnection());
} }
...@@ -1534,12 +1534,12 @@ public class TestPreparedStatement extends TestBase { ...@@ -1534,12 +1534,12 @@ public class TestPreparedStatement extends TestBase {
java.math.BigDecimal x = rs.getBigDecimal(1); java.math.BigDecimal x = rs.getBigDecimal(1);
trace("v=" + v + " x=" + x); trace("v=" + v + " x=" + x);
if (v == null) { if (v == null) {
assertTrue(x == null); assertNull(x);
} else { } else {
assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0); assertTrue(x.compareTo(new java.math.BigDecimal(v)) == 0);
} }
} }
assertTrue(!rs.next()); assertFalse(rs.next());
} }
private void testColumnMetaDataWithEquals(Connection conn) private void testColumnMetaDataWithEquals(Connection conn)
......
...@@ -204,7 +204,7 @@ public class TestStatement extends TestBase { ...@@ -204,7 +204,7 @@ public class TestStatement extends TestBase {
assertEquals(ResultSet.CONCUR_READ_ONLY, assertEquals(ResultSet.CONCUR_READ_ONLY,
stat2.getResultSetConcurrency()); stat2.getResultSetConcurrency());
assertEquals(0, stat.getMaxFieldSize()); assertEquals(0, stat.getMaxFieldSize());
assertTrue(!((JdbcStatement) stat2).isClosed()); assertFalse(((JdbcStatement) stat2).isClosed());
stat2.close(); stat2.close();
assertTrue(((JdbcStatement) stat2).isClosed()); assertTrue(((JdbcStatement) stat2).isClosed());
...@@ -279,19 +279,19 @@ public class TestStatement extends TestBase { ...@@ -279,19 +279,19 @@ public class TestStatement extends TestBase {
trace("execute"); trace("execute");
result = stat.execute( result = stat.execute(
"CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))"); "CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))");
assertTrue(!result); assertFalse(result);
result = stat.execute("INSERT INTO TEST VALUES(1,'Hello')"); result = stat.execute("INSERT INTO TEST VALUES(1,'Hello')");
assertTrue(!result); assertFalse(result);
result = stat.execute("INSERT INTO TEST(VALUE,ID) VALUES('JDBC',2)"); result = stat.execute("INSERT INTO TEST(VALUE,ID) VALUES('JDBC',2)");
assertTrue(!result); assertFalse(result);
result = stat.execute("UPDATE TEST SET VALUE='LDBC' WHERE ID=2"); result = stat.execute("UPDATE TEST SET VALUE='LDBC' WHERE ID=2");
assertTrue(!result); assertFalse(result);
result = stat.execute("DELETE FROM TEST WHERE ID=3"); result = stat.execute("DELETE FROM TEST WHERE ID=3");
assertTrue(!result); assertFalse(result);
result = stat.execute("SELECT * FROM TEST"); result = stat.execute("SELECT * FROM TEST");
assertTrue(result); assertTrue(result);
result = stat.execute("DROP TABLE TEST"); result = stat.execute("DROP TABLE TEST");
assertTrue(!result); assertFalse(result);
assertThrows(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY, stat). assertThrows(ErrorCode.METHOD_ONLY_ALLOWED_FOR_QUERY, stat).
executeQuery("CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))"); executeQuery("CREATE TABLE TEST(ID INT PRIMARY KEY,VALUE VARCHAR(255))");
...@@ -324,9 +324,9 @@ public class TestStatement extends TestBase { ...@@ -324,9 +324,9 @@ public class TestStatement extends TestBase {
stat.execute("DROP TABLE TEST"); stat.execute("DROP TABLE TEST");
stat.executeUpdate("DROP TABLE IF EXISTS TEST"); stat.executeUpdate("DROP TABLE IF EXISTS TEST");
assertTrue(stat.getWarnings() == null); assertNull(stat.getWarnings());
stat.clearWarnings(); stat.clearWarnings();
assertTrue(stat.getWarnings() == null); assertNull(stat.getWarnings());
assertTrue(conn == stat.getConnection()); assertTrue(conn == stat.getConnection());
assertEquals("SOME_ID", statBC.enquoteIdentifier("SOME_ID", false)); assertEquals("SOME_ID", statBC.enquoteIdentifier("SOME_ID", false));
......
...@@ -148,13 +148,13 @@ public class TestXA extends TestBase { ...@@ -148,13 +148,13 @@ public class TestXA extends TestBase {
XAResource res = xa.getXAResource(); XAResource res = xa.getXAResource();
res.start(xid, XAResource.TMNOFLAGS); res.start(xid, XAResource.TMNOFLAGS);
assertTrue(!c.getAutoCommit()); assertFalse(c.getAutoCommit());
res.end(xid, XAResource.TMSUCCESS); res.end(xid, XAResource.TMSUCCESS);
res.commit(xid, true); res.commit(xid, true);
assertTrue(c.getAutoCommit()); assertTrue(c.getAutoCommit());
res.start(xid, XAResource.TMNOFLAGS); res.start(xid, XAResource.TMNOFLAGS);
assertTrue(!c.getAutoCommit()); assertFalse(c.getAutoCommit());
res.end(xid, XAResource.TMFAIL); res.end(xid, XAResource.TMFAIL);
res.rollback(xid); res.rollback(xid);
assertTrue(c.getAutoCommit()); assertTrue(c.getAutoCommit());
...@@ -193,7 +193,7 @@ public class TestXA extends TestBase { ...@@ -193,7 +193,7 @@ public class TestXA extends TestBase {
xa.getXAResource().start(xid, xa.getXAResource().start(xid,
XAResource.TMNOFLAGS); XAResource.TMNOFLAGS);
Connection c = xa.getConnection(); Connection c = xa.getConnection();
assertTrue(!c.getAutoCommit()); assertFalse(c.getAutoCommit());
c.close(); c.close();
xa.close(); xa.close();
} }
......
...@@ -69,7 +69,7 @@ public class RecoverLobTest extends TestBase { ...@@ -69,7 +69,7 @@ public class RecoverLobTest extends TestBase {
int id = rs.getInt(1); int id = rs.getInt(1);
String data = rs.getString(2); String data = rs.getString(2);
assertTrue(data != null); assertNotNull(data);
assertTrue(data.length() == 10000 * id); assertTrue(data.length() == 10000 * id);
} }
......
...@@ -3,6 +3,80 @@ ...@@ -3,6 +3,80 @@
-- Initial Developer: H2 Group -- Initial Developer: H2 Group
-- --
explain select * from system_range(1, 2) where x=x+1 and x=1;
> PLAN
> ---------------------------------------------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX: X = 1 */ WHERE ((X = 1) AND (X = (X + 1))) AND (1 = (X + 1))
> rows: 1
explain select * from system_range(1, 2) where not (x = 1 and x*2 = 2);
> PLAN
> -------------------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX */ WHERE (X <> 1) OR ((X * 2) <> 2)
> rows: 1
explain select * from system_range(1, 10) where (NOT x >= 5);
> PLAN
> ------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 10) /* PUBLIC.RANGE_INDEX: X < 5 */ WHERE X < 5
> rows: 1
select (select t1.x from system_range(1,1) t2) from system_range(1,1) t1;
> SELECT T1.X FROM SYSTEM_RANGE(1, 1) T2 /* PUBLIC.RANGE_INDEX */ /* scanCount: 2 */
> ----------------------------------------------------------------------------------
> 1
> rows: 1
EXPLAIN PLAN FOR SELECT * FROM SYSTEM_RANGE(1, 20);
> PLAN
> -----------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 20) /* PUBLIC.RANGE_INDEX */
> rows: 1
select sum(x) from system_range(2, 1000) r where
not exists(select * from system_range(2, 32) r2 where r.x>r2.x and mod(r.x, r2.x)=0);
> SUM(X)
> ------
> 76127
> rows: 1
SELECT COUNT(*) FROM SYSTEM_RANGE(0, 2111222333);
> COUNT(*)
> ----------
> 2111222334
> rows: 1
select * from system_range(2, 100) r where
not exists(select * from system_range(2, 11) r2 where r.x>r2.x and mod(r.x, r2.x)=0);
> X
> --
> 11
> 13
> 17
> 19
> 2
> 23
> 29
> 3
> 31
> 37
> 41
> 43
> 47
> 5
> 53
> 59
> 61
> 67
> 7
> 71
> 73
> 79
> 83
> 89
> 97
> rows: 25
SELECT * FROM SYSTEM_RANGE(1, 10) ORDER BY 1; SELECT * FROM SYSTEM_RANGE(1, 10) ORDER BY 1;
> X > X
> -- > --
...@@ -118,3 +192,57 @@ SELECT * FROM SYSTEM_RANGE(2, 1, 0); ...@@ -118,3 +192,57 @@ SELECT * FROM SYSTEM_RANGE(2, 1, 0);
SELECT COUNT(*) FROM SYSTEM_RANGE(2, 1, 0); SELECT COUNT(*) FROM SYSTEM_RANGE(2, 1, 0);
> exception > exception
SELECT * FROM SYSTEM_RANGE(1, 8, 2);
> X
> -
> 1
> 3
> 5
> 7
> rows: 4
SELECT * FROM SYSTEM_RANGE(1, 8, 2) WHERE X = 2;
> X
> -
> rows: 0
SELECT COUNT(*) FROM SYSTEM_RANGE(1, 8, 2) WHERE X = 2;
>> 0
SELECT * FROM SYSTEM_RANGE(1, 8, 2) WHERE X BETWEEN 2 AND 6;
> X
> -
> 3
> 5
> rows: 2
SELECT COUNT(*) FROM SYSTEM_RANGE(1, 8, 2) WHERE X BETWEEN 2 AND 6;
>> 2
SELECT * FROM SYSTEM_RANGE(8, 1, -2) ORDER BY X DESC;
> X
> -
> 8
> 6
> 4
> 2
> rows (ordered): 4
SELECT * FROM SYSTEM_RANGE(8, 1, -2) WHERE X = 3;
> X
> -
> rows: 0
SELECT COUNT(*) FROM SYSTEM_RANGE(8, 1, -2) WHERE X = 3;
>> 0
SELECT * FROM SYSTEM_RANGE(8, 1, -2) WHERE X BETWEEN 3 AND 7 ORDER BY 1 DESC;
> X
> -
> 6
> 4
> rows (ordered): 2
SELECT COUNT(*) FROM SYSTEM_RANGE(8, 1, -2) WHERE X BETWEEN 3 AND 7;
>> 2
...@@ -1950,24 +1950,6 @@ create table test as select 1, space(10) from dual where 1=0 union all select x, ...@@ -1950,24 +1950,6 @@ create table test as select 1, space(10) from dual where 1=0 union all select x,
drop table test; drop table test;
> ok > ok
explain select * from system_range(1, 2) where x=x+1 and x=1;
> PLAN
> ---------------------------------------------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX: X = 1 */ WHERE ((X = 1) AND (X = (X + 1))) AND (1 = (X + 1))
> rows: 1
explain select * from system_range(1, 2) where not (x = 1 and x*2 = 2);
> PLAN
> -------------------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 2) /* PUBLIC.RANGE_INDEX */ WHERE (X <> 1) OR ((X * 2) <> 2)
> rows: 1
explain select * from system_range(1, 10) where (NOT x >= 5);
> PLAN
> ------------------------------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 10) /* PUBLIC.RANGE_INDEX: X < 5 */ WHERE X < 5
> rows: 1
CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255)); CREATE TABLE TEST(ID INT PRIMARY KEY, NAME VARCHAR(255));
> ok > ok
...@@ -3042,12 +3024,6 @@ SELECT t1.ID, (SELECT t1.id || ':' || AVG(t2.ID) FROM X t2) FROM X t1; ...@@ -3042,12 +3024,6 @@ SELECT t1.ID, (SELECT t1.id || ':' || AVG(t2.ID) FROM X t2) FROM X t1;
drop table x; drop table x;
> ok > ok
select (select t1.x from system_range(1,1) t2) from system_range(1,1) t1;
> SELECT T1.X FROM SYSTEM_RANGE(1, 1) T2 /* PUBLIC.RANGE_INDEX */ /* scanCount: 2 */
> ----------------------------------------------------------------------------------
> 1
> rows: 1
create table test(id int primary key, name varchar); create table test(id int primary key, name varchar);
> ok > ok
...@@ -5872,12 +5848,6 @@ EXPLAIN PLAN FOR SELECT LEFT(NAME, 2) FROM TEST; ...@@ -5872,12 +5848,6 @@ EXPLAIN PLAN FOR SELECT LEFT(NAME, 2) FROM TEST;
> SELECT LEFT(NAME, 2) FROM PUBLIC.TEST /* PUBLIC.TEST.tableScan */ > SELECT LEFT(NAME, 2) FROM PUBLIC.TEST /* PUBLIC.TEST.tableScan */
> rows: 1 > rows: 1
EXPLAIN PLAN FOR SELECT * FROM SYSTEM_RANGE(1, 20);
> PLAN
> -----------------------------------------------------------------------
> SELECT SYSTEM_RANGE.X FROM SYSTEM_RANGE(1, 20) /* PUBLIC.RANGE_INDEX */
> rows: 1
SELECT * FROM test t1 inner join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1; SELECT * FROM test t1 inner join test t2 on t1.id=t2.id and t2.name is not null where t1.id=1;
> ID NAME ID NAME > ID NAME ID NAME
> -- ----- -- ----- > -- ----- -- -----
...@@ -6358,54 +6328,6 @@ SELECT * FROM TEST; ...@@ -6358,54 +6328,6 @@ SELECT * FROM TEST;
DROP TABLE TEST; DROP TABLE TEST;
> ok > ok
--- range ----------------------------------------------------------------------------------------------
--import java.math.*;
--int s=0;for(int i=2;i<=1000;i++)
--s+=BigInteger.valueOf(i).isProbablePrime(10000)?i:0;s;
select sum(x) from system_range(2, 1000) r where
not exists(select * from system_range(2, 32) r2 where r.x>r2.x and mod(r.x, r2.x)=0);
> SUM(X)
> ------
> 76127
> rows: 1
SELECT COUNT(*) FROM SYSTEM_RANGE(0, 2111222333);
> COUNT(*)
> ----------
> 2111222334
> rows: 1
select * from system_range(2, 100) r where
not exists(select * from system_range(2, 11) r2 where r.x>r2.x and mod(r.x, r2.x)=0);
> X
> --
> 11
> 13
> 17
> 19
> 2
> 23
> 29
> 3
> 31
> 37
> 41
> 43
> 47
> 5
> 53
> 59
> 61
> 67
> 7
> 71
> 73
> 79
> 83
> 89
> 97
> rows: 25
--- syntax errors ---------------------------------------------------------------------------------------------- --- syntax errors ----------------------------------------------------------------------------------------------
CREATE SOMETHING STRANGE; CREATE SOMETHING STRANGE;
> exception > exception
......
...@@ -449,8 +449,8 @@ public class TestCacheLIRS extends TestBase { ...@@ -449,8 +449,8 @@ public class TestCacheLIRS extends TestBase {
Integer x = test.get(i); Integer x = test.get(i);
Integer y = test.peek(i); Integer y = test.peek(i);
if (i < size / 2) { if (i < size / 2) {
assertTrue("i: " + i, x != null); assertNotNull("i: " + i, x);
assertTrue("i: " + i, y != null); assertNotNull("i: " + i, y);
assertEquals(i * 10, x.intValue()); assertEquals(i * 10, x.intValue());
assertEquals(i * 10, y.intValue()); assertEquals(i * 10, y.intValue());
} else { } else {
...@@ -469,7 +469,7 @@ public class TestCacheLIRS extends TestBase { ...@@ -469,7 +469,7 @@ public class TestCacheLIRS extends TestBase {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Integer x = test.get(i); Integer x = test.get(i);
if (i < size / 2 || i == size - 1) { if (i < size / 2 || i == size - 1) {
assertTrue("i: " + i, x != null); assertNotNull("i: " + i, x);
assertEquals(i * 10, x.intValue()); assertEquals(i * 10, x.intValue());
} else { } else {
assertNull(x); assertNull(x);
......
...@@ -378,8 +378,8 @@ public class TestCacheLongKeyLIRS extends TestBase { ...@@ -378,8 +378,8 @@ public class TestCacheLongKeyLIRS extends TestBase {
Integer x = test.get(i); Integer x = test.get(i);
Integer y = test.peek(i); Integer y = test.peek(i);
if (i < size / 2) { if (i < size / 2) {
assertTrue("i: " + i, x != null); assertNotNull("i: " + i, x);
assertTrue("i: " + i, y != null); assertNotNull("i: " + i, y);
assertEquals(i * 10, x.intValue()); assertEquals(i * 10, x.intValue());
assertEquals(i * 10, y.intValue()); assertEquals(i * 10, y.intValue());
} else { } else {
...@@ -398,7 +398,7 @@ public class TestCacheLongKeyLIRS extends TestBase { ...@@ -398,7 +398,7 @@ public class TestCacheLongKeyLIRS extends TestBase {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
Integer x = test.get(i); Integer x = test.get(i);
if (i < size / 2 || i == size - 1 || i == size - 2) { if (i < size / 2 || i == size - 1 || i == size - 2) {
assertTrue("i: " + i, x != null); assertNotNull("i: " + i, x);
assertEquals(i * 10, x.intValue()); assertEquals(i * 10, x.intValue());
} else { } else {
assertNull(x); assertNull(x);
......
...@@ -141,7 +141,7 @@ public class TestDataUtils extends TestBase { ...@@ -141,7 +141,7 @@ public class TestDataUtils extends TestBase {
} }
try { try {
HashMap<String, String> map = DataUtils.parseMap(buff.toString()); HashMap<String, String> map = DataUtils.parseMap(buff.toString());
assertFalse(map == null); assertNotNull(map);
// ok // ok
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
// ok - but not another exception // ok - but not another exception
......
...@@ -134,7 +134,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -134,7 +134,7 @@ public class TestMVRTree extends TestMVStore {
for (SpatialKey k; it.hasNext();) { for (SpatialKey k; it.hasNext();) {
k = it.next(); k = it.next();
// System.out.println(k + ": " + r.get(k)); // System.out.println(k + ": " + r.get(k));
assertTrue(k != null); assertNotNull(k);
} }
s.close(); s.close();
} }
...@@ -181,7 +181,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -181,7 +181,7 @@ public class TestMVRTree extends TestMVStore {
assertEquals(len, r.size()); assertEquals(len, r.size());
int count = 0; int count = 0;
for (SpatialKey k : r.keySet()) { for (SpatialKey k : r.keySet()) {
assertTrue(r.get(k) != null); assertNotNull(r.get(k));
count++; count++;
} }
assertEquals(len, count); assertEquals(len, count);
...@@ -413,7 +413,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -413,7 +413,7 @@ public class TestMVRTree extends TestMVStore {
while (it.hasNext()) { while (it.hasNext()) {
SpatialKey n = it.next(); SpatialKey n = it.next();
String a = map.get(n); String a = map.get(n);
assertFalse(a == null); assertNotNull(a);
} }
break; break;
} }
...@@ -424,7 +424,7 @@ public class TestMVRTree extends TestMVStore { ...@@ -424,7 +424,7 @@ public class TestMVRTree extends TestMVStore {
while (it.hasNext()) { while (it.hasNext()) {
SpatialKey n = it.next(); SpatialKey n = it.next();
String a = map.get(n); String a = map.get(n);
assertFalse(a == null); assertNotNull(a);
} }
break; break;
} }
......
...@@ -528,7 +528,7 @@ public class TestMVStore extends TestBase { ...@@ -528,7 +528,7 @@ public class TestMVStore extends TestBase {
sleep(10); sleep(10);
} }
Throwable e = exRef.get(); Throwable e = exRef.get();
assertTrue(e != null); assertNotNull(e);
assertEquals(DataUtils.ERROR_WRITING_FAILED, assertEquals(DataUtils.ERROR_WRITING_FAILED,
DataUtils.getErrorCode(e.getMessage())); DataUtils.getErrorCode(e.getMessage()));
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
...@@ -894,7 +894,7 @@ public class TestMVStore extends TestBase { ...@@ -894,7 +894,7 @@ public class TestMVStore extends TestBase {
s.close(); s.close();
s = openStore(fileName); s = openStore(fileName);
Object test = s.getStoreHeader().get("test"); Object test = s.getStoreHeader().get("test");
assertFalse(test == null); assertNotNull(test);
assertEquals("123", test.toString()); assertEquals("123", test.toString());
s.close(); s.close();
} }
...@@ -1506,8 +1506,8 @@ public class TestMVStore extends TestBase { ...@@ -1506,8 +1506,8 @@ public class TestMVStore extends TestBase {
s.setRetentionTime(45000); s.setRetentionTime(45000);
assertEquals(2, s.getCurrentVersion()); assertEquals(2, s.getCurrentVersion());
meta = s.getMetaMap(); meta = s.getMetaMap();
assertTrue(meta.get("name.data") != null); assertNotNull(meta.get("name.data"));
assertTrue(meta.get("name.data0") != null); assertNotNull(meta.get("name.data0"));
assertNull(meta.get("name.data1")); assertNull(meta.get("name.data1"));
m = s.openMap("data"); m = s.openMap("data");
m0 = s.openMap("data0"); m0 = s.openMap("data0");
......
...@@ -174,7 +174,7 @@ public class TestMVStoreBenchmark extends TestBase { ...@@ -174,7 +174,7 @@ public class TestMVStoreBenchmark extends TestBase {
for (int a = 0; a < 5; a++) { for (int a = 0; a < 5; a++) {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
String x = map.get(i); String x = map.get(i);
assertTrue(x != null); assertNotNull(x);
} }
} }
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
......
...@@ -180,7 +180,7 @@ public class TestMVTableEngine extends TestBase { ...@@ -180,7 +180,7 @@ public class TestMVTableEngine extends TestBase {
stat.execute("checkpoint"); stat.execute("checkpoint");
stat.execute("shutdown immediately"); stat.execute("shutdown immediately");
Exception ex = t.getException(); Exception ex = t.getException();
assertTrue(ex != null); assertNotNull(ex);
try { try {
conn.close(); conn.close();
} catch (Exception e) { } catch (Exception e) {
......
...@@ -860,7 +860,7 @@ public class TestTransactionStore extends TestBase { ...@@ -860,7 +860,7 @@ public class TestTransactionStore extends TestBase {
assertNull(map.get(x)); assertNull(map.get(x));
} }
} catch (SQLException e) { } catch (SQLException e) {
assertTrue(map.get(x) != null); assertNotNull(map.get(x));
assertFalse(map.tryRemove(x)); assertFalse(map.tryRemove(x));
// PostgreSQL needs to rollback // PostgreSQL needs to rollback
buff.append(" -> rollback"); buff.append(" -> rollback");
......
...@@ -50,7 +50,7 @@ public class TestClassLoaderLeak extends TestBase { ...@@ -50,7 +50,7 @@ public class TestClassLoaderLeak extends TestBase {
Thread.sleep(10); Thread.sleep(10);
} }
ClassLoader cl = ref.get(); ClassLoader cl = ref.get();
assertTrue(cl == null); assertNull(cl);
// fill the memory, so a heap dump is created // fill the memory, so a heap dump is created
// using -XX:+HeapDumpOnOutOfMemoryError // using -XX:+HeapDumpOnOutOfMemoryError
// which can be analyzed using EclipseMAT // which can be analyzed using EclipseMAT
......
...@@ -219,16 +219,16 @@ public class TestFileSystem extends TestBase { ...@@ -219,16 +219,16 @@ public class TestFileSystem extends TestBase {
String resource = "org/h2/test/scripts/testSimple.in.txt"; String resource = "org/h2/test/scripts/testSimple.in.txt";
InputStream in; InputStream in;
in = getClass().getResourceAsStream("/" + resource); in = getClass().getResourceAsStream("/" + resource);
assertTrue(in != null); assertNotNull(in);
in.close(); in.close();
in = getClass().getClassLoader().getResourceAsStream(resource); in = getClass().getClassLoader().getResourceAsStream(resource);
assertTrue(in != null); assertNotNull(in);
in.close(); in.close();
in = FileUtils.newInputStream("classpath:" + resource); in = FileUtils.newInputStream("classpath:" + resource);
assertTrue(in != null); assertNotNull(in);
in.close(); in.close();
in = FileUtils.newInputStream("classpath:/" + resource); in = FileUtils.newInputStream("classpath:/" + resource);
assertTrue(in != null); assertNotNull(in);
in.close(); in.close();
} }
...@@ -320,7 +320,7 @@ public class TestFileSystem extends TestBase { ...@@ -320,7 +320,7 @@ public class TestFileSystem extends TestBase {
for (String f : FileUtils.newDirectoryStream( for (String f : FileUtils.newDirectoryStream(
"zip:" + getBaseDir() + "/fsJar.zip")) { "zip:" + getBaseDir() + "/fsJar.zip")) {
assertFalse(FileUtils.isAbsolute(f)); assertFalse(FileUtils.isAbsolute(f));
assertTrue(!FileUtils.isDirectory(f)); assertFalse(FileUtils.isDirectory(f));
assertTrue(FileUtils.size(f) > 0); assertTrue(FileUtils.size(f) > 0);
assertTrue(f.endsWith(FileUtils.getName(f))); assertTrue(f.endsWith(FileUtils.getName(f)));
assertEquals(0, FileUtils.lastModified(f)); assertEquals(0, FileUtils.lastModified(f));
...@@ -599,7 +599,7 @@ public class TestFileSystem extends TestBase { ...@@ -599,7 +599,7 @@ public class TestFileSystem extends TestBase {
IOUtils.copyFiles(fsBase + "/test", fsBase + "/test3"); IOUtils.copyFiles(fsBase + "/test", fsBase + "/test3");
FileUtils.move(fsBase + "/test3", fsBase + "/test2"); FileUtils.move(fsBase + "/test3", fsBase + "/test2");
FileUtils.move(fsBase + "/test2", fsBase + "/test2"); FileUtils.move(fsBase + "/test2", fsBase + "/test2");
assertTrue(!FileUtils.exists(fsBase + "/test3")); assertFalse(FileUtils.exists(fsBase + "/test3"));
assertTrue(FileUtils.exists(fsBase + "/test2")); assertTrue(FileUtils.exists(fsBase + "/test2"));
assertEquals(10000, FileUtils.size(fsBase + "/test2")); assertEquals(10000, FileUtils.size(fsBase + "/test2"));
byte[] buffer2 = new byte[10000]; byte[] buffer2 = new byte[10000];
...@@ -624,7 +624,7 @@ public class TestFileSystem extends TestBase { ...@@ -624,7 +624,7 @@ public class TestFileSystem extends TestBase {
assertTrue(FileUtils.isDirectory(fsBase + "/testDir")); assertTrue(FileUtils.isDirectory(fsBase + "/testDir"));
if (!fsBase.startsWith("jdbc:")) { if (!fsBase.startsWith("jdbc:")) {
FileUtils.deleteRecursive(fsBase + "/testDir", false); FileUtils.deleteRecursive(fsBase + "/testDir", false);
assertTrue(!FileUtils.exists(fsBase + "/testDir")); assertFalse(FileUtils.exists(fsBase + "/testDir"));
} }
} }
} }
......
...@@ -125,7 +125,7 @@ public class TestNetUtils extends TestBase { ...@@ -125,7 +125,7 @@ public class TestNetUtils extends TestBase {
closeSilently(socket); closeSilently(socket);
closeSilently(serverSocket); closeSilently(serverSocket);
if (task != null) { if (task != null) {
assertTrue(task.getException() != null); assertNotNull(task.getException());
assertEquals(javax.net.ssl.SSLHandshakeException.class.getName(), assertEquals(javax.net.ssl.SSLHandshakeException.class.getName(),
task.getException().getClass().getName()); task.getException().getClass().getName());
assertContains(task.getException().getMessage(), "certificate_unknown"); assertContains(task.getException().getMessage(), "certificate_unknown");
......
...@@ -476,7 +476,7 @@ public class TestTools extends TestBase { ...@@ -476,7 +476,7 @@ public class TestTools extends TestBase {
assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection());
assertEquals(0, rs.getFetchSize()); assertEquals(0, rs.getFetchSize());
assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType()); assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
assertTrue(rs.getStatement() == null); assertNull(rs.getStatement());
assertFalse(rs.isClosed()); assertFalse(rs.isClosed());
rs.beforeFirst(); rs.beforeFirst();
...@@ -760,7 +760,7 @@ public class TestTools extends TestBase { ...@@ -760,7 +760,7 @@ public class TestTools extends TestBase {
assertEquals(Double.MIN_VALUE, rs.getDouble("b")); assertEquals(Double.MIN_VALUE, rs.getDouble("b"));
assertEquals(Long.MIN_VALUE, rs.getLong("c")); assertEquals(Long.MIN_VALUE, rs.getLong("c"));
assertEquals(Short.MIN_VALUE, rs.getShort("d")); assertEquals(Short.MIN_VALUE, rs.getShort("d"));
assertTrue(!rs.getBoolean("e")); assertFalse(rs.getBoolean("e"));
assertEquals(new byte[] { (byte) 10, (byte) 20 }, rs.getBytes("f")); assertEquals(new byte[] { (byte) 10, (byte) 20 }, rs.getBytes("f"));
assertEquals("2007-12-31", rs.getString("g")); assertEquals("2007-12-31", rs.getString("g"));
assertEquals("23:59:59", rs.getString("h")); assertEquals("23:59:59", rs.getString("h"));
...@@ -902,8 +902,8 @@ public class TestTools extends TestBase { ...@@ -902,8 +902,8 @@ public class TestTools extends TestBase {
"SELECT * FROM TEST ORDER BY ID"); "SELECT * FROM TEST ORDER BY ID");
rs.next(); rs.next();
assertEquals(1, rs.getInt(1)); assertEquals(1, rs.getInt(1));
assertTrue(rs.getString(2) == null); assertNull(rs.getString(2));
assertTrue(rs.getString(3) == null); assertNull(rs.getString(3));
rs.next(); rs.next();
assertEquals(2, rs.getInt(1)); assertEquals(2, rs.getInt(1));
assertEquals("face", rs.getString(2)); assertEquals("face", rs.getString(2));
......
...@@ -302,7 +302,7 @@ public class TestValue extends TestBase { ...@@ -302,7 +302,7 @@ public class TestValue extends TestBase {
for (int i = 0; i < d.length - 1; i++) { for (int i = 0; i < d.length - 1; i++) {
assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0); assertTrue(values[i].compareTypeSafe(values[i+1], null) < 0);
assertTrue(values[i + 1].compareTypeSafe(values[i], null) > 0); assertTrue(values[i + 1].compareTypeSafe(values[i], null) > 0);
assertTrue(!values[i].equals(values[i+1])); assertFalse(values[i].equals(values[i+1]));
} }
} }
......
...@@ -47,7 +47,7 @@ public class TestColumnNamer extends TestBase { ...@@ -47,7 +47,7 @@ public class TestColumnNamer extends TestBase {
for (String id : ids) { for (String id : ids) {
Expression columnExp = ValueExpression.getDefault(); Expression columnExp = ValueExpression.getDefault();
String newColumnName = columnNamer.getColumnName(columnExp, index + 1, id); String newColumnName = columnNamer.getColumnName(columnExp, index + 1, id);
assertTrue(newColumnName != null); assertNotNull(newColumnName);
assertTrue(newColumnName.length() <= 30); assertTrue(newColumnName.length() <= 30);
assertTrue(newColumnName.length() >= 1); assertTrue(newColumnName.length() >= 1);
assertEquals(newColumnName, expectedColumnName[index]); assertEquals(newColumnName, expectedColumnName[index]);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论