1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
* Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License,
* Version 1.0, and under the Eclipse Public License, Version 1.0
* (http://h2database.com/html/license.html).
* Initial Developer: H2 Group
*/
package org.h2.engine;
import java.util.ArrayList;
import org.h2.table.Table;
/**
* A database object such as a table, an index, or a user.
*/
public interface DbObject {
/**
* The object is of the type table or view.
*/
int TABLE_OR_VIEW = 0;
/**
* This object is an index.
*/
int INDEX = 1;
/**
* This object is a user.
*/
int USER = 2;
/**
* This object is a sequence.
*/
int SEQUENCE = 3;
/**
* This object is a trigger.
*/
int TRIGGER = 4;
/**
* This object is a constraint (check constraint, unique constraint, or
* referential constraint).
*/
int CONSTRAINT = 5;
/**
* This object is a setting.
*/
int SETTING = 6;
/**
* This object is a role.
*/
int ROLE = 7;
/**
* This object is a right.
*/
int RIGHT = 8;
/**
* This object is an alias for a Java function.
*/
int FUNCTION_ALIAS = 9;
/**
* This object is a schema.
*/
int SCHEMA = 10;
/**
* This object is a constant.
*/
int CONSTANT = 11;
/**
* This object is a user data type (domain).
*/
int USER_DATATYPE = 12;
/**
* This object is a comment.
*/
int COMMENT = 13;
/**
* This object is a user-defined aggregate function.
*/
int AGGREGATE = 14;
/**
* Tell the object that is was modified.
*/
void setModified();
/**
* Get the last modification id.
*
* @return the modification id
*/
long getModificationId();
/**
* Get the SQL name of this object (may be quoted).
*
* @return the SQL name
*/
String getSQL();
/**
* Get the list of dependent children (for tables, this includes indexes and
* so on).
*
* @return the list of children
*/
ArrayList<DbObject> getChildren();
/**
* Get the database.
*
* @return the database
*/
Database getDatabase();
/**
* Get the unique object id.
*
* @return the object id
*/
int getId();
/**
* Get the name.
*
* @return the name
*/
String getName();
/**
* Construct a CREATE ... SQL statement for this object when creating a copy
* of it.
*
* @param table the new table
* @param quotedName the quoted name
* @return the SQL statement
*/
String getCreateSQLForCopy(Table table, String quotedName);
/**
* Construct the original CREATE ... SQL statement for this object.
*
* @return the SQL statement
*/
String getCreateSQL();
/**
* Construct a DROP ... SQL statement for this object.
*
* @return the SQL statement
*/
String getDropSQL();
/**
* Get the object type.
*
* @return the object type
*/
int getType();
/**
* Delete all dependent children objects and resources of this object.
*
* @param session the session
*/
void removeChildrenAndResources(Session session);
/**
* Check if renaming is allowed. Does nothing when allowed.
*
* @throws SQLException if renaming is not allowed
*/
void checkRename();
/**
* Rename the object.
*
* @param newName the new name
*/
void rename(String newName);
/**
* Check if this object is temporary (for example, a temporary table).
*
* @return true if is temporary
*/
boolean isTemporary();
/**
* Tell this object that it is temporary or not.
*
* @param temporary the new value
*/
void setTemporary(boolean temporary);
/**
* Change the comment of this object.
*
* @param comment the new comment, or null for no comment
*/
void setComment(String comment);
/**
* Get the current comment of this object.
*
* @return the comment, or null if not set
*/
String getComment();
}