001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.jdbc.metadata;
017
018/* <p> This class contains constants indicating names of the columns in the
019 *  result sets returned by methods on JcrMetaData. Each inner class represents
020 *  a particular method and the class attributes give the names of the columns on
021 *  methods ResultSet.</p>
022 */
023
024public interface JDBCColumnNames {
025
026    /**
027     * This class contains constants representing column names on ResultSet returned by getCatalogs method on DatabaseMetaData.
028     * These constant values are be used for the column names used in constructing the ResultSet obj.
029     */
030    interface CATALOGS {
031        // name of the column containing catalog or Virtual database name.
032        static final String TABLE_CAT = "TABLE_CAT"; //$NON-NLS-1$
033    }
034
035    /**
036     * This class contains constants representing column names on ResultSet returned by getColumns method on DatabaseMetaData.
037     * These constant values are be used to hardcode the column names used in constructin the ResultSet obj.
038     */
039    interface COLUMNS {
040
041        // name of the column containing catalog or Virtual database name.
042        static final String TABLE_CAT = "TABLE_CAT"; //$NON-NLS-1$
043
044        // name of the column containing schema or Virtual database version.
045        static final String TABLE_SCHEM = "TABLE_SCHEM"; //$NON-NLS-1$
046
047        // name of the column containing table or group name.
048        static final String TABLE_NAME = "TABLE_NAME"; //$NON-NLS-1$
049
050        // name of the column containing column or element name.
051        static final String COLUMN_NAME = "COLUMN_NAME"; //$NON-NLS-1$
052
053        /** name of column that contains SQL type from java.sql.Types for column's data type. */
054        static final String DATA_TYPE = "DATA_TYPE"; //$NON-NLS-1$
055
056        /** name of column that contains local type name used by the data source. */
057        static final String TYPE_NAME = "TYPE_NAME"; //$NON-NLS-1$
058
059        // name of the column containing column size.
060        static final String COLUMN_SIZE = "COLUMN_SIZE"; //$NON-NLS-1$
061
062        /** name of column that is not used will contain nulls */
063        static final String BUFFER_LENGTH = "BUFFER_LENGTH"; //$NON-NLS-1$
064
065        // name of the column containing number of digits to right of decimal
066        static final String DECIMAL_DIGITS = "DECIMAL_DIGITS"; //$NON-NLS-1$
067
068        // name of the column containing column's Radix.
069        static final String NUM_PREC_RADIX = "NUM_PREC_RADIX"; //$NON-NLS-1$
070
071        /** name of column that has an String value indicating nullablity */
072        static final String NULLABLE = "NULLABLE"; //$NON-NLS-1$
073
074        /** name of column containing explanatory notes. */
075        static final String REMARKS = "REMARKS"; //$NON-NLS-1$
076
077        /** name of column which contails default value for the column. */
078        static final String COLUMN_DEF = "COLUMN_DEF"; //$NON-NLS-1$
079
080        /** name of column that not used will contain nulls */
081        static final String SQL_DATA_TYPE = "SQL_DATA_TYPE"; //$NON-NLS-1$
082
083        /** name of column that not used will contain nulls */
084        static final String SQL_DATETIME_SUB = "SQL_DATETIME_SUB"; //$NON-NLS-1$
085
086        /** name of column that stores the max number of bytes in the column */
087        static final String CHAR_OCTET_LENGTH = "CHAR_OCTET_LENGTH"; //$NON-NLS-1$
088
089        /** name of column that stores the index of a column in the table */
090        static final String ORDINAL_POSITION = "ORDINAL_POSITION"; //$NON-NLS-1$
091
092        /** name of column that has an String value indicating nullablity */
093        static final String IS_NULLABLE = "IS_NULLABLE"; //$NON-NLS-1$
094
095        /** name of column that is the scope of a reference attribute (null if DATA_TYPE isn't REF) */
096        static final String SCOPE_CATLOG = "SCOPE_CATLOG"; //$NON-NLS-1$
097
098        /** name of column that is the scope of a reference attribute (null if the DATA_TYPE isn't REF) */
099        static final String SCOPE_SCHEMA = "SCOPE_SCHEMA"; //$NON-NLS-1$
100
101        /** name of column that is the scope of a reference attribure (null if the DATA_TYPE isn't REF) */
102        static final String SCOPE_TABLE = "SCOPE_TABLE"; //$NON-NLS-1$
103
104        /**
105         * name of column that is source type of a distinct type or user-generated Ref type, SQL type from java.sql.Types (null if
106         * DATA_TYPE isn't DISTINCT or user-generated REF)
107         */
108        static final String SOURCE_DATA_TYPE = "SOURCE_DATA_TYPE"; //$NON-NLS-1$
109
110        /** name of column that has an String value indicating format */
111        static final String FORMAT = "FORMAT"; //$NON-NLS-1$
112
113        /** name of column that has an String value indicating minimum range */
114        static final String MIN_RANGE = "MIN_RANGE"; //$NON-NLS-1$
115
116        /** name of column that has an String value indicating maximum range */
117        static final String MAX_RANGE = "MAX_RANGE"; //$NON-NLS-1$
118    }
119
120    /**
121     * This class contains constants representing column names on ResultSet returned by getSchemas method on DatabaseMetaData.
122     * These constant values are be used to hardcode the column names used in constructin the ResultSet obj.
123     */
124    interface SCHEMAS {
125
126        // name of the column containing procedure catalog or Virtual database name.
127        static final String TABLE_SCHEM = "TABLE_SCHEM"; //$NON-NLS-1$
128
129        // name of the column containing schema or Virtual database version.
130        static final String TABLE_CATALOG = "TABLE_CATALOG"; //$NON-NLS-1$
131
132    }
133
134    /**
135     * This class contains constants representing column names on ResultSet returned by getTables and getTableTypes methods on
136     * DatabaseMetaData. These constant values are be used to hardcode the column names used in construction the ResultSet obj.
137     */
138    interface TABLES {
139
140        // name of the column containing catalog or Virtual database name.
141        static final String TABLE_CAT = "TABLE_CAT"; //$NON-NLS-1$
142
143        // name of the column containing schema or Virtual database version.
144        static final String TABLE_SCHEM = "TABLE_SCHEM"; //$NON-NLS-1$
145
146        // name of the column containing table or group name.
147        static final String TABLE_NAME = "TABLE_NAME"; //$NON-NLS-1$
148
149        // name of the column containing table or group type.
150        static final String TABLE_TYPE = "TABLE_TYPE"; //$NON-NLS-1$
151
152        /** name of column containing explanatory notes. */
153        static final String REMARKS = "REMARKS"; //$NON-NLS-1$
154        static final String TYPE_CAT = "TYPE_CAT"; //$NON-NLS-1$
155        static final String TYPE_SCHEM = "TYPE_SCHEM"; //$NON-NLS-1$
156        static final String TYPE_NAME = "TYPE_NAME"; //$NON-NLS-1$
157        static final String SELF_REFERENCING_COL_NAME = "SELF_REFERENCING_COL_NAME"; //$NON-NLS-1$
158        static final String REF_GENERATION = "REF_GENERATION"; //$NON-NLS-1$
159        static final String ISPHYSICAL = "ISPHYSICAL"; //$NON-NLS-1$
160
161    }
162
163    /**
164     * This class contains constants representing column names on ResultSet returned by getTables and getTableTypes methods on
165     * DatabaseMetaData. These constant values are be used to hardcode the column names used in construction the ResultSet obj.
166     */
167    interface TABLE_TYPES {
168
169        // name of the column containing table or group type.
170        static final String TABLE_TYPE = "TABLE_TYPE"; //$NON-NLS-1$
171    }
172
173    /**
174     * This class contains constants representing column names on ResultSet returned by getTypeInfo method on DatabaseMetaData.
175     * These constant values are be used to hard code the column names used in construction of the ResultSet obj.
176     */
177    interface TYPE_INFO {
178
179        /** name of column that contains local type name used by the data source. */
180        static final String TYPE_NAME = "TYPE_NAME"; //$NON-NLS-1$
181
182        /** name of column that contains SQL type from java.sql.Types for column's data type. */
183        static final String DATA_TYPE = "DATA_TYPE"; //$NON-NLS-1$
184
185        // name of the column containing number of digits to right of decimal
186        static final String PRECISION = "PRECISION"; //$NON-NLS-1$
187
188        // name of the column containing prefix used to quote a literal
189        static final String LITERAL_PREFIX = "LITERAL_PREFIX"; //$NON-NLS-1$
190
191        // name of the column containing suffix used to quote a literal
192        static final String LITERAL_SUFFIX = "LITERAL_SUFFIX"; //$NON-NLS-1$
193
194        // name of the column containing params used in creating the type
195        static final String CREATE_PARAMS = "CREATE_PARAMS"; //$NON-NLS-1$
196
197        /** name of column that has an String value indicating nullablity */
198        static final String NULLABLE = "NULLABLE"; //$NON-NLS-1$
199
200        /** name of column that has an String value indicating case sensitivity */
201        static final String CASE_SENSITIVE = "CASE_SENSITIVE"; //$NON-NLS-1$
202
203        /** name of column that has an String value indicating searchability */
204        static final String SEARCHABLE = "SEARCHABLE"; //$NON-NLS-1$
205
206        /** name of column that has an String value indicating searchability */
207        static final String UNSIGNED_ATTRIBUTE = "UNSIGNED_ATTRIBUTE"; //$NON-NLS-1$
208
209        /** name of column that contains info if the column is a currency value */
210        static final String FIXED_PREC_SCALE = "FIXED_PREC_SCALE"; //$NON-NLS-1$
211
212        /** name of column that contains info whether the column is autoincrementable */
213        static final String AUTOINCREMENT = "AUTO_INCREMENT"; //$NON-NLS-1$
214
215        /** name of column that localised version of type name */
216        static final String LOCAL_TYPE_NAME = "LOCAL_TYPE_NAME"; //$NON-NLS-1$
217
218        /** name of column that gives the min scale supported */
219        static final String MINIMUM_SCALE = "MINIMUM_SCALE"; //$NON-NLS-1$
220
221        /** name of column that gives the max scale supported */
222        static final String MAXIMUM_SCALE = "MAXIMUM_SCALE"; //$NON-NLS-1$
223
224        /** name of column that not used will contain nulls */
225        static final String SQL_DATA_TYPE = "SQL_DATA_TYPE"; //$NON-NLS-1$
226
227        /** name of column that not used will contain nulls */
228        static final String SQL_DATETIME_SUB = "SQL_DATETIME_SUB"; //$NON-NLS-1$
229
230        // constant indiacting column's Radix.
231        static final String NUM_PREC_RADIX = "NUM_PREC_RADIX"; //$NON-NLS-1$
232    }
233
234    /**
235     * This class contains constants representing column names on ResultSet returned by getCrossReference, getExportedKeys, and
236     * getImportedKeys methods on DatabaseMetaData. These constant values are be used to hard code the column names used in
237     * construction the ResultSet obj.
238     */
239    interface REFERENCE_KEYS {
240
241        // name of the column containing catalog or Virtual database name for primary key's table.
242        static final String PKTABLE_CAT = "PKTABLE_CAT"; //$NON-NLS-1$
243
244        // name of the column containing schema or Virtual database version for primary key's table.
245        static final String PKTABLE_SCHEM = "PKTABLE_SCHEM"; //$NON-NLS-1$
246
247        // name of the column containing table or group name for primary key's table.
248        static final String PKTABLE_NAME = "PKTABLE_NAME"; //$NON-NLS-1$
249
250        // name of the column containing column or element name of the primary key.
251        static final String PKCOLUMN_NAME = "PKCOLUMN_NAME"; //$NON-NLS-1$
252
253        // name of the column containing catalog or Virtual database name for foreign key's table.
254        static final String FKTABLE_CAT = "FKTABLE_CAT"; //$NON-NLS-1$
255
256        // name of the column containing schema or Virtual database version for foreign key's table.
257        static final String FKTABLE_SCHEM = "FKTABLE_SCHEM"; //$NON-NLS-1$
258
259        // name of the column containing table or group name for foreign key's table.
260        static final String FKTABLE_NAME = "FKTABLE_NAME"; //$NON-NLS-1$
261
262        // name of the column containing column or element name of the foreign key.
263        static final String FKCOLUMN_NAME = "FKCOLUMN_NAME"; //$NON-NLS-1$
264
265        // name of the column containing sequence number within the foreign key
266        static final String KEY_SEQ = "KEY_SEQ"; //$NON-NLS-1$
267
268        // name of the column containing effect on foreign key when PK is updated.
269        static final String UPDATE_RULE = "UPDATE_RULE"; //$NON-NLS-1$
270
271        // name of the column containing effect on foreign key when PK is deleted.
272        static final String DELETE_RULE = "DELETE_RULE"; //$NON-NLS-1$
273
274        // name of the column containing name of the foreign key.
275        static final String FK_NAME = "FK_NAME"; //$NON-NLS-1$
276
277        // name of the column containing name of the primary key.
278        static final String PK_NAME = "PK_NAME"; //$NON-NLS-1$
279
280        // name of the column containing deferability of foreign key constraStrings.
281        static final String DEFERRABILITY = "DEFERRABILITY"; //$NON-NLS-1$
282        static final String FKPOSITION = "FKPOSITION"; //$NON-NLS-1$
283    }
284
285    /**
286     * This class contains constants representing column names on ResultSet returned by getPrimaryKeys method on DatabaseMetaData.
287     * These constant values are be used to hard code the column names used in construction the ResultSet obj.
288     */
289    interface PRIMARY_KEYS {
290
291        // name of the column containing catalog or Virtual database name.
292        static final String TABLE_CAT = "TABLE_CAT"; //$NON-NLS-1$
293
294        // name of the column containing schema or Virtual database version.
295        static final String TABLE_SCHEM = "TABLE_SCHEM"; //$NON-NLS-1$
296
297        // name of the column containing table or group name.
298        static final String TABLE_NAME = "TABLE_NAME"; //$NON-NLS-1$
299
300        // name of the column containing column or element name.
301        static final String COLUMN_NAME = "COLUMN_NAME"; //$NON-NLS-1$
302
303        // name of the column containing sequence number within the primary key
304        static final String KEY_SEQ = "KEY_SEQ"; //$NON-NLS-1$
305
306        // name of the column containing name of the primary key.
307        static final String PK_NAME = "PK_NAME"; //$NON-NLS-1$
308        static final String POSITION = "POSITION"; //$NON-NLS-1$
309    }
310
311    /**
312     * This class contains constants representing column names on ResultSet returned by getIndexInfo method on DatabaseMetaData.
313     * These constant values are be used to hard code the column names used in construction the ResultSet obj.
314     */
315    interface INDEX_INFO {
316
317        // name of the column containing tables catalog name on which the index is present
318        static final String TABLE_CAT = "TABLE_CAT"; //$NON-NLS-1$
319
320        // name of the column containing tables schema name on which the index is present
321        static final String TABLE_SCHEM = "TABLE_SCHEM"; //$NON-NLS-1$
322
323        // name of the column containing table or group name.
324        static final String TABLE_NAME = "TABLE_NAME"; //$NON-NLS-1$
325
326        // name of the column containing name of column showing if an index in non-unique
327        static final String NON_UNIQUE = "NON_UNIQUE"; //$NON-NLS-1$
328
329        // name of the column containing name of column containing index_qualifier string
330        static final String INDEX_QUALIFIER = "INDEX_QUALIFIER"; //$NON-NLS-1$
331
332        // name of the column containing name of column containing index names
333        static final String INDEX_NAME = "INDEX_NAME"; //$NON-NLS-1$
334
335        // name of the column containing name of column containing index types
336        static final String TYPE = "TYPE"; //$NON-NLS-1$
337
338        // name of the column containing name of the column containing column position.
339        static final String ORDINAL_POSITION = "ORDINAL_POSITION"; //$NON-NLS-1$
340
341        // name of the column containing name of the column containing column names.
342        static final String COLUMN_NAME = "COLUMN_NAME"; //$NON-NLS-1$
343
344        // name of the column containing name of column containing info if the index is asc or desc.
345        static final String ASC_OR_DESC = "ASC_OR_DESC"; //$NON-NLS-1$
346
347        // name of the column containing name of the column containing number of unique values in index.
348        static final String CARDINALITY = "CARDINALITY"; //$NON-NLS-1$
349
350        // name of the column containing name of the column giving number od pages used for the current index.
351        static final String PAGES = "PAGES"; //$NON-NLS-1$
352
353        // name of the column containing name of the column giving filter condition.
354        static final String FILTER_CONDITION = "FILTER_CONDITION"; //$NON-NLS-1$
355    }
356
357    /**
358     * This class contains constants representing column names on ResultSet returned by getImportedKeys method on
359     * DatabaseMetaData. These constant values are be used to hard code the column names used in construction the ResultSet obj.
360     */
361    interface REFERENCE_KEYS_INFO {
362
363        // name of the column containing tables catalog name on which the primary key is present
364        static final String PK_TABLE_CAT = "PKTABLE_CAT"; //$NON-NLS-1$
365
366        // name of the column containing tables schema name on which the primary key is present
367        static final String PK_TABLE_SCHEM = "PKTABLE_SCHEM"; //$NON-NLS-1$
368
369        // name of the column containing primary key's table or group name.
370        static final String PK_TABLE_NAME = "PKTABLE_NAME"; //$NON-NLS-1$
371
372        // name of the column containing primary key's column name.
373        static final String PK_COLUMN_NAME = "PKCOLUMN_NAME"; //$NON-NLS-1$
374
375        // name of the column containing tables catalog name on which the foreign key is present
376        static final String FK_TABLE_CAT = "FKTABLE_CAT"; //$NON-NLS-1$
377
378        // name of the column containing tables schema name on which the foreign key is present
379        static final String FK_TABLE_SCHEM = "FKTABLE_SCHEM"; //$NON-NLS-1$
380
381        // name of the column containing foreign key's table or group name.
382        static final String FK_TABLE_NAME = "FKTABLE_NAME"; //$NON-NLS-1$
383
384        // name of the column containing foreign key's column name.
385        static final String FK_COLUMN_NAME = "PKCOLUMN_NAME"; //$NON-NLS-1$
386
387        // name of the column containing sequence number within the primary key
388        static final String KEY_SEQ = "KEY_SEQ"; //$NON-NLS-1$
389
390        // name of the column containing the delete rule
391        static final String UPDATE_RULE = "UPDATE_RULE"; //$NON-NLS-1$
392
393        // name of the column containing the delete rule
394        static final String DELETE_RULE = "DELETE_RULE"; //$NON-NLS-1$
395
396        // name of the column containing name of the foreign key.
397        static final String FK_NAME = "FK_NAME"; //$NON-NLS-1$
398
399        // name of the column containing name of the primary key.
400        static final String PK_NAME = "PK_NAME"; //$NON-NLS-1$
401
402        static final String DEFERRABILITY = "DEFERRABILITY"; //$NON-NLS-1$
403    }
404
405    /**
406     * This class contains constants representing column names on ResultSet returned by getProcedures on DatabaseMetaData. These
407     * constant values are be used to hardcode the column names used in construction the ResultSet obj.
408     */
409    interface PROCEDURES {
410
411        // name of the column containing catalog name.
412        static final String PROCEDURE_CAT = "PROCEDURE_CAT"; //$NON-NLS-1$
413
414        // name of the column containing schema name.
415        static final String PROCEDURE_SCHEM = "PROCEDURE_SCHEM"; //$NON-NLS-1$
416
417        // name of the column containing table or group name.
418        static final String PROCEDURE_NAME = "PROCEDURE_NAME"; //$NON-NLS-1$
419
420        static final String RESERVED1 = ""; //$NON-NLS-1$
421        static final String RESERVED2 = ""; //$NON-NLS-1$
422        static final String RESERVED3 = ""; //$NON-NLS-1$
423
424        // name of column containing explanatory notes.
425        static final String REMARKS = "REMARKS"; //$NON-NLS-1$
426        static final String PROCEDURE_TYPE = "PROCEDURE_TYPE"; //$NON-NLS-1$
427        static final String SPECIFIC_NAME = "SPECIFIC_NAME"; //$NON-NLS-1$
428    }
429
430}