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.money_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 1043 private TConstant secondsPrecision; 1044 1045 /** 1046 * 1047 * @return a value of {@link TConstant}, typically the second precision value of datatype. 1048 */ 1049 public TConstant getSecondsPrecision() { 1050 return secondsPrecision; 1051 } 1052 1053 public void setPrecision(TConstant precision) { 1054 this.precision = precision; 1055 } 1056 1057 /** 1058 * 1059 * @return a value of {@link TConstant}, scale value of datatypes such as numeric, float. 1060 */ 1061 public TConstant getScale() { 1062 return scale; 1063 } 1064 1065 /** 1066 * 1067 * @return a value of {@link TConstant}, precision value of datatypes such as numeric, float. 1068 */ 1069 public TConstant getPrecision() { 1070 1071 return precision; 1072 } 1073 1074 public void setScale(TConstant scale) { 1075 this.scale = scale; 1076 } 1077 1078 public void setPrecisionScale(TPrecisionScale precisionScale){ 1079 if (precisionScale != null){ 1080 precision = precisionScale.getPrecision(); 1081 scale = precisionScale.getScale(); 1082 } 1083 } 1084 1085 private TPTNodeList <TIndices> arrays; 1086 1087 /** 1088 * index value of datetype in PostgreSQL. like this: SimpleTypename ARRAY [n,...]. 1089 * 1090 * @return a list of {@link TIndices}, 1091 */ 1092 public TPTNodeList<TIndices> getArrays() { 1093 return arrays; 1094 } 1095 1096 public void setArrays(TPTNodeList<TIndices> arrays) { 1097 1098 this.arrays = arrays; 1099 } 1100 1101 private TPTNodeList <TDatatypeAttribute> datatypeAttributeList; 1102 1103 public void setDatatypeAttributeList(TPTNodeList <TDatatypeAttribute> datatypeAttributeList) { 1104 this.datatypeAttributeList = datatypeAttributeList; 1105 } 1106 1107 /** 1108 * datatype attribute element. 1109 * @return a list of {@link TDatatypeAttribute} 1110 */ 1111 public TPTNodeList <TDatatypeAttribute> getDatatypeAttributeList() { 1112 1113 if (datatypeAttributeList == null){ 1114 datatypeAttributeList = new TPTNodeList <TDatatypeAttribute> (); 1115 } 1116 return datatypeAttributeList; 1117 } 1118 1119 public void init(Object arg1,Object arg2,Object arg3){ 1120 init(arg1,arg2); 1121 1122 if (arg3 != null) { 1123 switch (dataType){ 1124 case interval_year_to_month_t: 1125 break; 1126 case interval_day_to_second_t: 1127 case interval_second_t: 1128 case interval_minute_to_second_t: 1129 case interval_hour_to_second_t: 1130 this.secondsPrecision = (TConstant)arg3; 1131 break; 1132 case map_t: 1133 keyType = (TTypeName) arg2; 1134 valueType = (TTypeName)arg3; 1135 break; 1136 case string_t: 1137 collationName = ((TObjectName)arg3).toString(); 1138 break; 1139 case generic_t: 1140 if (arg3 instanceof TObjectName) { 1141 this.dataTypeName = ((TObjectName) arg3).toString(); 1142 } 1143 1144 break; 1145 default: 1146 break; 1147 } 1148 } 1149 } 1150 1151 public void setTypeModifiers(TExpressionList exprList){ 1152 if (exprList == null) return; 1153 if (exprList.size() == 1){ 1154 TExpression e = exprList.getExpression(0); 1155 if (e.getExpressionType() == EExpressionType.simple_constant_t) 1156 precision = e.getConstantOperand(); 1157 }else if (exprList.size() == 2){ 1158 TExpression e = exprList.getExpression(0); 1159 if (e.getExpressionType() == EExpressionType.simple_constant_t) 1160 precision = e.getConstantOperand(); 1161 TExpression e1 = exprList.getExpression(1); 1162 if (e1.getExpressionType() == EExpressionType.simple_constant_t) 1163 scale = e1.getConstantOperand(); 1164 } 1165 1166 } 1167 1168 private TTypeName elementType; 1169 private TTypeName keyType; 1170 private TTypeName valueType; 1171 1172 public TTypeName getElementType() { 1173 return elementType; 1174 } 1175 1176 public TTypeName getKeyType() { 1177 return keyType; 1178 } 1179 1180 public TTypeName getValueType() { 1181 return valueType; 1182 } 1183 1184 public void init(Object arg1, Object arg2){ 1185 init(arg1); 1186 1187 if ((arg2 != null) ){ 1188 1189 switch (dataType){ 1190 case interval_day_to_second_t: 1191 case interval_year_to_month_t: 1192 case interval_second_t: 1193 case interval_minute_to_second_t: 1194 case interval_hour_to_second_t: 1195 case interval_hour_to_minute_t: 1196 case interval_hour_t: 1197 case interval_day_to_minute_t: 1198 case interval_day_to_hour_t: 1199 case interval_month_t: 1200 case interval_year_t: 1201 precision = (TConstant)arg2; 1202 length = null; 1203 break; 1204 case binary_t: 1205 case varbinary_t: 1206 case bytea_t: 1207 case raw_t: 1208 case char_t: 1209 case nchar_t: 1210 case varchar_t: 1211 case varchar2_t: 1212 case nvarchar_t: 1213 case nvarchar2_t: 1214 case ntext_t: 1215 case long_varbinary_t: 1216 case long_varchar_t: 1217 case character_t: 1218 case byte_t: 1219 case varbyte_t: 1220 case clob_t: 1221 case blob_t: 1222 if (arg2 instanceof TConstant){ 1223 length = (TConstant)arg2; 1224 } 1225 else if (arg2 instanceof TDummy){ 1226 length = (TConstant)(((TDummy)arg2).node1); 1227 } 1228 break; 1229 case timestamp_t: 1230 if (arg2 instanceof TConstant){ 1231 length = (TConstant)arg2; 1232 scale = length; 1233 } 1234 else if (arg2 instanceof TDummy){ 1235 length = (TConstant)(((TDummy)arg2).node1); 1236 scale = length; 1237 } 1238 // if scale > 6, then set length to 11, otherwise, set length to 7 1239 // https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html#GUID-7B72E154-677A-4342-A1EA-C74C1EA928E6 1240 1241 if (scale != null){ 1242 Integer tmpi = scale.getIntegerValue(); 1243 if (tmpi != null){ 1244 if (tmpi > 6){ 1245 length = new TConstant(); 1246 length.init(ELiteralType.integer_et,new TSourceToken("11")); 1247 }else{ 1248 length = new TConstant(); 1249 length.init(ELiteralType.integer_et,new TSourceToken("7")); 1250 } 1251 } 1252 } 1253 1254 break; 1255 case time_t: 1256 case timetz_t: 1257 case timentz_t: 1258 case timestamp_with_time_zone_t: 1259 case timestamp_with_local_time_zone_t: 1260 if (arg2 instanceof TConstant){ 1261 fractionalSecondsPrecision = (TConstant)arg2; 1262 } 1263 else if (arg2 instanceof TDummy){ 1264 fractionalSecondsPrecision = (TConstant)(((TDummy)arg2).node1); 1265 } 1266 break; 1267 case string_t: 1268 if (arg2 instanceof TConstant){ //snowflake 1269 this.length = (TConstant)arg2; 1270// }else if (arg2 instanceof TObjectName){ //bigquery 1271// collationName = ((TObjectName)arg2).toString(); 1272 } else if (arg2 instanceof TDummy){ 1273 length = (TConstant)(((TDummy)arg2).node1); 1274 } 1275 1276 break; 1277 case xml_t: 1278 case xmltype_t: 1279 this.precision = ((TPrecisionScale)arg2).getPrecision(); 1280 this.scale = ((TPrecisionScale)arg2).getScale(); 1281 break; 1282 case array_t: 1283 case set_t: 1284 this.elementType = (TTypeName)arg2; 1285 break; 1286 case vargraphic_t: 1287 this.length = (TConstant)arg2; 1288 break; 1289 case int_t: 1290 case int2_t: 1291 case int4_t: 1292 case bigint_t: 1293 if (arg2 instanceof TDummy){ //mysql display length 1294 this.displayLength = (TConstant)(((TDummy)arg2).node1); 1295 } 1296 break; 1297 case generic_t: 1298 if (arg2 instanceof TObjectName) { 1299 this.dataTypeName = ((TObjectName) arg2).toString(); 1300 } 1301 break; 1302 default: 1303 if (arg2 instanceof TPrecisionScale){ 1304 this.precision = ((TPrecisionScale)arg2).getPrecision(); 1305 this.scale = ((TPrecisionScale)arg2).getScale(); 1306 if (dataType == EDataType.period_t){ 1307 secondsPrecision = ((TPrecisionScale)arg2).getPrecision(); 1308 } 1309 }else if (arg2 instanceof TDummy){ //opt_float rule in y file 1310 this.precision = (TConstant)(((TDummy)arg2).node1); 1311 }else if (arg2 instanceof TConstant){ 1312 this.length = (TConstant)arg2; 1313 } 1314 break; 1315 } 1316 } 1317 } 1318 1319 public void init(Object arg1){ 1320 dataType = (EDataType)arg1; 1321 } 1322 1323 public void setByteUnit(boolean byteUnit) { 1324 this.byteUnit = byteUnit; 1325 } 1326 1327 public void setCharUnit(boolean charUnit) { 1328 this.charUnit = charUnit; 1329 } 1330 1331 public void setVarying(boolean varying) { 1332 this.varying = varying; 1333 } 1334 1335 public void setSecondsPrecision(TConstant secondsPrecision) { 1336 this.secondsPrecision = secondsPrecision; 1337 } 1338 1339 public void setCharUnit(TSourceToken st){ 1340 if (st == null) return; 1341 if (st.tokencode == TBaseType.rrw_char){ 1342 charUnit = true; 1343 }else{ 1344 byteUnit = true; 1345 } 1346 1347 } 1348 1349 public void setVarying(TSourceToken st){ 1350 if (st != null){ 1351 varying = true; 1352 switch (dataType){ 1353 case char_t: 1354 dataType = EDataType.varchar_t; 1355 break; 1356 case nchar_t: 1357 dataType = EDataType.nvarchar_t; 1358 break; 1359 case bit_t: 1360 dataType = EDataType.varbit_t; 1361 break; 1362 default: 1363 break; 1364 } 1365 } 1366 } 1367 1368 /** 1369 * used in y file, setup dbobject type of all source tokens consist of this datatype. 1370 */ 1371 public void setDataTypeInTokens(){ 1372 if (this.getStartToken() == null) return; 1373 if (this.getEndToken() == null) return; 1374 TSourceTokenList stlist = this.getStartToken().container; 1375 TSourceToken st = null; 1376 int level = 0; 1377 for(int i= this.getStartToken().posinlist; i<=this.getEndToken().posinlist;i++){ 1378 st = stlist.get(i); 1379 if (st.tokentype == ETokenType.ttleftparenthesis){ level++; continue;} 1380 if (st.tokentype == ETokenType.ttrightparenthesis){ level--; continue;} 1381 if (level == 0){ 1382 st.setDbObjType(TObjectName.ttobjDatatype); 1383 } 1384 } 1385 1386 if ((this.type == TTypeName.lfdGeneric)||(this.dataType == EDataType.generic_t)){ 1387// st= getStartToken(); 1388// if (st.toString().equalsIgnoreCase("datetime")){ 1389// this.type = lfdDatetime; 1390// dataType = EDataType.datetime_t; 1391// } 1392 setDataTypeByToken(getStartToken()); 1393 } 1394 } 1395 1396 1397 public void setIntervalType(TDummy dummy){ 1398 if (dummy == null) return; 1399 TSourceToken startToken = dummy.getStartToken(); 1400 if (startToken == null) return; 1401 TSourceToken endToken = dummy.getEndToken(); 1402 if (endToken == null) return; 1403 TSourceTokenList stlist = startToken.container; 1404 1405 boolean hasYear = false; 1406 boolean hasMonth = false; 1407 boolean hasDay = false; 1408 boolean hasHour = false; 1409 boolean hasMinute = false; 1410 boolean hasSecond = false; 1411 boolean hasTo = false; 1412 1413 // For better pattern detection, track token positions 1414 int yearPos = -1; 1415 int monthPos = -1; 1416 int dayPos = -1; 1417 int hourPos = -1; 1418 int minutePos = -1; 1419 int secondPos = -1; 1420 int toPos = -1; 1421 1422 // Scan tokens to determine interval type 1423 for (int i = startToken.posinlist; i <= endToken.posinlist; i++) { 1424 TSourceToken st = stlist.get(i); 1425 String tokenText = st.toString().toLowerCase(); 1426 1427 if (tokenText.equals("year") || tokenText.equals("years")) { 1428 hasYear = true; 1429 yearPos = i; 1430 } else if (tokenText.equals("month") || tokenText.equals("months")) { 1431 hasMonth = true; 1432 monthPos = i; 1433 } else if (tokenText.equals("day") || tokenText.equals("days")) { 1434 hasDay = true; 1435 dayPos = i; 1436 } else if (tokenText.equals("hour") || tokenText.equals("hours")) { 1437 hasHour = true; 1438 hourPos = i; 1439 } else if (tokenText.equals("minute") || tokenText.equals("minutes")) { 1440 hasMinute = true; 1441 minutePos = i; 1442 } else if (tokenText.equals("second") || tokenText.equals("seconds")) { 1443 hasSecond = true; 1444 secondPos = i; 1445 } else if (tokenText.equals("to")) { 1446 hasTo = true; 1447 toPos = i; 1448 } 1449 } 1450 1451 // Determine interval type based on patterns and token positions 1452 if (hasTo) { 1453 // Check for YEAR TO MONTH pattern 1454 if (hasYear && hasMonth && yearPos < toPos && toPos < monthPos) { 1455 setDataType(EDataType.interval_year_to_month_t); 1456 return; 1457 } 1458 1459 // Check for DAY TO SECOND pattern 1460 if (hasDay && hasSecond && dayPos < toPos && toPos < secondPos) { 1461 setDataType(EDataType.interval_day_to_second_t); 1462 return; 1463 } 1464 1465 // Check for DAY TO MINUTE pattern 1466 if (hasDay && hasMinute && dayPos < toPos && toPos < minutePos) { 1467 setDataType(EDataType.interval_day_to_minute_t); 1468 return; 1469 } 1470 1471 // Check for DAY TO HOUR pattern 1472 if (hasDay && hasHour && dayPos < toPos && toPos < hourPos) { 1473 setDataType(EDataType.interval_day_to_hour_t); 1474 return; 1475 } 1476 1477 // Check for HOUR TO SECOND pattern 1478 if (hasHour && hasSecond && hourPos < toPos && toPos < secondPos) { 1479 setDataType(EDataType.interval_hour_to_second_t); 1480 return; 1481 } 1482 1483 // Check for HOUR TO MINUTE pattern 1484 if (hasHour && hasMinute && hourPos < toPos && toPos < minutePos) { 1485 setDataType(EDataType.interval_hour_to_minute_t); 1486 return; 1487 } 1488 1489 // Check for MINUTE TO SECOND pattern 1490 if (hasMinute && hasSecond && minutePos < toPos && toPos < secondPos) { 1491 setDataType(EDataType.interval_minute_to_second_t); 1492 return; 1493 } 1494 } 1495 1496 // Single-unit interval types (no TO keyword or not a recognized pattern) 1497 if (hasYear) { 1498 setDataType(EDataType.interval_year_t); 1499 } else if (hasMonth) { 1500 setDataType(EDataType.interval_month_t); 1501 } else if (hasDay) { 1502 setDataType(EDataType.interval_day_t); 1503 } else if (hasHour) { 1504 setDataType(EDataType.interval_hour_t); 1505 } else if (hasMinute) { 1506 setDataType(EDataType.interval_minute_t); 1507 } else if (hasSecond) { 1508 setDataType(EDataType.interval_second_t); 1509 } else { 1510 // Default to generic interval type if specific type can't be determined 1511 setDataType(EDataType.interval_t); 1512 } 1513 } 1514 1515 public void accept(TParseTreeVisitor v){ 1516 v.preVisit(this); 1517 v.postVisit(this); 1518 } 1519 1520 public void acceptChildren(TParseTreeVisitor v){ 1521 v.preVisit(this); 1522 v.postVisit(this); 1523 } 1524 1525 1526 1527 1528// following datatype const was deprecated since v1.4.3.0. 1529// DON'T use those const, use EDataType instead. 1530 1531 public void setType(int type) { 1532 this.type = type; 1533// switch (type){ 1534// case lfdGeneric: 1535// this.dataType = EDataType.generic_t; 1536// break; 1537// case lfdFloat: 1538// this.dataType = EDataType.float_t; 1539// break; 1540// case lfdDoublePrecision: 1541// this.dataType = EDataType.double_t; 1542// break; 1543// case lfdDecimal: 1544// case lfdDec: 1545// this.dataType = EDataType.dec_t; 1546// break; 1547// case lfdNumeric: 1548// this.dataType = EDataType.numeric_t; 1549// break; 1550// case lfdnumber: 1551// case lfdNum: 1552// this.dataType = EDataType.number_t; 1553// break; 1554// case lfdInteger: 1555// case lfdInt: 1556// this.dataType = EDataType.int_t; 1557// break; 1558// case lfdBit: 1559// this.dataType = EDataType.bit_t; 1560// break; 1561// case lfdBoolean: 1562// this.dataType = EDataType.bool_t; 1563// break; 1564// case lfdVarbinary: 1565// this.dataType = EDataType.varbinary_t; 1566// break; 1567// case lfdBinary: 1568// this.dataType = EDataType.binary_t; 1569// break; 1570// case lfdSmallint: 1571// dataType = EDataType.smallint_t; 1572// break; 1573// case lfdReal: 1574// dataType = EDataType.real_t; 1575// break; 1576// case lfdTinyInt: 1577// dataType = EDataType.tinyint_t; 1578// break; 1579// case lfdBigInt: 1580// dataType = EDataType.bigint_t; 1581// break; 1582// case lfdCharacter: 1583// case lfdChar: 1584// dataType = EDataType.char_t; 1585// break; 1586// case lfdVarchar: 1587// case lfdCharVar: 1588// case lfdCharacterVar: 1589// case lfdCharacterVarying: 1590// case lfdCharVarying: 1591// dataType = EDataType.varchar_t; 1592// break; 1593// case lfdVarchar2: 1594// dataType = EDataType.varchar2_t; 1595// break; 1596// case lfdNvarchar2: 1597// dataType = EDataType.nvarchar2_t; 1598// break; 1599// case lfdNationalCharacter: 1600// case lfdNationalChar: 1601// case lfdNchar: 1602// dataType = EDataType.nchar_t; 1603// break; 1604// case lfdNVarchar: 1605// case lfdNationalCharVarying: 1606// case lfdNcharVarying: 1607// dataType = EDataType.nvarchar_t; 1608// break; 1609// case lfdLongvarchar: 1610// dataType = EDataType.long_varchar_t; 1611// break; 1612// case lfdLongvarbinary: 1613// dataType = EDataType.long_varbinary_t; 1614// break; 1615// case lfdYear: 1616// dataType = EDataType.year_t; 1617// break; 1618// case lfdDate: 1619// dataType = EDataType.date_t; 1620// break; 1621// case lfdTimestamp: 1622// dataType = EDataType.timestamp_t; 1623// break; 1624// case lfdTimeStampWithTZ: 1625// dataType = EDataType.timestamp_with_time_zone_t; 1626// break; 1627// case lfdTimeStampWithLTZ: 1628// dataType = EDataType.timestamp_with_local_time_zone_t; 1629// break; 1630// case lfdTime: 1631// dataType = EDataType.time_t; 1632// break; 1633// case lfdDatetime: 1634// dataType = EDataType.datetime_t; 1635// break; 1636// case lfdIntervalYTM: 1637// case lfdIntervalYearToMonth: 1638// dataType = EDataType.interval_year_to_month_t; 1639// break; 1640// case lfdIntervalDTS: 1641// case lfdIntervalDayToSecond: 1642// dataType = EDataType.interval_day_to_second_t; 1643// break; 1644// case lfdLong: 1645// dataType = EDataType.long_t; 1646// break; 1647// case lfdRaw: 1648// dataType = EDataType.raw_t; 1649// break; 1650// case lfdLongRaw: 1651// dataType = EDataType.long_raw_t; 1652// break; 1653// case lfdBlob: 1654// dataType = EDataType.blob_t; 1655// break; 1656// case lfdClob: 1657// dataType = EDataType.clob_t; 1658// break; 1659// case lfdNClob: 1660// dataType = EDataType.nclob_t; 1661// break; 1662// case lfdBfile: 1663// dataType = EDataType.bfile_t; 1664// break; 1665// case lfdTinyblob: 1666// dataType = EDataType.tinyblob_t; 1667// break; 1668// case lfdMediumblob: 1669// dataType = EDataType.mediumblob_t; 1670// break; 1671// case lfdLongblob: 1672// dataType = EDataType.longblob_t; 1673// break; 1674// case lfdTinytext: 1675// dataType = EDataType.tinytext_t; 1676// break; 1677// case lfdText: 1678// dataType = EDataType.text_t; 1679// break; 1680// case lfdntext: 1681// dataType = EDataType.ntext_t; 1682// break; 1683// case lfdMediumtext: 1684// dataType = EDataType.mediumtext_t; 1685// break; 1686// case lfdLongtext: 1687// dataType = EDataType.longtext_t; 1688// break; 1689// case lfdURowid: 1690// dataType= EDataType.urowid_t; 1691// break; 1692// case lfdEnum: 1693// dataType = EDataType.enum_t; 1694// break; 1695// case lfdBinaryLargeObject: 1696// dataType = EDataType.binary_large_object_t; 1697// break; 1698// case lfdGraphic: 1699// dataType = EDataType.graphic_t; 1700// break; 1701// case lfdVarGraphic: 1702// dataType = EDataType.vargraphic_t; 1703// break; 1704// case lfdLongVarGraphic: 1705// dataType = EDataType.long_vargraphic_t; 1706// break; 1707// case lfdDatalink: 1708// dataType = EDataType.datalink_t; 1709// break; 1710// case lfdBinaryInteger: 1711// dataType = EDataType.binary_integer_t; 1712// break; 1713// case lfdPlsInteger: 1714// dataType = EDataType.pls_integer_t; 1715// break; 1716// case lfdByteint: 1717// dataType = EDataType.byteint_t; 1718// break; 1719// case lfdTimeWithTZ: 1720// dataType = EDataType.timetz_t; 1721// break; 1722// case lfdIntervalYear: 1723// dataType = EDataType.interval_year_t; 1724// break; 1725// case lfdIntervalMonth: 1726// dataType = EDataType.interval_month_t; 1727// break; 1728// case lfdIntervalDay: 1729// dataType = EDataType.interval_day_t; 1730// break; 1731// case lfdIntervalDayToHour: 1732// dataType = EDataType.interval_day_to_hour_t; 1733// break; 1734// case lfdIntervalDayToMinute: 1735// dataType = EDataType.interval_day_to_minute_t; 1736// break; 1737// case lfdIntervalHour: 1738// dataType = EDataType.interval_hour_t; 1739// break; 1740// case lfdIntervalHourToMinute: 1741// dataType = EDataType.interval_hour_to_minute_t; 1742// break; 1743// case lfdIntervalHourToSecond: 1744// dataType = EDataType.interval_hour_to_second_t; 1745// break; 1746// case lfdIntervalMinute: 1747// dataType = EDataType.interval_minute_t; 1748// break; 1749// case lfdIntervalMinuteToSecond: 1750// dataType = EDataType.interval_minute_to_second_t; 1751// break; 1752// case lfdIntervalSecond: 1753// dataType = EDataType.interval_second_t; 1754// break; 1755// case lfdByte: 1756// dataType = EDataType.byte_t; 1757// break; 1758// case lfdVarByte: 1759// dataType = EDataType.varbyte_t; 1760// break; 1761// case lfdPeriod: 1762// dataType = EDataType.period_t; 1763// break; 1764// case lfdCharacterLargeObject: 1765// case lfdCharLargeObject: 1766// dataType = EDataType.char_large_object_t; 1767// break; 1768// case lfdGeoMetry: 1769// dataType = EDataType.geometry_t; 1770// break; 1771// case lfdGeoGraphy: 1772// dataType = EDataType.geography_t; 1773// break; 1774// case lfdSet: 1775// dataType = EDataType.set_t; 1776// break; 1777// case lfdDBClob: 1778// dataType = EDataType.dbclob_t; 1779// break; 1780// case lfdInterval: 1781// dataType = EDataType.interval_t; 1782// break; 1783// default: 1784// break; 1785// } 1786 } 1787 1788 public int getType() { 1789 1790 return type; 1791 } 1792 1793 private int type = lfdUnknown; 1794 1795 /** 1796 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#unknown_t} 1797 */ 1798public final static int lfdUnknown = 2; 1799 /** 1800 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#generic_t} 1801 */ 1802public final static int lfdGeneric = 3; 1803 /** 1804 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#float_t} 1805 */ 1806public final static int lfdFloat = 4; 1807 /** 1808 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#double_t} 1809 */ 1810public final static int lfdDoublePrecision = 8; 1811 /** 1812 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dec_t} 1813 */ 1814public final static int lfdDecimal = 9; 1815 /** 1816 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dec_t} 1817 */ 1818public final static int lfdDec = 10; 1819 /** 1820 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#numeric_t} 1821 */ 1822public final static int lfdNumeric = 11; 1823 /** 1824 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#number_t} 1825 */ 1826public final static int lfdnumber = 12; 1827 /** 1828 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#number_t} 1829 */ 1830public final static int lfdNum = 13; 1831 /** 1832 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#int_t} 1833 */ 1834public final static int lfdInteger = 14; 1835 /** 1836 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bit_t} 1837 */ 1838public final static int lfdBit = 22; 1839 /** 1840 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bool_t} 1841 */ 1842public final static int lfdBoolean = 23; 1843 /** 1844 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varbinary_t} 1845 */ 1846public final static int lfdVarbinary = 33; 1847 /** 1848 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_t} 1849 */ 1850public final static int lfdBinary = 34; 1851 /** 1852 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#int_t} 1853 */ 1854public final static int lfdInt = 40; 1855 /** 1856 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#smallint_t} 1857 */ 1858public final static int lfdSmallint = 41; 1859 /** 1860 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#real_t} 1861 */ 1862public final static int lfdReal = 42; 1863 /** 1864 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinyint_t} 1865 */ 1866public final static int lfdTinyInt = 43; 1867// public final static int lfdMediumInt = 44; 1868/** 1869 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bigint_t} 1870 */ 1871public final static int lfdBigInt = 45; 1872 /** 1873 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_t} 1874 */ 1875public final static int lfdCharacter = 46; 1876 /** 1877 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_t} 1878 */ 1879public final static int lfdChar = 47; 1880 /** 1881 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 1882 */ 1883public final static int lfdVarchar = 48; 1884 /** 1885 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar2_t} 1886 */ 1887public final static int lfdVarchar2 = 49; 1888// public final static int lfdbinaryVar = 55; 1889 /** 1890 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_varchar_t} 1891 */ 1892public final static int lfdLongvarchar = 56; 1893 /** 1894 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_varbinary_t} 1895 */ 1896public final static int lfdLongvarbinary = 57; 1897// public final static int lfdMySQLSet = 58; 1898 /** 1899 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#year_t} 1900 */ 1901public final static int lfdYear = 59; 1902// public final static int lfdDouble = 60; 1903 /** 1904 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nchar_t} 1905 */ 1906public final static int lfdNationalChar = 61; 1907 /** 1908 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nchar_t} 1909 */ 1910public final static int lfdNchar = 62; 1911 /** 1912 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#date_t} 1913 */ 1914public final static int lfdDate = 63; 1915 /** 1916 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_t} 1917 */ 1918public final static int lfdTimestamp = 64; 1919 /** 1920 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_with_time_zone_t} 1921 */ 1922public final static int lfdTimeStampWithTZ = 65; 1923 /** 1924 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#timestamp_with_local_time_zone_t} 1925 */ 1926public final static int lfdTimeStampWithLTZ = 66; 1927// public final static int lfdDateWithFmt = 67; 1928 /** 1929 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#time_t} 1930 */ 1931public final static int lfdTime = 68; 1932 /** 1933 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#datetime_t} 1934 */ 1935public final static int lfdDatetime = 69; 1936// public final static int lfdsmalldatetime = 70; 1937 /** 1938 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_to_month_t} 1939 */ 1940public final static int lfdIntervalYTM = 71; 1941 /** 1942 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_second_t} 1943 */ 1944public final static int lfdIntervalDTS = 72; 1945 /** 1946 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_t} 1947 */ 1948public final static int lfdLong = 73; 1949 /** 1950 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#raw_t} 1951 */ 1952public final static int lfdRaw = 74; 1953 /** 1954 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_raw_t} 1955 */ 1956public final static int lfdLongRaw = 75; 1957 /** 1958 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#blob_t} 1959 */ 1960public final static int lfdBlob = 76; 1961 /** 1962 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#clob_t} 1963 */ 1964public final static int lfdClob = 77; 1965 /** 1966 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nclob_t} 1967 */ 1968public final static int lfdNClob = 78; 1969 /** 1970 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#bfile_t} 1971 */ 1972public final static int lfdBfile = 79; 1973// public final static int lfddbclob = 80; 1974 /** 1975 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinyblob_t} 1976 */ 1977public final static int lfdTinyblob = 81; 1978 /** 1979 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#mediumblob_t} 1980 */ 1981public final static int lfdMediumblob = 82; 1982 /** 1983 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#longblob_t} 1984 */ 1985public final static int lfdLongblob = 83; 1986 /** 1987 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#tinytext_t} 1988 */ 1989public final static int lfdTinytext = 84; 1990 /** 1991 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#text_t} 1992 */ 1993public final static int lfdText = 85; 1994 /** 1995 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#ntext_t} 1996 */ 1997public final static int lfdntext = 86; 1998// public final static int lfdimage = 87; 1999 /** 2000 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#mediumtext_t} 2001 */ 2002public final static int lfdMediumtext = 88; 2003 /** 2004 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#longtext_t} 2005 */ 2006public final static int lfdLongtext = 89; 2007 /** 2008 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#urowid_t} 2009 */ 2010public final static int lfdURowid = 90; 2011 /** 2012 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#enum_t} 2013 */ 2014public final static int lfdEnum = 91; 2015 /** 2016 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_large_object_t} 2017 */ 2018public final static int lfdBinaryLargeObject = 102; 2019 /** 2020 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#graphic_t} 2021 */ 2022public final static int lfdGraphic = 103; 2023 /** 2024 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#vargraphic_t} 2025 */ 2026public final static int lfdVarGraphic = 104; 2027 /** 2028 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#long_vargraphic_t} 2029 */ 2030public final static int lfdLongVarGraphic = 105; 2031 /** 2032 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#datalink_t} 2033 */ 2034public final static int lfdDatalink = 106; 2035 /** 2036 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#binary_integer_t} 2037 */ 2038public final static int lfdBinaryInteger = 107; // plsql 2039 /** 2040 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#pls_integer_t} 2041 */ 2042public final static int lfdPlsInteger = 108; // plsql 2043 /** 2044 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#byteint_t} 2045 */ 2046public final static int lfdByteint = 120; // teradata 2047 /** 2048 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#time_with_time_zone_t} 2049 */ 2050public final static int lfdTimeWithTZ = 121; //teradata 2051 /** 2052 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_t} 2053 */ 2054public final static int lfdIntervalYear = 130; //teradata 2055 /** 2056 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_year_to_month_t} 2057 */ 2058public final static int lfdIntervalYearToMonth = 131; //teradata 2059 /** 2060 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_month_t} 2061 */ 2062public final static int lfdIntervalMonth = 132; //teradata 2063 /** 2064 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_t} 2065 */ 2066public final static int lfdIntervalDay = 133; //teradata 2067 /** 2068 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_hour_t} 2069 */ 2070public final static int lfdIntervalDayToHour = 134; //teradata 2071 /** 2072 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_minute_t} 2073 */ 2074public final static int lfdIntervalDayToMinute = 135; //teradata 2075 /** 2076 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_day_to_second_t} 2077 */ 2078public final static int lfdIntervalDayToSecond = 136; //teradata 2079 /** 2080 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_t} 2081 */ 2082public final static int lfdIntervalHour = 137; //teradata 2083 /** 2084 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_to_minute_t} 2085 */ 2086public final static int lfdIntervalHourToMinute = 138; //teradata 2087 /** 2088 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_hour_to_second_t} 2089 */ 2090public final static int lfdIntervalHourToSecond = 139; //teradata 2091 /** 2092 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_minute_t} 2093 */ 2094public final static int lfdIntervalMinute = 140; //teradata 2095 /** 2096 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_minute_to_second_t} 2097 */ 2098public final static int lfdIntervalMinuteToSecond = 141; //teradata 2099 /** 2100 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_second_t} 2101 */ 2102public final static int lfdIntervalSecond = 142; //teradata 2103 /** 2104 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#byte_t} 2105 */ 2106public final static int lfdByte = 143; //teradata 2107 /** 2108 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varbyte_t} 2109 */ 2110public final static int lfdVarByte = 144; //teradata 2111 /** 2112 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 2113 */ 2114public final static int lfdCharacterVarying = 145; //teradata 2115 /** 2116 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#varchar_t} 2117 */ 2118public final static int lfdCharVarying = 146; //teradata 2119 /** 2120 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#period_t} 2121 */ 2122public final static int lfdPeriod = 147; //teradata 2123 /** 2124 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_large_object_t} 2125 */ 2126public final static int lfdCharacterLargeObject = 148; //teradata 2127 /** 2128 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#geometry_t} 2129 */ 2130public final static int lfdGeoMetry = 150;//sql srever 2008 2131 /** 2132 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#geography_t} 2133 */ 2134public final static int lfdGeoGraphy = 151;//sql srever 2008 2135 2136//public final static int lfdSigned = 160;//mysql 2137//public final static int lfdUnSigned = 161;//mysql 2138 /** 2139 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nvarchar_t} 2140 */ 2141public final static int lfdNationalCharVarying = 162;//mysql 2142 /** 2143 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#nvarchar_t} 2144 */ 2145public final static int lfdNcharVarying = 163;//mysql 2146 /** 2147 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#set_t} 2148 */ 2149public final static int lfdSet = 164;//mysql 2150 2151 /** 2152 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#char_large_object_t} 2153 */ 2154public final static int lfdCharLargeObject = 171;//db2 2155 /** 2156 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#dbclob_t} 2157 */ 2158public final static int lfdDBClob = 172; 2159 /** 2160 * @deprecated As of v1.4.3.0, replaced by {@link EDataType#interval_t} 2161 */ 2162public final static int lfdInterval = 181; //postgresql 2163 2164 2165/** 2166 * plsql type atribute 2167 * @deprecated As of v1.4.3.0, replaced by {@link TDatatypeAttribute} 2168 */ 2169public final static int lfdTypeAtribute = 107; 2170 2171/** 2172 * plsql rowtype atribute 2173 * @deprecated As of v1.4.3.0, replaced by {@link TDatatypeAttribute} 2174 */ 2175public final static int lfdRowTypeAtribute = 108; 2176 2177}