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

--no commit message

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