File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\engine\DbObject.java.html

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