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 private static Map<String, EDataType> dataTypeMap = new HashMap<String, EDataType>( ); 655 private static Map<String, EDataType> teradataDataTypeMap = new HashMap<String, EDataType>( ); 656 657 public static EDataType searchTeradataTypeByName(String typenameStr){ 658 659 if (teradataDataTypeMap.size() == 0){ 660 teradataDataTypeMap.put("array",EDataType.array_t); 661 teradataDataTypeMap.put("varray",EDataType.varray_t); 662 teradataDataTypeMap.put("blob",EDataType.blob_t); 663 teradataDataTypeMap.put("byte",EDataType.byte_t); 664 teradataDataTypeMap.put("varbyte",EDataType.varbyte_t); 665 teradataDataTypeMap.put("bigint",EDataType.bigint_t); 666 teradataDataTypeMap.put("byteint",EDataType.byteint_t); 667 teradataDataTypeMap.put("date",EDataType.date_t); 668 teradataDataTypeMap.put("dec",EDataType.dec_t); 669 teradataDataTypeMap.put("decimal",EDataType.decimal_t); 670 teradataDataTypeMap.put("double_precision",EDataType.double_precision_t); 671 teradataDataTypeMap.put("float",EDataType.float_t); 672 teradataDataTypeMap.put("integer",EDataType.int_t); 673 teradataDataTypeMap.put("int",EDataType.int_t); 674 teradataDataTypeMap.put("number",EDataType.number_t); 675 teradataDataTypeMap.put("numeric",EDataType.numeric_t); 676 teradataDataTypeMap.put("real",EDataType.real_t); 677 teradataDataTypeMap.put("smallint",EDataType.smallint_t); 678 teradataDataTypeMap.put("time",EDataType.time_t); 679 teradataDataTypeMap.put("timestamp",EDataType.timestamp_t); 680 teradataDataTypeMap.put("interval",EDataType.interval_t); 681 teradataDataTypeMap.put("char",EDataType.char_t); 682 teradataDataTypeMap.put("character",EDataType.char_t); 683 teradataDataTypeMap.put("clob",EDataType.clob_t); 684 teradataDataTypeMap.put("long",EDataType.long_t); 685 teradataDataTypeMap.put("long_varchar",EDataType.long_varchar_t); 686 teradataDataTypeMap.put("varchar",EDataType.varchar_t); 687 teradataDataTypeMap.put("period",EDataType.period_t); 688 teradataDataTypeMap.put("td_anytype",EDataType.td_anytype_t); 689 teradataDataTypeMap.put("variant_type",EDataType.variant_t); 690 teradataDataTypeMap.put("xml",EDataType.xml_t); 691 } 692 693 return teradataDataTypeMap.get(typenameStr.toLowerCase()); 694 } 695 696 public static EDataType searchTypeByName(String typenameStr, EDbVendor dbVendor){ 697 if (dbVendor == EDbVendor.dbvteradata) return searchTeradataTypeByName(typenameStr); 698 else return searchTypeByName(typenameStr); 699 } 700 701 public static EDataType searchTypeByName(String typenameStr){ 702 703 if (dataTypeMap.size() == 0){ 704 dataTypeMap.put("bfile",EDataType.bfile_t); 705 dataTypeMap.put("bigint",EDataType.bigint_t); 706 dataTypeMap.put("bignumeric",EDataType.bignumeric_t); 707 dataTypeMap.put("bigserial",EDataType.bigserial_t); 708 dataTypeMap.put("binary",EDataType.binary_t); 709 dataTypeMap.put("bit",EDataType.bit_t); 710 dataTypeMap.put("blob",EDataType.blob_t); 711 dataTypeMap.put("boolean",EDataType.boolean_t); 712 dataTypeMap.put("byte",EDataType.byte_t); 713 dataTypeMap.put("bytea",EDataType.bytea_t); 714 dataTypeMap.put("byteint",EDataType.byteint_t); 715 dataTypeMap.put("char",EDataType.char_t); 716 dataTypeMap.put("character",EDataType.char_t); 717 dataTypeMap.put("clob",EDataType.clob_t); 718 dataTypeMap.put("date",EDataType.date_t); 719 dataTypeMap.put("datetime",EDataType.datetime_t); 720 dataTypeMap.put("datetime2",EDataType.datetime2_t); 721 dataTypeMap.put("datetimeoffset",EDataType.datetime_t); 722 dataTypeMap.put("dec",EDataType.dec_t); 723 dataTypeMap.put("decimal",EDataType.dec_t); 724 dataTypeMap.put("double",EDataType.double_precision_t); 725 dataTypeMap.put("double_precision",EDataType.double_precision_t); 726 dataTypeMap.put("float",EDataType.float_t); 727 dataTypeMap.put("geometry",EDataType.geometry_t); 728 dataTypeMap.put("geography",EDataType.geography_t); 729 dataTypeMap.put("hierarchyid",EDataType.hierarchyid_t); 730 dataTypeMap.put("int",EDataType.int_t); 731 dataTypeMap.put("int4",EDataType.int4_t); 732 dataTypeMap.put("int64",EDataType.int64_t); 733 dataTypeMap.put("int8",EDataType.int8_t); 734 dataTypeMap.put("integer",EDataType.int_t); 735 dataTypeMap.put("interval",EDataType.interval_t); 736 dataTypeMap.put("image",EDataType.varbinary_t); 737 dataTypeMap.put("long",EDataType.long_t); 738 dataTypeMap.put("long_raw",EDataType.long_raw_t); 739 dataTypeMap.put("money",EDataType.money_t); 740 dataTypeMap.put("nchar",EDataType.nchar_t); 741 dataTypeMap.put("nclob",EDataType.nclob_t); 742 dataTypeMap.put("number",EDataType.number_t); 743 dataTypeMap.put("numeric",EDataType.numeric_t); 744 dataTypeMap.put("ntext",EDataType.nvarchar_t); 745 dataTypeMap.put("nvarchar",EDataType.nvarchar_t); 746 dataTypeMap.put("period",EDataType.period_t); 747 dataTypeMap.put("real",EDataType.real_t); 748 dataTypeMap.put("refcursor",EDataType.refcursor_t); 749 dataTypeMap.put("rowid",EDataType.rowid_t); 750 dataTypeMap.put("serial",EDataType.serial_t); 751 dataTypeMap.put("signtype",EDataType.signtype_t); 752 dataTypeMap.put("simple_integer",EDataType.simple_integer_t); 753 dataTypeMap.put("smalldatetime",EDataType.datetime_t); 754 dataTypeMap.put("smallint",EDataType.smallint_t); 755 dataTypeMap.put("smallmoney",EDataType.smallmoney_t); 756 dataTypeMap.put("sql_variant",EDataType.sql_variant_t); 757 dataTypeMap.put("string",EDataType.string_t); 758 dataTypeMap.put("text",EDataType.text_t); 759 dataTypeMap.put("time",EDataType.time_t); 760 dataTypeMap.put("timestamp",EDataType.timestamp_t); 761 dataTypeMap.put("tinyint",EDataType.tinyint_t); 762 dataTypeMap.put("uniqueidentifier",EDataType.uniqueidentifier_t); 763 dataTypeMap.put("varbinary",EDataType.varbinary_t); 764 dataTypeMap.put("varbyte",EDataType.varbyte_t); 765 dataTypeMap.put("varchar",EDataType.varchar_t); 766 dataTypeMap.put("xml",EDataType.xml_t); 767 dataTypeMap.put("xmltype",EDataType.xml_t); 768 } 769 770 return dataTypeMap.get(typenameStr.toLowerCase()); 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 * Fields in the BigQuery struct <fields> 839 * 840 * @return BigQuery struct <fields> 841 */ 842 public TColumnDefinitionList getColumnDefList() { 843 844 return columnDefList; 845 } 846 847 public void setTypeOfMap(TTypeName typeOfMap) { 848 this.typeOfMap = typeOfMap; 849 } 850 851 public void setPrimitiveTypeOfMap(TTypeName primitiveTypeOfMap) { 852 853 this.primitiveTypeOfMap = primitiveTypeOfMap; 854 } 855 856 public TTypeName getTypeOfMap() { 857 858 return typeOfMap; 859 } 860 861 public TTypeName getPrimitiveTypeOfMap() { 862 863 return primitiveTypeOfMap; 864 } 865 866 public void setTypeOfList(TTypeName typeOfList) { 867 this.typeOfList = typeOfList; 868 } 869 870 /** 871 * Type of <T> in Hive, BigQuery Array <T>. BigQuery struct <T> 872 * 873 * @return HIVE, BigQuery element type of Array <T>, struct <T> 874 */ 875 public TTypeName getTypeOfList() { 876 877 return typeOfList; 878 } 879 880 public void setDataTypeByObjectName(TObjectName objectName){ 881 if (objectName == null) return; 882 dataTypeObjectName = objectName; 883 String tokenText = TBaseType.getTextWithoutQuoted(objectName.toString()); 884 EDataType t = searchTypeByName(tokenText); 885 if (t != null){ 886 dataType = t; 887 }else if(dataType == EDataType.generic_t){ 888 if (dataTypeName == null){ 889 dataTypeName = objectName.toString(); 890 } 891 } 892 } 893 public void setDataTypeByToken(TSourceToken st){ 894 if (st == null) return; 895 String tokenText = st.getTextWithoutQuoted(); 896 EDataType t = searchTypeByName(tokenText); 897 if (t != null){ 898 dataType = t; 899 }else if(dataType == EDataType.generic_t){ 900 if (dataTypeName == null){ 901 dataTypeName = st.toString(); 902 } 903 } 904 } 905 906 private String dataTypeName = null; 907 private TObjectName dataTypeObjectName = null; 908 909 public TObjectName getDataTypeObjectName() { 910 return dataTypeObjectName; 911 } 912 913 /** 914 * The string representation of the datatype 915 * @return The string representation of the datatype 916 */ 917 public String getDataTypeName() { 918 switch (dataType){ 919 case double_precision_t: 920 return "double precision"; 921 case unsigned_int_t: 922 return "unsigned int"; 923 case long_raw_t: 924 return "long raw"; 925 case binary_float_t: 926 return "binary float"; 927 case binary_double_t: 928 return "binary double"; 929 case timestamp_with_time_zone_t: 930 case timestamp_with_local_time_zone_t: 931 return "timestamp"; 932 case interval_year_to_month_t: 933 return "interval year"; 934 case interval_day_to_second_t: 935 return "interval day"; 936 case generic_t: 937 if (dataTypeName != null){ 938 return dataTypeName; 939 } 940 else if (getStartToken() != null){ 941 return getStartToken().toString(); 942 }else 943 return ""; 944 case unknown_t: 945 if (dataTypeName != null){ 946 return dataTypeName; 947 } 948 else if (getStartToken() != null){ 949 return getStartToken().toString(); 950 }else 951 return ""; 952 default: 953 break; 954 } 955 956 if (dataTypeName != null) return dataTypeName; 957 958 String ret = getDataType().toString(); 959 if (ret.endsWith("_t")){ 960 ret = ret.substring(0,ret.length()-2); 961 } 962 return ret; 963 964 } 965 966 private EDataType dataType = EDataType.unknown_t; 967 968 public void setDataType(EDataType dataType) { 969 this.dataType = dataType; 970 } 971 972 /** 973 * 974 * @return a value of {@link EDataType} 975 * 976 */ 977 public EDataType getDataType() { 978 979 return dataType; 980 } 981 982 983 984 private TConstant start; //informix serial (start) 985 986 public void setStart(TConstant start) { 987 this.start = start; 988 } 989 990 public TConstant getStart() { 991 992 return start; 993 } 994 995 private TConstant Max; //informix nvarchar(max,reserve) 996 997 public void setMax(TConstant max) { 998 Max = max; 999 } 1000 1001 public void setReserve(TConstant reserve) { 1002 Reserve = reserve; 1003 } 1004 1005 public TConstant getMax() { 1006 1007 return Max; 1008 } 1009 1010 public TConstant getReserve() { 1011 return Reserve; 1012 } 1013 1014 private TConstant Reserve; //informix nvarchar(max,reserve) 1015 1016 private TConstant length; 1017 1018 /** 1019 * mysql display length for integer datatype 1020 * @return constant 1021 */ 1022 public TConstant getDisplayLength() { 1023 return displayLength; 1024 } 1025 1026 private TConstant displayLength; // mysql display length for integer, https://stackoverflow.com/questions/3135804/types-in-mysql-bigint20-vs-int20/3135854#3135854 1027 1028 public void setLength(TConstant length) { 1029 this.length = length; 1030 } 1031 1032 /** 1033 * it's a number, or a max constant. 1034 * @return a value of {@link TConstant}, length of this datatype. 1035 */ 1036 public TConstant getLength() { 1037 return length; 1038 } 1039 1040 private TConstant precision; 1041 private TConstant scale; 1042 private TConstant storageFormat; 1043 1044 private TConstant secondsPrecision; 1045 1046 /** 1047 * 1048 * @return a value of {@link TConstant}, typically the second precision value of datatype. 1049 */ 1050 public TConstant getSecondsPrecision() { 1051 return secondsPrecision; 1052 } 1053 1054 public void setPrecision(TConstant precision) { 1055 this.precision = precision; 1056 } 1057 1058 /** 1059 * 1060 * @return a value of {@link TConstant}, scale value of datatypes such as numeric, float. 1061 */ 1062 public TConstant getScale() { 1063 return scale; 1064 } 1065 1066 /** 1067 * 1068 * @return a value of {@link TConstant}, precision value of datatypes such as numeric, float. 1069 */ 1070 public TConstant getPrecision() { 1071 1072 return precision; 1073 } 1074 1075 public void setScale(TConstant scale) { 1076 this.scale = scale; 1077 } 1078 1079 /** 1080 * For VECTOR type, returns the storage format (DENSE or SPARSE). 1081 * 1082 * @return a value of {@link TConstant}, storage format of VECTOR type. 1083 */ 1084 public TConstant getStorageFormat() { 1085 return storageFormat; 1086 } 1087 1088 public void setStorageFormat(TConstant storageFormat) { 1089 this.storageFormat = storageFormat; 1090 } 1091 1092 public void setPrecisionScale(TPrecisionScale precisionScale){ 1093 if (precisionScale != null){ 1094 precision = precisionScale.getPrecision(); 1095 scale = precisionScale.getScale(); 1096 storageFormat = precisionScale.getStorageFormat(); 1097 } 1098 } 1099 1100 private TPTNodeList <TIndices> arrays; 1101 1102 /** 1103 * index value of datetype in PostgreSQL. like this: SimpleTypename ARRAY [n,...]. 1104 * 1105 * @return a list of {@link TIndices}, 1106 */ 1107 public TPTNodeList<TIndices> getArrays() { 1108 return arrays; 1109 } 1110 1111 public void setArrays(TPTNodeList<TIndices> arrays) { 1112 1113 this.arrays = arrays; 1114 } 1115 1116 private TPTNodeList <TDatatypeAttribute> datatypeAttributeList; 1117 1118 public void setDatatypeAttributeList(TPTNodeList <TDatatypeAttribute> datatypeAttributeList) { 1119 this.datatypeAttributeList = datatypeAttributeList; 1120 } 1121 1122 /** 1123 * datatype attribute element. 1124 * @return a list of {@link TDatatypeAttribute} 1125 */ 1126 public TPTNodeList <TDatatypeAttribute> getDatatypeAttributeList() { 1127 1128 if (datatypeAttributeList == null){ 1129 datatypeAttributeList = new TPTNodeList <TDatatypeAttribute> (); 1130 } 1131 return datatypeAttributeList; 1132 } 1133 1134 public void init(Object arg1,Object arg2,Object arg3){ 1135 init(arg1,arg2); 1136 1137 if (arg3 != null) { 1138 switch (dataType){ 1139 case interval_year_to_month_t: 1140 break; 1141 case interval_day_to_second_t: 1142 case interval_second_t: 1143 case interval_minute_to_second_t: 1144 case interval_hour_to_second_t: 1145 this.secondsPrecision = (TConstant)arg3; 1146 break; 1147 case map_t: 1148 keyType = (TTypeName) arg2; 1149 valueType = (TTypeName)arg3; 1150 break; 1151 case string_t: 1152 collationName = ((TObjectName)arg3).toString(); 1153 break; 1154 case generic_t: 1155 if (arg3 instanceof TObjectName) { 1156 this.dataTypeName = ((TObjectName) arg3).toString(); 1157 } 1158 1159 break; 1160 default: 1161 break; 1162 } 1163 } 1164 } 1165 1166 public void setTypeModifiers(TExpressionList exprList){ 1167 if (exprList == null) return; 1168 if (exprList.size() == 1){ 1169 TExpression e = exprList.getExpression(0); 1170 if (e.getExpressionType() == EExpressionType.simple_constant_t) 1171 precision = e.getConstantOperand(); 1172 }else if (exprList.size() == 2){ 1173 TExpression e = exprList.getExpression(0); 1174 if (e.getExpressionType() == EExpressionType.simple_constant_t) 1175 precision = e.getConstantOperand(); 1176 TExpression e1 = exprList.getExpression(1); 1177 if (e1.getExpressionType() == EExpressionType.simple_constant_t) 1178 scale = e1.getConstantOperand(); 1179 } 1180 1181 } 1182 1183 private TTypeName elementType; 1184 private TTypeName keyType; 1185 private TTypeName valueType; 1186 1187 public TTypeName getElementType() { 1188 return elementType; 1189 } 1190 1191 public TTypeName getKeyType() { 1192 return keyType; 1193 } 1194 1195 public TTypeName getValueType() { 1196 return valueType; 1197 } 1198 1199 public void init(Object arg1, Object arg2){ 1200 init(arg1); 1201 1202 if ((arg2 != null) ){ 1203 1204 switch (dataType){ 1205 case interval_day_to_second_t: 1206 case interval_year_to_month_t: 1207 case interval_second_t: 1208 case interval_minute_to_second_t: 1209 case interval_hour_to_second_t: 1210 case interval_hour_to_minute_t: 1211 case interval_hour_t: 1212 case interval_day_to_minute_t: 1213 case interval_day_to_hour_t: 1214 case interval_month_t: 1215 case interval_year_t: 1216 precision = (TConstant)arg2; 1217 length = null; 1218 break; 1219 case binary_t: 1220 case varbinary_t: 1221 case bytea_t: 1222 case raw_t: 1223 case char_t: 1224 case nchar_t: 1225 case varchar_t: 1226 case varchar2_t: 1227 case nvarchar_t: 1228 case nvarchar2_t: 1229 case ntext_t: 1230 case long_varbinary_t: 1231 case long_varchar_t: 1232 case character_t: 1233 case byte_t: 1234 case varbyte_t: 1235 case clob_t: 1236 case blob_t: 1237 if (arg2 instanceof TConstant){ 1238 length = (TConstant)arg2; 1239 } 1240 else if (arg2 instanceof TDummy){ 1241 length = (TConstant)(((TDummy)arg2).node1); 1242 } 1243 break; 1244 case timestamp_t: 1245 if (arg2 instanceof TConstant){ 1246 length = (TConstant)arg2; 1247 scale = length; 1248 } 1249 else if (arg2 instanceof TDummy){ 1250 length = (TConstant)(((TDummy)arg2).node1); 1251 scale = length; 1252 } 1253 // if scale > 6, then set length to 11, otherwise, set length to 7 1254 // https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html#GUID-7B72E154-677A-4342-A1EA-C74C1EA928E6 1255 1256 if (scale != null){ 1257 Integer tmpi = scale.getIntegerValue(); 1258 if (tmpi != null){ 1259 if (tmpi > 6){ 1260 length = new TConstant(); 1261 length.init(ELiteralType.integer_et,new TSourceToken("11")); 1262 }else{ 1263 length = new TConstant(); 1264 length.init(ELiteralType.integer_et,new TSourceToken("7")); 1265 } 1266 } 1267 } 1268 1269 break; 1270 case time_t: 1271 case timetz_t: 1272 case timentz_t: 1273 case timestamp_with_time_zone_t: 1274 case timestamp_with_local_time_zone_t: 1275 if (arg2 instanceof TConstant){ 1276 fractionalSecondsPrecision = (TConstant)arg2; 1277 } 1278 else if (arg2 instanceof TDummy){ 1279 fractionalSecondsPrecision = (TConstant)(((TDummy)arg2).node1); 1280 } 1281 break; 1282 case string_t: 1283 if (arg2 instanceof TConstant){ //snowflake 1284 this.length = (TConstant)arg2; 1285// }else if (arg2 instanceof TObjectName){ //bigquery 1286// collationName = ((TObjectName)arg2).toString(); 1287 } else if (arg2 instanceof TDummy){ 1288 length = (TConstant)(((TDummy)arg2).node1); 1289 } 1290 1291 break; 1292 case xml_t: 1293 case xmltype_t: 1294 this.precision = ((TPrecisionScale)arg2).getPrecision(); 1295 this.scale = ((TPrecisionScale)arg2).getScale(); 1296 break; 1297 case array_t: 1298 case set_t: 1299 this.elementType = (TTypeName)arg2; 1300 break; 1301 case vargraphic_t: 1302 this.length = (TConstant)arg2; 1303 break; 1304 case int_t: 1305 case int2_t: 1306 case int4_t: 1307 case bigint_t: 1308 if (arg2 instanceof TDummy){ //mysql display length 1309 this.displayLength = (TConstant)(((TDummy)arg2).node1); 1310 } 1311 break; 1312 case generic_t: 1313 if (arg2 instanceof TObjectName) { 1314 this.dataTypeName = ((TObjectName) arg2).toString(); 1315 } 1316 break; 1317 default: 1318 if (arg2 instanceof TPrecisionScale){ 1319 this.precision = ((TPrecisionScale)arg2).getPrecision(); 1320 this.scale = ((TPrecisionScale)arg2).getScale(); 1321 this.storageFormat = ((TPrecisionScale)arg2).getStorageFormat(); 1322 if (dataType == EDataType.period_t){ 1323 secondsPrecision = ((TPrecisionScale)arg2).getPrecision(); 1324 } 1325 }else if (arg2 instanceof TDummy){ //opt_float rule in y file 1326 this.precision = (TConstant)(((TDummy)arg2).node1); 1327 }else if (arg2 instanceof TConstant){ 1328 this.length = (TConstant)arg2; 1329 } 1330 break; 1331 } 1332 } 1333 } 1334 1335 public void init(Object arg1){ 1336 dataType = (EDataType)arg1; 1337 } 1338 1339 public void setByteUnit(boolean byteUnit) { 1340 this.byteUnit = byteUnit; 1341 } 1342 1343 public void setCharUnit(boolean charUnit) { 1344 this.charUnit = charUnit; 1345 } 1346 1347 public void setVarying(boolean varying) { 1348 this.varying = varying; 1349 } 1350 1351 public void setSecondsPrecision(TConstant secondsPrecision) { 1352 this.secondsPrecision = secondsPrecision; 1353 } 1354 1355 public void setCharUnit(TSourceToken st){ 1356 if (st == null) return; 1357 if (st.tokencode == TBaseType.rrw_char){ 1358 charUnit = true; 1359 }else{ 1360 byteUnit = true; 1361 } 1362 1363 } 1364 1365 public void setVarying(TSourceToken st){ 1366 if (st != null){ 1367 varying = true; 1368 switch (dataType){ 1369 case char_t: 1370 dataType = EDataType.varchar_t; 1371 break; 1372 case nchar_t: 1373 dataType = EDataType.nvarchar_t; 1374 break; 1375 case bit_t: 1376 dataType = EDataType.varbit_t; 1377 break; 1378 default: 1379 break; 1380 } 1381 } 1382 } 1383 1384 /** 1385 * used in y file, setup dbobject type of all source tokens consist of this datatype. 1386 */ 1387 public void setDataTypeInTokens(){ 1388 if (this.getStartToken() == null) return; 1389 if (this.getEndToken() == null) return; 1390 TSourceTokenList stlist = this.getStartToken().container; 1391 TSourceToken st = null; 1392 int level = 0; 1393 for(int i= this.getStartToken().posinlist; i<=this.getEndToken().posinlist;i++){ 1394 st = stlist.get(i); 1395 if (st.tokentype == ETokenType.ttleftparenthesis){ level++; continue;} 1396 if (st.tokentype == ETokenType.ttrightparenthesis){ level--; continue;} 1397 if (level == 0){ 1398 st.setDbObjType(TObjectName.ttobjDatatype); 1399 } 1400 } 1401 1402 if ((this.type == TTypeName.lfdGeneric)||(this.dataType == EDataType.generic_t)){ 1403// st= getStartToken(); 1404// if (st.toString().equalsIgnoreCase("datetime")){ 1405// this.type = lfdDatetime; 1406// dataType = EDataType.datetime_t; 1407// } 1408 setDataTypeByToken(getStartToken()); 1409 } 1410 } 1411 1412 1413 public void setIntervalType(TDummy dummy){ 1414 if (dummy == null) return; 1415 TSourceToken startToken = dummy.getStartToken(); 1416 if (startToken == null) return; 1417 TSourceToken endToken = dummy.getEndToken(); 1418 if (endToken == null) return; 1419 TSourceTokenList stlist = startToken.container; 1420 1421 boolean hasYear = false; 1422 boolean hasMonth = false; 1423 boolean hasDay = false; 1424 boolean hasHour = false; 1425 boolean hasMinute = false; 1426 boolean hasSecond = false; 1427 boolean hasTo = false; 1428 1429 // For better pattern detection, track token positions 1430 int yearPos = -1; 1431 int monthPos = -1; 1432 int dayPos = -1; 1433 int hourPos = -1; 1434 int minutePos = -1; 1435 int secondPos = -1; 1436 int toPos = -1; 1437 1438 // Scan tokens to determine interval type 1439 for (int i = startToken.posinlist; i <= endToken.posinlist; i++) { 1440 TSourceToken st = stlist.get(i); 1441 String tokenText = st.toString().toLowerCase(); 1442 1443 if (tokenText.equals("year") || tokenText.equals("years")) { 1444 hasYear = true; 1445 yearPos = i; 1446 } else if (tokenText.equals("month") || tokenText.equals("months")) { 1447 hasMonth = true; 1448 monthPos = i; 1449 } else if (tokenText.equals("day") || tokenText.equals("days")) { 1450 hasDay = true; 1451 dayPos = i; 1452 } else if (tokenText.equals("hour") || tokenText.equals("hours")) { 1453 hasHour = true; 1454 hourPos = i; 1455 } else if (tokenText.equals("minute") || tokenText.equals("minutes")) { 1456 hasMinute = true; 1457 minutePos = i; 1458 } else if (tokenText.equals("second") || tokenText.equals("seconds")) { 1459 hasSecond = true; 1460 secondPos = i; 1461 } else if (tokenText.equals("to")) { 1462 hasTo = true; 1463 toPos = i; 1464 } 1465 } 1466 1467 // Determine interval type based on patterns and token positions 1468 if (hasTo) { 1469 // Check for YEAR TO MONTH pattern 1470 if (hasYear && hasMonth && yearPos < toPos && toPos < monthPos) { 1471 setDataType(EDataType.interval_year_to_month_t); 1472 return; 1473 } 1474 1475 // Check for DAY TO SECOND pattern 1476 if (hasDay && hasSecond && dayPos < toPos && toPos < secondPos) { 1477 setDataType(EDataType.interval_day_to_second_t); 1478 return; 1479 } 1480 1481 // Check for DAY TO MINUTE pattern 1482 if (hasDay && hasMinute && dayPos < toPos && toPos < minutePos) { 1483 setDataType(EDataType.interval_day_to_minute_t); 1484 return; 1485 } 1486 1487 // Check for DAY TO HOUR pattern 1488 if (hasDay && hasHour && dayPos < toPos && toPos < hourPos) { 1489 setDataType(EDataType.interval_day_to_hour_t); 1490 return; 1491 } 1492 1493 // Check for HOUR TO SECOND pattern 1494 if (hasHour && hasSecond && hourPos < toPos && toPos < secondPos) { 1495 setDataType(EDataType.interval_hour_to_second_t); 1496 return; 1497 } 1498 1499 // Check for HOUR TO MINUTE pattern 1500 if (hasHour && hasMinute && hourPos < toPos && toPos < minutePos) { 1501 setDataType(EDataType.interval_hour_to_minute_t); 1502 return; 1503 } 1504 1505 // Check for MINUTE TO SECOND pattern 1506 if (hasMinute && hasSecond && minutePos < toPos && toPos < secondPos) { 1507 setDataType(EDataType.interval_minute_to_second_t); 1508 return; 1509 } 1510 } 1511 1512 // Single-unit interval types (no TO keyword or not a recognized pattern) 1513 if (hasYear) { 1514 setDataType(EDataType.interval_year_t); 1515 } else if (hasMonth) { 1516 setDataType(EDataType.interval_month_t); 1517 } else if (hasDay) { 1518 setDataType(EDataType.interval_day_t); 1519 } else if (hasHour) { 1520 setDataType(EDataType.interval_hour_t); 1521 } else if (hasMinute) { 1522 setDataType(EDataType.interval_minute_t); 1523 } else if (hasSecond) { 1524 setDataType(EDataType.interval_second_t); 1525 } else { 1526 // Default to generic interval type if specific type can't be determined 1527 setDataType(EDataType.interval_t); 1528 } 1529 } 1530 1531 public void accept(TParseTreeVisitor v){ 1532 v.preVisit(this); 1533 v.postVisit(this); 1534 } 1535 1536 public void acceptChildren(TParseTreeVisitor v){ 1537 v.preVisit(this); 1538 v.postVisit(this); 1539 } 1540 1541 1542 1543 1544// following datatype const was deprecated since v1.4.3.0. 1545// DON'T use those const, use EDataType instead. 1546 1547 public void setType(int type) { 1548 this.type = type; 1549// switch (type){ 1550// case lfdGeneric: 1551// this.dataType = EDataType.generic_t; 1552// break; 1553// case lfdFloat: 1554// this.dataType = EDataType.float_t; 1555// break; 1556// case lfdDoublePrecision: 1557// this.dataType = EDataType.double_t; 1558// break; 1559// case lfdDecimal: 1560// case lfdDec: 1561// this.dataType = EDataType.dec_t; 1562// break; 1563// case lfdNumeric: 1564// this.dataType = EDataType.numeric_t; 1565// break; 1566// case lfdnumber: 1567// case lfdNum: 1568// this.dataType = EDataType.number_t; 1569// break; 1570// case lfdInteger: 1571// case lfdInt: 1572// this.dataType = EDataType.int_t; 1573// break; 1574// case lfdBit: 1575// this.dataType = EDataType.bit_t; 1576// break; 1577// case lfdBoolean: 1578// this.dataType = EDataType.bool_t; 1579// break; 1580// case lfdVarbinary: 1581// this.dataType = EDataType.varbinary_t; 1582// break; 1583// case lfdBinary: 1584// this.dataType = EDataType.binary_t; 1585// break; 1586// case lfdSmallint: 1587// dataType = EDataType.smallint_t; 1588// break; 1589// case lfdReal: 1590// dataType = EDataType.real_t; 1591// break; 1592// case lfdTinyInt: 1593// dataType = EDataType.tinyint_t; 1594// break; 1595// case lfdBigInt: 1596// dataType = EDataType.bigint_t; 1597// break; 1598// case lfdCharacter: 1599// case lfdChar: 1600// dataType = EDataType.char_t; 1601// break; 1602// case lfdVarchar: 1603// case lfdCharVar: 1604// case lfdCharacterVar: 1605// case lfdCharacterVarying: 1606// case lfdCharVarying: 1607// dataType = EDataType.varchar_t; 1608// break; 1609// case lfdVarchar2: 1610// dataType = EDataType.varchar2_t; 1611// break; 1612// case lfdNvarchar2: 1613// dataType = EDataType.nvarchar2_t; 1614// break; 1615// case lfdNationalCharacter: 1616// case lfdNationalChar: 1617// case lfdNchar: 1618// dataType = EDataType.nchar_t; 1619// break; 1620// case lfdNVarchar: 1621// case lfdNationalCharVarying: 1622// case lfdNcharVarying: 1623// dataType = EDataType.nvarchar_t; 1624// break; 1625// case lfdLongvarchar: 1626// dataType = EDataType.long_varchar_t; 1627// break; 1628// case lfdLongvarbinary: 1629// dataType = EDataType.long_varbinary_t; 1630// break; 1631// case lfdYear: 1632// dataType = EDataType.year_t; 1633// break; 1634// case lfdDate: 1635// dataType = EDataType.date_t; 1636// break; 1637// case lfdTimestamp: 1638// dataType = EDataType.timestamp_t; 1639// break; 1640// case lfdTimeStampWithTZ: 1641// dataType = EDataType.timestamp_with_time_zone_t; 1642// break; 1643// case lfdTimeStampWithLTZ: 1644// dataType = EDataType.timestamp_with_local_time_zone_t; 1645// break; 1646// case lfdTime: 1647// dataType = EDataType.time_t; 1648// break; 1649// case lfdDatetime: 1650// dataType = EDataType.datetime_t; 1651// break; 1652// case lfdIntervalYTM: 1653// case lfdIntervalYearToMonth: 1654// dataType = EDataType.interval_year_to_month_t; 1655// break; 1656// case lfdIntervalDTS: 1657// case lfdIntervalDayToSecond: 1658// dataType = EDataType.interval_day_to_second_t; 1659// break; 1660// case lfdLong: 1661// dataType = EDataType.long_t; 1662// break; 1663// case lfdRaw: 1664// dataType = EDataType.raw_t; 1665// break; 1666// case lfdLongRaw: 1667// dataType = EDataType.long_raw_t; 1668// break; 1669// case lfdBlob: 1670// dataType = EDataType.blob_t; 1671// break; 1672// case lfdClob: 1673// dataType = EDataType.clob_t; 1674// break; 1675// case lfdNClob: 1676// dataType = EDataType.nclob_t; 1677// break; 1678// case lfdBfile: 1679// dataType = EDataType.bfile_t; 1680// break; 1681// case lfdTinyblob: 1682// dataType = EDataType.tinyblob_t; 1683// break; 1684// case lfdMediumblob: 1685// dataType = EDataType.mediumblob_t; 1686// break; 1687// case lfdLongblob: 1688// dataType = EDataType.longblob_t; 1689// break; 1690// case lfdTinytext: 1691// dataType = EDataType.tinytext_t; 1692// break; 1693// case lfdText: 1694// dataType = EDataType.text_t; 1695// break; 1696// case lfdntext: 1697// dataType = EDataType.ntext_t; 1698// break; 1699// case lfdMediumtext: 1700// dataType = EDataType.mediumtext_t; 1701// break; 1702// case lfdLongtext: 1703// dataType = EDataType.longtext_t; 1704// break; 1705// case lfdURowid: 1706// dataType= EDataType.urowid_t; 1707// break; 1708// case lfdEnum: 1709// dataType = EDataType.enum_t; 1710// break; 1711// case lfdBinaryLargeObject: 1712// dataType = EDataType.binary_large_object_t; 1713// break; 1714// case lfdGraphic: 1715// dataType = EDataType.graphic_t; 1716// break; 1717// case lfdVarGraphic: 1718// dataType = EDataType.vargraphic_t; 1719// break; 1720// case lfdLongVarGraphic: 1721// dataType = EDataType.long_vargraphic_t; 1722// break; 1723// case lfdDatalink: 1724// dataType = EDataType.datalink_t; 1725// break; 1726// case lfdBinaryInteger: 1727// dataType = EDataType.binary_integer_t; 1728// break; 1729// case lfdPlsInteger: 1730// dataType = EDataType.pls_integer_t; 1731// break; 1732// case lfdByteint: 1733// dataType = EDataType.byteint_t; 1734// break; 1735// case lfdTimeWithTZ: 1736// dataType = EDataType.timetz_t; 1737// break; 1738// case lfdIntervalYear: 1739// dataType = EDataType.interval_year_t; 1740// break; 1741// case lfdIntervalMonth: 1742// dataType = EDataType.interval_month_t; 1743// break; 1744// case lfdIntervalDay: 1745// dataType = EDataType.interval_day_t; 1746// break; 1747// case lfdIntervalDayToHour: 1748// dataType = EDataType.interval_day_to_hour_t; 1749// break; 1750// case lfdIntervalDayToMinute: 1751// dataType = EDataType.interval_day_to_minute_t; 1752// break; 1753// case lfdIntervalHour: 1754// dataType = EDataType.interval_hour_t; 1755// break; 1756// case lfdIntervalHourToMinute: 1757// dataType = EDataType.interval_hour_to_minute_t; 1758// break; 1759// case lfdIntervalHourToSecond: 1760// dataType = EDataType.interval_hour_to_second_t; 1761// break; 1762// case lfdIntervalMinute: 1763// dataType = EDataType.interval_minute_t; 1764// break; 1765// case lfdIntervalMinuteToSecond: 1766// dataType = EDataType.interval_minute_to_second_t; 1767// break; 1768// case lfdIntervalSecond: 1769// dataType = EDataType.interval_second_t; 1770// break; 1771// case lfdByte: 1772// dataType = EDataType.byte_t; 1773// break; 1774// case lfdVarByte: 1775// dataType = EDataType.varbyte_t; 1776// break; 1777// case lfdPeriod: 1778// dataType = EDataType.period_t; 1779// break; 1780// case lfdCharacterLargeObject: 1781// case lfdCharLargeObject: 1782// dataType = EDataType.char_large_object_t; 1783// break; 1784// case lfdGeoMetry: 1785// dataType = EDataType.geometry_t; 1786// break; 1787// case lfdGeoGraphy: 1788// dataType = EDataType.geography_t; 1789// break; 1790// case lfdSet: 1791// dataType = EDataType.set_t; 1792// break; 1793// case lfdDBClob: 1794// dataType = EDataType.dbclob_t; 1795// break; 1796// case lfdInterval: 1797// dataType = EDataType.interval_t; 1798// break; 1799// default: 1800// break; 1801// } 1802 } 1803 1804 public int getType() { 1805 1806 return type; 1807 } 1808 1809 private int type = lfdUnknown; 1810 1811 /** 1812 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#unknown_t} 1813 */ 1814public final static int lfdUnknown = 2; 1815 /** 1816 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#generic_t} 1817 */ 1818public final static int lfdGeneric = 3; 1819 /** 1820 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#float_t} 1821 */ 1822public final static int lfdFloat = 4; 1823 /** 1824 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#double_t} 1825 */ 1826public final static int lfdDoublePrecision = 8; 1827 /** 1828 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dec_t} 1829 */ 1830public final static int lfdDecimal = 9; 1831 /** 1832 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dec_t} 1833 */ 1834public final static int lfdDec = 10; 1835 /** 1836 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#numeric_t} 1837 */ 1838public final static int lfdNumeric = 11; 1839 /** 1840 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#number_t} 1841 */ 1842public final static int lfdnumber = 12; 1843 /** 1844 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#number_t} 1845 */ 1846public final static int lfdNum = 13; 1847 /** 1848 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#int_t} 1849 */ 1850public final static int lfdInteger = 14; 1851 /** 1852 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bit_t} 1853 */ 1854public final static int lfdBit = 22; 1855 /** 1856 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bool_t} 1857 */ 1858public final static int lfdBoolean = 23; 1859 /** 1860 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varbinary_t} 1861 */ 1862public final static int lfdVarbinary = 33; 1863 /** 1864 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_t} 1865 */ 1866public final static int lfdBinary = 34; 1867 /** 1868 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#int_t} 1869 */ 1870public final static int lfdInt = 40; 1871 /** 1872 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#smallint_t} 1873 */ 1874public final static int lfdSmallint = 41; 1875 /** 1876 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#real_t} 1877 */ 1878public final static int lfdReal = 42; 1879 /** 1880 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinyint_t} 1881 */ 1882public final static int lfdTinyInt = 43; 1883// public final static int lfdMediumInt = 44; 1884/** 1885 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bigint_t} 1886 */ 1887public final static int lfdBigInt = 45; 1888 /** 1889 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_t} 1890 */ 1891public final static int lfdCharacter = 46; 1892 /** 1893 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_t} 1894 */ 1895public final static int lfdChar = 47; 1896 /** 1897 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 1898 */ 1899public final static int lfdVarchar = 48; 1900 /** 1901 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar2_t} 1902 */ 1903public final static int lfdVarchar2 = 49; 1904// public final static int lfdbinaryVar = 55; 1905 /** 1906 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_varchar_t} 1907 */ 1908public final static int lfdLongvarchar = 56; 1909 /** 1910 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_varbinary_t} 1911 */ 1912public final static int lfdLongvarbinary = 57; 1913// public final static int lfdMySQLSet = 58; 1914 /** 1915 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#year_t} 1916 */ 1917public final static int lfdYear = 59; 1918// public final static int lfdDouble = 60; 1919 /** 1920 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nchar_t} 1921 */ 1922public final static int lfdNationalChar = 61; 1923 /** 1924 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nchar_t} 1925 */ 1926public final static int lfdNchar = 62; 1927 /** 1928 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#date_t} 1929 */ 1930public final static int lfdDate = 63; 1931 /** 1932 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_t} 1933 */ 1934public final static int lfdTimestamp = 64; 1935 /** 1936 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_with_time_zone_t} 1937 */ 1938public final static int lfdTimeStampWithTZ = 65; 1939 /** 1940 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_with_local_time_zone_t} 1941 */ 1942public final static int lfdTimeStampWithLTZ = 66; 1943// public final static int lfdDateWithFmt = 67; 1944 /** 1945 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#time_t} 1946 */ 1947public final static int lfdTime = 68; 1948 /** 1949 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#datetime_t} 1950 */ 1951public final static int lfdDatetime = 69; 1952// public final static int lfdsmalldatetime = 70; 1953 /** 1954 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_to_month_t} 1955 */ 1956public final static int lfdIntervalYTM = 71; 1957 /** 1958 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_second_t} 1959 */ 1960public final static int lfdIntervalDTS = 72; 1961 /** 1962 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_t} 1963 */ 1964public final static int lfdLong = 73; 1965 /** 1966 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#raw_t} 1967 */ 1968public final static int lfdRaw = 74; 1969 /** 1970 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_raw_t} 1971 */ 1972public final static int lfdLongRaw = 75; 1973 /** 1974 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#blob_t} 1975 */ 1976public final static int lfdBlob = 76; 1977 /** 1978 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#clob_t} 1979 */ 1980public final static int lfdClob = 77; 1981 /** 1982 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nclob_t} 1983 */ 1984public final static int lfdNClob = 78; 1985 /** 1986 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bfile_t} 1987 */ 1988public final static int lfdBfile = 79; 1989// public final static int lfddbclob = 80; 1990 /** 1991 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinyblob_t} 1992 */ 1993public final static int lfdTinyblob = 81; 1994 /** 1995 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#mediumblob_t} 1996 */ 1997public final static int lfdMediumblob = 82; 1998 /** 1999 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#longblob_t} 2000 */ 2001public final static int lfdLongblob = 83; 2002 /** 2003 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinytext_t} 2004 */ 2005public final static int lfdTinytext = 84; 2006 /** 2007 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#text_t} 2008 */ 2009public final static int lfdText = 85; 2010 /** 2011 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#ntext_t} 2012 */ 2013public final static int lfdntext = 86; 2014// public final static int lfdimage = 87; 2015 /** 2016 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#mediumtext_t} 2017 */ 2018public final static int lfdMediumtext = 88; 2019 /** 2020 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#longtext_t} 2021 */ 2022public final static int lfdLongtext = 89; 2023 /** 2024 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#urowid_t} 2025 */ 2026public final static int lfdURowid = 90; 2027 /** 2028 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#enum_t} 2029 */ 2030public final static int lfdEnum = 91; 2031 /** 2032 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_large_object_t} 2033 */ 2034public final static int lfdBinaryLargeObject = 102; 2035 /** 2036 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#graphic_t} 2037 */ 2038public final static int lfdGraphic = 103; 2039 /** 2040 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#vargraphic_t} 2041 */ 2042public final static int lfdVarGraphic = 104; 2043 /** 2044 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_vargraphic_t} 2045 */ 2046public final static int lfdLongVarGraphic = 105; 2047 /** 2048 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#datalink_t} 2049 */ 2050public final static int lfdDatalink = 106; 2051 /** 2052 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_integer_t} 2053 */ 2054public final static int lfdBinaryInteger = 107; // plsql 2055 /** 2056 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#pls_integer_t} 2057 */ 2058public final static int lfdPlsInteger = 108; // plsql 2059 /** 2060 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#byteint_t} 2061 */ 2062public final static int lfdByteint = 120; // teradata 2063 /** 2064 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#time_with_time_zone_t} 2065 */ 2066public final static int lfdTimeWithTZ = 121; //teradata 2067 /** 2068 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_t} 2069 */ 2070public final static int lfdIntervalYear = 130; //teradata 2071 /** 2072 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_to_month_t} 2073 */ 2074public final static int lfdIntervalYearToMonth = 131; //teradata 2075 /** 2076 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_month_t} 2077 */ 2078public final static int lfdIntervalMonth = 132; //teradata 2079 /** 2080 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_t} 2081 */ 2082public final static int lfdIntervalDay = 133; //teradata 2083 /** 2084 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_hour_t} 2085 */ 2086public final static int lfdIntervalDayToHour = 134; //teradata 2087 /** 2088 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_minute_t} 2089 */ 2090public final static int lfdIntervalDayToMinute = 135; //teradata 2091 /** 2092 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_second_t} 2093 */ 2094public final static int lfdIntervalDayToSecond = 136; //teradata 2095 /** 2096 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_t} 2097 */ 2098public final static int lfdIntervalHour = 137; //teradata 2099 /** 2100 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_to_minute_t} 2101 */ 2102public final static int lfdIntervalHourToMinute = 138; //teradata 2103 /** 2104 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_to_second_t} 2105 */ 2106public final static int lfdIntervalHourToSecond = 139; //teradata 2107 /** 2108 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_minute_t} 2109 */ 2110public final static int lfdIntervalMinute = 140; //teradata 2111 /** 2112 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_minute_to_second_t} 2113 */ 2114public final static int lfdIntervalMinuteToSecond = 141; //teradata 2115 /** 2116 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_second_t} 2117 */ 2118public final static int lfdIntervalSecond = 142; //teradata 2119 /** 2120 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#byte_t} 2121 */ 2122public final static int lfdByte = 143; //teradata 2123 /** 2124 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varbyte_t} 2125 */ 2126public final static int lfdVarByte = 144; //teradata 2127 /** 2128 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 2129 */ 2130public final static int lfdCharacterVarying = 145; //teradata 2131 /** 2132 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 2133 */ 2134public final static int lfdCharVarying = 146; //teradata 2135 /** 2136 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#period_t} 2137 */ 2138public final static int lfdPeriod = 147; //teradata 2139 /** 2140 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_large_object_t} 2141 */ 2142public final static int lfdCharacterLargeObject = 148; //teradata 2143 /** 2144 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#geometry_t} 2145 */ 2146public final static int lfdGeoMetry = 150;//sql srever 2008 2147 /** 2148 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#geography_t} 2149 */ 2150public final static int lfdGeoGraphy = 151;//sql srever 2008 2151 2152//public final static int lfdSigned = 160;//mysql 2153//public final static int lfdUnSigned = 161;//mysql 2154 /** 2155 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nvarchar_t} 2156 */ 2157public final static int lfdNationalCharVarying = 162;//mysql 2158 /** 2159 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nvarchar_t} 2160 */ 2161public final static int lfdNcharVarying = 163;//mysql 2162 /** 2163 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#set_t} 2164 */ 2165public final static int lfdSet = 164;//mysql 2166 2167 /** 2168 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_large_object_t} 2169 */ 2170public final static int lfdCharLargeObject = 171;//db2 2171 /** 2172 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dbclob_t} 2173 */ 2174public final static int lfdDBClob = 172; 2175 /** 2176 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_t} 2177 */ 2178public final static int lfdInterval = 181; //postgresql 2179 2180 2181/** 2182 * plsql type atribute 2183 * @deprecated As of v1.4.3.0, replaced by {@link TDatatypeAttribute} 2184 */ 2185public final static int lfdTypeAtribute = 107; 2186 2187/** 2188 * plsql rowtype atribute 2189 * @deprecated As of v1.4.3.0, replaced by {@link TDatatypeAttribute} 2190 */ 2191public final static int lfdRowTypeAtribute = 108; 2192 2193}