1 package com.daffodilwoods.daffodildb.server.datadictionarysystem; 2 3 import java.io.*; 4 import java.text.*; 5 import java.util.*; 6 7 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 8 import com.daffodilwoods.daffodildb.server.sql99.*; 9 import com.daffodilwoods.daffodildb.server.sql99.common.*; 10 import com.daffodilwoods.daffodildb.server.sql99.ddl.descriptors.*; 11 import com.daffodilwoods.daffodildb.server.sql99.ddl.utility.*; 12 import com.daffodilwoods.daffodildb.server.sql99.dql.iterator.*; 13 import com.daffodilwoods.daffodildb.utils.*; 14 22 import com.daffodilwoods.database.general.*; 23 import com.daffodilwoods.database.resource.*; 24 import com.daffodilwoods.database.utility.*; 25 26 public class ColumnCharacteristics implements _ColumnCharacteristics, Datatype { 27 28 private PreparedStatementGetter preparedStatementGetter; 29 30 private QualifiedIdentifier tableName; 31 32 private int columnCount = 0; 33 34 private ColumnProperties[] columnPropertiesArray; 35 36 37 private TreeMap columnIndexesMap; 38 39 private boolean searchedPrimaryKey; 40 private String [] primaryKeys; 41 private int[] primaryKeyIndexes; 42 43 private String table_Catalog; 44 private String table_Schema; 45 private String table_Name; 46 private short tableType; 47 private Collator collator; 48 49 private String country; 50 private String language; 51 52 public ColumnCharacteristics(QualifiedIdentifier tableName, PreparedStatementGetter preparedStatementGetter0, boolean addSystemFields) throws InitializeException, DException { 53 this.tableName = tableName; 54 preparedStatementGetter = preparedStatementGetter0; 55 setColumnProperties(addSystemFields); 56 } 57 58 61 public int getColumnIndex(String columnName) throws DException { 62 if (columnName == null) 63 throw new IllegalColumnException("DSE3514", new String [] {columnName, tableName.getIdentifier()}); 64 Integer index = (Integer ) columnIndexesMap.get(columnName); 65 if (index == null) { 66 int dotIndex = columnName.lastIndexOf('.'); 67 if (dotIndex != -1) 68 columnName = columnName.substring(dotIndex + 1); 69 index = (Integer ) columnIndexesMap.get(columnName); 70 if (index == null) 71 throw new IllegalColumnException("DSE3514", new String [] {columnName, tableName.getIdentifier()}); 72 else 73 return index.hashCode(); 74 } 75 return index.hashCode(); 76 } 77 78 public int[] getColumnIndexes(String [] columnNames) throws DException { 79 if (columnNames == null) 80 throw new IllegalColumnException("DSE749", (Object [])null); 81 int len = columnNames.length; 82 int[] columnIndexes = new int[len]; 83 for (int i = 0; i < len; i++) 84 columnIndexes[i] = getColumnIndex(columnNames[i]); 85 return columnIndexes; 86 } 87 88 91 public String [] getColumnNames() throws DException { 92 String [] columnNames = new String [columnCount]; 93 for (int i = 0; i < columnCount; i++) 94 columnNames[i] = columnPropertiesArray[i].columnName; 95 return columnNames; 96 } 97 98 102 public String getColumnName(int columnIndex) throws DException { 103 try { 104 return columnPropertiesArray[columnIndex].columnName; 105 } catch (ArrayIndexOutOfBoundsException e) { 106 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 107 } 108 } 109 110 113 public int getColumnCount() throws DException { 114 return columnCount; 115 } 116 117 120 121 124 public int getSize(int columnIndex) throws DException { 125 try { 126 return columnPropertiesArray[columnIndex].size; 127 } catch (ArrayIndexOutOfBoundsException e) { 128 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 129 } 130 } 131 132 135 public int getColumnType(int columnIndex) throws DException { 136 try { 137 return columnPropertiesArray[columnIndex].type; 138 } catch (ArrayIndexOutOfBoundsException e) { 139 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 140 } 141 } 142 143 146 public int getPrecision(int columnIndex) throws DException { 147 try { 148 return columnPropertiesArray[columnIndex].precision; 149 } catch (ArrayIndexOutOfBoundsException e) { 150 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 151 } 152 } 153 154 158 public String getRelatedTable(int columnIndex) throws DException { 159 ColumnProperties columnProperties = columnPropertiesArray[columnIndex]; 160 String columnName = columnProperties.columnName; 161 if (columnProperties.relatedTable == null || ! (columnProperties.relatedTable.equals("?"))) 162 return columnProperties.relatedTable; 163 _SelectQueryIterator iterator = getIterator(preparedStatementGetter.getTablesForeignConstriaintExecuter(), 164 getParametersToGetRelatedTable(tableName, columnName)); 165 setRelatedTable(columnProperties, iterator); 166 return columnProperties.relatedTable; 167 } 168 169 public String getRelation(int columnIndex) throws DException { 170 ColumnProperties columnProperties = columnPropertiesArray[columnIndex]; 171 if (columnProperties.relation == null || ! (columnProperties.relation.equals("?"))) 172 return columnProperties.relation; 173 String referencedTable = getRelatedTable(columnIndex); 174 return columnProperties.relation; 175 } 176 177 public String [] getRelatedColumns(int columnIndex) throws DException { 178 ColumnProperties columnProperties = columnPropertiesArray[columnIndex]; 179 if (columnProperties.relation == null || ! (columnProperties.relation.equals("?"))) 180 return columnProperties.relatedColumns; 181 String referencedTable = getRelatedTable(columnIndex); 182 return columnProperties.relatedColumns; 183 } 184 185 public String [] getPrimaryKeys() throws DException { 186 if (!searchedPrimaryKey) 187 setPrimaryKeys(); 188 return primaryKeys; 189 } 190 191 public void setPrimaryKeys() throws DException { 192 primaryKeys = new String [] {SystemFields.systemFields[SystemFields.rowId]}; 193 194 searchedPrimaryKey = true; 195 196 try { 197 _SelectQueryIterator iterator = getIterator(preparedStatementGetter.getPrimaryKeysExecuter(), breakTableName(tableName)); 198 199 ArrayList primaryKeysList = new ArrayList(); 200 if (iterator.first()) { 201 do { 202 Object [] values = (Object []) iterator.getObject(); 203 primaryKeysList.add(values[0]); 204 } while (iterator.next()); 205 primaryKeys = (String []) primaryKeysList.toArray(new String [0]); 206 } else { 207 primaryKeys = new String [] {SystemFields.systemFields[SystemFields.rowId], }; 208 } 209 } catch (Exception e) { 210 e.printStackTrace(); 211 212 primaryKeys = new String [] {SystemFields.systemFields[SystemFields.rowId]}; 213 } 214 } 215 216 public int[] getPrimaryConditionColumns() throws DException { 217 if (primaryKeyIndexes == null) { 218 getPrimaryKeys(); 219 primaryKeyIndexes = getColumnIndexes(primaryKeys); 220 } 221 return primaryKeyIndexes; 222 } 223 224 private void setRelatedTable(ColumnProperties columnProperties, _SelectQueryIterator iterator) throws DException { 225 try { 226 Object [] values = null; 227 if (iterator.first()) { 228 Object [] constraintvalues = (Object []) iterator.getObject(); 229 int ordinalPosition = constraintvalues[3].hashCode(); 230 _SelectQueryIterator relatedIterator = getIterator(preparedStatementGetter.getrelatedTableAndColumnExecuter(), 231 new Object [] {constraintvalues[0], constraintvalues[1], constraintvalues[2]}); 232 int index = 1; 233 relatedIterator.first(); 234 do { 235 if (index == ordinalPosition) { 236 values = (Object []) relatedIterator.getObject(); 237 } 238 index++; 239 } while (relatedIterator.next()); 240 241 } 242 columnProperties.relatedTable = values == null ? null : values[0] + "." 243 + values[1] + "." + values[2]; 244 columnProperties.relation = values == null ? null : values[3] + " = ?"; 245 columnProperties.relatedColumns = values == null ? null : new String [] { (String ) values[3]}; 246 } catch (Exception e) { 247 e.printStackTrace(); 248 } 249 } 250 251 private Object [] getParametersToGetRelatedTable(QualifiedIdentifier tableName, String columnName) throws DException { 252 Object [] parameters = new Object [4]; 253 parameters[0] = tableName.catalog; 254 parameters[1] = tableName.schema; 255 parameters[2] = tableName.name; 256 parameters[3] = columnName; 257 return parameters; 258 } 259 260 private String [] breakTableName(QualifiedIdentifier tableName) throws DException { 261 String [] breakedTableName = new String [3]; 262 breakedTableName[0] = tableName.catalog; 263 breakedTableName[1] = tableName.schema; 264 breakedTableName[2] = tableName.name; 265 return breakedTableName; 266 } 267 268 private void setColumnProperties(boolean addSystemFields) throws InitializeException, DException { 269 columnIndexesMap = new TreeMap(String.CASE_INSENSITIVE_ORDER); 270 271 ColumnProperties[] systemFieldsProperties = addSystemFields ? getSystemFieldsProperties() 272 : null; 273 int startIndex = addSystemFields ? systemFieldsProperties.length : 0; 274 ColumnProperties[] properties = isSystemTable() ? getSystemTablesColumnProperties() 275 : getColumnProperties(); 276 if (systemFieldsProperties == null) 277 columnPropertiesArray = properties; 278 else if (tableType == TypeConstants.VIEW) { 279 columnPropertiesArray = properties; 280 columnCount = columnCount - startIndex; 281 } else { 282 int propertiesLen = properties.length; 283 boolean isrowIdColumn = false; 284 ArrayList propertiesList = new ArrayList(); 285 for (int i = 0; i < propertiesLen; i++) { 286 isrowIdColumn = properties[i].columnName.equalsIgnoreCase(SystemFields.systemFields[SystemFields.rowId]); 287 if (isrowIdColumn) { 288 systemFieldsProperties[0] = properties[i]; 289 columnCount--; 290 } else 291 propertiesList.add(properties[i]); 292 } 293 properties = (ColumnProperties[]) propertiesList.toArray(new ColumnProperties[0]); 294 propertiesLen = propertiesList.size(); 295 columnPropertiesArray = new ColumnProperties[columnCount]; 296 System.arraycopy(systemFieldsProperties, 0, columnPropertiesArray, 0, startIndex); 297 System.arraycopy(properties, 0, columnPropertiesArray, startIndex, propertiesLen); 298 } 299 for (int c = 0; c < columnCount; c++) 300 columnIndexesMap.put(columnPropertiesArray[c].columnName, new Integer (c)); 301 if (primaryKeys != null) { 302 searchedPrimaryKey = true; 303 } 304 } 305 306 private ColumnProperties[] getSystemFieldsProperties() throws DException { 307 Object [][] systemFields = CharacteristicsConstants.systemFieldsProperties; 308 int noOfSystemFields = systemFields.length; 309 ColumnProperties[] systemFieldsProperties = new ColumnProperties[noOfSystemFields]; 310 for (int i = 0; i < noOfSystemFields; i++) { 311 systemFieldsProperties[i] = new ColumnProperties(); 312 systemFieldsProperties[i].columnName = (String ) systemFields[i][0]; 313 systemFieldsProperties[i].type = systemFields[i][1].hashCode(); 314 systemFieldsProperties[i].size = systemFields[i][2].hashCode(); 315 systemFieldsProperties[i].precision = systemFields[i][3].hashCode(); 316 columnCount++; 317 } 318 return systemFieldsProperties; 319 } 320 321 private ColumnProperties[] getSystemTablesColumnProperties() throws DException { 322 Object [][] systemTablesColumns = SystemTablesCreator.getTableStructure(tableName); 323 return getSystemTableColumnsProperties(systemTablesColumns); 324 } 325 326 private ColumnProperties[] getSystemTableColumnsProperties(Object [][] systemTablesColumns) throws DException { 327 int noOfColumns = systemTablesColumns.length; 328 ColumnProperties[] systemTablesProperties = new ColumnProperties[noOfColumns]; 329 for (int i = 0; i < noOfColumns; i++) { 330 systemTablesProperties[i] = new ColumnProperties(); 331 systemTablesProperties[i].columnName = (String ) systemTablesColumns[i][0]; 332 systemTablesProperties[i].type = systemTablesColumns[i][1].hashCode(); 333 int byteSize = systemTablesColumns[i][2].hashCode(); 334 systemTablesProperties[i].precision = ColumnCharacteristicsUtilities.getPrecision(systemTablesProperties[i].type, byteSize); 335 boolean fixed = ( (Boolean ) systemTablesColumns[i][3]).booleanValue(); 336 systemTablesProperties[i].size = byteSize; systemTablesProperties[i].domainCatalog = (String ) systemTablesColumns[i][4]; 338 systemTablesProperties[i].domainSchema = (String ) systemTablesColumns[i][5]; 339 systemTablesProperties[i].domainName = (String ) systemTablesColumns[i][6]; 340 columnCount++; 341 } 342 tableType = TypeConstants.TABLE; 343 collator = null; primaryKeys = SystemTablesCreator.getPrimaryKeys(tableName); 345 return systemTablesProperties; 346 } 347 348 private ColumnProperties[] getColumnProperties() throws DException { 349 String [] breakedTableName = breakTableName(tableName); 350 _SelectQueryIterator columnIterator = getIterator(preparedStatementGetter.getcolumnExecuter(), breakedTableName); 351 if (!columnIterator.first()) { 352 throw new DException("DSE959", new Object [] {tableName.getIdentifier()}); 353 } 354 ArrayList propertiesList = new ArrayList(10); 355 TreeMap identifierList = new TreeMap(String.CASE_INSENSITIVE_ORDER); 356 Object [] record = null; 357 do { 358 ColumnProperties columnProperties = new ColumnProperties(); 359 record = (Object []) columnIterator.getObject(); 360 361 identifierList.put(record[SystemTablesFields.columns_dtd_identifier], 362 record[SystemTablesFields.columns_ordinal_position]); 363 364 columnProperties.columnName = (String ) record[SystemTablesFields.columns_column_name]; 365 columnProperties.isNullable = ( (String ) record[SystemTablesFields.columns_is_nullable]).equalsIgnoreCase("YES") ? 1 : 0; 366 columnProperties.domainCatalog = (String ) record[SystemTablesFields.columns_domain_catalog]; 367 columnProperties.isAutoIncrement = ( (String ) record[SystemTablesFields.columns_is_autoIncrement]).equalsIgnoreCase("YES"); 368 columnProperties.domainSchema = (String ) record[SystemTablesFields.columns_domain_schema]; 369 columnProperties.domainName = (String ) record[SystemTablesFields.columns_domain_name]; 370 columnCount++; 371 propertiesList.add(columnProperties); 372 } while (columnIterator.next()); 373 _SelectQueryIterator iterator = getIterator(preparedStatementGetter.getDataTypeExecuter(), breakedTableName); 374 if (iterator.first()) { 375 do { 376 Object [] values = (Object []) iterator.getObject(); 377 String identifier = (String ) values[SystemTablesFields.data_type_descriptor_dtd_identifier]; 378 int columnIndex = identifierList.get(identifier).hashCode() - 1; 379 ColumnProperties columnProperties = (ColumnProperties) propertiesList.get(columnIndex); 380 381 int type = com.daffodilwoods.database.utility.TypeConverter.getDataBaseType( (String ) values[SystemTablesFields.data_type_descriptor_data_type]); 382 int numPecision = values[SystemTablesFields.data_type_descriptor_numeric_precision] == null ? 0 : 383 values[SystemTablesFields.data_type_descriptor_numeric_precision].hashCode(); 384 int charLength = values[SystemTablesFields.data_type_descriptor_character_maximum_length] == null ? 0 : 385 values[SystemTablesFields.data_type_descriptor_character_maximum_length].hashCode(); 386 int decimal = values[SystemTablesFields.data_type_descriptor_numeric_scale] == null ? 0 : 387 values[SystemTablesFields.data_type_descriptor_numeric_scale].hashCode(); 388 int datePrecision = values[SystemTablesFields.data_type_descriptor_datetime_precision] == null ? 0 : 389 values[SystemTablesFields.data_type_descriptor_datetime_precision].hashCode(); 390 int intervalPrecision = values[SystemTablesFields.data_type_descriptor_interval_precision] == null ? 0 : 391 values[SystemTablesFields.data_type_descriptor_interval_precision].hashCode(); 392 boolean fixed = isFixed(type); 393 columnProperties.precision = GeneralUtility.getPrecision(charLength, numPecision, datePrecision, intervalPrecision); 394 columnProperties.type = type; 395 columnProperties.decimal = decimal; 396 int byteSize = GeneralUtility.getBytesCount(type, columnProperties.precision); 397 columnProperties.size = byteSize; 398 } while (iterator.next()); 399 } 400 _SelectQueryIterator tableTypeAndCodesIterator = getIterator(preparedStatementGetter.getTableTypesAndCodesExecuter(), new Object [] {breakedTableName[0], breakedTableName[1], breakedTableName[2]}); 401 if (tableTypeAndCodesIterator.first()) { 402 Object [] data = ( (Object []) tableTypeAndCodesIterator.getObject()); 403 String type = (String ) data[0]; 404 tableType = type.equalsIgnoreCase(SqlKeywords.VIEW) ? TypeConstants.VIEW : TypeConstants.TABLE; 405 if (data[1] != null) { 406 language = (String ) data[1]; 407 country = (String ) data[2]; 408 collator = Collator.getInstance(new Locale(language, country)); 409 } 410 } 411 ColumnProperties[] cp = new ColumnProperties[propertiesList.size()]; 412 return (ColumnProperties[]) propertiesList.toArray(cp); 413 } 414 415 public short getTableType() throws DException { 416 return tableType; 417 } 418 419 private boolean isFixed(int type) throws DException { 420 return! (type == ARRAY || type == BIGDECIMAL || type == VARCHAR || 421 type == NUMERIC || type == DECIMAL || type == DEC || 422 type == CHARACTERVARYING || type == CHARVARYING || 423 type == BITVARYING || type == SUM || 424 type == VARBINARY || type == REF || type == STRUCT); 425 } 426 427 private boolean isSystemTable() throws DException { 428 return P.indexOfIgnoreCase(SystemTablesCreator.tableNames, tableName.getIdentifier()) != -1 || 429 tableName.equals(SystemTables.TABLEINFO) || 430 tableName.equals(SystemTables.INDEXINFO) || 431 tableName.equals(SystemTables.CLUSTERINFO) || 432 tableName.equals(SystemTables.COLUMNINFO) || 433 tableName.equals(SystemTables.DATABASEINFO); 434 } 435 436 437 438 440 public String getTableName(int index) throws DException { 441 try { 442 String check = columnPropertiesArray[index].domainCatalog; 443 } catch (ArrayIndexOutOfBoundsException e) { 444 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (index), tableName.getIdentifier()}); 445 } 446 return tableName.name; 447 } 448 449 public int getScale(int columnIndex) throws DException { 450 try { 451 return columnPropertiesArray[columnIndex].decimal; 452 } catch (ArrayIndexOutOfBoundsException e) { 453 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 454 } 455 456 } 457 458 public String getSchemaName(int columnIndex) throws DException { 459 try { 460 String check = columnPropertiesArray[columnIndex].domainCatalog; 461 } catch (ArrayIndexOutOfBoundsException e) { 462 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 463 } 464 return (breakTableName(tableName))[1]; 465 466 } 467 468 public String getCatalogName(int columnIndex) throws DException { 469 try { 470 String check = columnPropertiesArray[columnIndex].domainCatalog; 471 } catch (ArrayIndexOutOfBoundsException e) { 472 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 473 } 474 return (breakTableName(tableName))[0]; 475 } 476 477 public int isNullable(int columnIndex) throws DException { 478 try { 479 return columnPropertiesArray[columnIndex].isNullable; 480 } catch (ArrayIndexOutOfBoundsException e) { 481 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 482 } 483 } 484 485 public String getColumnLabel(int index) throws DException { 486 return getColumnName(index); 487 } 488 489 public String getDomainCatalog(int index) throws DException { 490 try { 491 return columnPropertiesArray[index].domainCatalog; 492 } catch (ArrayIndexOutOfBoundsException e) { 493 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (index), tableName.getIdentifier()}); 494 } 495 } 496 497 public String getDomainSchema(int index) throws DException { 498 try { 499 return columnPropertiesArray[index].domainSchema; 500 } catch (ArrayIndexOutOfBoundsException e) { 501 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (index), tableName.getIdentifier()}); 502 } 503 } 504 505 public String getDomainName(int index) throws DException { 506 try { 507 return columnPropertiesArray[index].domainName; 508 } catch (ArrayIndexOutOfBoundsException e) { 509 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (index), tableName.getIdentifier()}); 510 } 511 } 512 513 public int[] getDomainColumnIndexes() throws DException { 514 int[] domainIndexes = new int[columnCount]; 515 int j = 0; 516 for (int i = 0; i < columnCount; i++) 517 if (! (columnPropertiesArray[i].domainName == null || columnPropertiesArray[i].domainName.equals(""))) { 518 domainIndexes[j++] = i; 519 } 520 if (j == 0) 521 return null; 522 int[] temp = new int[j]; 523 System.arraycopy(domainIndexes, 0, temp, 0, j); 524 return temp; 525 } 526 527 public Collator getCollator() throws DException { 528 return collator; 529 } 530 531 public String getCountry() throws DException { 532 return country; 533 } 534 535 public String getLanguage() throws DException { 536 return language; 537 } 538 539 573 574 634 635 642 643 public String getQualifiedTableName(int index) throws DException { 644 return tableName.getIdentifier(); 645 } 646 647 648 class ColumnProperties implements Serializable { 649 public String columnName; 650 651 public int type = -1; 652 653 public int size = -2; 654 655 public int decimal = 0; 656 657 public int precision = 0; 658 659 public int isNullable = 0; 660 661 public String relatedTable = "?"; 662 663 public String relation = "?"; 664 665 public String [] relatedColumns = null; 666 667 public String domainCatalog; 668 public String domainSchema; 669 public String domainName; 670 public boolean isAutoIncrement; 671 public String schemaName; 672 public String catalogName; 673 public int columnIndex; 674 public String columnLabel; 675 public int columnPrecision; 676 public QualifiedIdentifier QualifiedTableName; 677 public int columnScale; 678 public String tableName; 679 680 681 public ColumnProperties() throws DException { 682 } 683 684 public ColumnProperties(_ColumnCharacteristics cc, int columnIndex0) throws DException { 685 catalogName = cc.getCatalogName(columnIndex0); 686 schemaName = cc.getSchemaName(columnIndex0); 687 columnName = cc.getColumnName(columnIndex0); 688 isAutoIncrement = cc.isAutoIncrement(columnIndex0); 689 isNullable = cc.isNullable(columnIndex0); 690 size = cc.getSize(columnIndex0); 691 type = cc.getColumnType(columnIndex0); 692 columnIndex = cc.getColumnIndex(cc.getColumnName(columnIndex0)); 693 columnLabel = cc.getColumnLabel(columnIndex0); 694 columnPrecision = cc.getPrecision(columnIndex0); 695 tableName = cc.getTableName(columnIndex0); 696 QualifiedTableName = new QualifiedIdentifier(catalogName, schemaName, tableName); 697 columnScale = cc.getScale(columnIndex0); 698 relatedTable = cc.getRelatedTable(columnIndex0); 699 relation = cc.getRelation(columnIndex0); 700 relatedColumns = cc.getRelatedColumns(columnIndex0); 701 } 702 } 703 704 private _SelectQueryIterator getIterator(_Executer executer, Object [] parameters) throws DException { 705 return (_SelectQueryIterator) executer.executeForFresh(parameters); 706 } 707 708 public boolean isAutoIncrement(int columnIndex) throws DException { 709 try { 710 return columnPropertiesArray[columnIndex].isAutoIncrement; 711 } catch (ArrayIndexOutOfBoundsException e) { 712 throw new IllegalColumnException("DSE3514", new Object [] {new Integer (columnIndex), tableName.getIdentifier()}); 713 } 714 } 715 716 public _ColumnCharacteristics getCCFromIndexes(_ColumnCharacteristics cc, int offset, int[] columnIndexes) throws DException { 717 int columnCount = columnIndexes.length; 718 ColumnProperties[] columnProperties = new ColumnProperties[columnCount]; 719 ColumnProperties cp = null; 720 for (int i = 0; i < columnCount; i++) { 721 int columnIndex = columnIndexes[i]; 722 cp = new ColumnProperties(cc, columnIndex); 723 columnProperties[i] = cp; 724 } 725 return new SelectedColumnCharacteristics(columnProperties, cp.QualifiedTableName); 726 } 727 728 733 } 734 | Popular Tags |