| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.table; |
| 7 |
|
| 8 |
import org.h2.engine.SessionLocal; |
| 9 |
import org.h2.index.Index; |
| 10 |
import org.h2.index.VirtualConstructedTableIndex; |
| 11 |
import org.h2.result.ResultInterface; |
| 12 |
import org.h2.schema.Schema; |
| 13 |
|
| 14 |
/** |
| 15 |
* A base class for virtual tables that construct all their content at once. |
| 16 |
*/ |
| 17 |
public abstract class VirtualConstructedTable extends VirtualTable { |
| 18 |
|
| 19 |
protected VirtualConstructedTable(Schema schema, int id, String name) { |
| 20 |
super(schema, id, name); |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* Read the rows from the table. |
| 25 |
* |
| 26 |
* @param session |
| 27 |
* the session |
| 28 |
* @return the result |
| 29 |
*/ |
| 30 |
public abstract ResultInterface getResult(SessionLocal session); |
| 31 |
|
| 32 |
@Override |
| 33 |
public Index getScanIndex(SessionLocal session) { |
| 34 |
return new VirtualConstructedTableIndex(this, IndexColumn.wrap(columns)); |
| 35 |
} |
| 36 |
|
| 37 |
@Override |
| 38 |
public long getMaxDataModificationId() { |
| 39 |
// TODO optimization: virtual table currently doesn't know the |
| 40 |
// last modified date |
| 41 |
return Long.MAX_VALUE; |
| 42 |
} |
| 43 |
|
| 44 |
} |