TableDerived.java (hsqldb-2.7.0) | : | TableDerived.java (hsqldb-2.7.1) | ||
---|---|---|---|---|
/* Copyright (c) 2001-2021, The HSQL Development Group | /* Copyright (c) 2001-2022, The HSQL Development Group | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions are met: | * modification, are permitted provided that the following conditions are met: | |||
* | * | |||
* Redistributions of source code must retain the above copyright notice, this | * Redistributions of source code must retain the above copyright notice, this | |||
* list of conditions and the following disclaimer. | * list of conditions and the following disclaimer. | |||
* | * | |||
* Redistributions in binary form must reproduce the above copyright notice, | * Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | * this list of conditions and the following disclaimer in the documentation | |||
skipping to change at line 50 | skipping to change at line 50 | |||
import org.hsqldb.navigator.RowSetNavigatorData; | import org.hsqldb.navigator.RowSetNavigatorData; | |||
import org.hsqldb.navigator.RowSetNavigatorDataTable; | import org.hsqldb.navigator.RowSetNavigatorDataTable; | |||
import org.hsqldb.persist.PersistentStore; | import org.hsqldb.persist.PersistentStore; | |||
import org.hsqldb.result.Result; | import org.hsqldb.result.Result; | |||
import org.hsqldb.types.Type; | import org.hsqldb.types.Type; | |||
/** | /** | |||
* Table with data derived from a query expression. | * Table with data derived from a query expression. | |||
* | * | |||
* @author Fred Toussi (fredt@users dot sourceforge.net) | * @author Fred Toussi (fredt@users dot sourceforge.net) | |||
* @version 2.6.0 | * @version 2.7.1 | |||
* @since 1.9.0 | * @since 1.9.0 | |||
*/ | */ | |||
public class TableDerived extends Table { | public class TableDerived extends Table { | |||
// | // | |||
public static final TableDerived[] emptyArray = new TableDerived[]{}; | public static final TableDerived[] emptyArray = new TableDerived[]{}; | |||
// | // | |||
QueryExpression queryExpression; | QueryExpression queryExpression; | |||
Expression dataExpression; | Expression dataExpression; | |||
skipping to change at line 89 | skipping to change at line 89 | |||
case TableBase.VIEW_TABLE : | case TableBase.VIEW_TABLE : | |||
case TableBase.RESULT_TABLE : | case TableBase.RESULT_TABLE : | |||
case TableBase.SYSTEM_SUBQUERY : | case TableBase.SYSTEM_SUBQUERY : | |||
break; | break; | |||
default : | default : | |||
throw Error.runtimeError(ErrorCode.U_S0500, "Table"); | throw Error.runtimeError(ErrorCode.U_S0500, "Table"); | |||
} | } | |||
} | } | |||
/** | ||||
* For named sunbqueries. | ||||
*/ | ||||
public TableDerived(Database database, HsqlName name, int type, | ||||
HsqlName[] colNames, Type[] colTypes) { | ||||
this(database, name, type); | ||||
// todo check column counts match | ||||
for (int i = 0; i < colNames.length; i++) { | ||||
ColumnSchema column = new ColumnSchema(colNames[i], colTypes[i]); | ||||
columnList.add(column.getName().name, column); | ||||
} | ||||
columnCount = colNames.length; | ||||
createPrimaryKey(null, null, false); | ||||
} | ||||
public TableDerived(Database database, HsqlName name, int type, | public TableDerived(Database database, HsqlName name, int type, | |||
Type[] columnTypes, OrderedHashMap columnList, | Type[] columnTypes, OrderedHashMap columnList, | |||
int[] pkColumns) { | int[] pkColumns) { | |||
this(database, name, type); | this(database, name, type); | |||
this.colTypes = columnTypes; | this.colTypes = columnTypes; | |||
this.columnList = columnList; | this.columnList = columnList; | |||
columnCount = columnList.size(); | columnCount = columnList.size(); | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 22 lines changed or added |