1 package com.daffodilwoods.daffodildb.server.sql99.common; 2 3 import java.io.*; 4 import java.math.*; 5 import java.util.*; 6 7 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 8 import com.daffodilwoods.daffodildb.server.sql99.*; 9 import com.daffodilwoods.daffodildb.server.sql99.dql.common.*; 10 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*; 11 import com.daffodilwoods.daffodildb.server.sql99.dql.resultsetmetadata.*; 12 import com.daffodilwoods.daffodildb.server.sql99.expression.expressionprimary.*; 13 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 14 import com.daffodilwoods.daffodildb.utils.field.*; 15 import com.daffodilwoods.database.general.*; 16 import com.daffodilwoods.database.resource.*; 17 18 public class ColumnDetails implements Datatypes, TypeConstants, Serializable, Cloneable , _Reference, 19 SimpleConstants { 20 21 private _ColumnCharacteristics chainedColumnCC; private TableDetails displayTable; private QualifiedIdentifier qualifiedIdentifier; protected String [] tableAliasArray; public boolean outerReference; protected Object typeObject; 27 protected TableDetails tableDetails; 28 protected ArrayList columnName; protected int type; protected String aliasName; 31 private String reason; 32 protected String functionType; protected String quantifier; 35 public boolean forcheck = false; 36 protected int dataType = -5; 37 private int orderDataType = -5; 38 protected int size; 39 private int orderSize; 40 private String expression; protected int index = -1; 43 protected boolean question; 44 private boolean belongsToSessionCondition; public Boolean negativeFlag; 47 private boolean isSelectListColumn; private boolean belongToAllowedPredicate; private Object byteComparisonObject; private int selectedGroupMappingIndex = -1; 51 private int unionSelectedColumnIndex = -1; 52 private int canUseByteComparison; 53 private boolean containClauseFlag = false; protected boolean isTriggerCase = false; 55 56 protected String originalColumnName; 57 protected _Executer functionExecuter; 58 private int sequence = -1; 59 private boolean isReturnStatementCD; 60 private boolean isAssignmentTarget; 61 public static final DException INDEX_NOT_INITIALIZED = new DException("DSE565", null); 62 63 public ColumnDetails() { 64 columnName = new ArrayList(5); 65 type = -1; 66 dataType = -5; 67 orderDataType = -5; 68 size = -5; 69 orderSize = -5; 70 } 71 72 public void setColumnName(String [] column) throws DException { 73 74 if (columnName.isEmpty()) { 75 originalColumnName = column[column.length - 1]; 76 } 77 if (!this.columnName.isEmpty()) 78 this.columnName.clear(); 79 appropriateName = null; 80 columnName.addAll(Arrays.asList(column)); 81 } 82 83 public void setSize(int size0) throws DException { 84 size = size0; 85 } 86 87 public void setSizeForSetOperators(int size0) throws DException { 88 orderSize = getSize(); 89 size = size0; 90 } 91 92 public int getSizeForOrder() throws DException { 93 orderSize = orderSize < 0 ? getSize() : orderSize; 94 return orderSize; 95 } 96 97 public static int getSize(ColumnDetails[] columnDetails) throws DException { 98 if (columnDetails == null) 99 throw new DException("DSE3549", null); 100 int size = checkForStringType(columnDetails); 101 if (size != 0) 102 return size; 103 int[] typeAndSize = getAppropriateTypeAndSize(columnDetails); 104 return typeAndSize[1]; 105 } 106 107 public int getSizeFromUnderlying() throws DException { 108 try { 109 return ( (_sortspecificationAndselectSubList) typeObject). 110 getByteComparison(byteComparisonObject).getSize(); 111 } catch (ClassCastException ex) { 112 if (getType() == TypeConstants.REFERENCE || 113 getType() == TypeConstants.CONSTANT || getUnderLyingReference()) 114 return -1; 115 throw ex; 116 } catch (NullPointerException ex) { 117 if (getType() == TypeConstants.REFERENCE) 118 return -1; 119 throw ex; 120 } 121 122 catch (DException ex1) { 123 if (ex1.getDseCode().equalsIgnoreCase("DSE3804") && byteComparisonObject == null) 124 return -1; 125 throw ex1; 126 } 127 128 } 129 130 public int getSize() throws DException { 131 size = size < 0 ? getSizeFromUnderlying() : size; 132 return size; 133 } 134 135 public String [] getColumnName() throws DException { 136 if (columnName.size() == 0) { 137 throw new DException("DSE721", null); 138 } 139 return (String []) columnName.toArray(new String [0]); 140 } 141 142 public String [] getAppColumnName() throws DException { 143 if (columnName.size() == 0) { 144 throw new DException("DSE721", null); 145 } 146 if (tableDetails == null) { 147 String [] result = (String []) columnName.toArray(new String [0]); 148 if (aliasName != null) 149 result[result.length - 1] = aliasName; 150 return result; 151 } else { 152 String [] tableName = tableDetails.getAppropriateTableName(); 153 int length = tableName.length; 154 String [] result = new String [length + 1]; 155 System.arraycopy(tableName, 0, result, 0, length); 156 result[length] = aliasName != null ? aliasName : 157 (String ) columnName.get(columnName.size() - 1); 158 return result; 159 } 160 } 161 162 public void setColumn(String [] columnName0) throws DException { 163 164 if (columnName.isEmpty()) { 165 originalColumnName = columnName0[columnName0.length - 1]; 166 } 167 this.columnName.clear(); 168 appropriateName = null; this.columnName.addAll(Arrays.asList(columnName0)); 170 171 172 } 173 174 public void setFunctionType(String functiontype) throws DException { 175 this.functionType = functiontype; 176 } 177 178 public void setType(int type) throws DException { 179 this.type = type; 180 } 181 182 public void setDatatype(int type) throws DException { 183 dataType = type; 184 } 185 186 public void setDataTypeForSetOperators(int type) throws DException { 187 orderDataType = getDatatypeForOrder(); 188 dataType = type; 189 } 190 191 196 public int getDatatype() throws DException { 197 198 dataType = dataType == -5 ? outerReference ? -1 199 : type == CONSTANT ? getDatatypeInCaseOfConstant() 200 : getDatatypeInNormalCase() 201 : dataType; 202 return dataType; 203 } 204 205 public int getDatatypeForOrder() throws DException { 206 orderDataType = orderDataType == -5 ? getDatatype() : orderDataType; 207 return orderDataType; 208 } 209 210 public int getType() throws DException { 211 if (type == -1) 212 throw new DException("DSE732", null); 213 return type; 214 } 215 216 public void setAliasName(String name) throws DException { 217 aliasName = name; 218 } 219 220 public String getAliasName() throws DException { 221 return aliasName; 222 } 223 224 public String getAppropriateTableName() throws DException { 225 return tableDetails != null ? tableDetails.getNameOfTable() : null; 226 } 227 228 public String getAppropriateTableNameForMaterializedView() throws DException { 229 if (tableDetails != null) 230 return tableDetails.getUnderscoreTableName(); 231 return null; 232 } 233 234 public String getNameOfTable() throws DException { 235 String nameOfTable = ""; 236 int i; 237 for (i = 0; i < columnName.size() - 2; ++i) { 238 nameOfTable += (String ) columnName.get(i) + "."; 239 } 240 nameOfTable += (String ) columnName.get(i); 241 return nameOfTable; 242 } 243 244 248 public void setContainClauseFlag() { 249 containClauseFlag = true; 250 } 251 252 257 public boolean getContainClauseFlag() { 258 return containClauseFlag; 259 } 260 261 public String toString() { 262 try { 263 String str = type == GROUPING ? "" + typeObject : getStringOfColumn(); 264 return str + " hashCode " + hashCode() + " TableDetails [" + tableDetails + 265 "] alias " + getAliasName() + " typeObject " + typeObject + 266 " type = " + type + "\n"; 267 } catch (DException E) { 268 throw new DRuntimeException(E.getDseCode(), E.getParameters()); 269 } 270 } 271 272 public void setQuantifier(String quantifier) throws DException { 273 this.quantifier = quantifier; 274 } 275 276 public String getQuantifier() throws DException { 277 return quantifier; 278 } 279 280 String appropriateName = null; 281 public String getStringOfColumn() throws DException { 282 if (appropriateName == null) { 283 int size = columnName.size(); 284 String appropriateTableName = getAppropriateTableName(); 285 if (appropriateTableName != null) 286 appropriateName = appropriateTableName + "." + columnName.get(size - 1); 287 else { 288 int i; 289 StringBuffer buffer = new StringBuffer (); 290 for (i = 0; i < size - 1; ++i) { 291 buffer.append(columnName.get(i)); 292 buffer.append("."); 293 } 294 buffer.append(columnName.get(i)); 295 appropriateName = buffer.toString(); 296 } 297 } 298 return appropriateName; 299 } 300 301 public void setIndex(int index) throws DException { 302 this.index = index; 303 } 304 305 public int getIndex() throws DException { 306 if (index == -1) 307 throw INDEX_NOT_INITIALIZED; 308 return index; 309 } 310 311 public String getFunctionType() throws DException { 312 return functionType; 313 } 314 315 public void setTableDetails(TableDetails tableDetails0) throws DException { 316 317 tableDetails = tableDetails0; 318 } 319 320 public String getColumn() { 321 return (String ) columnName.get(columnName.size() - 1); 322 } 323 324 public String getAppropriateColumn() { 325 String sign = negativeFlag == null ? "" : negativeFlag.booleanValue() ? "-" : 326 "+"; 327 return aliasName != null ? aliasName : type == GROUPING ? 328 typeObject.toString() 329 : (sign + (String ) columnName.get(columnName.size() - 1)); 330 } 331 332 public Object clone() throws CloneNotSupportedException { 333 if (outerReference) { 334 return this; 335 } 336 ColumnDetails cd = new ColumnDetails(); 337 cd.columnName = columnName; 338 cd.type = type; 339 cd.aliasName = aliasName; 340 cd.functionType = functionType; 341 cd.quantifier = quantifier; 342 cd.dataType = dataType; 343 cd.size = size; 344 cd.index = index; 345 cd.tableDetails = tableDetails; 346 cd.typeObject = typeObject; 347 cd.outerReference = outerReference; 348 cd.tableAliasArray = tableAliasArray; 349 cd.columnName = new ArrayList(); 350 cd.columnName.addAll(columnName); 351 cd.negativeFlag = negativeFlag; 352 cd.isTriggerCase = isTriggerCase; 353 cd.originalColumnName = originalColumnName; 354 cd.question = question; 355 cd.sequence = sequence; 357 cd.isCloned = true; 358 return cd; 359 } 360 361 public void setQuestion() { 362 question = true; 363 } 364 365 public boolean getQuestion() { 366 return question; 367 } 368 369 375 public ColumnDetails[] getChildColumnDetails() throws DException { 376 if (type == FUNCTIONAL || type == GROUPING || type == CASEEXPRESSION || 377 type == SCALARFUNCTION || type == USERFUNCTION) 378 return ( (_sortspecificationAndselectSubList) typeObject). 379 getChildColumnDetails(); 380 else { 381 throw new DException("DSE4115", new Object [] {typeObject}); } 383 } 384 385 public ColumnDetails[] getExistingColumnDetails() throws DException { 386 if (type == FUNCTIONAL || type == GROUPING || type == CASEEXPRESSION || 387 type == SCALARFUNCTION || type == USERFUNCTION || type == SCALARSUBQUERY) 388 return ( (_sortspecificationAndselectSubList) typeObject). 389 getChildColumnDetails(); 390 else 391 throw new DException("DSE4115", new Object [] {typeObject}); } 393 394 public Object run(Object object) throws DException { 395 return ( (com.daffodilwoods.daffodildb.utils.parser.StatementExecuter) 396 typeObject).run(object); 397 } 398 399 public void setObject(Object object) throws DException { 400 typeObject = object; 401 } 402 403 public Object getObject() throws DException { 404 return typeObject; 405 } 406 407 public TableDetails getTable() throws DException { 408 return tableDetails; 409 } 410 411 public TableDetails getTableDetails() throws DException { 412 return outerReference ? null : tableDetails; 413 } 414 415 public _Aggregate getExecutable() throws DException { 416 try { 417 return ( (setfunctionspecification) typeObject).getExecutable(); 418 } catch (ClassCastException ex) { 419 return ( (_derivedcolumn) typeObject).getExecutable(); 420 } 421 } 422 423 public int getReferenceType() throws DException { 424 return COLUMNDETAIL; 425 } 426 427 public void setTableAliasArray(String [] tableAliasArray0) throws DException { 428 tableAliasArray = tableAliasArray0; 429 } 430 431 public String [] getTableAliasArray() throws DException { 432 return tableAliasArray; 433 } 434 435 public void setUnderLyingReference(boolean outerReference0) throws DException { 436 outerReference = outerReference0; 437 438 } 439 440 public boolean getUnderLyingReference() throws DException { 441 return outerReference; 442 } 443 444 public boolean isValidForView() throws DException { 445 if (type == 0) 446 throw new DException("DSE262", null); 447 if (type != REFERENCE && aliasName != null) 448 return true; 449 if (type == REFERENCE || type == SCALARSUBQUERY) 450 return true; 451 return false; 452 } 453 454 public String getOriginalColumn() { 455 String sign = negativeFlag == null ? "" : negativeFlag.booleanValue() ? "-" : 456 "+"; 457 return type == GROUPING ? typeObject.toString() 458 : (sign + originalColumnName); 459 460 } 461 462 public String getQualifiedColumnName() throws DException { 463 return type == GROUPING ? typeObject.toString() 464 : getStringOfColumn(); 465 } 466 467 public void setSessionConditionFlag() throws DException { 468 this.belongsToSessionCondition = true; 469 } 470 471 public boolean checkSessionConditionFlag() throws DException { 472 return belongsToSessionCondition; 473 } 474 475 public void setQualifiedIdentifier(QualifiedIdentifier qualifiedIdentifier0) throws 476 DException { 477 qualifiedIdentifier = qualifiedIdentifier0; 478 } 479 480 public String getQualifiedChainedTableName() throws DException { 481 return tableAliasArray == null ? tableDetails.getQualifiedTableName() : 482 qualifiedIdentifier.getIdentifier(); 483 } 484 485 public QualifiedIdentifier getChainedIdentifier() throws DException { 486 return qualifiedIdentifier; 487 } 488 489 public _ColumnCharacteristics getColumnCharacteristics() throws DException { 490 return tableAliasArray == null ? tableDetails.cc : chainedColumnCC; 491 } 492 493 497 498 public void setChainedColumnCC(_ColumnCharacteristics chainedColumnCC0) throws 499 DException { 500 chainedColumnCC = chainedColumnCC0; 501 } 502 503 public void setTableForDisplay(TableDetails displayTable0) throws DException { 504 displayTable = displayTable0; 505 } 506 507 public TableDetails getTableForDisplay() throws DException { 508 return displayTable; 509 } 510 511 public void setNegativeValueFlag(boolean b) throws DException { 512 this.negativeFlag = new Boolean (b); 513 } 514 515 public boolean checkNegativeValueFlag() throws DException { 516 return negativeFlag == null ? false : negativeFlag.booleanValue(); 517 } 518 519 public void setExpression(String s) { 520 expression = s; 521 } 522 523 public String getExpression() { 524 return expression; 525 } 526 527 public String getTriggerTableAlias() throws DException { 528 return columnName.isEmpty() ? null : columnName.size() == 1 ? null : 529 (String ) columnName.get(columnName.size() - 2); 530 } 531 532 public boolean ifBelongToSelectList() { 533 return isSelectListColumn; 534 } 535 536 public void setAsSelectListColumn() { 537 isSelectListColumn = true; 538 } 539 540 public void setAsBelongToAllowedPredicateColumn() { 541 belongToAllowedPredicate = true; 542 } 543 544 public boolean ifBelongToAllowedPredicate() throws DException { 545 return belongToAllowedPredicate; 546 } 547 548 public ColumnDetails[] getCorresspondingColumnsInvolved() throws DException { 549 ColumnDetails[] columns = getCorresspondingColumnsInvolvedForViewColumns(); 550 ArrayList list = new ArrayList(); 551 getColumnsInvolved(columns, list); 552 return list.isEmpty() ? null : 553 (ColumnDetails[]) list.toArray(new ColumnDetails[list.size()]); 554 } 555 556 private ColumnDetails[] getCorresspondingColumnsInvolvedForViewColumns() throws 557 DException { 558 switch (getType()) { 559 case REFERENCE: 560 case CONSTANT: 561 return new ColumnDetails[] { 562 this}; 563 default: 564 return getExistingColumnDetails(); 565 } 566 } 567 568 private void getColumnsInvolved(ColumnDetails[] columns, ArrayList list) throws 569 DException { 570 for (int i = 0, length = columns.length; i < length; i++) { 571 switch (columns[i].getType()) { 572 case REFERENCE: 573 TableDetails table = columns[i].getTable(); 574 if (table.isFromSubQuery()) { 575 _SelectColumnCharacteristics scc = (_SelectColumnCharacteristics) 576 table.cc; 577 list.addAll(Arrays.asList(scc. 578 getCorresspondingColumnsForFromSubQueryColumn(columns[i]))); 579 continue; 580 } 581 list.add(columns[i]); 582 break; 583 case CONSTANT: 584 list.add(columns[i]); 585 break; 586 case SCALARFUNCTION: 587 case GROUPING: 588 case FUNCTIONAL: 589 case CASEEXPRESSION: 590 case USERFUNCTION: 591 getColumnsInvolved(columns[i].getExistingColumnDetails(), list); 592 break; 593 } 594 } 595 } 596 597 public String getAppropriateQualifiedName() throws DException { 598 return aliasName != null ? aliasName : getStringOfColumn(); 599 } 600 601 private int getDatatypeInCaseOfConstant() throws DException { 602 String number = getColumn(); 603 if (question) { 604 return getDatatypeInNormalCase(); 605 606 } 607 int counter = 1; 608 while (true) { 609 try { 610 switch (counter) { 611 case 1: 612 Byte.parseByte(number); 613 return BYTE; 614 case 2: 615 Short.parseShort(number); 616 return SHORT; 617 case 3: 618 Integer.parseInt(number); 619 return INTEGER; 620 case 4: 621 Long.parseLong(number); 622 return LONG; 623 case 5: 624 new BigInteger(number); 625 return BIGDECIMAL; 626 case 6: 627 double d = Double.parseDouble(number); 628 if ( Double.MAX_VALUE < d) 629 throw new ArithmeticException (); 630 return DOUBLE; 631 default: 632 return BIGDECIMAL; 633 } 634 } catch (Exception ex) { 635 counter++; 636 } 637 } 638 } 639 640 private int getDatatypeInNormalCase() throws DException { 641 if (type == FUNCTIONAL || type == GROUPING || type == CASEEXPRESSION || 642 type == SCALARFUNCTION || type == USERFUNCTION || type == SCALARSUBQUERY) 643 return ( (_sortspecificationAndselectSubList) typeObject). 644 getByteComparison(byteComparisonObject).getDataTypes()[0]; 645 if (type == CONSTANT) { 646 if (getQuestion()) { 647 return -1; 648 } 649 ByteComparison b = ( (_sortspecificationAndselectSubList) typeObject). 650 getByteComparison(byteComparisonObject); 651 int dataType1 = b.getDataTypes()[0]; 652 if (dataType1 == -1) { 653 Object field = b.getField()[0]; 654 if (field instanceof FieldBase) { 655 FieldBase f = ( (FieldBase) field); 656 f.setDatatype( -1); 657 dataType1 = f.getDatatype(); 658 } else { 659 throw new DException("DSE514", null); 660 } 661 } 662 return dataType1; 663 } else { 664 throw new DException("DSE4115", new Object [] {getColumn()}); } 666 667 } 668 669 public void setByteComparisonObject(Object vv) throws DException { 670 byteComparisonObject = vv; 671 } 672 673 public int getSelectedMappingIndex() throws DException { 674 if (selectedGroupMappingIndex == -1) 675 throw new DException("DSE565", null); 676 return selectedGroupMappingIndex; 677 } 678 679 public int getUnionSelectedColumnIndex() throws DException { 680 if (unionSelectedColumnIndex == -1) 681 throw new DException("DSE565", null); 682 return unionSelectedColumnIndex; 683 } 684 685 public void setSelectedMappingIndex(int mappingIndex) throws DException { 686 selectedGroupMappingIndex = mappingIndex; 687 } 688 689 public void setUnionSelectedColumn(int mappingIndex) throws DException { 690 unionSelectedColumnIndex = mappingIndex; 691 } 692 693 700 701 public void setByteComparison(boolean flag) throws DException { 702 if (!flag) 703 canUseByteComparison = -1; 705 } 706 707 public boolean canUseByteComparison() throws DException { 708 return canUseByteComparison == 0 && type == REFERENCE; 709 } 710 711 private static int checkForStringType(ColumnDetails[] columnDetails) throws 712 DException { 713 int size = 0; 714 for (int i = 0; i < columnDetails.length; i++) { 715 if (columnDetails[i].getDatatype() == CHARACTER 716 || columnDetails[i].getDatatype() == CHAR 717 || columnDetails[i].getDatatype() == CHARVARYING 718 || columnDetails[i].getDatatype() == CHARACTERVARYING 719 || columnDetails[i].getDatatype() == VARCHAR) { 720 size += columnDetails[i].getSize(); 721 } 722 } 723 return size; 724 } 725 726 private static int[] getAppropriateTypeAndSize(ColumnDetails[] columnDetails) throws 727 DException { 728 int max = 0, j = 0, length = columnDetails.length; 729 if (length == 0) 730 return new int[] { 731 LONG, LONGSIZE}; 732 for (int i = 0; i < length; i++) { 733 int type = columnDetails[i].getDatatype(); 734 if (max < type) { 735 max = type; 736 j = i; 737 } 738 } 739 switch (max) { 740 case BYTE: 741 case TINYINT: 742 return new int[] { 743 max, BYTESIZE}; 744 case SMALLINT: 745 case SHORT: 746 return new int[] { 747 max, SHORTSIZE}; 748 case INT: 749 case INTEGER: 750 return new int[] { 751 max, INTSIZE}; 752 case LONG: 753 case BIGINT: 754 return new int[] { 755 max, LONGSIZE}; 756 case FLOAT: 757 case DOUBLE: 758 case DOUBLEPRECISION: 759 return new int[] { 760 max, DOUBLESIZE}; 761 case REAL: 762 return new int[] { 763 max, FLOATSIZE}; 764 case DEC: 765 case DECIMAL: 766 case NUMERIC: 767 case BIGDECIMAL: 768 return new int[] { 769 BIGDECIMAL, columnDetails[j].getSize()}; 770 case BOOLEAN: 771 return new int[] { 772 max, BOOLEANSIZE}; 773 case DATE: 774 return new int[] { 775 max, DATESIZE}; 776 case TIME: 777 case TIME_WITH_TIMEZONE: 778 return new int[] { 779 max, TIMESIZE}; 780 case TIMESTAMP: 781 case TIMESTAMP_WITH_TIMEZONE: 782 return new int[] { 783 max, TIMESTAMPSIZE}; 784 case BLOB: 785 case LONGVARBINARY: 786 case CLOB: 787 case CHARACTER: 788 case CHARACTERLARGEOBJECT: 789 case CHARLARGEOBJECT: 790 case BINARYLARGEOBJECT: 791 case BIT: 792 case BINARY: 793 case BITVARYING: 794 case VARBINARY: 795 case VARCHAR: 796 case LONGVARCHAR: 797 case REF: 798 case STRUCT: 799 case MODULE: 800 case SUM: 801 case ARRAY: 802 case RECORD: 803 case RECORDSET: 804 return new int[] { 805 max, columnDetails[j].getSize()}; 806 default: 807 throw new DException("DSE514", new Object [] {new Integer (max)}); 808 809 } 810 } 811 812 public _Reference[] getReferences(TableDetails[] td) throws DException { 813 if (type == FUNCTIONAL || type == GROUPING || type == CASEEXPRESSION || 814 type == SCALARFUNCTION || type == USERFUNCTION || getQuestion() || type == SCALARSUBQUERY) 815 return ( (_sortspecificationAndselectSubList) typeObject).getReferences( 816 td); 817 else if (type == REFERENCE && td != null) { 818 int i = 0; 819 for (; i < td.length; i++) { 820 if (isSameTableDetails(td[i], tableDetails)) 821 break; 822 } 823 if (i == td.length) 824 return new _Reference[] { 825 this}; 826 } else if (type == CONSTANT && outerReference) { 827 return ( (columnreference) typeObject).getReferences(td); } 829 return null; 830 } 831 832 public boolean isSame(_Reference reference) throws DException { 833 if (reference.getReferenceType() == COLUMNDETAIL) { 834 ColumnDetails cd = (ColumnDetails) reference; 835 if (cd.getAliasName() == null ^ aliasName == null) 836 return false; 837 if (aliasName != null) 838 return aliasName.equalsIgnoreCase(cd.getAliasName()); 839 return getQualifiedColumnName().equalsIgnoreCase(cd. 840 getQualifiedColumnName()); 841 } 842 return false; 843 } 844 845 public void setTriggerFlag() { 846 isTriggerCase = true; 847 } 848 849 public boolean getTriggerFlag() { 850 return isTriggerCase; 851 } 852 853 public static boolean isSameTableDetails(TableDetails td1, TableDetails td2) throws 854 DException { 855 if (td1 == null || td2 == null) { 856 return td1 == null && td2 == null; 857 } 858 String ta1 = td1.getAliasName(); 859 String ta2 = td2.getAliasName(); 860 if (ta1 != null) { 861 if (ta2 != null && ta2.equalsIgnoreCase(ta1)) 862 return true; 863 return false; 864 } else { 865 return td1.getQualifiedTableName().equalsIgnoreCase(td2. 866 getQualifiedTableName()); 867 } 868 } 869 870 public void setReason(String reason0) throws DException { 871 reason = reason0; 872 } 873 874 public String getReason() throws DException { 875 return reason; 876 } 877 878 public void setOriginalColumnName(String col0) throws DException { 879 originalColumnName = col0; 880 } 881 882 883 public void setTypeForSequence(int sequence0) { 884 sequence = sequence0; 885 } 886 887 public int getTypeForSequence() { 888 return sequence; 889 } 890 891 892 boolean isCloned; 893 public boolean isCloned() { 894 return isCloned; 895 } 896 897 public void setCloned(boolean isCloned0) { 898 isCloned = isCloned0; 899 } 900 901 public void setReturnStatementCD(boolean isReturnStatementCD0) { 902 isReturnStatementCD = isReturnStatementCD0; 903 } 904 905 public boolean isReturnStatementCD() { 906 return isReturnStatementCD; 907 } 908 909 public void setAssignmentTarget(boolean isAssignmentTarget0) { 910 isAssignmentTarget = isAssignmentTarget0; 911 } 912 913 public boolean isAssignmentTarget() { 914 return isAssignmentTarget; 915 } 916 } 917 | Popular Tags |