1 package com.daffodilwoods.daffodildb.server.datadictionarysystem; 2 3 import java.text.*; 4 5 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 6 import com.daffodilwoods.database.general.*; 7 import com.daffodilwoods.database.resource.*; 8 import com.daffodilwoods.daffodildb.server.datadictionarysystem.ColumnCharacteristics.ColumnProperties; 9 10 18 19 public class SelectedColumnCharacteristics implements _ColumnCharacteristics, Datatype { 20 private ColumnProperties[] columnPropertiesArray; 21 private QualifiedIdentifier tableName; 22 private int columnCount = 0; 23 24 public SelectedColumnCharacteristics(ColumnProperties[] columnProperties, QualifiedIdentifier tableName0) { 25 columnPropertiesArray = columnProperties; 26 columnCount = columnProperties.length; 27 tableName = tableName0; 28 } 29 30 public int getColumnType(int index) throws DException { 31 return columnPropertiesArray[index - 1].type; 32 } 33 34 public int getColumnIndex(String columnName) throws DException { 35 for (int i = 0; i < columnPropertiesArray.length; i++) { 36 if (columnPropertiesArray[i].columnName.equalsIgnoreCase(columnName)) 37 return i + 1; 38 } 39 throw new DException("DSE508", new Object [] {columnName}); 40 41 } 42 43 public String getColumnName(int index) throws DException { 44 try { 45 return columnPropertiesArray[index - 1].columnName; 46 } catch (ArrayIndexOutOfBoundsException e) { 47 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (index), tableName.getIdentifier()}); 48 } 49 50 } 51 52 public String getRelatedTable(int columnIndex) throws DatabaseException, DException { 53 return columnPropertiesArray[columnIndex - 1].relatedTable; 54 } 55 56 public int getColumnCount() throws DException { 57 return columnCount; 58 } 59 60 public String [] getColumnNames() throws DException { 61 String [] columnNames = new String [columnCount]; 62 for (int i = 0; i < columnCount; i++) 63 columnNames[i] = columnPropertiesArray[i].columnName; 64 return columnNames; 65 } 66 67 public int getSize(int columnIndex) throws DException { 68 return columnPropertiesArray[columnIndex - 1].size; 69 } 70 71 public String [] getPrimaryKeys() throws DatabaseException, DException { 72 throw new java.lang.UnsupportedOperationException ("Method getPrimaryKeys() not yet implemented."); 73 } 74 75 public String getRelation(int columnIndex) throws DatabaseException, DException { 76 return columnPropertiesArray[columnIndex - 1].relation; 77 } 78 79 public int[] getColumnIndexes(String [] columnNames) throws DException { 80 if (columnNames == null) 81 throw new IllegalColumnException("DSE749", (Object [])null); 82 int len = columnNames.length; 83 int[] columnIndexes = new int[len]; 84 for (int i = 0; i < len; i++) 85 columnIndexes[i] = getColumnIndex(columnNames[i]); 86 return columnIndexes; 87 } 88 89 public int[] getPrimaryConditionColumns() throws DException { 90 throw new java.lang.UnsupportedOperationException ("Method getPrimaryConditionColumns() not yet implemented."); 91 } 92 93 public String getTableName(int columnIndex) throws DatabaseException, DException { 94 return columnPropertiesArray[columnIndex - 1].tableName; 95 } 96 97 public short getTableType() throws DException { 98 throw new java.lang.UnsupportedOperationException ("Method getTableType() not yet implemented."); 99 } 100 101 public int getPrecision(int columnIndex) throws DException { 102 return columnPropertiesArray[columnIndex - 1].precision; 103 } 104 105 public int getScale(int columnIndex) throws DException { 106 return columnPropertiesArray[columnIndex - 1].decimal; 107 } 108 109 public String getSchemaName(int columnIndex) throws DException { 110 return columnPropertiesArray[columnIndex - 1].schemaName; 111 } 112 113 public String getCatalogName(int columnIndex) throws DException { 114 return columnPropertiesArray[columnIndex - 1].catalogName; 115 } 116 117 public int isNullable(int columnIndex) throws DException { 118 return columnPropertiesArray[columnIndex - 1].isNullable; 119 } 120 121 public boolean isAutoIncrement(int columnIndex) throws DException { 122 return columnPropertiesArray[columnIndex - 1].isAutoIncrement; 123 } 124 125 public String getColumnLabel(int columnIndex) throws DException { 126 return columnPropertiesArray[columnIndex - 1].columnLabel; 127 } 128 129 public String getQualifiedTableName(int columnIndex) throws DException { 130 return columnPropertiesArray[columnIndex - 1].QualifiedTableName.getIdentifier(); 131 } 132 133 public String [] getRelatedColumns(int columnIndex) throws DatabaseException, DException { 134 return columnPropertiesArray[columnIndex - 1].relatedColumns; 135 } 136 137 public Collator getCollator() throws DException { 138 throw new UnsupportedOperationException ("Method not yet implemented"); 139 } 140 141 public _ColumnCharacteristics getCCFromIndexes(_ColumnCharacteristics cc, int offset, int[] columnIndexes) throws DException { 142 throw new UnsupportedOperationException ("getCCFromIndexes(cc, offset, columnIndexes) method not implemented yet"); 143 } 144 } 145 | Popular Tags |