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

--no commit message

--no commit message
上级 23cceaf0
...@@ -214,6 +214,10 @@ public class DiskFile implements CacheWriter { ...@@ -214,6 +214,10 @@ public class DiskFile implements CacheWriter {
try { try {
DataInputStream in = new DataInputStream(new ByteArrayInputStream(summary)); DataInputStream in = new DataInputStream(new ByteArrayInputStream(summary));
int b2 = in.readInt(); int b2 = in.readInt();
if(b2 > fileBlockCount) {
database.getTrace(Trace.DATABASE).info("unexpected size " + b2 + " when initializing summary for " +fileName+" expected:" + fileBlockCount);
return;
}
stage++; stage++;
for(int i=0, x = 0; i<b2 / 8; i++) { for(int i=0, x = 0; i<b2 / 8; i++) {
int mask = in.read(); int mask = in.read();
......
...@@ -25,12 +25,12 @@ public class TableView extends Table { ...@@ -25,12 +25,12 @@ public class TableView extends Table {
private String querySQL; private String querySQL;
private ObjectArray tables; private ObjectArray tables;
private String[] columnNames; private String[] columnNames;
private boolean invalid;
private Query viewQuery; private Query viewQuery;
private ViewIndex index; private ViewIndex index;
private boolean recursive; private boolean recursive;
private SQLException createException;
public TableView(Schema schema, int id, String name, String querySQL, ObjectArray params, String[] columnNames, Session session) throws SQLException { public TableView(Schema schema, int id, String name, String querySQL, ObjectArray params, String[] columnNames, Session session, boolean recursive) throws SQLException {
super(schema, id, name, false); super(schema, id, name, false);
this.querySQL = querySQL; this.querySQL = querySQL;
this.columnNames = columnNames; this.columnNames = columnNames;
...@@ -68,34 +68,35 @@ public class TableView extends Table { ...@@ -68,34 +68,35 @@ public class TableView extends Table {
} }
cols = new Column[list.size()]; cols = new Column[list.size()];
list.toArray(cols); list.toArray(cols);
invalid = false; createException = null;
if(getId() != 0) { if(getId() != 0) {
addViewToTables(); addViewToTables();
} }
viewQuery = query; viewQuery = query;
} catch(SQLException e) { } catch(SQLException e) {
createException = e;
// if it can't be compiled, then it's a 'zero column table' // if it can't be compiled, then it's a 'zero column table'
// this avoids problems when creating the view when opening the database // this avoids problems when creating the view when opening the database
tables = new ObjectArray(); tables = new ObjectArray();
cols = new Column[0]; cols = new Column[0];
invalid = true;
if(columnNames != null) { int testing;
cols = new Column[columnNames.length]; // if(recursive && columnNames != null) {
for(int i=0; i<columnNames.length; i++) { // cols = new Column[columnNames.length];
cols[i] = new Column(columnNames[i], Value.STRING, 255, 0); // for(int i=0; i<columnNames.length; i++) {
} // cols[i] = new Column(columnNames[i], Value.STRING, 255, 0);
invalid = false; // }
index.setRecursive(true); // index.setRecursive(true);
recursive = true; // recursive = true;
} // createException = null;
// }
} }
setColumns(cols); setColumns(cols);
} }
public boolean getInvalid() { public boolean getInvalid() {
return invalid; return createException != null;
} }
public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException { public PlanItem getBestPlanItem(Session session, int[] masks) throws SQLException {
...@@ -196,8 +197,9 @@ public class TableView extends Table { ...@@ -196,8 +197,9 @@ public class TableView extends Table {
} }
public Index getScanIndex(Session session) throws SQLException { public Index getScanIndex(Session session) throws SQLException {
if(invalid) { if(createException != null) {
throw Message.getSQLException(Message.VIEW_IS_INVALID_1, getSQL()); String msg = createException.getMessage();
throw Message.getSQLException(Message.VIEW_IS_INVALID_2, new String[]{getSQL(), msg}, createException);
} }
PlanItem item = getBestPlanItem(session, null); PlanItem item = getBestPlanItem(session, null);
return item.getIndex(); return item.getIndex();
...@@ -221,7 +223,7 @@ public class TableView extends Table { ...@@ -221,7 +223,7 @@ public class TableView extends Table {
} }
public long getMaxDataModificationId() { public long getMaxDataModificationId() {
if(invalid) { if(createException != null) {
throw Message.getInternalError(); throw Message.getInternalError();
} }
if(viewQuery == null) { if(viewQuery == null) {
......
/* /*
* Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html). * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
* */ * Initial Developer: H2 Group
*/
package org.h2.value; package org.h2.value;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
...@@ -30,9 +31,6 @@ import org.h2.util.ExactUTF8InputStreamReader; ...@@ -30,9 +31,6 @@ import org.h2.util.ExactUTF8InputStreamReader;
import org.h2.util.IOUtils; import org.h2.util.IOUtils;
import org.h2.util.StringCache; import org.h2.util.StringCache;
/**
* @author Thomas
*/
public class Transfer { public class Transfer {
private static final int BUFFER_SIZE = 16 * 1024; private static final int BUFFER_SIZE = 16 * 1024;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论