001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.*; 004 005import java.util.HashMap; 006import java.util.Map; 007 008 009/** 010* This class represents SQL Datatype. 011 * call method {@link #toString() toString} will return string representation of datatype 012 * including type name,length,precision,scale and attributes 013 * <ul> 014 * <li>typename 015 * <li>typename(length) 016 * <ul> 017 * <li>length: {@link #getLength()}</li> 018 * </uL> 019 * </li> 020 * <li>typename(precision,scale) 021 * <ul> 022 * <li>precision: {@link #getPrecision()}</li> 023 * <li>precision: {@link #getScale()}</li> 024 * </uL> 025 * </li> 026 * </ul> 027 * 028 * 029 * <p>datetype attribute 030 * <br> In datatype like this: MEDIUMTEXT [CHARACTER SET cs_name] [COLLATE collation_name], 031 * CHARACTER SET and COLLATE were treated as attribute of the MEDIUMTEXT datatype,those attributes 032 * can be fetched from {@link #getDatatypeAttributeList()}. For more detailed information about 033 * attributes in datatype, please check {@link TDatatypeAttribute}. 034 * <p> 035 * method {@link #getDatatypeAttributeList()} can be used to get datatype attribute 036 * such as FORMAT 'yyyymmdd' of DATE in this fuction: CAST('20120802' AS DATE FORMAT 'yyyymmdd'). 037 * 038* 039* <p>BINARY 040 * <ul> 041* <li>BINARY[(n)] 042 * <ul> 043 * <li>{@link EDataType#binary_t}</li> 044 * <li>n: {@link #getLength()}</li> 045 * </ul> 046 * </li> 047* <li>BINARY LARGE OBJECT</li> 048* <li>BLOB 049 * <ul> 050 * <li>{@link EDataType#blob_t} 051 * </li> 052 * </ul> 053 * </li> 054* <li>GRAPHIC 055 * <ul> 056 * <li>{@link EDataType#graphic_t} 057 * </li> 058 * </ul> 059 * </li> 060* <li>LONGBLOB 061 * <ul> 062 * <li>{@link EDataType#longblob_t} 063 * </li> 064 * </ul> 065 * </li> 066* <li>LONG RAW 067 * <ul> 068 * <li>{@link EDataType#long_raw_t} 069 * </li> 070 * </ul> 071 * </li> 072* <li>VARBINARY[(n)] 073 * <ul> 074 * <li>{@link EDataType#varbinary_t} 075 * </li> 076 * <li>n: {@link #getLength()}</li> 077 * </ul> 078 * </li> 079* <li>BYTEA 080 * <ul> 081 * <li>{@link EDataType#bytea_t} 082 * </li> 083 * </ul> 084 * </li> 085* <li>IMAGE(SQL Server) </li> 086* <li>TINYBLOB(MySQL, SQL Server) 087 * <ul> 088 * <li>{@link EDataType#tinyblob_t} 089 * </li> 090 * </ul> 091 * </li> 092* </ul> 093 * 094* <p>BOOLEAN 095 * <ul> 096* <li>BOOL 097 * <ul> 098 * <li>{@link EDataType#bool_t} 099 * </li> 100 * </ul> 101 * </li> 102* <li>BOOLEAN 103 * <ul> 104 * <li>{@link EDataType#bool_t} 105 * </li> 106 * </ul> 107 * </li> 108* </ul> 109 * 110* <p>CHARACTER STRING 111 * <ul> 112* <li>CHAR[(n)]/CHARACTER[(n)] 113 * <ul> 114 * <li>{@link EDataType#char_t}. 115 * </li> 116 * <li>n: {@link #getLength()} </li> 117 * </ul> 118 * </li> 119* <li>CHARACTER VARYING(n)/VARCHAR(n)/CHAR VARYING(n)/VARCHAR2(n) (Oracle) 120 * <ul> 121 * <li>{@link EDataType#varchar_t} 122 * </li> 123 * <li>n: {@link #getLength()} </li> 124 * </ul> 125 * </li> 126* <li>NATIONAL CHARACTER[(n)]/NATIONAL CHAR[(n)]/NCHAR[(n)] 127 * <ul> 128 * <li>{@link EDataType#nchar_t} 129 * </li> 130 * <li>n: {@link #getLength()} </li> 131 * </ul> 132 * </li> 133* <li>NATIONAL CHARACTER VARYING(n)/NATIONAL CHAR VARYING(n)/NCHAR VARYING(n)/NVARCHAR/VARGRAPHIC(n) 134 * <ul> 135 * <li>{@link EDataType#nvarchar_t} 136 * </li> 137 * <li>n: {@link #getLength()} </li> 138 * </ul> 139 * </li> 140* <li>NVARCHAR2(n) (Oracle) 141 * <ul> 142 * <li>{@link EDataType#nvarchar2_t} 143 * </li> 144 * <li>n: {@link #getLength()} </li> 145 * </ul> 146 * </li> 147* <li>CHARACTER LARGE OBJECT/CLOB 148 * <ul> 149 * <li>{@link EDataType#clob_t} 150 * </li> 151 * </ul> 152 * </li> 153* <li>NATIONAL CHARACTER LARGE OBJECT</li> 154* <li>NCLOB 155 * <ul> 156 * <li>{@link EDataType#nclob_t} 157 * </li> 158 * </ul> 159 * </li> 160* <li>DBCLOB 161 * <ul> 162 * <li>{@link EDataType#dbclob_t} 163 * </li> 164 * </ul> 165 * </li> 166* <li>NTEXT/NATIONAL TEXT(SQL Server) 167 * <ul> 168 * <li>{@link EDataType#ntext_t} 169 * </li> 170 * </ul> 171 * </li> 172* <li>TEXT 173 * <ul> 174 * <li>{@link EDataType#text_t} 175 * </li> 176 * </ul> 177 * </li> 178* <li>CHAR FOR BIT DATA</li> 179* <li>VARCHAR FOR BIT DATA</li> 180* <li>TINYTEXT(MySQL)</li> 181* </ul> 182* 183* <p>DATALINK 184 * <ul> 185* <li>DATALINK 186 * <ul> 187 * <li>{@link EDataType#datalink_t} 188 * </li> 189 * </ul> 190 * </li> 191*</ul> 192 * 193* <p>INTERVAL 194 * <ul> 195* <li>INTERVAL 196 * <ul> 197 * <li>{@link EDataType#interval_t} 198 * </li> 199 * </ul> 200 * </li> 201* <li>INTERVAL DAY[(precision)] 202 * <ul> 203 * <li>{@link EDataType#interval_day_t} 204 * </li> 205 * <li>precision: {@link #getPrecision()}</li> 206 * </ul> 207 * </li> 208* <li>INTERVAL DAY[(precision)] TO SECOND[(second precision)] 209 * <ul> 210 * <li>{@link EDataType#interval_day_to_second_t} 211 * </li> 212 * <li>precision: {@link #getPrecision()}</li> 213 * <li>second precision: {@link #getSecondsPrecision()}</li> 214 * </ul> 215 * </li> 216* <li>INTERVAL DAY[(precision)] TO MINUTE 217 * <ul> 218 * <li>{@link EDataType#interval_day_to_minute_t} 219 * </li> 220 * <li>precision: {@link #getPrecision()}</li> 221 * </ul> 222 * </li> 223* <li>INTERVAL DAY[(precision)] TO HOUR 224 * <ul> 225 * <li>{@link EDataType#interval_day_to_hour_t} 226 * </li> 227 * <li>precision: {@link #getPrecision()}</li> 228 * </ul> 229 * </li> 230* <li>INTERVAL YEAR[(precision)] TO MONTH 231 * <ul> 232 * <li>{@link EDataType#interval_year_to_month_t} 233 * </li> 234 * <li>precision: {@link #getPrecision()}</li> 235 * </ul> 236 * </li> 237* <li>TIMESPAN 238 * <ul> 239 * <li>{@link EDataType#timespan_t} 240 * </li> 241 * </ul> 242 * </li> 243 * </ul> 244* 245*<p> COLLECTION 246 * <ul> 247* <li>ARRAY </li> 248* <li>MULTISET</li> 249 * </ul> 250* 251* <p>NUMERIC 252 * <ul> 253* <li>INTEGER/INT 254 * <ul> 255 * <li>{@link EDataType#int_t} 256 * </li> 257 * </ul> 258 * </li> 259* <li>INT4(PostgreSQL) 260 * <ul> 261 * <li>{@link EDataType#int4_t} 262 * </li> 263 * </ul> 264 * </li> 265* <li>MEDIUMINT(MySQL) 266 * <ul> 267 * <li>{@link EDataType#mediumint_t} 268 * </li> 269 * </ul> 270 * </li> 271* <li>SMALLINT 272 * <ul> 273 * <li>{@link EDataType#smallint_t} 274 * </li> 275 * </ul> 276 * </li> 277* <li>INT2(PostgreSQL) 278 * <ul> 279 * <li>{@link EDataType#int2_t} 280 * </li> 281 * </ul> 282 * </li> 283* <li>BIGINT 284 * <ul> 285 * <li>{@link EDataType#bigint_t} 286 * </li> 287 * </ul> 288 * </li> 289* <li>NUMERIC(p,s) 290 * <ul> 291 * <li>{@link EDataType#numeric_t} 292 * </li> 293 * <li>p: {@link #getPrecision()}</li> 294 * <li>s: {@link #getScale()}</li> 295 * </ul> 296 * </li> 297* <li>NUMBER(p,s) 298 * <ul> 299 * <li>{@link EDataType#number_t} 300 * </li> 301 * <li>p: {@link #getPrecision()}</li> 302 * <li>s: {@link #getScale()}</li> 303 * </ul> 304 * </li> 305* <li>DEC[IMAL](p,s) 306 * <ul> 307 * <li>{@link EDataType#dec_t} 308 * </li> 309 * <li>p: {@link #getPrecision()}</li> 310 * <li>s: {@link #getScale()}</li> 311 * </ul> 312 * </li> 313* <li>FLOAT(p,s) 314 * <ul> 315 * <li>{@link EDataType#float_t} 316 * </li> 317 * <li>p: {@link #getPrecision()}</li> 318 * <li>s: {@link #getScale()}</li> 319 * </ul> 320 * </li> 321* <li>FLOAT4(PostgreSQL) 322 * <ul> 323 * <li>{@link EDataType#float4_t} 324 * </li> 325 * </ul> 326 * </li> 327* <li>FLOAT8(PostgreSQL) 328 * <ul> 329 * <li>{@link EDataType#float8_t} 330 * </li> 331 * </ul> 332 * </li> 333* <li>REAL 334 * <ul> 335 * <li>{@link EDataType#real_t} 336 * </li> 337 * </ul> 338 * </li> 339* <li>DOUBLE/DOUBLE PRECISION 340 * <ul> 341 * <li>{@link EDataType#double_t} 342 * </li> 343 * </ul> 344 * </li> 345* <li>BINARY_FLOAT(Oracle)</li> 346* <li>BINARY_DOUBLE(Oracle)</li> 347* <li>TINYINT/YEAR(MySQL)</li> 348 * </ul> 349* 350* <p>TEMPORAL 351 * <ul> 352* <li>DATE 353 * <ul> 354 * <li>{@link EDataType#date_t} 355 * </li> 356 * </ul> 357 * </li> 358* <li>TIME 359 * <ul> 360 * <li>{@link EDataType#time_t} 361 * </li> 362 * </ul> 363 * </li> 364* <li>TIME WITH TIME ZONE/TIMETZ(PostgreSQL) 365 * <ul> 366 * <li>{@link EDataType#time_with_time_zone_t} 367 * </li> 368 * </ul> 369 * </li> 370* <li>TIMESTAMP [(fractional_seconds)] 371 * <ul> 372 * <li>{@link EDataType#timestamp_t} 373 * </li> 374 * <li>fractional_seconds: {@link #getPrecision()}</li> 375 * </ul> 376 * </li> 377* <li>TIMESTAMP [(fractional_seconds)] WITH TIME ZONE 378 * <ul> 379 * <li>{@link EDataType#timestamp_with_time_zone_t} 380 * </li> 381 * <li>fractional_seconds: {@link #getPrecision()}</li> 382 * </ul> 383 * </li> 384* <li>DATETIME 385 * <ul> 386 * <li>{@link EDataType#datetime_t} 387 * </li> 388 * </ul> 389 * </li> 390* <li>SMALLDATETIME 391 * <ul> 392 * <li>{@link EDataType#smalldatetime_t} 393 * </li> 394 * </ul> 395 * </li> 396* <li>DATETIMEOFFSET[ (fractional seconds precision) ] 397 * <ul> 398 * <li>{@link EDataType#datetimeoffset_t} 399 * </li> 400 * <li>fractional seconds precision: {@link #getPrecision()}</li> 401 * </ul> 402 * </li> 403* <li>DATETIME2[ (fractional seconds precision) ](SQL Server) 404 * <ul> 405 * <li>{@link EDataType#datetime2_t} 406 * </li> 407 * <li>fractional seconds precision: {@link #getPrecision()}</li> 408 * </ul> 409 * </li> 410* <li>TIMESTAMPTZ</li> 411 * </ul> 412* 413* 414* <p>XML 415 * <ul> 416* <li>XML 417 * <ul> 418 * <li>{@link EDataType#xml_t} 419 * </li> 420 * </ul> 421 * </li> 422* <li>XMLTYPE(Oracle)</li> 423 * </ul> 424* 425* <p>HIVE array 426 * <ul> 427* <li>array</li> 428 * 429 * <li>{@link EDataType#listType_t} 430 * </li> 431 * <li>T: {@link #getTypeOfList()}</li> 432 * </ul> 433 * 434* 435 * 436 * <p>OTHERS 437 * <ul> 438* <li>BFILE(Oracle)</li> 439 * 440 * <li>{@link EDataType#bfile_t} 441 * </li> 442 * 443 * 444* <li>BIT(MySQL,PostgreSQL,SQL Server)</li> 445* <li>BITVARYING/VARBIT(PostgreSQL)</li> 446* <li>BOX(PostgreSQL)</li> 447* <li>CIDR(PostgreSQL)</li> 448* <li>CIRCLE(PostgreSQL)</li> 449* <li>CURSOR(SQL Server)</li> 450* <li>ENUM(MySQL, PostgreSQL)</li> 451* <li>GEOGRAPHY(SQL Server)</li> 452 * 453 * <li>{@link EDataType#geography_t} 454 * </li> 455 * 456 * 457* <li>GEOMETRY(SQL Server)</li> 458 * <li>{@link EDataType#geometry_t} 459 * </li> 460* <li>HIERARCHYID(SQL Server)</li> 461* <li>INET(PostgreSQL)</li> 462* <li>LINE(PostgreSQL)</li> 463* <li>LONG(Oracle)</li> 464 * <li>{@link EDataType#long_t} 465 * </li> 466* <li>LONG VARCHAR</li> 467* <li>LONG VARGRAPHIC</li> 468* <li>LONGTEXT(MySQL)</li> 469* <li>LSEG(PostgreSQL)</li> 470* <li>MACADDR(PostgreSQL)</li> 471* <li>MEDIUMBLOB(MySQL)</li> 472* <li>MEDIUMTEXT(MySQL)</li> 473* <li>MONEY(PostgreSQL,SQL Server)</li> 474* <li>OID(PostgreSQL)</li> 475* <li>PATH(PostgreSQL)</li> 476* <li>POINT(PostgreSQL)</li> 477* <li>POLYGON(PostgreSQL)</li> 478* <li>RAW(Oracle)</li> 479 * <li>{@link EDataType#raw_t} 480 * </li> 481* <li>ROWID(Oracle)</li> 482* <li>ROWVERSION(SQL Server)</li> 483* <li>SERIAL, SERIAL4(MySQL,PostgreSQL)</li> 484* <li>SERIAL8, BIGSERIAL(PostgreSQL)</li> 485* <li>SET(MySQL)</li> 486* <li>SMALLMONEY(SQL Server)</li> 487* <li>SQL_VARIANT(SQL Server)</li> 488* <li>TABLE(SQL Server)</li> 489* <li>UNIQUEIDENTIFIER(SQL Server)</li> 490* <li>UROWID(Oracle)</li> 491 * </ul> 492* 493* 494* <p>datatypes optional attributes: 495* <ul> 496* <li>NSIGNED (MySQL)</li> 497* <li>ZEROFILL (MySQL)</li> 498* <li>CHARACTER SET cs_name (MySQL)</li> 499* <li>COLLATE collation_name (MySQL)</li> 500* </ul> 501 * 502* @see TDatatypeAttribute 503* 504*/ 505public class TTypeName extends TParseTreeNode implements Cloneable { 506 507 private TCharacterDatatypeProperty characterDatatypeProperty; 508 509 public void setCharacterDatatypeProperty(TCharacterDatatypeProperty characterDatatypeProperty) { 510 this.characterDatatypeProperty = characterDatatypeProperty; 511 } 512 513 public TCharacterDatatypeProperty getCharacterDatatypeProperty() { 514 return characterDatatypeProperty; 515 } 516 517 @Override 518 public String toString(){ 519 StringBuilder sb = new StringBuilder(); 520 TTypeName subType; 521 // tables.append(",\t"+column.getColumnDataType().toString()); 522 switch (this.getDataType()){ 523 case array_t: 524 subType = this.getTypeOfList(); 525 526 if ((subType != null) && (subType.getDataType() == EDataType.struct_t)){ 527 sb.append("array"); 528 sb.append("\n\tstruct"); 529 for(int k=0;k<subType.getColumnDefList().size();k++){ 530 sb.append("\n\t\t\t\t\t\t"+ subType.getColumnDefList().getColumn(k).getColumnName().toString() 531 +",\t"+ subType.getColumnDefList().getColumn(k).getDatatype().toString()); 532 } 533 }else{ 534 sb.append(super.toString()); 535 } 536 break; 537 case struct_t: 538 subType = this; 539 for(int k=0;k<subType.getColumnDefList().size();k++){ 540 sb.append("\n\t\t\t\t\t\t"+ subType.getColumnDefList().getColumn(k).getColumnName().toString() 541 +",\t"+ subType.getColumnDefList().getColumn(k).getDatatype().toString()); 542 } 543 break; 544 default: 545 String s = super.toString(); 546 if (s == null) s = this.plainText; // 这个值是在 clone() method 中设置的 547 sb.append(s); 548 break; 549 } 550 551 return sb.toString(); 552 } 553 public TTypeName clone(){ 554 TTypeName cloneObject = new TTypeName(); 555 cloneObject.dataType = this.dataType; 556 if (this.typeOfList != null){ 557 cloneObject.typeOfList = this.typeOfList.clone(); 558 } 559 560 if (this.columnDefList != null){ 561 cloneObject.columnDefList = new TColumnDefinitionList(); 562 for(int i=0;i<this.columnDefList.size();i++){ 563 cloneObject.columnDefList.addColumn(this.columnDefList.getColumn(i).clone()); 564 } 565 } 566 567 cloneObject.setPlainText(this.toString()); // 下面的两个设置token的操作会导致 原 TTypeName 的内存不能释放,导致内存泄漏,所有用 setPlainText 设置文本信息 568 569// cloneObject.setStartToken(this.getStartToken()); 570// cloneObject.setEndToken(this.getEndToken()); 571 572 return cloneObject; 573 } 574 575 @Override 576 public void setPlainText(String plainText) { 577 this.plainText = plainText; 578 } 579 580 private String plainText; 581 582 public TTypeName(){ 583 584 } 585 586 public TTypeName(EDataType dataType){ 587 this.dataType = dataType; 588 } 589 590 public TTypeName(EDataType dataType,TConstant length){ 591 this(dataType); 592 switch (this.dataType){ 593 case time_t: 594 case timetz_t: 595 case timentz_t: 596 case timestamp_with_time_zone_t: 597 case timestamp_with_local_time_zone_t: 598 this.fractionalSecondsPrecision = length; 599 break; 600 case interval_year_to_month_t: 601 case interval_day_to_second_t: 602 this.precision = length; 603 break; 604 default: 605 this.length = length; 606 break; 607 } 608 } 609 610 public TTypeName(EDataType dataType,TConstant precision, TConstant scale){ 611 this(dataType); 612 this.precision = precision; 613 switch (this.dataType){ 614 case interval_year_to_month_t: 615 case interval_day_to_second_t: 616 this.secondsPrecision = scale; 617 break; 618 default: 619 this.scale = scale; 620 break; 621 } 622 623 } 624 625 private TConstant fractionalSecondsPrecision; 626 627 public void setFractionalSecondsPrecision(TConstant fractionalSecondsPrecision) { 628 this.fractionalSecondsPrecision = fractionalSecondsPrecision; 629 } 630 631 public TConstant getFractionalSecondsPrecision() { 632 633 return fractionalSecondsPrecision; 634 } 635 636 private boolean byteUnit = false; 637 638 public boolean isCharUnit() { 639 return charUnit; 640 } 641 642 public boolean isByteUnit() { 643 return byteUnit; 644 } 645 646 private boolean charUnit = false; 647 648 private boolean varying = false; 649 650 public boolean isVarying() { 651 return varying; 652 } 653 654 // Filled once, when the class is initialized. They used to be filled on the first lookup; two 655 // threads parsing Teradata at once then filled the same HashMap together, and a concurrent resize 656 // could drop entries for the rest of the JVM: TestThreadSafety followed by TestMantis4647 failed 657 // about one run in sixty, with x(DATE) parsed as a function call. 658 private static final Map<String, EDataType> dataTypeMap = new HashMap<String, EDataType>( ); 659 private static final Map<String, EDataType> teradataDataTypeMap = new HashMap<String, EDataType>( ); 660 661 static { 662 teradataDataTypeMap.put("array",EDataType.array_t); 663 teradataDataTypeMap.put("varray",EDataType.varray_t); 664 teradataDataTypeMap.put("blob",EDataType.blob_t); 665 teradataDataTypeMap.put("byte",EDataType.byte_t); 666 teradataDataTypeMap.put("varbyte",EDataType.varbyte_t); 667 teradataDataTypeMap.put("bigint",EDataType.bigint_t); 668 teradataDataTypeMap.put("byteint",EDataType.byteint_t); 669 teradataDataTypeMap.put("date",EDataType.date_t); 670 teradataDataTypeMap.put("dec",EDataType.dec_t); 671 teradataDataTypeMap.put("decimal",EDataType.decimal_t); 672 teradataDataTypeMap.put("double_precision",EDataType.double_precision_t); 673 teradataDataTypeMap.put("float",EDataType.float_t); 674 teradataDataTypeMap.put("integer",EDataType.int_t); 675 teradataDataTypeMap.put("int",EDataType.int_t); 676 teradataDataTypeMap.put("number",EDataType.number_t); 677 teradataDataTypeMap.put("numeric",EDataType.numeric_t); 678 teradataDataTypeMap.put("real",EDataType.real_t); 679 teradataDataTypeMap.put("smallint",EDataType.smallint_t); 680 teradataDataTypeMap.put("time",EDataType.time_t); 681 teradataDataTypeMap.put("timestamp",EDataType.timestamp_t); 682 teradataDataTypeMap.put("interval",EDataType.interval_t); 683 teradataDataTypeMap.put("char",EDataType.char_t); 684 teradataDataTypeMap.put("character",EDataType.char_t); 685 teradataDataTypeMap.put("clob",EDataType.clob_t); 686 teradataDataTypeMap.put("long",EDataType.long_t); 687 teradataDataTypeMap.put("long_varchar",EDataType.long_varchar_t); 688 teradataDataTypeMap.put("varchar",EDataType.varchar_t); 689 teradataDataTypeMap.put("period",EDataType.period_t); 690 teradataDataTypeMap.put("td_anytype",EDataType.td_anytype_t); 691 teradataDataTypeMap.put("variant_type",EDataType.variant_t); 692 teradataDataTypeMap.put("xml",EDataType.xml_t); 693 dataTypeMap.put("bfile",EDataType.bfile_t); 694 dataTypeMap.put("bigint",EDataType.bigint_t); 695 dataTypeMap.put("bignumeric",EDataType.bignumeric_t); 696 dataTypeMap.put("bigserial",EDataType.bigserial_t); 697 dataTypeMap.put("binary",EDataType.binary_t); 698 dataTypeMap.put("bit",EDataType.bit_t); 699 dataTypeMap.put("blob",EDataType.blob_t); 700 dataTypeMap.put("boolean",EDataType.boolean_t); 701 dataTypeMap.put("byte",EDataType.byte_t); 702 dataTypeMap.put("bytea",EDataType.bytea_t); 703 dataTypeMap.put("byteint",EDataType.byteint_t); 704 dataTypeMap.put("char",EDataType.char_t); 705 dataTypeMap.put("character",EDataType.char_t); 706 dataTypeMap.put("clob",EDataType.clob_t); 707 dataTypeMap.put("date",EDataType.date_t); 708 dataTypeMap.put("datetime",EDataType.datetime_t); 709 dataTypeMap.put("datetime2",EDataType.datetime2_t); 710 dataTypeMap.put("datetimeoffset",EDataType.datetime_t); 711 dataTypeMap.put("dec",EDataType.dec_t); 712 dataTypeMap.put("decimal",EDataType.dec_t); 713 dataTypeMap.put("double",EDataType.double_precision_t); 714 dataTypeMap.put("double_precision",EDataType.double_precision_t); 715 dataTypeMap.put("float",EDataType.float_t); 716 dataTypeMap.put("geometry",EDataType.geometry_t); 717 dataTypeMap.put("geography",EDataType.geography_t); 718 dataTypeMap.put("hierarchyid",EDataType.hierarchyid_t); 719 dataTypeMap.put("int",EDataType.int_t); 720 dataTypeMap.put("int4",EDataType.int4_t); 721 dataTypeMap.put("int64",EDataType.int64_t); 722 dataTypeMap.put("int8",EDataType.int8_t); 723 dataTypeMap.put("integer",EDataType.int_t); 724 dataTypeMap.put("interval",EDataType.interval_t); 725 dataTypeMap.put("image",EDataType.varbinary_t); 726 dataTypeMap.put("long",EDataType.long_t); 727 dataTypeMap.put("long_raw",EDataType.long_raw_t); 728 dataTypeMap.put("money",EDataType.money_t); 729 dataTypeMap.put("nchar",EDataType.nchar_t); 730 dataTypeMap.put("nclob",EDataType.nclob_t); 731 dataTypeMap.put("number",EDataType.number_t); 732 dataTypeMap.put("numeric",EDataType.numeric_t); 733 dataTypeMap.put("ntext",EDataType.nvarchar_t); 734 dataTypeMap.put("nvarchar",EDataType.nvarchar_t); 735 dataTypeMap.put("period",EDataType.period_t); 736 dataTypeMap.put("real",EDataType.real_t); 737 dataTypeMap.put("refcursor",EDataType.refcursor_t); 738 dataTypeMap.put("rowid",EDataType.rowid_t); 739 dataTypeMap.put("serial",EDataType.serial_t); 740 dataTypeMap.put("signtype",EDataType.signtype_t); 741 dataTypeMap.put("simple_integer",EDataType.simple_integer_t); 742 dataTypeMap.put("smalldatetime",EDataType.datetime_t); 743 dataTypeMap.put("smallint",EDataType.smallint_t); 744 dataTypeMap.put("smallmoney",EDataType.smallmoney_t); 745 dataTypeMap.put("sql_variant",EDataType.sql_variant_t); 746 dataTypeMap.put("string",EDataType.string_t); 747 dataTypeMap.put("text",EDataType.text_t); 748 dataTypeMap.put("time",EDataType.time_t); 749 dataTypeMap.put("timestamp",EDataType.timestamp_t); 750 dataTypeMap.put("tinyint",EDataType.tinyint_t); 751 dataTypeMap.put("uniqueidentifier",EDataType.uniqueidentifier_t); 752 dataTypeMap.put("uuid",EDataType.uuid_t); 753 dataTypeMap.put("varbinary",EDataType.varbinary_t); 754 dataTypeMap.put("varbyte",EDataType.varbyte_t); 755 dataTypeMap.put("varchar",EDataType.varchar_t); 756 dataTypeMap.put("xml",EDataType.xml_t); 757 dataTypeMap.put("xmltype",EDataType.xml_t); 758 } 759 760 public static EDataType searchTeradataTypeByName(String typenameStr){ 761 return teradataDataTypeMap.get(typenameStr.toLowerCase(java.util.Locale.ROOT)); 762 } 763 764 public static EDataType searchTypeByName(String typenameStr, EDbVendor dbVendor){ 765 if (dbVendor == EDbVendor.dbvteradata) return searchTeradataTypeByName(typenameStr); 766 else return searchTypeByName(typenameStr); 767 } 768 769 public static EDataType searchTypeByName(String typenameStr){ 770 return dataTypeMap.get(typenameStr.toLowerCase(java.util.Locale.ROOT)); 771 } 772 773 private String charsetName = null; 774 private String collationName = null; 775 private TColumnDefinitionList columnDefList; 776 777 public void setCharsetAndCollation(TDummy dummy){ 778 if (dummy == null) return; 779 if (dummy.int1 == 1){ // character set 780 charsetName = dummy.node1.toString(); 781 }else if (dummy.int1 == 2){ // collation 782 collationName = dummy.node1.toString(); 783 }else if (dummy.int1 == 3){ // character set and collation 784 charsetName = dummy.node1.toString(); 785 collationName = dummy.node2.toString(); 786 } 787// if (dummy.node1 != null){ 788// charsetName = dummy.node1.toString(); 789// } 790// if (dummy.st1 != null){ 791// collationName = dummy.node2.toString(); 792// } 793 } 794 795 public void setCharsetNameByToken(TSourceToken st){ 796 if (st == null) return; 797 charsetName = st.toString(); 798 } 799 public void setCharsetName(String charsetName) { 800 this.charsetName = charsetName; 801 } 802 803 public void setCollationName(String collationName) { 804 this.collationName = collationName; 805 } 806 807 public String getCharsetName() { 808 if (charsetName != null) return charsetName; 809 if (characterDatatypeProperty != null) return characterDatatypeProperty.getCharacterSetName(); 810 return null; 811 } 812 813 814 public String getCollationName() { 815 return collationName; 816 } 817 818 private TTypeName typeOfList; 819 private TTypeName primitiveTypeOfMap; 820 private TTypeName typeOfMap; 821 822 public void setColTypeList(TPTNodeList<TTypeName> colTypeList) { 823 this.colTypeList = colTypeList; 824 } 825 826 public TPTNodeList<TTypeName> getColTypeList() { 827 828 return colTypeList; 829 } 830 831 private TPTNodeList <TTypeName> colTypeList; 832 833 public void setColumnDefList(TColumnDefinitionList columnDefList) { 834 this.columnDefList = columnDefList; 835 } 836 837 /** 838 * The fields of a STRUCT or ROW type in declaration order: BigQuery {@code STRUCT<a INT64>}, Hive family 839 * {@code STRUCT<a:INT>}, Trino family {@code ROW(a INTEGER)}; null for any other type. 840 * 841 * @return the declared fields, each a column definition with its name and type 842 */ 843 public TColumnDefinitionList getColumnDefList() { 844 845 return columnDefList; 846 } 847 848 public void setTypeOfMap(TTypeName typeOfMap) { 849 this.typeOfMap = typeOfMap; 850 } 851 852 public void setPrimitiveTypeOfMap(TTypeName primitiveTypeOfMap) { 853 854 this.primitiveTypeOfMap = primitiveTypeOfMap; 855 } 856 857 public TTypeName getTypeOfMap() { 858 859 return typeOfMap; 860 } 861 862 public TTypeName getPrimitiveTypeOfMap() { 863 864 return primitiveTypeOfMap; 865 } 866 867 public void setTypeOfList(TTypeName typeOfList) { 868 this.typeOfList = typeOfList; 869 } 870 871 /** 872 * Type of <T> in Hive, BigQuery Array <T>. BigQuery struct <T> 873 * 874 * @return HIVE, BigQuery element type of Array <T>, struct <T> 875 */ 876 public TTypeName getTypeOfList() { 877 878 return typeOfList; 879 } 880 881 public void setDataTypeByObjectName(TObjectName objectName){ 882 if (objectName == null) return; 883 dataTypeObjectName = objectName; 884 String tokenText = TBaseType.getTextWithoutQuoted(objectName.toString()); 885 EDataType t = searchTypeByName(tokenText); 886 if (t != null){ 887 dataType = t; 888 }else if(dataType == EDataType.generic_t){ 889 if (dataTypeName == null){ 890 dataTypeName = objectName.toString(); 891 } 892 } 893 } 894 public void setDataTypeByToken(TSourceToken st){ 895 if (st == null) return; 896 String tokenText = st.getTextWithoutQuoted(); 897 EDataType t = searchTypeByName(tokenText); 898 if (t != null){ 899 dataType = t; 900 }else if(dataType == EDataType.generic_t){ 901 if (dataTypeName == null){ 902 dataTypeName = st.toString(); 903 } 904 } 905 } 906 907 private String dataTypeName = null; 908 private TObjectName dataTypeObjectName = null; 909 910 /** 911 * The original parsed name of a named datatype or an anchored datatype's 912 * reference (for example {@code employees.last_name} in {@code %TYPE}). 913 * Its tokens retain qualification, delimiters and source positions. The 914 * datatype attributes distinguish a type name, {@code %TYPE} reference, 915 * and {@code %ROWTYPE} reference; a name alone does not prove a catalog binding. 916 */ 917 public TObjectName getDataTypeObjectName() { 918 return dataTypeObjectName; 919 } 920 921 /** 922 * The string representation of the datatype 923 * @return The string representation of the datatype 924 */ 925 public String getDataTypeName() { 926 switch (dataType){ 927 case double_precision_t: 928 return "double precision"; 929 case unsigned_int_t: 930 return "unsigned int"; 931 case long_raw_t: 932 return "long raw"; 933 case binary_float_t: 934 return "binary float"; 935 case binary_double_t: 936 return "binary double"; 937 case timestamp_with_time_zone_t: 938 case timestamp_with_local_time_zone_t: 939 return "timestamp"; 940 case interval_year_to_month_t: 941 return "interval year"; 942 case interval_day_to_second_t: 943 return "interval day"; 944 case generic_t: 945 if (dataTypeName != null){ 946 return dataTypeName; 947 } 948 else if (getStartToken() != null){ 949 return getStartToken().toString(); 950 }else 951 return ""; 952 case unknown_t: 953 if (dataTypeName != null){ 954 return dataTypeName; 955 } 956 else if (getStartToken() != null){ 957 return getStartToken().toString(); 958 }else 959 return ""; 960 default: 961 break; 962 } 963 964 if (dataTypeName != null) return dataTypeName; 965 966 String ret = getDataType().toString(); 967 if (ret.endsWith("_t")){ 968 ret = ret.substring(0,ret.length()-2); 969 } 970 return ret; 971 972 } 973 974 private EDataType dataType = EDataType.unknown_t; 975 976 public void setDataType(EDataType dataType) { 977 this.dataType = dataType; 978 } 979 980 /** 981 * 982 * @return a value of {@link EDataType} 983 * 984 */ 985 public EDataType getDataType() { 986 987 return dataType; 988 } 989 990 991 992 private TConstant start; //informix serial (start) 993 994 public void setStart(TConstant start) { 995 this.start = start; 996 } 997 998 public TConstant getStart() { 999 1000 return start; 1001 } 1002 1003 private TConstant Max; //informix nvarchar(max,reserve) 1004 1005 public void setMax(TConstant max) { 1006 Max = max; 1007 } 1008 1009 public void setReserve(TConstant reserve) { 1010 Reserve = reserve; 1011 } 1012 1013 public TConstant getMax() { 1014 1015 return Max; 1016 } 1017 1018 public TConstant getReserve() { 1019 return Reserve; 1020 } 1021 1022 private TConstant Reserve; //informix nvarchar(max,reserve) 1023 1024 private TConstant length; 1025 1026 /** 1027 * mysql display length for integer datatype 1028 * @return constant 1029 */ 1030 public TConstant getDisplayLength() { 1031 return displayLength; 1032 } 1033 1034 private TConstant displayLength; // mysql display length for integer, https://stackoverflow.com/questions/3135804/types-in-mysql-bigint20-vs-int20/3135854#3135854 1035 1036 public void setLength(TConstant length) { 1037 this.length = length; 1038 } 1039 1040 /** 1041 * it's a number, or a max constant. 1042 * @return a value of {@link TConstant}, length of this datatype. 1043 */ 1044 public TConstant getLength() { 1045 return length; 1046 } 1047 1048 private TConstant precision; 1049 private TConstant scale; 1050 private TConstant storageFormat; 1051 1052 private TConstant secondsPrecision; 1053 1054 /** 1055 * 1056 * @return a value of {@link TConstant}, typically the second precision value of datatype. 1057 */ 1058 public TConstant getSecondsPrecision() { 1059 return secondsPrecision; 1060 } 1061 1062 public void setPrecision(TConstant precision) { 1063 this.precision = precision; 1064 } 1065 1066 /** 1067 * 1068 * @return a value of {@link TConstant}, scale value of datatypes such as numeric, float. 1069 */ 1070 public TConstant getScale() { 1071 return scale; 1072 } 1073 1074 /** 1075 * 1076 * @return a value of {@link TConstant}, precision value of datatypes such as numeric, float. 1077 */ 1078 public TConstant getPrecision() { 1079 1080 return precision; 1081 } 1082 1083 public void setScale(TConstant scale) { 1084 this.scale = scale; 1085 } 1086 1087 /** 1088 * For VECTOR type, returns the storage format (DENSE or SPARSE). 1089 * 1090 * @return a value of {@link TConstant}, storage format of VECTOR type. 1091 */ 1092 public TConstant getStorageFormat() { 1093 return storageFormat; 1094 } 1095 1096 public void setStorageFormat(TConstant storageFormat) { 1097 this.storageFormat = storageFormat; 1098 } 1099 1100 public void setPrecisionScale(TPrecisionScale precisionScale){ 1101 if (precisionScale != null){ 1102 precision = precisionScale.getPrecision(); 1103 scale = precisionScale.getScale(); 1104 storageFormat = precisionScale.getStorageFormat(); 1105 } 1106 } 1107 1108 private TPTNodeList <TIndices> arrays; 1109 1110 /** 1111 * index value of datetype in PostgreSQL. like this: SimpleTypename ARRAY [n,...]. 1112 * 1113 * @return a list of {@link TIndices}, 1114 */ 1115 public TPTNodeList<TIndices> getArrays() { 1116 return arrays; 1117 } 1118 1119 public void setArrays(TPTNodeList<TIndices> arrays) { 1120 1121 this.arrays = arrays; 1122 } 1123 1124 private TPTNodeList <TDatatypeAttribute> datatypeAttributeList; 1125 1126 public void setDatatypeAttributeList(TPTNodeList <TDatatypeAttribute> datatypeAttributeList) { 1127 this.datatypeAttributeList = datatypeAttributeList; 1128 } 1129 1130 /** 1131 * datatype attribute element. 1132 * @return a list of {@link TDatatypeAttribute} 1133 */ 1134 public TPTNodeList <TDatatypeAttribute> getDatatypeAttributeList() { 1135 1136 if (datatypeAttributeList == null){ 1137 datatypeAttributeList = new TPTNodeList <TDatatypeAttribute> (); 1138 } 1139 return datatypeAttributeList; 1140 } 1141 1142 public void init(Object arg1,Object arg2,Object arg3){ 1143 init(arg1,arg2); 1144 1145 if (arg3 != null) { 1146 switch (dataType){ 1147 case interval_year_to_month_t: 1148 break; 1149 case interval_day_to_second_t: 1150 case interval_second_t: 1151 case interval_minute_to_second_t: 1152 case interval_hour_to_second_t: 1153 this.secondsPrecision = (TConstant)arg3; 1154 break; 1155 case map_t: 1156 keyType = (TTypeName) arg2; 1157 valueType = (TTypeName)arg3; 1158 break; 1159 case string_t: 1160 collationName = ((TObjectName)arg3).toString(); 1161 break; 1162 case generic_t: 1163 if (arg3 instanceof TObjectName) { 1164 this.dataTypeObjectName = (TObjectName) arg3; 1165 this.dataTypeName = dataTypeObjectName.toString(); 1166 } 1167 1168 break; 1169 default: 1170 break; 1171 } 1172 } 1173 } 1174 1175 public void setTypeModifiers(TExpressionList exprList){ 1176 if (exprList == null) return; 1177 if (exprList.size() == 1){ 1178 TExpression e = exprList.getExpression(0); 1179 if (e.getExpressionType() == EExpressionType.simple_constant_t) 1180 precision = e.getConstantOperand(); 1181 }else if (exprList.size() == 2){ 1182 TExpression e = exprList.getExpression(0); 1183 if (e.getExpressionType() == EExpressionType.simple_constant_t) 1184 precision = e.getConstantOperand(); 1185 TExpression e1 = exprList.getExpression(1); 1186 if (e1.getExpressionType() == EExpressionType.simple_constant_t) 1187 scale = e1.getConstantOperand(); 1188 } 1189 1190 } 1191 1192 private TTypeName elementType; 1193 private TTypeName keyType; 1194 private TTypeName valueType; 1195 1196 public TTypeName getElementType() { 1197 return elementType; 1198 } 1199 1200 public TTypeName getKeyType() { 1201 return keyType; 1202 } 1203 1204 public TTypeName getValueType() { 1205 return valueType; 1206 } 1207 1208 public void init(Object arg1, Object arg2){ 1209 init(arg1); 1210 1211 if ((arg2 != null) ){ 1212 1213 switch (dataType){ 1214 case interval_day_to_second_t: 1215 case interval_year_to_month_t: 1216 case interval_second_t: 1217 case interval_minute_to_second_t: 1218 case interval_hour_to_second_t: 1219 case interval_hour_to_minute_t: 1220 case interval_hour_t: 1221 case interval_day_to_minute_t: 1222 case interval_day_to_hour_t: 1223 case interval_month_t: 1224 case interval_year_t: 1225 precision = (TConstant)arg2; 1226 length = null; 1227 break; 1228 case binary_t: 1229 case varbinary_t: 1230 case bytea_t: 1231 case raw_t: 1232 case char_t: 1233 case nchar_t: 1234 case varchar_t: 1235 case varchar2_t: 1236 case nvarchar_t: 1237 case nvarchar2_t: 1238 case ntext_t: 1239 case long_varbinary_t: 1240 case long_varchar_t: 1241 case character_t: 1242 case byte_t: 1243 case varbyte_t: 1244 case clob_t: 1245 case blob_t: 1246 if (arg2 instanceof TConstant){ 1247 length = (TConstant)arg2; 1248 } 1249 else if (arg2 instanceof TDummy){ 1250 length = (TConstant)(((TDummy)arg2).node1); 1251 } 1252 break; 1253 case timestamp_t: 1254 if (arg2 instanceof TConstant){ 1255 length = (TConstant)arg2; 1256 scale = length; 1257 } 1258 else if (arg2 instanceof TDummy){ 1259 length = (TConstant)(((TDummy)arg2).node1); 1260 scale = length; 1261 } 1262 // if scale > 6, then set length to 11, otherwise, set length to 7 1263 // https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html#GUID-7B72E154-677A-4342-A1EA-C74C1EA928E6 1264 1265 if (scale != null){ 1266 Integer tmpi = scale.getIntegerValue(); 1267 if (tmpi != null){ 1268 if (tmpi > 6){ 1269 length = new TConstant(); 1270 length.init(ELiteralType.integer_et,new TSourceToken("11")); 1271 }else{ 1272 length = new TConstant(); 1273 length.init(ELiteralType.integer_et,new TSourceToken("7")); 1274 } 1275 } 1276 } 1277 1278 break; 1279 case time_t: 1280 case timetz_t: 1281 case timentz_t: 1282 case timestamp_with_time_zone_t: 1283 case timestamp_with_local_time_zone_t: 1284 if (arg2 instanceof TConstant){ 1285 fractionalSecondsPrecision = (TConstant)arg2; 1286 } 1287 else if (arg2 instanceof TDummy){ 1288 fractionalSecondsPrecision = (TConstant)(((TDummy)arg2).node1); 1289 } 1290 break; 1291 case string_t: 1292 if (arg2 instanceof TConstant){ //snowflake 1293 this.length = (TConstant)arg2; 1294// }else if (arg2 instanceof TObjectName){ //bigquery 1295// collationName = ((TObjectName)arg2).toString(); 1296 } else if (arg2 instanceof TDummy){ 1297 length = (TConstant)(((TDummy)arg2).node1); 1298 } 1299 1300 break; 1301 case xml_t: 1302 case xmltype_t: 1303 this.precision = ((TPrecisionScale)arg2).getPrecision(); 1304 this.scale = ((TPrecisionScale)arg2).getScale(); 1305 break; 1306 case array_t: 1307 case set_t: 1308 this.elementType = (TTypeName)arg2; 1309 break; 1310 case vargraphic_t: 1311 this.length = (TConstant)arg2; 1312 break; 1313 case int_t: 1314 case int2_t: 1315 case int4_t: 1316 case bigint_t: 1317 if (arg2 instanceof TDummy){ //mysql display length 1318 this.displayLength = (TConstant)(((TDummy)arg2).node1); 1319 } 1320 break; 1321 case generic_t: 1322 if (arg2 instanceof TObjectName) { 1323 this.dataTypeObjectName = (TObjectName) arg2; 1324 this.dataTypeName = dataTypeObjectName.toString(); 1325 } 1326 break; 1327 default: 1328 if (arg2 instanceof TPrecisionScale){ 1329 this.precision = ((TPrecisionScale)arg2).getPrecision(); 1330 this.scale = ((TPrecisionScale)arg2).getScale(); 1331 this.storageFormat = ((TPrecisionScale)arg2).getStorageFormat(); 1332 if (dataType == EDataType.period_t){ 1333 secondsPrecision = ((TPrecisionScale)arg2).getPrecision(); 1334 } 1335 }else if (arg2 instanceof TDummy){ //opt_float rule in y file 1336 this.precision = (TConstant)(((TDummy)arg2).node1); 1337 }else if (arg2 instanceof TConstant){ 1338 this.length = (TConstant)arg2; 1339 } 1340 break; 1341 } 1342 } 1343 } 1344 1345 public void init(Object arg1){ 1346 dataType = (EDataType)arg1; 1347 } 1348 1349 public void setByteUnit(boolean byteUnit) { 1350 this.byteUnit = byteUnit; 1351 } 1352 1353 public void setCharUnit(boolean charUnit) { 1354 this.charUnit = charUnit; 1355 } 1356 1357 public void setVarying(boolean varying) { 1358 this.varying = varying; 1359 } 1360 1361 public void setSecondsPrecision(TConstant secondsPrecision) { 1362 this.secondsPrecision = secondsPrecision; 1363 } 1364 1365 public void setCharUnit(TSourceToken st){ 1366 if (st == null) return; 1367 if (st.tokencode == TBaseType.rrw_char){ 1368 charUnit = true; 1369 }else{ 1370 byteUnit = true; 1371 } 1372 1373 } 1374 1375 public void setVarying(TSourceToken st){ 1376 if (st != null){ 1377 varying = true; 1378 switch (dataType){ 1379 case char_t: 1380 dataType = EDataType.varchar_t; 1381 break; 1382 case nchar_t: 1383 dataType = EDataType.nvarchar_t; 1384 break; 1385 case bit_t: 1386 dataType = EDataType.varbit_t; 1387 break; 1388 default: 1389 break; 1390 } 1391 } 1392 } 1393 1394 /** 1395 * used in y file, setup dbobject type of all source tokens consist of this datatype. 1396 */ 1397 public void setDataTypeInTokens(){ 1398 if (this.getStartToken() == null) return; 1399 if (this.getEndToken() == null) return; 1400 TSourceTokenList stlist = this.getStartToken().container; 1401 TSourceToken st = null; 1402 int level = 0; 1403 for(int i= this.getStartToken().posinlist; i<=this.getEndToken().posinlist;i++){ 1404 st = stlist.get(i); 1405 if (st.tokentype == ETokenType.ttleftparenthesis){ level++; continue;} 1406 if (st.tokentype == ETokenType.ttrightparenthesis){ level--; continue;} 1407 if (level == 0){ 1408 st.setDbObjType(TObjectName.ttobjDatatype); 1409 } 1410 } 1411 1412 if ((this.type == TTypeName.lfdGeneric)||(this.dataType == EDataType.generic_t)){ 1413// st= getStartToken(); 1414// if (st.toString().equalsIgnoreCase("datetime")){ 1415// this.type = lfdDatetime; 1416// dataType = EDataType.datetime_t; 1417// } 1418 setDataTypeByToken(getStartToken()); 1419 } 1420 } 1421 1422 1423 public void setIntervalType(TDummy dummy){ 1424 if (dummy == null) return; 1425 TSourceToken startToken = dummy.getStartToken(); 1426 if (startToken == null) return; 1427 TSourceToken endToken = dummy.getEndToken(); 1428 if (endToken == null) return; 1429 TSourceTokenList stlist = startToken.container; 1430 1431 boolean hasYear = false; 1432 boolean hasMonth = false; 1433 boolean hasDay = false; 1434 boolean hasHour = false; 1435 boolean hasMinute = false; 1436 boolean hasSecond = false; 1437 boolean hasTo = false; 1438 1439 // For better pattern detection, track token positions 1440 int yearPos = -1; 1441 int monthPos = -1; 1442 int dayPos = -1; 1443 int hourPos = -1; 1444 int minutePos = -1; 1445 int secondPos = -1; 1446 int toPos = -1; 1447 1448 // Scan tokens to determine interval type 1449 for (int i = startToken.posinlist; i <= endToken.posinlist; i++) { 1450 TSourceToken st = stlist.get(i); 1451 String tokenText = st.toString().toLowerCase(java.util.Locale.ROOT); 1452 1453 if (tokenText.equals("year") || tokenText.equals("years")) { 1454 hasYear = true; 1455 yearPos = i; 1456 } else if (tokenText.equals("month") || tokenText.equals("months")) { 1457 hasMonth = true; 1458 monthPos = i; 1459 } else if (tokenText.equals("day") || tokenText.equals("days")) { 1460 hasDay = true; 1461 dayPos = i; 1462 } else if (tokenText.equals("hour") || tokenText.equals("hours")) { 1463 hasHour = true; 1464 hourPos = i; 1465 } else if (tokenText.equals("minute") || tokenText.equals("minutes")) { 1466 hasMinute = true; 1467 minutePos = i; 1468 } else if (tokenText.equals("second") || tokenText.equals("seconds")) { 1469 hasSecond = true; 1470 secondPos = i; 1471 } else if (tokenText.equals("to")) { 1472 hasTo = true; 1473 toPos = i; 1474 } 1475 } 1476 1477 // Determine interval type based on patterns and token positions 1478 if (hasTo) { 1479 // Check for YEAR TO MONTH pattern 1480 if (hasYear && hasMonth && yearPos < toPos && toPos < monthPos) { 1481 setDataType(EDataType.interval_year_to_month_t); 1482 return; 1483 } 1484 1485 // Check for DAY TO SECOND pattern 1486 if (hasDay && hasSecond && dayPos < toPos && toPos < secondPos) { 1487 setDataType(EDataType.interval_day_to_second_t); 1488 return; 1489 } 1490 1491 // Check for DAY TO MINUTE pattern 1492 if (hasDay && hasMinute && dayPos < toPos && toPos < minutePos) { 1493 setDataType(EDataType.interval_day_to_minute_t); 1494 return; 1495 } 1496 1497 // Check for DAY TO HOUR pattern 1498 if (hasDay && hasHour && dayPos < toPos && toPos < hourPos) { 1499 setDataType(EDataType.interval_day_to_hour_t); 1500 return; 1501 } 1502 1503 // Check for HOUR TO SECOND pattern 1504 if (hasHour && hasSecond && hourPos < toPos && toPos < secondPos) { 1505 setDataType(EDataType.interval_hour_to_second_t); 1506 return; 1507 } 1508 1509 // Check for HOUR TO MINUTE pattern 1510 if (hasHour && hasMinute && hourPos < toPos && toPos < minutePos) { 1511 setDataType(EDataType.interval_hour_to_minute_t); 1512 return; 1513 } 1514 1515 // Check for MINUTE TO SECOND pattern 1516 if (hasMinute && hasSecond && minutePos < toPos && toPos < secondPos) { 1517 setDataType(EDataType.interval_minute_to_second_t); 1518 return; 1519 } 1520 } 1521 1522 // Single-unit interval types (no TO keyword or not a recognized pattern) 1523 if (hasYear) { 1524 setDataType(EDataType.interval_year_t); 1525 } else if (hasMonth) { 1526 setDataType(EDataType.interval_month_t); 1527 } else if (hasDay) { 1528 setDataType(EDataType.interval_day_t); 1529 } else if (hasHour) { 1530 setDataType(EDataType.interval_hour_t); 1531 } else if (hasMinute) { 1532 setDataType(EDataType.interval_minute_t); 1533 } else if (hasSecond) { 1534 setDataType(EDataType.interval_second_t); 1535 } else { 1536 // Default to generic interval type if specific type can't be determined 1537 setDataType(EDataType.interval_t); 1538 } 1539 } 1540 1541 public void accept(TParseTreeVisitor v){ 1542 v.preVisit(this); 1543 v.postVisit(this); 1544 } 1545 1546 public void acceptChildren(TParseTreeVisitor v){ 1547 v.preVisit(this); 1548 v.postVisit(this); 1549 } 1550 1551 1552 1553 1554// following datatype const was deprecated since v1.4.3.0. 1555// DON'T use those const, use EDataType instead. 1556 1557 public void setType(int type) { 1558 this.type = type; 1559// switch (type){ 1560// case lfdGeneric: 1561// this.dataType = EDataType.generic_t; 1562// break; 1563// case lfdFloat: 1564// this.dataType = EDataType.float_t; 1565// break; 1566// case lfdDoublePrecision: 1567// this.dataType = EDataType.double_t; 1568// break; 1569// case lfdDecimal: 1570// case lfdDec: 1571// this.dataType = EDataType.dec_t; 1572// break; 1573// case lfdNumeric: 1574// this.dataType = EDataType.numeric_t; 1575// break; 1576// case lfdnumber: 1577// case lfdNum: 1578// this.dataType = EDataType.number_t; 1579// break; 1580// case lfdInteger: 1581// case lfdInt: 1582// this.dataType = EDataType.int_t; 1583// break; 1584// case lfdBit: 1585// this.dataType = EDataType.bit_t; 1586// break; 1587// case lfdBoolean: 1588// this.dataType = EDataType.bool_t; 1589// break; 1590// case lfdVarbinary: 1591// this.dataType = EDataType.varbinary_t; 1592// break; 1593// case lfdBinary: 1594// this.dataType = EDataType.binary_t; 1595// break; 1596// case lfdSmallint: 1597// dataType = EDataType.smallint_t; 1598// break; 1599// case lfdReal: 1600// dataType = EDataType.real_t; 1601// break; 1602// case lfdTinyInt: 1603// dataType = EDataType.tinyint_t; 1604// break; 1605// case lfdBigInt: 1606// dataType = EDataType.bigint_t; 1607// break; 1608// case lfdCharacter: 1609// case lfdChar: 1610// dataType = EDataType.char_t; 1611// break; 1612// case lfdVarchar: 1613// case lfdCharVar: 1614// case lfdCharacterVar: 1615// case lfdCharacterVarying: 1616// case lfdCharVarying: 1617// dataType = EDataType.varchar_t; 1618// break; 1619// case lfdVarchar2: 1620// dataType = EDataType.varchar2_t; 1621// break; 1622// case lfdNvarchar2: 1623// dataType = EDataType.nvarchar2_t; 1624// break; 1625// case lfdNationalCharacter: 1626// case lfdNationalChar: 1627// case lfdNchar: 1628// dataType = EDataType.nchar_t; 1629// break; 1630// case lfdNVarchar: 1631// case lfdNationalCharVarying: 1632// case lfdNcharVarying: 1633// dataType = EDataType.nvarchar_t; 1634// break; 1635// case lfdLongvarchar: 1636// dataType = EDataType.long_varchar_t; 1637// break; 1638// case lfdLongvarbinary: 1639// dataType = EDataType.long_varbinary_t; 1640// break; 1641// case lfdYear: 1642// dataType = EDataType.year_t; 1643// break; 1644// case lfdDate: 1645// dataType = EDataType.date_t; 1646// break; 1647// case lfdTimestamp: 1648// dataType = EDataType.timestamp_t; 1649// break; 1650// case lfdTimeStampWithTZ: 1651// dataType = EDataType.timestamp_with_time_zone_t; 1652// break; 1653// case lfdTimeStampWithLTZ: 1654// dataType = EDataType.timestamp_with_local_time_zone_t; 1655// break; 1656// case lfdTime: 1657// dataType = EDataType.time_t; 1658// break; 1659// case lfdDatetime: 1660// dataType = EDataType.datetime_t; 1661// break; 1662// case lfdIntervalYTM: 1663// case lfdIntervalYearToMonth: 1664// dataType = EDataType.interval_year_to_month_t; 1665// break; 1666// case lfdIntervalDTS: 1667// case lfdIntervalDayToSecond: 1668// dataType = EDataType.interval_day_to_second_t; 1669// break; 1670// case lfdLong: 1671// dataType = EDataType.long_t; 1672// break; 1673// case lfdRaw: 1674// dataType = EDataType.raw_t; 1675// break; 1676// case lfdLongRaw: 1677// dataType = EDataType.long_raw_t; 1678// break; 1679// case lfdBlob: 1680// dataType = EDataType.blob_t; 1681// break; 1682// case lfdClob: 1683// dataType = EDataType.clob_t; 1684// break; 1685// case lfdNClob: 1686// dataType = EDataType.nclob_t; 1687// break; 1688// case lfdBfile: 1689// dataType = EDataType.bfile_t; 1690// break; 1691// case lfdTinyblob: 1692// dataType = EDataType.tinyblob_t; 1693// break; 1694// case lfdMediumblob: 1695// dataType = EDataType.mediumblob_t; 1696// break; 1697// case lfdLongblob: 1698// dataType = EDataType.longblob_t; 1699// break; 1700// case lfdTinytext: 1701// dataType = EDataType.tinytext_t; 1702// break; 1703// case lfdText: 1704// dataType = EDataType.text_t; 1705// break; 1706// case lfdntext: 1707// dataType = EDataType.ntext_t; 1708// break; 1709// case lfdMediumtext: 1710// dataType = EDataType.mediumtext_t; 1711// break; 1712// case lfdLongtext: 1713// dataType = EDataType.longtext_t; 1714// break; 1715// case lfdURowid: 1716// dataType= EDataType.urowid_t; 1717// break; 1718// case lfdEnum: 1719// dataType = EDataType.enum_t; 1720// break; 1721// case lfdBinaryLargeObject: 1722// dataType = EDataType.binary_large_object_t; 1723// break; 1724// case lfdGraphic: 1725// dataType = EDataType.graphic_t; 1726// break; 1727// case lfdVarGraphic: 1728// dataType = EDataType.vargraphic_t; 1729// break; 1730// case lfdLongVarGraphic: 1731// dataType = EDataType.long_vargraphic_t; 1732// break; 1733// case lfdDatalink: 1734// dataType = EDataType.datalink_t; 1735// break; 1736// case lfdBinaryInteger: 1737// dataType = EDataType.binary_integer_t; 1738// break; 1739// case lfdPlsInteger: 1740// dataType = EDataType.pls_integer_t; 1741// break; 1742// case lfdByteint: 1743// dataType = EDataType.byteint_t; 1744// break; 1745// case lfdTimeWithTZ: 1746// dataType = EDataType.timetz_t; 1747// break; 1748// case lfdIntervalYear: 1749// dataType = EDataType.interval_year_t; 1750// break; 1751// case lfdIntervalMonth: 1752// dataType = EDataType.interval_month_t; 1753// break; 1754// case lfdIntervalDay: 1755// dataType = EDataType.interval_day_t; 1756// break; 1757// case lfdIntervalDayToHour: 1758// dataType = EDataType.interval_day_to_hour_t; 1759// break; 1760// case lfdIntervalDayToMinute: 1761// dataType = EDataType.interval_day_to_minute_t; 1762// break; 1763// case lfdIntervalHour: 1764// dataType = EDataType.interval_hour_t; 1765// break; 1766// case lfdIntervalHourToMinute: 1767// dataType = EDataType.interval_hour_to_minute_t; 1768// break; 1769// case lfdIntervalHourToSecond: 1770// dataType = EDataType.interval_hour_to_second_t; 1771// break; 1772// case lfdIntervalMinute: 1773// dataType = EDataType.interval_minute_t; 1774// break; 1775// case lfdIntervalMinuteToSecond: 1776// dataType = EDataType.interval_minute_to_second_t; 1777// break; 1778// case lfdIntervalSecond: 1779// dataType = EDataType.interval_second_t; 1780// break; 1781// case lfdByte: 1782// dataType = EDataType.byte_t; 1783// break; 1784// case lfdVarByte: 1785// dataType = EDataType.varbyte_t; 1786// break; 1787// case lfdPeriod: 1788// dataType = EDataType.period_t; 1789// break; 1790// case lfdCharacterLargeObject: 1791// case lfdCharLargeObject: 1792// dataType = EDataType.char_large_object_t; 1793// break; 1794// case lfdGeoMetry: 1795// dataType = EDataType.geometry_t; 1796// break; 1797// case lfdGeoGraphy: 1798// dataType = EDataType.geography_t; 1799// break; 1800// case lfdSet: 1801// dataType = EDataType.set_t; 1802// break; 1803// case lfdDBClob: 1804// dataType = EDataType.dbclob_t; 1805// break; 1806// case lfdInterval: 1807// dataType = EDataType.interval_t; 1808// break; 1809// default: 1810// break; 1811// } 1812 } 1813 1814 public int getType() { 1815 1816 return type; 1817 } 1818 1819 private int type = lfdUnknown; 1820 1821 /** 1822 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#unknown_t} 1823 */ 1824public final static int lfdUnknown = 2; 1825 /** 1826 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#generic_t} 1827 */ 1828public final static int lfdGeneric = 3; 1829 /** 1830 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#float_t} 1831 */ 1832public final static int lfdFloat = 4; 1833 /** 1834 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#double_t} 1835 */ 1836public final static int lfdDoublePrecision = 8; 1837 /** 1838 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dec_t} 1839 */ 1840public final static int lfdDecimal = 9; 1841 /** 1842 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dec_t} 1843 */ 1844public final static int lfdDec = 10; 1845 /** 1846 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#numeric_t} 1847 */ 1848public final static int lfdNumeric = 11; 1849 /** 1850 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#number_t} 1851 */ 1852public final static int lfdnumber = 12; 1853 /** 1854 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#number_t} 1855 */ 1856public final static int lfdNum = 13; 1857 /** 1858 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#int_t} 1859 */ 1860public final static int lfdInteger = 14; 1861 /** 1862 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bit_t} 1863 */ 1864public final static int lfdBit = 22; 1865 /** 1866 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bool_t} 1867 */ 1868public final static int lfdBoolean = 23; 1869 /** 1870 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varbinary_t} 1871 */ 1872public final static int lfdVarbinary = 33; 1873 /** 1874 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_t} 1875 */ 1876public final static int lfdBinary = 34; 1877 /** 1878 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#int_t} 1879 */ 1880public final static int lfdInt = 40; 1881 /** 1882 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#smallint_t} 1883 */ 1884public final static int lfdSmallint = 41; 1885 /** 1886 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#real_t} 1887 */ 1888public final static int lfdReal = 42; 1889 /** 1890 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinyint_t} 1891 */ 1892public final static int lfdTinyInt = 43; 1893// public final static int lfdMediumInt = 44; 1894/** 1895 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bigint_t} 1896 */ 1897public final static int lfdBigInt = 45; 1898 /** 1899 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_t} 1900 */ 1901public final static int lfdCharacter = 46; 1902 /** 1903 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_t} 1904 */ 1905public final static int lfdChar = 47; 1906 /** 1907 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 1908 */ 1909public final static int lfdVarchar = 48; 1910 /** 1911 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar2_t} 1912 */ 1913public final static int lfdVarchar2 = 49; 1914// public final static int lfdbinaryVar = 55; 1915 /** 1916 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_varchar_t} 1917 */ 1918public final static int lfdLongvarchar = 56; 1919 /** 1920 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_varbinary_t} 1921 */ 1922public final static int lfdLongvarbinary = 57; 1923// public final static int lfdMySQLSet = 58; 1924 /** 1925 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#year_t} 1926 */ 1927public final static int lfdYear = 59; 1928// public final static int lfdDouble = 60; 1929 /** 1930 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nchar_t} 1931 */ 1932public final static int lfdNationalChar = 61; 1933 /** 1934 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nchar_t} 1935 */ 1936public final static int lfdNchar = 62; 1937 /** 1938 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#date_t} 1939 */ 1940public final static int lfdDate = 63; 1941 /** 1942 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_t} 1943 */ 1944public final static int lfdTimestamp = 64; 1945 /** 1946 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_with_time_zone_t} 1947 */ 1948public final static int lfdTimeStampWithTZ = 65; 1949 /** 1950 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_with_local_time_zone_t} 1951 */ 1952public final static int lfdTimeStampWithLTZ = 66; 1953// public final static int lfdDateWithFmt = 67; 1954 /** 1955 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#time_t} 1956 */ 1957public final static int lfdTime = 68; 1958 /** 1959 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#datetime_t} 1960 */ 1961public final static int lfdDatetime = 69; 1962// public final static int lfdsmalldatetime = 70; 1963 /** 1964 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_to_month_t} 1965 */ 1966public final static int lfdIntervalYTM = 71; 1967 /** 1968 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_second_t} 1969 */ 1970public final static int lfdIntervalDTS = 72; 1971 /** 1972 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_t} 1973 */ 1974public final static int lfdLong = 73; 1975 /** 1976 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#raw_t} 1977 */ 1978public final static int lfdRaw = 74; 1979 /** 1980 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_raw_t} 1981 */ 1982public final static int lfdLongRaw = 75; 1983 /** 1984 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#blob_t} 1985 */ 1986public final static int lfdBlob = 76; 1987 /** 1988 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#clob_t} 1989 */ 1990public final static int lfdClob = 77; 1991 /** 1992 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nclob_t} 1993 */ 1994public final static int lfdNClob = 78; 1995 /** 1996 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bfile_t} 1997 */ 1998public final static int lfdBfile = 79; 1999// public final static int lfddbclob = 80; 2000 /** 2001 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinyblob_t} 2002 */ 2003public final static int lfdTinyblob = 81; 2004 /** 2005 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#mediumblob_t} 2006 */ 2007public final static int lfdMediumblob = 82; 2008 /** 2009 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#longblob_t} 2010 */ 2011public final static int lfdLongblob = 83; 2012 /** 2013 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinytext_t} 2014 */ 2015public final static int lfdTinytext = 84; 2016 /** 2017 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#text_t} 2018 */ 2019public final static int lfdText = 85; 2020 /** 2021 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#ntext_t} 2022 */ 2023public final static int lfdntext = 86; 2024// public final static int lfdimage = 87; 2025 /** 2026 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#mediumtext_t} 2027 */ 2028public final static int lfdMediumtext = 88; 2029 /** 2030 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#longtext_t} 2031 */ 2032public final static int lfdLongtext = 89; 2033 /** 2034 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#urowid_t} 2035 */ 2036public final static int lfdURowid = 90; 2037 /** 2038 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#enum_t} 2039 */ 2040public final static int lfdEnum = 91; 2041 /** 2042 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_large_object_t} 2043 */ 2044public final static int lfdBinaryLargeObject = 102; 2045 /** 2046 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#graphic_t} 2047 */ 2048public final static int lfdGraphic = 103; 2049 /** 2050 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#vargraphic_t} 2051 */ 2052public final static int lfdVarGraphic = 104; 2053 /** 2054 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_vargraphic_t} 2055 */ 2056public final static int lfdLongVarGraphic = 105; 2057 /** 2058 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#datalink_t} 2059 */ 2060public final static int lfdDatalink = 106; 2061 /** 2062 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_integer_t} 2063 */ 2064public final static int lfdBinaryInteger = 107; // plsql 2065 /** 2066 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#pls_integer_t} 2067 */ 2068public final static int lfdPlsInteger = 108; // plsql 2069 /** 2070 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#byteint_t} 2071 */ 2072public final static int lfdByteint = 120; // teradata 2073 /** 2074 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#time_with_time_zone_t} 2075 */ 2076public final static int lfdTimeWithTZ = 121; //teradata 2077 /** 2078 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_t} 2079 */ 2080public final static int lfdIntervalYear = 130; //teradata 2081 /** 2082 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_to_month_t} 2083 */ 2084public final static int lfdIntervalYearToMonth = 131; //teradata 2085 /** 2086 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_month_t} 2087 */ 2088public final static int lfdIntervalMonth = 132; //teradata 2089 /** 2090 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_t} 2091 */ 2092public final static int lfdIntervalDay = 133; //teradata 2093 /** 2094 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_hour_t} 2095 */ 2096public final static int lfdIntervalDayToHour = 134; //teradata 2097 /** 2098 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_minute_t} 2099 */ 2100public final static int lfdIntervalDayToMinute = 135; //teradata 2101 /** 2102 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_second_t} 2103 */ 2104public final static int lfdIntervalDayToSecond = 136; //teradata 2105 /** 2106 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_t} 2107 */ 2108public final static int lfdIntervalHour = 137; //teradata 2109 /** 2110 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_to_minute_t} 2111 */ 2112public final static int lfdIntervalHourToMinute = 138; //teradata 2113 /** 2114 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_to_second_t} 2115 */ 2116public final static int lfdIntervalHourToSecond = 139; //teradata 2117 /** 2118 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_minute_t} 2119 */ 2120public final static int lfdIntervalMinute = 140; //teradata 2121 /** 2122 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_minute_to_second_t} 2123 */ 2124public final static int lfdIntervalMinuteToSecond = 141; //teradata 2125 /** 2126 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_second_t} 2127 */ 2128public final static int lfdIntervalSecond = 142; //teradata 2129 /** 2130 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#byte_t} 2131 */ 2132public final static int lfdByte = 143; //teradata 2133 /** 2134 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varbyte_t} 2135 */ 2136public final static int lfdVarByte = 144; //teradata 2137 /** 2138 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 2139 */ 2140public final static int lfdCharacterVarying = 145; //teradata 2141 /** 2142 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 2143 */ 2144public final static int lfdCharVarying = 146; //teradata 2145 /** 2146 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#period_t} 2147 */ 2148public final static int lfdPeriod = 147; //teradata 2149 /** 2150 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_large_object_t} 2151 */ 2152public final static int lfdCharacterLargeObject = 148; //teradata 2153 /** 2154 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#geometry_t} 2155 */ 2156public final static int lfdGeoMetry = 150;//sql srever 2008 2157 /** 2158 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#geography_t} 2159 */ 2160public final static int lfdGeoGraphy = 151;//sql srever 2008 2161 2162//public final static int lfdSigned = 160;//mysql 2163//public final static int lfdUnSigned = 161;//mysql 2164 /** 2165 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nvarchar_t} 2166 */ 2167public final static int lfdNationalCharVarying = 162;//mysql 2168 /** 2169 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nvarchar_t} 2170 */ 2171public final static int lfdNcharVarying = 163;//mysql 2172 /** 2173 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#set_t} 2174 */ 2175public final static int lfdSet = 164;//mysql 2176 2177 /** 2178 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_large_object_t} 2179 */ 2180public final static int lfdCharLargeObject = 171;//db2 2181 /** 2182 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dbclob_t} 2183 */ 2184public final static int lfdDBClob = 172; 2185 /** 2186 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_t} 2187 */ 2188public final static int lfdInterval = 181; //postgresql 2189 2190 2191/** 2192 * plsql type atribute 2193 * @deprecated As of v1.4.3.0, replaced by {@link TDatatypeAttribute} 2194 */ 2195public final static int lfdTypeAtribute = 107; 2196 2197/** 2198 * plsql rowtype atribute 2199 * @deprecated As of v1.4.3.0, replaced by {@link TDatatypeAttribute} 2200 */ 2201public final static int lfdRowTypeAtribute = 108; 2202 2203}