Debian Codegraph @

src/main/org/h2/result/ResultExternal.java

raw
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.result;
7
8 import java.util.Collection;
9 import org.h2.value.Value;
10
11 /**
12 * This interface is used to extend the LocalResult class, if data does not fit
13 * in memory.
14 */
15 public interface ResultExternal {
16
17 /**
18 * Reset the current position of this object.
19 */
20 void reset();
21
22 /**
23 * Get the next row from the result.
24 *
25 * @return the next row or null
26 */
27 Value[] next();
28
29 /**
30 * Add a row to this object.
31 *
32 * @param values the row to add
33 * @return the new number of rows in this object
34 */
35 int addRow(Value[] values);
36
37 /**
38 * Add a number of rows to the result.
39 *
40 * @param rows the list of rows to add
41 * @return the new number of rows in this object
42 */
43 int addRows(Collection<Value[]> rows);
44
45 /**
46 * Close this object and delete the temporary file.
47 */
48 void close();
49
50 /**
51 * Remove the row with the given values from this object if such a row
52 * exists.
53 *
54 * @param values the row
55 * @return the new row count
56 */
57 int removeRow(Value[] values);
58
59 /**
60 * Check if the given row exists in this object.
61 *
62 * @param values the row
63 * @return true if it exists
64 */
65 boolean contains(Value[] values);
66
67 /**
68 * Create a shallow copy of this object if possible.
69 *
70 * @return the shallow copy, or null
71 */
72 ResultExternal createShallowCopy();
73
74 }