001: /*
002:
003: Derby - Class org.apache.derby.impl.sql.catalog.SYSCONSTRAINTSRowFactory
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.impl.sql.catalog;
023:
024: import org.apache.derby.iapi.types.RowLocation;
025:
026: import org.apache.derby.iapi.services.sanity.SanityManager;
027:
028: import org.apache.derby.iapi.types.TypeId;
029: import org.apache.derby.iapi.sql.dictionary.SystemColumn;
030: import org.apache.derby.catalog.TypeDescriptor;
031:
032: import org.apache.derby.iapi.types.DataValueDescriptor;
033:
034: import org.apache.derby.iapi.types.DataValueFactory;
035:
036: import org.apache.derby.iapi.sql.dictionary.CatalogRowFactory;
037: import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor;
038: import org.apache.derby.iapi.sql.dictionary.ConstraintDescriptor;
039: import org.apache.derby.iapi.sql.dictionary.DataDescriptorGenerator;
040: import org.apache.derby.iapi.sql.dictionary.DataDictionary;
041: import org.apache.derby.iapi.sql.dictionary.DataDictionaryContext;
042: import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor;
043: import org.apache.derby.iapi.sql.dictionary.SubCheckConstraintDescriptor;
044: import org.apache.derby.iapi.sql.dictionary.SubConstraintDescriptor;
045: import org.apache.derby.iapi.sql.dictionary.SubKeyConstraintDescriptor;
046: import org.apache.derby.iapi.sql.dictionary.TableDescriptor;
047: import org.apache.derby.iapi.sql.dictionary.TupleDescriptor;
048:
049: import org.apache.derby.iapi.services.uuid.UUIDFactory;
050: import org.apache.derby.catalog.UUID;
051:
052: import org.apache.derby.iapi.sql.execute.ExecIndexRow;
053: import org.apache.derby.iapi.sql.execute.ExecRow;
054: import org.apache.derby.iapi.sql.execute.ExecutionContext;
055: import org.apache.derby.iapi.sql.execute.ExecutionFactory;
056:
057: import org.apache.derby.iapi.error.StandardException;
058:
059: import org.apache.derby.catalog.IndexDescriptor;
060:
061: /**
062: * Factory for creating a SYSCONTRAINTS row.
063: *
064: * @author jerry
065: */
066:
067: public class SYSCONSTRAINTSRowFactory extends CatalogRowFactory {
068: private static final String TABLENAME_STRING = "SYSCONSTRAINTS";
069:
070: protected static final int SYSCONSTRAINTS_COLUMN_COUNT = 7;
071: protected static final int SYSCONSTRAINTS_CONSTRAINTID = 1;
072: protected static final int SYSCONSTRAINTS_TABLEID = 2;
073: protected static final int SYSCONSTRAINTS_CONSTRAINTNAME = 3;
074: protected static final int SYSCONSTRAINTS_TYPE = 4;
075: protected static final int SYSCONSTRAINTS_SCHEMAID = 5;
076: protected static final int SYSCONSTRAINTS_STATE = ConstraintDescriptor.SYSCONSTRAINTS_STATE_FIELD;
077: protected static final int SYSCONSTRAINTS_REFERENCECOUNT = 7;
078:
079: protected static final int SYSCONSTRAINTS_INDEX1_ID = 0;
080: protected static final int SYSCONSTRAINTS_INDEX2_ID = 1;
081: protected static final int SYSCONSTRAINTS_INDEX3_ID = 2;
082:
083: private static final boolean[] uniqueness = { true, true, false };
084:
085: private static final int[][] indexColumnPositions = {
086: { SYSCONSTRAINTS_CONSTRAINTID },
087: { SYSCONSTRAINTS_CONSTRAINTNAME, SYSCONSTRAINTS_SCHEMAID },
088: { SYSCONSTRAINTS_TABLEID } };
089:
090: private static final String[] uuids = {
091: "8000002f-00d0-fd77-3ed8-000a0a0b1900" // catalog UUID
092: , "80000036-00d0-fd77-3ed8-000a0a0b1900" // heap UUID
093: , "80000031-00d0-fd77-3ed8-000a0a0b1900" // SYSCONSTRAINTS_INDEX1
094: , "80000033-00d0-fd77-3ed8-000a0a0b1900" // SYSCONSTRAINTS_INDEX2
095: , "80000035-00d0-fd77-3ed8-000a0a0b1900" // SYSCONSTRAINTS_INDEX3
096: };
097:
098: /////////////////////////////////////////////////////////////////////////////
099: //
100: // CONSTRUCTORS
101: //
102: /////////////////////////////////////////////////////////////////////////////
103:
104: public SYSCONSTRAINTSRowFactory(UUIDFactory uuidf,
105: ExecutionFactory ef, DataValueFactory dvf,
106: boolean convertIdToLower) {
107: super (uuidf, ef, dvf, convertIdToLower);
108: initInfo(SYSCONSTRAINTS_COLUMN_COUNT, TABLENAME_STRING,
109: indexColumnPositions, uniqueness, uuids);
110: }
111:
112: /////////////////////////////////////////////////////////////////////////////
113: //
114: // METHODS
115: //
116: /////////////////////////////////////////////////////////////////////////////
117:
118: /**
119: * Make a SYSCONTRAINTS row
120: *
121: * @return Row suitable for inserting into SYSCONTRAINTS.
122: *
123: * @exception StandardException thrown on failure
124: */
125: public ExecRow makeRow(TupleDescriptor td, TupleDescriptor parent)
126: throws StandardException {
127: DataValueDescriptor col;
128: ExecRow row;
129: int constraintIType;
130: UUID oid;
131: String constraintSType = null;
132: String constraintID = null;
133: String tableID = null;
134: String constraintName = null;
135: String schemaID = null;
136: boolean isEnabled = true;
137: int referenceCount = 0;
138:
139: if (td != null) {
140: ConstraintDescriptor constraint = (ConstraintDescriptor) td;
141: /*
142: ** We only allocate a new UUID if the descriptor doesn't already have one.
143: ** For descriptors replicated from a Source system, we already have an UUID.
144: */
145: oid = constraint.getUUID();
146: constraintID = oid.toString();
147:
148: oid = constraint.getTableId();
149: tableID = oid.toString();
150:
151: constraintName = constraint.getConstraintName();
152:
153: constraintIType = constraint.getConstraintType();
154: switch (constraintIType) {
155: case DataDictionary.PRIMARYKEY_CONSTRAINT:
156: constraintSType = "P";
157: break;
158:
159: case DataDictionary.UNIQUE_CONSTRAINT:
160: constraintSType = "U";
161: break;
162:
163: case DataDictionary.CHECK_CONSTRAINT:
164: constraintSType = "C";
165: break;
166:
167: case DataDictionary.FOREIGNKEY_CONSTRAINT:
168: constraintSType = "F";
169: break;
170:
171: default:
172: if (SanityManager.DEBUG) {
173: SanityManager
174: .THROWASSERT("invalid constraint type");
175: }
176: }
177:
178: schemaID = constraint.getSchemaDescriptor().getUUID()
179: .toString();
180: isEnabled = constraint.isEnabled();
181: referenceCount = constraint.getReferenceCount();
182: }
183:
184: /* Insert info into sysconstraints */
185:
186: /* RESOLVE - It would be nice to require less knowledge about sysconstraints
187: * and have this be more table driven.
188: */
189:
190: /* Build the row to insert */
191: row = getExecutionFactory().getValueRow(
192: SYSCONSTRAINTS_COLUMN_COUNT);
193:
194: /* 1st column is CONSTRAINTID (UUID - char(36)) */
195: row.setColumn(SYSCONSTRAINTS_CONSTRAINTID, dvf
196: .getCharDataValue(constraintID));
197:
198: /* 2nd column is TABLEID (UUID - char(36)) */
199: row.setColumn(SYSCONSTRAINTS_TABLEID, dvf
200: .getCharDataValue(tableID));
201:
202: /* 3rd column is NAME (varchar(128)) */
203: row.setColumn(SYSCONSTRAINTS_CONSTRAINTNAME, dvf
204: .getVarcharDataValue(constraintName));
205:
206: /* 4th column is TYPE (char(1)) */
207: row.setColumn(SYSCONSTRAINTS_TYPE, dvf
208: .getCharDataValue(constraintSType));
209:
210: /* 5th column is SCHEMAID (UUID - char(36)) */
211: row.setColumn(SYSCONSTRAINTS_SCHEMAID, dvf
212: .getCharDataValue(schemaID));
213:
214: /* 6th column is STATE (char(1)) */
215: row.setColumn(SYSCONSTRAINTS_STATE, dvf
216: .getCharDataValue(isEnabled ? "E" : "D"));
217:
218: /* 7th column is REFERENCED */
219: row.setColumn(SYSCONSTRAINTS_REFERENCECOUNT, dvf
220: .getDataValue(referenceCount));
221:
222: return row;
223: }
224:
225: ///////////////////////////////////////////////////////////////////////////
226: //
227: // ABSTRACT METHODS TO BE IMPLEMENTED BY CHILDREN OF CatalogRowFactory
228: //
229: ///////////////////////////////////////////////////////////////////////////
230:
231: /**
232: * Make a ConstraintDescriptor out of a SYSCONSTRAINTS row
233: *
234: * @param row a SYSCONSTRAINTS row
235: * @param parentTupleDescriptor Subconstraint descriptor with auxiliary info.
236: * @param dd dataDictionary
237: *
238: * @exception StandardException thrown on failure
239: */
240: public TupleDescriptor buildDescriptor(ExecRow row,
241: TupleDescriptor parentTupleDescriptor, DataDictionary dd)
242: throws StandardException {
243: ConstraintDescriptor constraintDesc = null;
244:
245: if (SanityManager.DEBUG) {
246: SanityManager.ASSERT(
247: row.nColumns() == SYSCONSTRAINTS_COLUMN_COUNT,
248: "Wrong number of columns for a SYSCONSTRAINTS row");
249: }
250:
251: DataValueDescriptor col;
252: ConglomerateDescriptor conglomDesc;
253: DataDescriptorGenerator ddg;
254: TableDescriptor td = null;
255: int constraintIType = -1;
256: int[] keyColumns = null;
257: UUID constraintUUID;
258: UUID schemaUUID;
259: UUID tableUUID;
260: UUID referencedConstraintId = null;
261: SchemaDescriptor schema;
262: String tableUUIDString;
263: String constraintName;
264: String constraintSType;
265: String constraintStateStr;
266: boolean constraintEnabled;
267: int referenceCount;
268: String constraintUUIDString;
269: String schemaUUIDString;
270: SubConstraintDescriptor scd;
271:
272: if (SanityManager.DEBUG) {
273: if (!(parentTupleDescriptor instanceof SubConstraintDescriptor)) {
274: SanityManager
275: .THROWASSERT("parentTupleDescriptor expected to be instanceof "
276: + "SubConstraintDescriptor, not "
277: + parentTupleDescriptor.getClass()
278: .getName());
279: }
280: }
281:
282: scd = (SubConstraintDescriptor) parentTupleDescriptor;
283:
284: ddg = dd.getDataDescriptorGenerator();
285:
286: /* 1st column is CONSTRAINTID (UUID - char(36)) */
287: col = row.getColumn(SYSCONSTRAINTS_CONSTRAINTID);
288: constraintUUIDString = col.getString();
289: constraintUUID = getUUIDFactory().recreateUUID(
290: constraintUUIDString);
291:
292: /* 2nd column is TABLEID (UUID - char(36)) */
293: col = row.getColumn(SYSCONSTRAINTS_TABLEID);
294: tableUUIDString = col.getString();
295: tableUUID = getUUIDFactory().recreateUUID(tableUUIDString);
296:
297: /* Get the TableDescriptor.
298: * It may be cached in the SCD,
299: * otherwise we need to go to the
300: * DD.
301: */
302: if (scd != null) {
303: td = scd.getTableDescriptor();
304: }
305: if (td == null) {
306: td = dd.getTableDescriptor(tableUUID);
307: }
308:
309: /* 3rd column is NAME (varchar(128)) */
310: col = row.getColumn(SYSCONSTRAINTS_CONSTRAINTNAME);
311: constraintName = col.getString();
312:
313: /* 4th column is TYPE (char(1)) */
314: col = row.getColumn(SYSCONSTRAINTS_TYPE);
315: constraintSType = col.getString();
316: if (SanityManager.DEBUG) {
317: SanityManager.ASSERT(constraintSType.length() == 1,
318: "Fourth column type incorrect");
319: }
320:
321: boolean typeSet = false;
322: switch (constraintSType.charAt(0)) {
323: case 'P':
324: constraintIType = DataDictionary.PRIMARYKEY_CONSTRAINT;
325: typeSet = true;
326: // fall through
327:
328: case 'U':
329: if (!typeSet) {
330: constraintIType = DataDictionary.UNIQUE_CONSTRAINT;
331: typeSet = true;
332: }
333: // fall through
334:
335: case 'F':
336: if (!typeSet)
337: constraintIType = DataDictionary.FOREIGNKEY_CONSTRAINT;
338: if (SanityManager.DEBUG) {
339: if (!(parentTupleDescriptor instanceof SubKeyConstraintDescriptor)) {
340: SanityManager
341: .THROWASSERT("parentTupleDescriptor expected to be instanceof "
342: + "SubKeyConstraintDescriptor, not "
343: + parentTupleDescriptor.getClass()
344: .getName());
345: }
346: }
347: conglomDesc = td
348: .getConglomerateDescriptor(((SubKeyConstraintDescriptor) parentTupleDescriptor)
349: .getIndexId());
350: /* Take care the rare case of conglomDesc being null. The
351: * reason is that our "td" is out of date. Another thread
352: * which was adding a constraint committed between the moment
353: * we got the table descriptor (conglomerate list) and the
354: * moment we scanned and got the constraint desc list. Since
355: * that thread just added a new row to SYSCONGLOMERATES,
356: * SYSCONSTRAINTS, etc. We wouldn't have wanted to lock the
357: * system tables just to prevent other threads from adding new
358: * rows.
359: */
360: if (conglomDesc == null) {
361: // we can't be getting td from cache because if we are
362: // here, we must have been in dd's ddl mode (that's why
363: // the ddl thread went through), we are not done yet, the
364: // dd ref count is not 0, hence it couldn't have turned
365: // into COMPILE_ONLY mode
366: td = dd.getTableDescriptor(tableUUID);
367: if (scd != null)
368: scd.setTableDescriptor(td);
369: // try again now
370: conglomDesc = td
371: .getConglomerateDescriptor(((SubKeyConstraintDescriptor) parentTupleDescriptor)
372: .getIndexId());
373: }
374:
375: if (SanityManager.DEBUG) {
376: SanityManager
377: .ASSERT(conglomDesc != null,
378: "conglomDesc is expected to be non-null for backing index");
379: }
380: keyColumns = conglomDesc.getIndexDescriptor()
381: .baseColumnPositions();
382: referencedConstraintId = ((SubKeyConstraintDescriptor) parentTupleDescriptor)
383: .getKeyConstraintId();
384: keyColumns = conglomDesc.getIndexDescriptor()
385: .baseColumnPositions();
386: break;
387:
388: case 'C':
389: constraintIType = DataDictionary.CHECK_CONSTRAINT;
390: if (SanityManager.DEBUG) {
391: if (!(parentTupleDescriptor instanceof SubCheckConstraintDescriptor)) {
392: SanityManager
393: .THROWASSERT("parentTupleDescriptor expected to be instanceof "
394: + "SubCheckConstraintDescriptor, not "
395: + parentTupleDescriptor.getClass()
396: .getName());
397: }
398: }
399: break;
400:
401: default:
402: if (SanityManager.DEBUG) {
403: SanityManager
404: .THROWASSERT("Fourth column value invalid");
405: }
406: }
407:
408: /* 5th column is SCHEMAID (UUID - char(36)) */
409: col = row.getColumn(SYSCONSTRAINTS_SCHEMAID);
410: schemaUUIDString = col.getString();
411: schemaUUID = getUUIDFactory().recreateUUID(schemaUUIDString);
412:
413: schema = dd.getSchemaDescriptor(schemaUUID, null);
414:
415: /* 6th column is STATE (char(1)) */
416: col = row.getColumn(SYSCONSTRAINTS_STATE);
417: constraintStateStr = col.getString();
418: if (SanityManager.DEBUG) {
419: SanityManager.ASSERT(constraintStateStr.length() == 1,
420: "Sixth column (state) type incorrect");
421: }
422:
423: switch (constraintStateStr.charAt(0)) {
424: case 'E':
425: constraintEnabled = true;
426: break;
427: case 'D':
428: constraintEnabled = false;
429: break;
430: default:
431: constraintEnabled = true;
432: if (SanityManager.DEBUG) {
433: SanityManager.THROWASSERT("Invalidate state value '"
434: + constraintStateStr + "' for constraint");
435: }
436: }
437:
438: /* 7th column is REFERENCECOUNT, boolean */
439: col = row.getColumn(SYSCONSTRAINTS_REFERENCECOUNT);
440: referenceCount = col.getInt();
441:
442: /* now build and return the descriptor */
443:
444: switch (constraintIType) {
445: case DataDictionary.PRIMARYKEY_CONSTRAINT:
446: constraintDesc = ddg
447: .newPrimaryKeyConstraintDescriptor(
448: td,
449: constraintName,
450: false, //deferable,
451: false, //initiallyDeferred,
452: keyColumns,//genReferencedColumns(dd, td), //int referencedColumns[],
453: constraintUUID,
454: ((SubKeyConstraintDescriptor) parentTupleDescriptor)
455: .getIndexId(), schema,
456: constraintEnabled, referenceCount);
457: break;
458:
459: case DataDictionary.UNIQUE_CONSTRAINT:
460: constraintDesc = ddg
461: .newUniqueConstraintDescriptor(
462: td,
463: constraintName,
464: false, //deferable,
465: false, //initiallyDeferred,
466: keyColumns,//genReferencedColumns(dd, td), //int referencedColumns[],
467: constraintUUID,
468: ((SubKeyConstraintDescriptor) parentTupleDescriptor)
469: .getIndexId(), schema,
470: constraintEnabled, referenceCount);
471: break;
472:
473: case DataDictionary.FOREIGNKEY_CONSTRAINT:
474: if (SanityManager.DEBUG) {
475: SanityManager
476: .ASSERT(referenceCount == 0,
477: "REFERENCECOUNT column is nonzero for fk constraint");
478: }
479:
480: constraintDesc = ddg
481: .newForeignKeyConstraintDescriptor(
482: td,
483: constraintName,
484: false, //deferable,
485: false, //initiallyDeferred,
486: keyColumns,//genReferencedColumns(dd, td), //int referencedColumns[],
487: constraintUUID,
488: ((SubKeyConstraintDescriptor) parentTupleDescriptor)
489: .getIndexId(),
490: schema,
491: referencedConstraintId,
492: constraintEnabled,
493: ((SubKeyConstraintDescriptor) parentTupleDescriptor)
494: .getRaDeleteRule(),
495: ((SubKeyConstraintDescriptor) parentTupleDescriptor)
496: .getRaUpdateRule());
497: break;
498:
499: case DataDictionary.CHECK_CONSTRAINT:
500: if (SanityManager.DEBUG) {
501: SanityManager
502: .ASSERT(referenceCount == 0,
503: "REFERENCECOUNT column is nonzero for check constraint");
504: }
505:
506: constraintDesc = ddg
507: .newCheckConstraintDescriptor(
508: td,
509: constraintName,
510: false, //deferable,
511: false, //initiallyDeferred,
512: constraintUUID,
513: ((SubCheckConstraintDescriptor) parentTupleDescriptor)
514: .getConstraintText(),
515: ((SubCheckConstraintDescriptor) parentTupleDescriptor)
516: .getReferencedColumnsDescriptor(),
517: schema, constraintEnabled);
518: break;
519: }
520: return constraintDesc;
521: }
522:
523: /**
524: * Get the constraint ID of the row.
525: *
526: * @param row The row from sysconstraints
527: *
528: * @return UUID The constraint id
529: *
530: * @exception StandardException thrown on failure
531: */
532: protected UUID getConstraintId(ExecRow row)
533: throws StandardException {
534: DataValueDescriptor col;
535: String constraintUUIDString;
536:
537: /* 1st column is CONSTRAINTID (UUID - char(36)) */
538: col = row.getColumn(SYSCONSTRAINTS_CONSTRAINTID);
539: constraintUUIDString = col.getString();
540: return getUUIDFactory().recreateUUID(constraintUUIDString);
541: }
542:
543: /**
544: * Get the constraint name of the row.
545: *
546: * @param row The row from sysconstraints
547: *
548: * @return UUID The constraint name
549: *
550: * @exception StandardException thrown on failure
551: */
552: protected String getConstraintName(ExecRow row)
553: throws StandardException {
554: DataValueDescriptor col;
555: String constraintName;
556:
557: /* 3rd column is CONSTRAINTNAME (char(128)) */
558: col = row.getColumn(SYSCONSTRAINTS_CONSTRAINTNAME);
559: constraintName = col.getString();
560: return constraintName;
561: }
562:
563: /**
564: * Get the schema ID of the row.
565: *
566: * @param row The row from sysconstraints
567: *
568: * @return UUID The schema
569: *
570: * @exception StandardException thrown on failure
571: */
572: protected UUID getSchemaId(ExecRow row) throws StandardException {
573: DataValueDescriptor col;
574: String schemaUUIDString;
575:
576: /* 5th column is SCHEMAID (UUID - char(36)) */
577: col = row.getColumn(SYSCONSTRAINTS_SCHEMAID);
578: schemaUUIDString = col.getString();
579: return getUUIDFactory().recreateUUID(schemaUUIDString);
580: }
581:
582: /**
583: * Get the table ID of the row.
584: *
585: * @param row The row from sysconstraints
586: *
587: * @return UUID The table id
588: *
589: * @exception StandardException thrown on failure
590: */
591: protected UUID getTableId(ExecRow row) throws StandardException {
592: DataValueDescriptor col;
593: String tableUUIDString;
594:
595: /* 2nd column is TABLEID (UUID - char(36)) */
596: col = row.getColumn(SYSCONSTRAINTS_TABLEID);
597: tableUUIDString = col.getString();
598: return getUUIDFactory().recreateUUID(tableUUIDString);
599: }
600:
601: /**
602: * Get the constraint type out of the row.
603: *
604: * @param row The row from sysconstraints
605: *
606: * @return int The constraint type as an int
607: *
608: * @exception StandardException thrown on failure
609: */
610: protected int getConstraintType(ExecRow row)
611: throws StandardException {
612: DataValueDescriptor col;
613: int constraintIType;
614: String constraintSType;
615:
616: /* 4th column is TYPE (char(1)) */
617: col = row.getColumn(SYSCONSTRAINTS_TYPE);
618: constraintSType = col.getString();
619: if (SanityManager.DEBUG) {
620: SanityManager.ASSERT(constraintSType.length() == 1,
621: "Fourth column type incorrect");
622: }
623:
624: switch (constraintSType.charAt(0)) {
625: case 'P':
626: constraintIType = DataDictionary.PRIMARYKEY_CONSTRAINT;
627: break;
628:
629: case 'U':
630: constraintIType = DataDictionary.UNIQUE_CONSTRAINT;
631: break;
632:
633: case 'C':
634: constraintIType = DataDictionary.CHECK_CONSTRAINT;
635: break;
636:
637: case 'F':
638: constraintIType = DataDictionary.FOREIGNKEY_CONSTRAINT;
639: break;
640:
641: default:
642: if (SanityManager.DEBUG) {
643: SanityManager
644: .THROWASSERT("Fourth column value invalid");
645: }
646: constraintIType = -1;
647: }
648:
649: return constraintIType;
650: }
651:
652: /**
653: * Builds a list of columns suitable for creating this Catalog.
654: *
655: *
656: * @return array of SystemColumn suitable for making this catalog.
657: */
658: public SystemColumn[] buildColumnList() {
659: int index = 0;
660: SystemColumn[] columnList = new SystemColumn[SYSCONSTRAINTS_COLUMN_COUNT];
661:
662: // describe columns
663:
664: columnList[index++] = new SystemColumnImpl(
665: convertIdCase("CONSTRAINTID"), // column name
666: SYSCONSTRAINTS_CONSTRAINTID, // column number
667: 0, // precision
668: 0, // scale
669: false, // nullability
670: "CHAR", // dataType
671: true, // built-in type
672: 36 // maxLength
673: );
674:
675: columnList[index++] = new SystemColumnImpl(
676: convertIdCase("TABLEID"), // column name
677: SYSCONSTRAINTS_TABLEID, // column number
678: 0, // precision
679: 0, // scale
680: false, // nullability
681: "CHAR", // dataType
682: true, // built-in type
683: 36 // maxLength
684: );
685:
686: columnList[index++] = new SystemColumnImpl( // SQL IDENTIFIER
687: convertIdCase("CONSTRAINTNAME"), // column name
688: SYSCONSTRAINTS_CONSTRAINTNAME, false // nullability
689: );
690:
691: columnList[index++] = new SystemColumnImpl(
692: convertIdCase("TYPE"), // column name
693: SYSCONSTRAINTS_TYPE, // column number
694: 0, // precision
695: 0, // scale
696: false, // nullability
697: "CHAR", // dataType
698: true, // built-in type
699: 1 // maxLength
700: );
701:
702: columnList[index++] = new SystemColumnImpl(
703: convertIdCase("SCHEMAID"), // column name
704: SYSCONSTRAINTS_SCHEMAID, // column number
705: 0, // precision
706: 0, // scale
707: false, // nullability
708: "CHAR", // dataType
709: true, // built-in type
710: 36 // maxLength
711: );
712:
713: columnList[index++] = new SystemColumnImpl(
714: convertIdCase("STATE"), // column name
715: SYSCONSTRAINTS_STATE, // column number
716: 0, // precision
717: 0, // scale
718: false, // nullability
719: "CHAR", // dataType
720: true, // built-in type
721: 1 // maxLength
722: );
723:
724: columnList[index++] = new SystemColumnImpl(
725: convertIdCase("REFERENCECOUNT"), // column name
726: SYSCONSTRAINTS_REFERENCECOUNT, // column number
727: 0, // precision
728: 0, // scale
729: false, // nullability
730: "INTEGER", // dataType
731: true, // built-in type
732: 1 // maxLength
733: );
734: return columnList;
735: }
736:
737: }
|