提交 f89dd431 authored 作者: Thomas Mueller's avatar Thomas Mueller

--no commit message

--no commit message
上级 41a063a1
......@@ -45,21 +45,24 @@ public class ScanCursor implements Cursor {
public boolean next() throws SQLException {
if (multiVersion) {
while (true) {
if (delta.hasNext()) {
row = (Row) delta.next();
if (!row.getDeleted() || row.getSessionId() == session.getId()) {
if (delta != null) {
if (!delta.hasNext()) {
delta = null;
row = null;
continue;
} else {
row = (Row) delta.next();
if (!row.getDeleted() || row.getSessionId() == session.getId()) {
continue;
}
}
} else {
row = scan.getNextRow(session, row);
if (row != null && row.getSessionId() != 0 && row.getSessionId() != session.getId()) {
continue;
}
}
if (row == null) {
break;
}
if (row.getSessionId() == 0 || row.getSessionId() == session.getId() || row.getDeleted()) {
break;
}
break;
}
return row != null;
}
......
......@@ -144,7 +144,7 @@ public class ScanIndex extends BaseIndex {
public void commit(int operation, Row row) throws SQLException {
if (database.isMultiVersion()) {
if (delta != null && operation == UndoLogRecord.DELETE) {
if (delta != null) {
delta.remove(row);
}
incrementRowCount(row.getSessionId(), operation == UndoLogRecord.DELETE ? 1 : -1);
......
......@@ -19,10 +19,23 @@ public class Permutations {
private int[] index;
private boolean hasNext = true;
/**
* Create a new permutations object.
*
* @param in the source array
* @param out the target array
*/
public Permutations(Object[] in, Object[] out) {
this(in, out, in.length);
}
/**
* Create a new permutations object.
*
* @param in the source array
* @param out the target array
* @param m the number of output elements to generate
*/
public Permutations(Object[] in, Object[] out, int m) {
this.n = in.length;
this.m = m;
......@@ -86,6 +99,8 @@ public class Permutations {
/**
* Get the index of the first element from the right that is less
* than its neighbor on the right.
*
* @return the index or -1 if non is found
*/
private int rightmostDip() {
for (int i = n - 2; i >= 0; i--) {
......@@ -98,6 +113,8 @@ public class Permutations {
/**
* Reverse the elements to the right of the specified index.
*
* @param i the index
*/
private void reverseAfter(int i) {
int start = i + 1;
......
......@@ -154,8 +154,6 @@ java org.h2.test.TestAll timer
/*
Javadocs: abstract class (Table)
add tests with select distinct type (code coverage)
documentation: package.html
......
......@@ -89,6 +89,18 @@ public class TestMvcc1 extends TestBase {
s2.execute("drop table test");
c2.rollback();
// table scan problem
s1.execute("create table test(id int, name varchar)");
s1.execute("insert into test values(1, 'A'), (2, 'B')");
c1.commit();
test(s1, "select count(*) from test where name<>'C'", "2");
s2.execute("update test set name='B2' where id=2");
test(s1, "select count(*) from test where name<>'C'", "2");
c2.commit();
s2.execute("drop table test");
c2.rollback();
// referential integrity problem
s1.execute("create table a (id integer identity not null, code varchar(10) not null, primary key(id))");
s1.execute("create table b (name varchar(100) not null, a integer, primary key(name), foreign key(a) references a(id))");
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论