File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\engine\UserDataType.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 org.h2.message.DbException;
10 import org.h2.message.Trace;
11 import org.h2.table.Column;
12 import org.h2.table.Table;
13
14 /**
15 * Represents a domain (user-defined data type).
16 */
17 public class UserDataType extends DbObjectBase {
18
19 private Column column;
20
21 public UserDataType(Database database, int id, String name) {
22 initDbObjectBase(database, id, name, Trace.DATABASE);
23 }
24
25 public String getCreateSQLForCopy(Table table, String quotedName) {
26 throw DbException.throwInternalError();
27 }
28
29 public String getDropSQL() {
30 return "DROP DOMAIN IF EXISTS " + getSQL();
31 }
32
33 public String getCreateSQL() {
34 return "CREATE DOMAIN " + getSQL() + " AS " + column.getCreateSQL();
35 }
36
37 public Column getColumn() {
38 return column;
39 }
40
41 public int getType() {
42 return DbObject.USER_DATATYPE;
43 }
44
45 public void removeChildrenAndResources(Session session) {
46 database.removeMeta(session, getId());
47 }
48
49 public void checkRename() {
50 // ok
51 }
52
53 public void setColumn(Column column) {
54 this.column = column;
55 }
56
57 }
58