1 /* Copyright (c) 2001-2016, The HSQL Development Group 2 * All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * Redistributions of source code must retain the above copyright notice, this 8 * list of conditions and the following disclaimer. 9 * 10 * Redistributions in binary form must reproduce the above copyright notice, 11 * this list of conditions and the following disclaimer in the documentation 12 * and/or other materials provided with the distribution. 13 * 14 * Neither the name of the HSQL Development Group nor the names of its 15 * contributors may be used to endorse or promote products derived from this 16 * software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, 22 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 32 package org.hsqldb; 33 34 import org.hsqldb.HsqlNameManager.HsqlName; 35 import org.hsqldb.lib.OrderedHashSet; 36 import org.hsqldb.rights.Grantee; 37 38 /** 39 * SQL schema object interface 40 * 41 * @author Fred Toussi (fredt@users dot sourceforge.net) 42 * @version 2.3.4 43 * @since 1.9.0 44 */ 45 public interface SchemaObject { 46 47 int DATABASE = 0; 48 int CATALOG = 1; 49 int SCHEMA = 2; 50 int TABLE = 3; 51 int VIEW = 4; 52 int CONSTRAINT = 5; 53 int ASSERTION = 6; 54 int SEQUENCE = 7; 55 int TRIGGER = 8; 56 int COLUMN = 9; 57 int TRANSITION = 10; 58 int GRANTEE = 11; 59 int TYPE = 12; 60 int DOMAIN = 13; 61 int CHARSET = 14; 62 int COLLATION = 15; 63 int FUNCTION = 16; 64 int PROCEDURE = 17; 65 int ROUTINE = 18; 66 int CURSOR = 19; 67 int INDEX = 20; 68 int LABEL = 21; 69 int VARIABLE = 22; 70 int PARAMETER = 23; 71 int SPECIFIC_ROUTINE = 24; 72 int WRAPPER = 25; 73 int SERVER = 26; 74 int SUBQUERY = 27; 75 int SEARCH = 28; 76 int REFERENCE = 29; 77 78 // 79 SchemaObject[] emptyArray = new SchemaObject[]{}; 80 getType()81 int getType(); 82 getName()83 HsqlName getName(); 84 getSchemaName()85 HsqlName getSchemaName(); 86 getCatalogName()87 HsqlName getCatalogName(); 88 getOwner()89 Grantee getOwner(); 90 getReferences()91 OrderedHashSet getReferences(); 92 getComponents()93 OrderedHashSet getComponents(); 94 compile(Session session, SchemaObject parentObject)95 void compile(Session session, SchemaObject parentObject); 96 getSQL()97 String getSQL(); 98 getChangeTimestamp()99 long getChangeTimestamp(); 100 101 interface ConstraintTypes { 102 103 int FOREIGN_KEY = 0; 104 int MAIN = 1; 105 int UNIQUE = 2; 106 int CHECK = 3; 107 int PRIMARY_KEY = 4; 108 int TEMP = 5; 109 } 110 111 /* 112 SQL CLI codes 113 114 Referential Constraint 0 CASCADE 115 Referential Constraint 1 RESTRICT 116 Referential Constraint 2 SET NULL 117 Referential Constraint 3 NO ACTION 118 Referential Constraint 4 SET DEFAULT 119 */ 120 interface ReferentialAction { 121 122 int CASCADE = 0; 123 int RESTRICT = 1; 124 int SET_NULL = 2; 125 int NO_ACTION = 3; 126 int SET_DEFAULT = 4; 127 } 128 129 interface Deferable { 130 131 int INIT_DEFERRED = 5; 132 int INIT_IMMEDIATE = 6; 133 int NOT_DEFERRABLE = 7; 134 } 135 136 interface ViewCheckModes { 137 138 int CHECK_NONE = 0; 139 int CHECK_LOCAL = 1; 140 int CHECK_CASCADE = 2; 141 } 142 143 interface ParameterModes { 144 145 byte PARAM_UNKNOWN = 0; // java.sql.ParameterMetaData.parameterModeUnknown 146 byte PARAM_IN = 1; // java.sql.ParameterMetaData.parameterModeIn 147 byte PARAM_OUT = 4; // java.sql.ParameterMetaData.parameterModeInOut 148 byte PARAM_INOUT = 2; // java.sql.ParameterMetaData.parameterModeOut 149 } 150 151 interface Nullability { 152 153 byte NO_NULLS = 0; // java.sql.ResultSetMetaData.columnNoNulls 154 byte NULLABLE = 1; // java.sql.ResultSetMetaData.columnNullable 155 byte NULLABLE_UNKNOWN = 2; // java.sql.ResultSetMetaData.columnNullableUnknown 156 } 157 } 158