github.com/XiaoMi/Gaea@v1.2.5/parser/tidb-types/field_type.go (about) 1 // Copyright 2015 PingCAP, Inc. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // See the License for the specific language governing permissions and 12 // limitations under the License. 13 14 package types 15 16 import ( 17 "strconv" 18 19 "github.com/XiaoMi/Gaea/mysql" 20 "github.com/XiaoMi/Gaea/parser/tidb-types/json" 21 ast "github.com/XiaoMi/Gaea/parser/types" 22 ) 23 24 // UnspecifiedLength is unspecified length. 25 const ( 26 UnspecifiedLength = -1 27 ) 28 29 // FieldType records field type information. 30 type FieldType = ast.FieldType 31 32 // NewFieldType returns a FieldType, 33 // with a type and other information about field type. 34 func NewFieldType(tp byte) *FieldType { 35 return &FieldType{ 36 Tp: tp, 37 Flen: UnspecifiedLength, 38 Decimal: UnspecifiedLength, 39 } 40 } 41 42 // AggFieldType aggregates field types for a multi-argument function like `IF`, `IFNULL`, `COALESCE` 43 // whose return type is determined by the arguments' FieldTypes. 44 // Aggregation is performed by MergeFieldType function. 45 func AggFieldType(tps []*FieldType) *FieldType { 46 var currType FieldType 47 for i, t := range tps { 48 if i == 0 && currType.Tp == mysql.TypeUnspecified { 49 currType = *t 50 continue 51 } 52 mtp := MergeFieldType(currType.Tp, t.Tp) 53 currType.Tp = mtp 54 } 55 56 return &currType 57 } 58 59 // AggregateEvalType aggregates arguments' EvalType of a multi-argument function. 60 func AggregateEvalType(fts []*FieldType, flag *uint) EvalType { 61 var ( 62 aggregatedEvalType = ETString 63 unsigned bool 64 gotFirst bool 65 gotBinString bool 66 ) 67 lft := fts[0] 68 for _, ft := range fts { 69 if ft.Tp == mysql.TypeNull { 70 continue 71 } 72 et := ft.EvalType() 73 rft := ft 74 if (IsTypeBlob(ft.Tp) || IsTypeVarchar(ft.Tp) || IsTypeChar(ft.Tp)) && mysql.HasBinaryFlag(ft.Flag) { 75 gotBinString = true 76 } 77 if !gotFirst { 78 gotFirst = true 79 aggregatedEvalType = et 80 unsigned = mysql.HasUnsignedFlag(ft.Flag) 81 } else { 82 aggregatedEvalType = mergeEvalType(aggregatedEvalType, et, lft, rft, unsigned, mysql.HasUnsignedFlag(ft.Flag)) 83 unsigned = unsigned && mysql.HasUnsignedFlag(ft.Flag) 84 } 85 lft = rft 86 } 87 setTypeFlag(flag, mysql.UnsignedFlag, unsigned) 88 setTypeFlag(flag, mysql.BinaryFlag, !aggregatedEvalType.IsStringKind() || gotBinString) 89 return aggregatedEvalType 90 } 91 92 func mergeEvalType(lhs, rhs EvalType, lft, rft *FieldType, isLHSUnsigned, isRHSUnsigned bool) EvalType { 93 if lft.Tp == mysql.TypeUnspecified || rft.Tp == mysql.TypeUnspecified { 94 if lft.Tp == rft.Tp { 95 return ETString 96 } 97 if lft.Tp == mysql.TypeUnspecified { 98 lhs = rhs 99 } else { 100 rhs = lhs 101 } 102 } 103 if lhs.IsStringKind() || rhs.IsStringKind() { 104 return ETString 105 } else if lhs == ETReal || rhs == ETReal { 106 return ETReal 107 } else if lhs == ETDecimal || rhs == ETDecimal || isLHSUnsigned != isRHSUnsigned { 108 return ETDecimal 109 } 110 return ETInt 111 } 112 113 func setTypeFlag(flag *uint, flagItem uint, on bool) { 114 if on { 115 *flag |= flagItem 116 } else { 117 *flag &= ^flagItem 118 } 119 } 120 121 // DefaultParamTypeForValue returns the default FieldType for the parameterized value. 122 func DefaultParamTypeForValue(value interface{}, tp *FieldType) { 123 switch value.(type) { 124 case nil: 125 tp.Tp = mysql.TypeVarString 126 tp.Flen = UnspecifiedLength 127 tp.Decimal = UnspecifiedLength 128 default: 129 DefaultTypeForValue(value, tp) 130 if hasVariantFieldLength(tp) { 131 tp.Flen = UnspecifiedLength 132 } 133 if tp.Tp == mysql.TypeUnspecified { 134 tp.Tp = mysql.TypeVarString 135 } 136 } 137 } 138 139 func hasVariantFieldLength(tp *FieldType) bool { 140 switch tp.Tp { 141 case mysql.TypeLonglong, mysql.TypeVarString, mysql.TypeDouble, mysql.TypeBlob, 142 mysql.TypeBit, mysql.TypeDuration, mysql.TypeNewDecimal, mysql.TypeEnum, mysql.TypeSet: 143 return true 144 } 145 return false 146 } 147 148 // DefaultTypeForValue returns the default FieldType for the value. 149 func DefaultTypeForValue(value interface{}, tp *FieldType) { 150 switch x := value.(type) { 151 case nil: 152 tp.Tp = mysql.TypeNull 153 tp.Flen = 0 154 tp.Decimal = 0 155 SetBinChsClnFlag(tp) 156 case bool: 157 tp.Tp = mysql.TypeLonglong 158 tp.Flen = 1 159 tp.Decimal = 0 160 tp.Flag |= mysql.IsBooleanFlag 161 SetBinChsClnFlag(tp) 162 case int: 163 tp.Tp = mysql.TypeLonglong 164 tp.Flen = len(strconv.FormatInt(int64(x), 10)) 165 tp.Decimal = 0 166 SetBinChsClnFlag(tp) 167 case int64: 168 tp.Tp = mysql.TypeLonglong 169 tp.Flen = len(strconv.FormatInt(x, 10)) 170 tp.Decimal = 0 171 SetBinChsClnFlag(tp) 172 case uint64: 173 tp.Tp = mysql.TypeLonglong 174 tp.Flag |= mysql.UnsignedFlag 175 tp.Flen = len(strconv.FormatUint(x, 10)) 176 tp.Decimal = 0 177 SetBinChsClnFlag(tp) 178 case string: 179 tp.Tp = mysql.TypeVarString 180 // TODO: tp.Flen should be len(x) * 3 (max bytes length of CharsetUTF8) 181 tp.Flen = len(x) 182 tp.Decimal = UnspecifiedLength 183 tp.Charset, tp.Collate = mysql.GetDefaultCharsetAndCollate() 184 case float64: 185 tp.Tp = mysql.TypeDouble 186 s := strconv.FormatFloat(x, 'f', -1, 64) 187 tp.Flen = len(s) 188 tp.Decimal = UnspecifiedLength 189 SetBinChsClnFlag(tp) 190 case []byte: 191 tp.Tp = mysql.TypeBlob 192 tp.Flen = len(x) 193 tp.Decimal = UnspecifiedLength 194 SetBinChsClnFlag(tp) 195 case BitLiteral: 196 tp.Tp = mysql.TypeVarString 197 tp.Flen = len(x) 198 tp.Decimal = 0 199 SetBinChsClnFlag(tp) 200 case HexLiteral: 201 tp.Tp = mysql.TypeVarString 202 tp.Flen = len(x) 203 tp.Decimal = 0 204 tp.Flag |= mysql.UnsignedFlag 205 SetBinChsClnFlag(tp) 206 case BinaryLiteral: 207 tp.Tp = mysql.TypeBit 208 tp.Flen = len(x) * 8 209 tp.Decimal = 0 210 SetBinChsClnFlag(tp) 211 tp.Flag &= ^mysql.BinaryFlag 212 tp.Flag |= mysql.UnsignedFlag 213 case Time: 214 tp.Tp = x.Type 215 switch x.Type { 216 case mysql.TypeDate: 217 tp.Flen = mysql.MaxDateWidth 218 tp.Decimal = UnspecifiedLength 219 case mysql.TypeDatetime, mysql.TypeTimestamp: 220 tp.Flen = mysql.MaxDatetimeWidthNoFsp 221 if x.Fsp > DefaultFsp { // consider point('.') and the fractional part. 222 tp.Flen += x.Fsp + 1 223 } 224 tp.Decimal = x.Fsp 225 } 226 SetBinChsClnFlag(tp) 227 case Duration: 228 tp.Tp = mysql.TypeDuration 229 tp.Flen = len(x.String()) 230 if x.Fsp > DefaultFsp { // consider point('.') and the fractional part. 231 tp.Flen = x.Fsp + 1 232 } 233 tp.Decimal = x.Fsp 234 SetBinChsClnFlag(tp) 235 case *MyDecimal: 236 tp.Tp = mysql.TypeNewDecimal 237 tp.Flen = len(x.ToString()) 238 tp.Decimal = int(x.digitsFrac) 239 SetBinChsClnFlag(tp) 240 case Enum: 241 tp.Tp = mysql.TypeEnum 242 tp.Flen = len(x.Name) 243 tp.Decimal = UnspecifiedLength 244 SetBinChsClnFlag(tp) 245 case Set: 246 tp.Tp = mysql.TypeSet 247 tp.Flen = len(x.Name) 248 tp.Decimal = UnspecifiedLength 249 SetBinChsClnFlag(tp) 250 case json.BinaryJSON: 251 tp.Tp = mysql.TypeJSON 252 tp.Flen = UnspecifiedLength 253 tp.Decimal = 0 254 tp.Charset = mysql.CharsetBin 255 tp.Collate = mysql.CollationBin 256 default: 257 tp.Tp = mysql.TypeUnspecified 258 tp.Flen = UnspecifiedLength 259 tp.Decimal = UnspecifiedLength 260 } 261 } 262 263 // DefaultCharsetForType returns the default charset/collation for mysql type. 264 func DefaultCharsetForType(tp byte) (string, string) { 265 switch tp { 266 case mysql.TypeVarString, mysql.TypeString, mysql.TypeVarchar: 267 // Default charset for string types is utf8. 268 return mysql.DefaultCharset, mysql.DefaultCollationName 269 } 270 return mysql.CharsetBin, mysql.CollationBin 271 } 272 273 // MergeFieldType merges two MySQL type to a new type. 274 // This is used in hybrid field type expression. 275 // For example "select case c when 1 then 2 when 2 then 'tidb' from t;" 276 // The result field type of the case expression is the merged type of the two when clause. 277 // See https://github.com/mysql/mysql-server/blob/5.7/sql/field.cc#L1042 278 func MergeFieldType(a byte, b byte) byte { 279 ia := getFieldTypeIndex(a) 280 ib := getFieldTypeIndex(b) 281 return fieldTypeMergeRules[ia][ib] 282 } 283 284 func getFieldTypeIndex(tp byte) int { 285 itp := int(tp) 286 if itp < fieldTypeTearFrom { 287 return itp 288 } 289 return fieldTypeTearFrom + itp - fieldTypeTearTo - 1 290 } 291 292 const ( 293 fieldTypeTearFrom = int(mysql.TypeBit) + 1 294 fieldTypeTearTo = int(mysql.TypeJSON) - 1 295 fieldTypeNum = fieldTypeTearFrom + (255 - fieldTypeTearTo) 296 ) 297 298 var fieldTypeMergeRules = [fieldTypeNum][fieldTypeNum]byte{ 299 /* mysql.TypeDecimal -> */ 300 { 301 //mysql.TypeDecimal mysql.TypeTiny 302 mysql.TypeNewDecimal, mysql.TypeNewDecimal, 303 //mysql.TypeShort mysql.TypeLong 304 mysql.TypeNewDecimal, mysql.TypeNewDecimal, 305 //mysql.TypeFloat mysql.TypeDouble 306 mysql.TypeDouble, mysql.TypeDouble, 307 //mysql.TypeNull mysql.TypeTimestamp 308 mysql.TypeNewDecimal, mysql.TypeVarchar, 309 //mysql.TypeLonglong mysql.TypeInt24 310 mysql.TypeDecimal, mysql.TypeDecimal, 311 //mysql.TypeDate mysql.TypeTime 312 mysql.TypeVarchar, mysql.TypeVarchar, 313 //mysql.TypeDatetime mysql.TypeYear 314 mysql.TypeVarchar, mysql.TypeVarchar, 315 //mysql.TypeNewDate mysql.TypeVarchar 316 mysql.TypeVarchar, mysql.TypeVarchar, 317 //mysql.TypeBit <16>-<244> 318 mysql.TypeVarchar, 319 //mysql.TypeJSON 320 mysql.TypeVarchar, 321 //mysql.TypeNewDecimal mysql.TypeEnum 322 mysql.TypeNewDecimal, mysql.TypeVarchar, 323 //mysql.TypeSet mysql.TypeTinyBlob 324 mysql.TypeVarchar, mysql.TypeTinyBlob, 325 //mysql.TypeMediumBlob mysql.TypeLongBlob 326 mysql.TypeMediumBlob, mysql.TypeLongBlob, 327 //mysql.TypeBlob mysql.TypeVarString 328 mysql.TypeBlob, mysql.TypeVarchar, 329 //mysql.TypeString mysql.TypeGeometry 330 mysql.TypeString, mysql.TypeVarchar, 331 }, 332 /* mysql.TypeTiny -> */ 333 { 334 //mysql.TypeDecimal mysql.TypeTiny 335 mysql.TypeNewDecimal, mysql.TypeTiny, 336 //mysql.TypeShort mysql.TypeLong 337 mysql.TypeShort, mysql.TypeLong, 338 //mysql.TypeFloat mysql.TypeDouble 339 mysql.TypeFloat, mysql.TypeDouble, 340 //mysql.TypeNull mysql.TypeTimestamp 341 mysql.TypeTiny, mysql.TypeVarchar, 342 //mysql.TypeLonglong mysql.TypeInt24 343 mysql.TypeLonglong, mysql.TypeInt24, 344 //mysql.TypeDate mysql.TypeTime 345 mysql.TypeVarchar, mysql.TypeVarchar, 346 //mysql.TypeDatetime mysql.TypeYear 347 mysql.TypeVarchar, mysql.TypeTiny, 348 //mysql.TypeNewDate mysql.TypeVarchar 349 mysql.TypeVarchar, mysql.TypeVarchar, 350 //mysql.TypeBit <16>-<244> 351 mysql.TypeVarchar, 352 //mysql.TypeJSON 353 mysql.TypeVarchar, 354 //mysql.TypeNewDecimal mysql.TypeEnum 355 mysql.TypeNewDecimal, mysql.TypeVarchar, 356 //mysql.TypeSet mysql.TypeTinyBlob 357 mysql.TypeVarchar, mysql.TypeTinyBlob, 358 //mysql.TypeMediumBlob mysql.TypeLongBlob 359 mysql.TypeMediumBlob, mysql.TypeLongBlob, 360 //mysql.TypeBlob mysql.TypeVarString 361 mysql.TypeBlob, mysql.TypeVarchar, 362 //mysql.TypeString mysql.TypeGeometry 363 mysql.TypeString, mysql.TypeVarchar, 364 }, 365 /* mysql.TypeShort -> */ 366 { 367 //mysql.TypeDecimal mysql.TypeTiny 368 mysql.TypeNewDecimal, mysql.TypeShort, 369 //mysql.TypeShort mysql.TypeLong 370 mysql.TypeShort, mysql.TypeLong, 371 //mysql.TypeFloat mysql.TypeDouble 372 mysql.TypeFloat, mysql.TypeDouble, 373 //mysql.TypeNull mysql.TypeTimestamp 374 mysql.TypeShort, mysql.TypeVarchar, 375 //mysql.TypeLonglong mysql.TypeInt24 376 mysql.TypeLonglong, mysql.TypeInt24, 377 //mysql.TypeDate mysql.TypeTime 378 mysql.TypeVarchar, mysql.TypeVarchar, 379 //mysql.TypeDatetime mysql.TypeYear 380 mysql.TypeVarchar, mysql.TypeShort, 381 //mysql.TypeNewDate mysql.TypeVarchar 382 mysql.TypeVarchar, mysql.TypeVarchar, 383 //mysql.TypeBit <16>-<244> 384 mysql.TypeVarchar, 385 //mysql.TypeJSON 386 mysql.TypeVarchar, 387 //mysql.TypeNewDecimal mysql.TypeEnum 388 mysql.TypeNewDecimal, mysql.TypeVarchar, 389 //mysql.TypeSet mysql.TypeTinyBlob 390 mysql.TypeVarchar, mysql.TypeTinyBlob, 391 //mysql.TypeMediumBlob mysql.TypeLongBlob 392 mysql.TypeMediumBlob, mysql.TypeLongBlob, 393 //mysql.TypeBlob mysql.TypeVarString 394 mysql.TypeBlob, mysql.TypeVarchar, 395 //mysql.TypeString mysql.TypeGeometry 396 mysql.TypeString, mysql.TypeVarchar, 397 }, 398 /* mysql.TypeLong -> */ 399 { 400 //mysql.TypeDecimal mysql.TypeTiny 401 mysql.TypeNewDecimal, mysql.TypeLong, 402 //mysql.TypeShort mysql.TypeLong 403 mysql.TypeLong, mysql.TypeLong, 404 //mysql.TypeFloat mysql.TypeDouble 405 mysql.TypeDouble, mysql.TypeDouble, 406 //mysql.TypeNull mysql.TypeTimestamp 407 mysql.TypeLong, mysql.TypeVarchar, 408 //mysql.TypeLonglong mysql.TypeInt24 409 mysql.TypeLonglong, mysql.TypeLong, 410 //mysql.TypeDate mysql.TypeTime 411 mysql.TypeVarchar, mysql.TypeVarchar, 412 //mysql.TypeDatetime mysql.TypeYear 413 mysql.TypeVarchar, mysql.TypeLong, 414 //mysql.TypeNewDate mysql.TypeVarchar 415 mysql.TypeVarchar, mysql.TypeVarchar, 416 //mysql.TypeBit <16>-<244> 417 mysql.TypeVarchar, 418 //mysql.TypeJSON 419 mysql.TypeVarchar, 420 //mysql.TypeNewDecimal mysql.TypeEnum 421 mysql.TypeNewDecimal, mysql.TypeVarchar, 422 //mysql.TypeSet mysql.TypeTinyBlob 423 mysql.TypeVarchar, mysql.TypeTinyBlob, 424 //mysql.TypeMediumBlob mysql.TypeLongBlob 425 mysql.TypeMediumBlob, mysql.TypeLongBlob, 426 //mysql.TypeBlob mysql.TypeVarString 427 mysql.TypeBlob, mysql.TypeVarchar, 428 //mysql.TypeString mysql.TypeGeometry 429 mysql.TypeString, mysql.TypeVarchar, 430 }, 431 /* mysql.TypeFloat -> */ 432 { 433 //mysql.TypeDecimal mysql.TypeTiny 434 mysql.TypeDouble, mysql.TypeFloat, 435 //mysql.TypeShort mysql.TypeLong 436 mysql.TypeFloat, mysql.TypeDouble, 437 //mysql.TypeFloat mysql.TypeDouble 438 mysql.TypeFloat, mysql.TypeDouble, 439 //mysql.TypeNull mysql.TypeTimestamp 440 mysql.TypeFloat, mysql.TypeVarchar, 441 //mysql.TypeLonglong mysql.TypeInt24 442 mysql.TypeFloat, mysql.TypeFloat, 443 //mysql.TypeDate mysql.TypeTime 444 mysql.TypeVarchar, mysql.TypeVarchar, 445 //mysql.TypeDatetime mysql.TypeYear 446 mysql.TypeVarchar, mysql.TypeFloat, 447 //mysql.TypeNewDate mysql.TypeVarchar 448 mysql.TypeVarchar, mysql.TypeVarchar, 449 //mysql.TypeBit <16>-<244> 450 mysql.TypeVarchar, 451 //mysql.TypeJSON 452 mysql.TypeVarchar, 453 //mysql.TypeNewDecimal mysql.TypeEnum 454 mysql.TypeDouble, mysql.TypeVarchar, 455 //mysql.TypeSet mysql.TypeTinyBlob 456 mysql.TypeVarchar, mysql.TypeTinyBlob, 457 //mysql.TypeMediumBlob mysql.TypeLongBlob 458 mysql.TypeMediumBlob, mysql.TypeLongBlob, 459 //mysql.TypeBlob mysql.TypeVarString 460 mysql.TypeBlob, mysql.TypeVarchar, 461 //mysql.TypeString mysql.TypeGeometry 462 mysql.TypeString, mysql.TypeVarchar, 463 }, 464 /* mysql.TypeDouble -> */ 465 { 466 //mysql.TypeDecimal mysql.TypeTiny 467 mysql.TypeDouble, mysql.TypeDouble, 468 //mysql.TypeShort mysql.TypeLong 469 mysql.TypeDouble, mysql.TypeDouble, 470 //mysql.TypeFloat mysql.TypeDouble 471 mysql.TypeDouble, mysql.TypeDouble, 472 //mysql.TypeNull mysql.TypeTimestamp 473 mysql.TypeDouble, mysql.TypeVarchar, 474 //mysql.TypeLonglong mysql.TypeInt24 475 mysql.TypeDouble, mysql.TypeDouble, 476 //mysql.TypeDate mysql.TypeTime 477 mysql.TypeVarchar, mysql.TypeVarchar, 478 //mysql.TypeDatetime mysql.TypeYear 479 mysql.TypeVarchar, mysql.TypeDouble, 480 //mysql.TypeNewDate mysql.TypeVarchar 481 mysql.TypeVarchar, mysql.TypeVarchar, 482 //mysql.TypeBit <16>-<244> 483 mysql.TypeVarchar, 484 //mysql.TypeJSON 485 mysql.TypeVarchar, 486 //mysql.TypeNewDecimal mysql.TypeEnum 487 mysql.TypeDouble, mysql.TypeVarchar, 488 //mysql.TypeSet mysql.TypeTinyBlob 489 mysql.TypeVarchar, mysql.TypeTinyBlob, 490 //mysql.TypeMediumBlob mysql.TypeLongBlob 491 mysql.TypeMediumBlob, mysql.TypeLongBlob, 492 //mysql.TypeBlob mysql.TypeVarString 493 mysql.TypeBlob, mysql.TypeVarchar, 494 //mysql.TypeString mysql.TypeGeometry 495 mysql.TypeString, mysql.TypeVarchar, 496 }, 497 /* mysql.TypeNull -> */ 498 { 499 //mysql.TypeDecimal mysql.TypeTiny 500 mysql.TypeNewDecimal, mysql.TypeTiny, 501 //mysql.TypeShort mysql.TypeLong 502 mysql.TypeShort, mysql.TypeLong, 503 //mysql.TypeFloat mysql.TypeDouble 504 mysql.TypeFloat, mysql.TypeDouble, 505 //mysql.TypeNull mysql.TypeTimestamp 506 mysql.TypeNull, mysql.TypeTimestamp, 507 //mysql.TypeLonglong mysql.TypeInt24 508 mysql.TypeLonglong, mysql.TypeLonglong, 509 //mysql.TypeDate mysql.TypeTime 510 mysql.TypeDate, mysql.TypeDuration, 511 //mysql.TypeDatetime mysql.TypeYear 512 mysql.TypeDatetime, mysql.TypeYear, 513 //mysql.TypeNewDate mysql.TypeVarchar 514 mysql.TypeNewDate, mysql.TypeVarchar, 515 //mysql.TypeBit <16>-<244> 516 mysql.TypeBit, 517 //mysql.TypeJSON 518 mysql.TypeJSON, 519 //mysql.TypeNewDecimal mysql.TypeEnum 520 mysql.TypeNewDecimal, mysql.TypeEnum, 521 //mysql.TypeSet mysql.TypeTinyBlob 522 mysql.TypeSet, mysql.TypeTinyBlob, 523 //mysql.TypeMediumBlob mysql.TypeLongBlob 524 mysql.TypeMediumBlob, mysql.TypeLongBlob, 525 //mysql.TypeBlob mysql.TypeVarString 526 mysql.TypeBlob, mysql.TypeVarchar, 527 //mysql.TypeString mysql.TypeGeometry 528 mysql.TypeString, mysql.TypeGeometry, 529 }, 530 /* mysql.TypeTimestamp -> */ 531 { 532 //mysql.TypeDecimal mysql.TypeTiny 533 mysql.TypeVarchar, mysql.TypeVarchar, 534 //mysql.TypeShort mysql.TypeLong 535 mysql.TypeVarchar, mysql.TypeVarchar, 536 //mysql.TypeFloat mysql.TypeDouble 537 mysql.TypeVarchar, mysql.TypeVarchar, 538 //mysql.TypeNull mysql.TypeTimestamp 539 mysql.TypeTimestamp, mysql.TypeTimestamp, 540 //mysql.TypeLonglong mysql.TypeInt24 541 mysql.TypeVarchar, mysql.TypeVarchar, 542 //mysql.TypeDate mysql.TypeTime 543 mysql.TypeDatetime, mysql.TypeDatetime, 544 //mysql.TypeDatetime mysql.TypeYear 545 mysql.TypeDatetime, mysql.TypeVarchar, 546 //mysql.TypeNewDate mysql.TypeVarchar 547 mysql.TypeNewDate, mysql.TypeVarchar, 548 //mysql.TypeBit <16>-<244> 549 mysql.TypeVarchar, 550 //mysql.TypeJSON 551 mysql.TypeVarchar, 552 //mysql.TypeNewDecimal mysql.TypeEnum 553 mysql.TypeVarchar, mysql.TypeVarchar, 554 //mysql.TypeSet mysql.TypeTinyBlob 555 mysql.TypeVarchar, mysql.TypeTinyBlob, 556 //mysql.TypeMediumBlob mysql.TypeLongBlob 557 mysql.TypeMediumBlob, mysql.TypeLongBlob, 558 //mysql.TypeBlob mysql.TypeVarString 559 mysql.TypeBlob, mysql.TypeVarchar, 560 //mysql.TypeString mysql.TypeGeometry 561 mysql.TypeString, mysql.TypeVarchar, 562 }, 563 /* mysql.TypeLonglong -> */ 564 { 565 //mysql.TypeDecimal mysql.TypeTiny 566 mysql.TypeNewDecimal, mysql.TypeLonglong, 567 //mysql.TypeShort mysql.TypeLong 568 mysql.TypeLonglong, mysql.TypeLonglong, 569 //mysql.TypeFloat mysql.TypeDouble 570 mysql.TypeDouble, mysql.TypeDouble, 571 //mysql.TypeNull mysql.TypeTimestamp 572 mysql.TypeLonglong, mysql.TypeVarchar, 573 //mysql.TypeLonglong mysql.TypeInt24 574 mysql.TypeLonglong, mysql.TypeLong, 575 //mysql.TypeDate mysql.TypeTime 576 mysql.TypeVarchar, mysql.TypeVarchar, 577 //mysql.TypeDatetime mysql.TypeYear 578 mysql.TypeVarchar, mysql.TypeLonglong, 579 //mysql.TypeNewDate mysql.TypeVarchar 580 mysql.TypeNewDate, mysql.TypeVarchar, 581 //mysql.TypeBit <16>-<244> 582 mysql.TypeVarchar, 583 //mysql.TypeJSON 584 mysql.TypeVarchar, 585 //mysql.TypeNewDecimal mysql.TypeEnum 586 mysql.TypeNewDecimal, mysql.TypeVarchar, 587 //mysql.TypeSet mysql.TypeTinyBlob 588 mysql.TypeVarchar, mysql.TypeTinyBlob, 589 //mysql.TypeMediumBlob mysql.TypeLongBlob 590 mysql.TypeMediumBlob, mysql.TypeLongBlob, 591 //mysql.TypeBlob mysql.TypeVarString 592 mysql.TypeBlob, mysql.TypeVarchar, 593 //mysql.TypeString mysql.TypeGeometry 594 mysql.TypeString, mysql.TypeVarchar, 595 }, 596 /* mysql.TypeInt24 -> */ 597 { 598 //mysql.TypeDecimal mysql.TypeTiny 599 mysql.TypeNewDecimal, mysql.TypeInt24, 600 //mysql.TypeShort mysql.TypeLong 601 mysql.TypeInt24, mysql.TypeLong, 602 //mysql.TypeFloat mysql.TypeDouble 603 mysql.TypeFloat, mysql.TypeDouble, 604 //mysql.TypeNull mysql.TypeTimestamp 605 mysql.TypeInt24, mysql.TypeVarchar, 606 //mysql.TypeLonglong mysql.TypeInt24 607 mysql.TypeLonglong, mysql.TypeInt24, 608 //mysql.TypeDate mysql.TypeTime 609 mysql.TypeVarchar, mysql.TypeVarchar, 610 //mysql.TypeDatetime mysql.TypeYear 611 mysql.TypeVarchar, mysql.TypeInt24, 612 //mysql.TypeNewDate mysql.TypeVarchar 613 mysql.TypeNewDate, mysql.TypeVarchar, 614 //mysql.TypeBit <16>-<244> 615 mysql.TypeVarchar, 616 //mysql.TypeJSON 617 mysql.TypeVarchar, 618 //mysql.TypeNewDecimal mysql.TypeEnum 619 mysql.TypeNewDecimal, mysql.TypeVarchar, 620 //mysql.TypeSet mysql.TypeTinyBlob 621 mysql.TypeVarchar, mysql.TypeTinyBlob, 622 //mysql.TypeMediumBlob mysql.TypeLongBlob 623 mysql.TypeMediumBlob, mysql.TypeLongBlob, 624 //mysql.TypeBlob mysql.TypeVarString 625 mysql.TypeBlob, mysql.TypeVarchar, 626 //mysql.TypeString mysql.TypeGeometry 627 mysql.TypeString, mysql.TypeVarchar, 628 }, 629 /* mysql.TypeDate -> */ 630 { 631 //mysql.TypeDecimal mysql.TypeTiny 632 mysql.TypeVarchar, mysql.TypeVarchar, 633 //mysql.TypeShort mysql.TypeLong 634 mysql.TypeVarchar, mysql.TypeVarchar, 635 //mysql.TypeFloat mysql.TypeDouble 636 mysql.TypeVarchar, mysql.TypeVarchar, 637 //mysql.TypeNull mysql.TypeTimestamp 638 mysql.TypeDate, mysql.TypeDatetime, 639 //mysql.TypeLonglong mysql.TypeInt24 640 mysql.TypeVarchar, mysql.TypeVarchar, 641 //mysql.TypeDate mysql.TypeTime 642 mysql.TypeDate, mysql.TypeDatetime, 643 //mysql.TypeDatetime mysql.TypeYear 644 mysql.TypeDatetime, mysql.TypeVarchar, 645 //mysql.TypeNewDate mysql.TypeVarchar 646 mysql.TypeNewDate, mysql.TypeVarchar, 647 //mysql.TypeBit <16>-<244> 648 mysql.TypeVarchar, 649 //mysql.TypeJSON 650 mysql.TypeVarchar, 651 //mysql.TypeNewDecimal mysql.TypeEnum 652 mysql.TypeVarchar, mysql.TypeVarchar, 653 //mysql.TypeSet mysql.TypeTinyBlob 654 mysql.TypeVarchar, mysql.TypeTinyBlob, 655 //mysql.TypeMediumBlob mysql.TypeLongBlob 656 mysql.TypeMediumBlob, mysql.TypeLongBlob, 657 //mysql.TypeBlob mysql.TypeVarString 658 mysql.TypeBlob, mysql.TypeVarchar, 659 //mysql.TypeString mysql.TypeGeometry 660 mysql.TypeString, mysql.TypeVarchar, 661 }, 662 /* mysql.TypeTime -> */ 663 { 664 //mysql.TypeDecimal mysql.TypeTiny 665 mysql.TypeVarchar, mysql.TypeVarchar, 666 //mysql.TypeShort mysql.TypeLong 667 mysql.TypeVarchar, mysql.TypeVarchar, 668 //mysql.TypeFloat mysql.TypeDouble 669 mysql.TypeVarchar, mysql.TypeVarchar, 670 //mysql.TypeNull mysql.TypeTimestamp 671 mysql.TypeDuration, mysql.TypeDatetime, 672 //mysql.TypeLonglong mysql.TypeInt24 673 mysql.TypeVarchar, mysql.TypeVarchar, 674 //mysql.TypeDate mysql.TypeTime 675 mysql.TypeDatetime, mysql.TypeDuration, 676 //mysql.TypeDatetime mysql.TypeYear 677 mysql.TypeDatetime, mysql.TypeVarchar, 678 //mysql.TypeNewDate mysql.TypeVarchar 679 mysql.TypeNewDate, mysql.TypeVarchar, 680 //mysql.TypeBit <16>-<244> 681 mysql.TypeVarchar, 682 //mysql.TypeJSON 683 mysql.TypeVarchar, 684 //mysql.TypeNewDecimal mysql.TypeEnum 685 mysql.TypeVarchar, mysql.TypeVarchar, 686 //mysql.TypeSet mysql.TypeTinyBlob 687 mysql.TypeVarchar, mysql.TypeTinyBlob, 688 //mysql.TypeMediumBlob mysql.TypeLongBlob 689 mysql.TypeMediumBlob, mysql.TypeLongBlob, 690 //mysql.TypeBlob mysql.TypeVarString 691 mysql.TypeBlob, mysql.TypeVarchar, 692 //mysql.TypeString mysql.TypeGeometry 693 mysql.TypeString, mysql.TypeVarchar, 694 }, 695 /* mysql.TypeDatetime -> */ 696 { 697 //mysql.TypeDecimal mysql.TypeTiny 698 mysql.TypeVarchar, mysql.TypeVarchar, 699 //mysql.TypeShort mysql.TypeLong 700 mysql.TypeVarchar, mysql.TypeVarchar, 701 //mysql.TypeFloat mysql.TypeDouble 702 mysql.TypeVarchar, mysql.TypeVarchar, 703 //mysql.TypeNull mysql.TypeTimestamp 704 mysql.TypeDatetime, mysql.TypeDatetime, 705 //mysql.TypeLonglong mysql.TypeInt24 706 mysql.TypeVarchar, mysql.TypeVarchar, 707 //mysql.TypeDate mysql.TypeTime 708 mysql.TypeDatetime, mysql.TypeDatetime, 709 //mysql.TypeDatetime mysql.TypeYear 710 mysql.TypeDatetime, mysql.TypeVarchar, 711 //mysql.TypeNewDate mysql.TypeVarchar 712 mysql.TypeNewDate, mysql.TypeVarchar, 713 //mysql.TypeBit <16>-<244> 714 mysql.TypeVarchar, 715 //mysql.TypeJSON 716 mysql.TypeVarchar, 717 //mysql.TypeNewDecimal mysql.TypeEnum 718 mysql.TypeVarchar, mysql.TypeVarchar, 719 //mysql.TypeSet mysql.TypeTinyBlob 720 mysql.TypeVarchar, mysql.TypeTinyBlob, 721 //mysql.TypeMediumBlob mysql.TypeLongBlob 722 mysql.TypeMediumBlob, mysql.TypeLongBlob, 723 //mysql.TypeBlob mysql.TypeVarString 724 mysql.TypeBlob, mysql.TypeVarchar, 725 //mysql.TypeString mysql.TypeGeometry 726 mysql.TypeString, mysql.TypeVarchar, 727 }, 728 /* mysql.TypeYear -> */ 729 { 730 //mysql.TypeDecimal mysql.TypeTiny 731 mysql.TypeDecimal, mysql.TypeTiny, 732 //mysql.TypeShort mysql.TypeLong 733 mysql.TypeShort, mysql.TypeLong, 734 //mysql.TypeFloat mysql.TypeDouble 735 mysql.TypeFloat, mysql.TypeDouble, 736 //mysql.TypeNull mysql.TypeTimestamp 737 mysql.TypeYear, mysql.TypeVarchar, 738 //mysql.TypeLonglong mysql.TypeInt24 739 mysql.TypeLonglong, mysql.TypeInt24, 740 //mysql.TypeDate mysql.TypeTime 741 mysql.TypeVarchar, mysql.TypeVarchar, 742 //mysql.TypeDatetime mysql.TypeYear 743 mysql.TypeVarchar, mysql.TypeYear, 744 //mysql.TypeNewDate mysql.TypeVarchar 745 mysql.TypeVarchar, mysql.TypeVarchar, 746 //mysql.TypeBit <16>-<244> 747 mysql.TypeVarchar, 748 //mysql.TypeJSON 749 mysql.TypeVarchar, 750 //mysql.TypeNewDecimal mysql.TypeEnum 751 mysql.TypeNewDecimal, mysql.TypeVarchar, 752 //mysql.TypeSet mysql.TypeTinyBlob 753 mysql.TypeVarchar, mysql.TypeTinyBlob, 754 //mysql.TypeMediumBlob mysql.TypeLongBlob 755 mysql.TypeMediumBlob, mysql.TypeLongBlob, 756 //mysql.TypeBlob mysql.TypeVarString 757 mysql.TypeBlob, mysql.TypeVarchar, 758 //mysql.TypeString mysql.TypeGeometry 759 mysql.TypeString, mysql.TypeVarchar, 760 }, 761 /* mysql.TypeNewDate -> */ 762 { 763 //mysql.TypeDecimal mysql.TypeTiny 764 mysql.TypeVarchar, mysql.TypeVarchar, 765 //mysql.TypeShort mysql.TypeLong 766 mysql.TypeVarchar, mysql.TypeVarchar, 767 //mysql.TypeFloat mysql.TypeDouble 768 mysql.TypeVarchar, mysql.TypeVarchar, 769 //mysql.TypeNull mysql.TypeTimestamp 770 mysql.TypeNewDate, mysql.TypeDatetime, 771 //mysql.TypeLonglong mysql.TypeInt24 772 mysql.TypeVarchar, mysql.TypeVarchar, 773 //mysql.TypeDate mysql.TypeTime 774 mysql.TypeNewDate, mysql.TypeDatetime, 775 //mysql.TypeDatetime mysql.TypeYear 776 mysql.TypeDatetime, mysql.TypeVarchar, 777 //mysql.TypeNewDate mysql.TypeVarchar 778 mysql.TypeNewDate, mysql.TypeVarchar, 779 //mysql.TypeBit <16>-<244> 780 mysql.TypeVarchar, 781 //mysql.TypeJSON 782 mysql.TypeVarchar, 783 //mysql.TypeNewDecimal mysql.TypeEnum 784 mysql.TypeVarchar, mysql.TypeVarchar, 785 //mysql.TypeSet mysql.TypeTinyBlob 786 mysql.TypeVarchar, mysql.TypeTinyBlob, 787 //mysql.TypeMediumBlob mysql.TypeLongBlob 788 mysql.TypeMediumBlob, mysql.TypeLongBlob, 789 //mysql.TypeBlob mysql.TypeVarString 790 mysql.TypeBlob, mysql.TypeVarchar, 791 //mysql.TypeString mysql.TypeGeometry 792 mysql.TypeString, mysql.TypeVarchar, 793 }, 794 /* mysql.TypeVarchar -> */ 795 { 796 //mysql.TypeDecimal mysql.TypeTiny 797 mysql.TypeVarchar, mysql.TypeVarchar, 798 //mysql.TypeShort mysql.TypeLong 799 mysql.TypeVarchar, mysql.TypeVarchar, 800 //mysql.TypeFloat mysql.TypeDouble 801 mysql.TypeVarchar, mysql.TypeVarchar, 802 //mysql.TypeNull mysql.TypeTimestamp 803 mysql.TypeVarchar, mysql.TypeVarchar, 804 //mysql.TypeLonglong mysql.TypeInt24 805 mysql.TypeVarchar, mysql.TypeVarchar, 806 //mysql.TypeDate mysql.TypeTime 807 mysql.TypeVarchar, mysql.TypeVarchar, 808 //mysql.TypeDatetime mysql.TypeYear 809 mysql.TypeVarchar, mysql.TypeVarchar, 810 //mysql.TypeNewDate mysql.TypeVarchar 811 mysql.TypeVarchar, mysql.TypeVarchar, 812 //mysql.TypeBit <16>-<244> 813 mysql.TypeVarchar, 814 //mysql.TypeJSON 815 mysql.TypeVarchar, 816 //mysql.TypeNewDecimal mysql.TypeEnum 817 mysql.TypeVarchar, mysql.TypeVarchar, 818 //mysql.TypeSet mysql.TypeTinyBlob 819 mysql.TypeVarchar, mysql.TypeTinyBlob, 820 //mysql.TypeMediumBlob mysql.TypeLongBlob 821 mysql.TypeMediumBlob, mysql.TypeLongBlob, 822 //mysql.TypeBlob mysql.TypeVarString 823 mysql.TypeBlob, mysql.TypeVarchar, 824 //mysql.TypeString mysql.TypeGeometry 825 mysql.TypeVarchar, mysql.TypeVarchar, 826 }, 827 /* mysql.TypeBit -> */ 828 { 829 //mysql.TypeDecimal mysql.TypeTiny 830 mysql.TypeVarchar, mysql.TypeVarchar, 831 //mysql.TypeShort mysql.TypeLong 832 mysql.TypeVarchar, mysql.TypeVarchar, 833 //mysql.TypeFloat mysql.TypeDouble 834 mysql.TypeVarchar, mysql.TypeVarchar, 835 //mysql.TypeNull mysql.TypeTimestamp 836 mysql.TypeBit, mysql.TypeVarchar, 837 //mysql.TypeLonglong mysql.TypeInt24 838 mysql.TypeVarchar, mysql.TypeVarchar, 839 //mysql.TypeDate mysql.TypeTime 840 mysql.TypeVarchar, mysql.TypeVarchar, 841 //mysql.TypeDatetime mysql.TypeYear 842 mysql.TypeVarchar, mysql.TypeVarchar, 843 //mysql.TypeNewDate mysql.TypeVarchar 844 mysql.TypeVarchar, mysql.TypeVarchar, 845 //mysql.TypeBit <16>-<244> 846 mysql.TypeBit, 847 //mysql.TypeJSON 848 mysql.TypeVarchar, 849 //mysql.TypeNewDecimal mysql.TypeEnum 850 mysql.TypeVarchar, mysql.TypeVarchar, 851 //mysql.TypeSet mysql.TypeTinyBlob 852 mysql.TypeVarchar, mysql.TypeTinyBlob, 853 //mysql.TypeMediumBlob mysql.TypeLongBlob 854 mysql.TypeMediumBlob, mysql.TypeLongBlob, 855 //mysql.TypeBlob mysql.TypeVarString 856 mysql.TypeBlob, mysql.TypeVarchar, 857 //mysql.TypeString mysql.TypeGeometry 858 mysql.TypeString, mysql.TypeVarchar, 859 }, 860 /* mysql.TypeJSON -> */ 861 { 862 //mysql.TypeDecimal mysql.TypeTiny 863 mysql.TypeVarchar, mysql.TypeVarchar, 864 //mysql.TypeShort mysql.TypeLong 865 mysql.TypeVarchar, mysql.TypeVarchar, 866 //mysql.TypeNewFloat mysql.TypeDouble 867 mysql.TypeVarchar, mysql.TypeVarchar, 868 //mysql.TypeNull mysql.TypeTimestamp 869 mysql.TypeJSON, mysql.TypeVarchar, 870 //mysql.TypeLongLONG mysql.TypeInt24 871 mysql.TypeVarchar, mysql.TypeVarchar, 872 //mysql.TypeDate TypeDuration 873 mysql.TypeVarchar, mysql.TypeVarchar, 874 //mysql.TypeDatetime TypeYear 875 mysql.TypeVarchar, mysql.TypeVarchar, 876 //mysql.TypeNewDate mysql.TypeVarchar 877 mysql.TypeVarchar, mysql.TypeVarchar, 878 //mysql.TypeBit <16>-<244> 879 mysql.TypeVarchar, 880 //mysql.TypeJSON 881 mysql.TypeJSON, 882 //mysql.TypeNewDecimal TypeEnum 883 mysql.TypeVarchar, mysql.TypeVarchar, 884 //mysql.TypeSet mysql.TypeTinyBlob 885 mysql.TypeVarchar, mysql.TypeLongBlob, 886 //mysql.TypeMediumBlob mysql.TypeLongBlob 887 mysql.TypeLongBlob, mysql.TypeLongBlob, 888 //mysql.TypeBlob mysql.TypeVarString 889 mysql.TypeLongBlob, mysql.TypeVarchar, 890 //mysql.TypeString TypeGeometry 891 mysql.TypeString, mysql.TypeVarchar, 892 }, 893 /* mysql.TypeNewDecimal -> */ 894 { 895 //mysql.TypeDecimal mysql.TypeTiny 896 mysql.TypeNewDecimal, mysql.TypeNewDecimal, 897 //mysql.TypeShort mysql.TypeLong 898 mysql.TypeNewDecimal, mysql.TypeNewDecimal, 899 //mysql.TypeFloat mysql.TypeDouble 900 mysql.TypeDouble, mysql.TypeDouble, 901 //mysql.TypeNull mysql.TypeTimestamp 902 mysql.TypeNewDecimal, mysql.TypeVarchar, 903 //mysql.TypeLonglong mysql.TypeInt24 904 mysql.TypeNewDecimal, mysql.TypeNewDecimal, 905 //mysql.TypeDate mysql.TypeTime 906 mysql.TypeVarchar, mysql.TypeVarchar, 907 //mysql.TypeDatetime mysql.TypeYear 908 mysql.TypeVarchar, mysql.TypeNewDecimal, 909 //mysql.TypeNewDate mysql.TypeVarchar 910 mysql.TypeVarchar, mysql.TypeVarchar, 911 //mysql.TypeBit <16>-<244> 912 mysql.TypeVarchar, 913 //mysql.TypeJSON 914 mysql.TypeVarchar, 915 //mysql.TypeNewDecimal mysql.TypeEnum 916 mysql.TypeNewDecimal, mysql.TypeVarchar, 917 //mysql.TypeSet mysql.TypeTinyBlob 918 mysql.TypeVarchar, mysql.TypeTinyBlob, 919 //mysql.TypeMediumBlob mysql.TypeLongBlob 920 mysql.TypeMediumBlob, mysql.TypeLongBlob, 921 //mysql.TypeBlob mysql.TypeVarString 922 mysql.TypeBlob, mysql.TypeVarchar, 923 //mysql.TypeString mysql.TypeGeometry 924 mysql.TypeString, mysql.TypeVarchar, 925 }, 926 /* mysql.TypeEnum -> */ 927 { 928 //mysql.TypeDecimal mysql.TypeTiny 929 mysql.TypeVarchar, mysql.TypeVarchar, 930 //mysql.TypeShort mysql.TypeLong 931 mysql.TypeVarchar, mysql.TypeVarchar, 932 //mysql.TypeFloat mysql.TypeDouble 933 mysql.TypeVarchar, mysql.TypeVarchar, 934 //mysql.TypeNull mysql.TypeTimestamp 935 mysql.TypeEnum, mysql.TypeVarchar, 936 //mysql.TypeLonglong mysql.TypeInt24 937 mysql.TypeVarchar, mysql.TypeVarchar, 938 //mysql.TypeDate mysql.TypeTime 939 mysql.TypeVarchar, mysql.TypeVarchar, 940 //mysql.TypeDatetime mysql.TypeYear 941 mysql.TypeVarchar, mysql.TypeVarchar, 942 //mysql.TypeNewDate mysql.TypeVarchar 943 mysql.TypeVarchar, mysql.TypeVarchar, 944 //mysql.TypeBit <16>-<244> 945 mysql.TypeVarchar, 946 //mysql.TypeJSON 947 mysql.TypeVarchar, 948 //mysql.TypeNewDecimal mysql.TypeEnum 949 mysql.TypeVarchar, mysql.TypeVarchar, 950 //mysql.TypeSet mysql.TypeTinyBlob 951 mysql.TypeVarchar, mysql.TypeTinyBlob, 952 //mysql.TypeMediumBlob mysql.TypeLongBlob 953 mysql.TypeMediumBlob, mysql.TypeLongBlob, 954 //mysql.TypeBlob mysql.TypeVarString 955 mysql.TypeBlob, mysql.TypeVarchar, 956 //mysql.TypeString mysql.TypeGeometry 957 mysql.TypeString, mysql.TypeVarchar, 958 }, 959 /* mysql.TypeSet -> */ 960 { 961 //mysql.TypeDecimal mysql.TypeTiny 962 mysql.TypeVarchar, mysql.TypeVarchar, 963 //mysql.TypeShort mysql.TypeLong 964 mysql.TypeVarchar, mysql.TypeVarchar, 965 //mysql.TypeFloat mysql.TypeDouble 966 mysql.TypeVarchar, mysql.TypeVarchar, 967 //mysql.TypeNull mysql.TypeTimestamp 968 mysql.TypeSet, mysql.TypeVarchar, 969 //mysql.TypeLonglong mysql.TypeInt24 970 mysql.TypeVarchar, mysql.TypeVarchar, 971 //mysql.TypeDate mysql.TypeTime 972 mysql.TypeVarchar, mysql.TypeVarchar, 973 //mysql.TypeDatetime mysql.TypeYear 974 mysql.TypeVarchar, mysql.TypeVarchar, 975 //mysql.TypeNewDate mysql.TypeVarchar 976 mysql.TypeVarchar, mysql.TypeVarchar, 977 //mysql.TypeBit <16>-<244> 978 mysql.TypeVarchar, 979 //mysql.TypeJSON 980 mysql.TypeVarchar, 981 //mysql.TypeNewDecimal mysql.TypeEnum 982 mysql.TypeVarchar, mysql.TypeVarchar, 983 //mysql.TypeSet mysql.TypeTinyBlob 984 mysql.TypeVarchar, mysql.TypeTinyBlob, 985 //mysql.TypeMediumBlob mysql.TypeLongBlob 986 mysql.TypeMediumBlob, mysql.TypeLongBlob, 987 //mysql.TypeBlob mysql.TypeVarString 988 mysql.TypeBlob, mysql.TypeVarchar, 989 //mysql.TypeString mysql.TypeGeometry 990 mysql.TypeString, mysql.TypeVarchar, 991 }, 992 /* mysql.TypeTinyBlob -> */ 993 { 994 //mysql.TypeDecimal mysql.TypeTiny 995 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 996 //mysql.TypeShort mysql.TypeLong 997 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 998 //mysql.TypeFloat mysql.TypeDouble 999 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1000 //mysql.TypeNull mysql.TypeTimestamp 1001 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1002 //mysql.TypeLonglong mysql.TypeInt24 1003 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1004 //mysql.TypeDate mysql.TypeTime 1005 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1006 //mysql.TypeDatetime mysql.TypeYear 1007 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1008 //mysql.TypeNewDate mysql.TypeVarchar 1009 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1010 //mysql.TypeBit <16>-<244> 1011 mysql.TypeTinyBlob, 1012 //mysql.TypeJSON 1013 mysql.TypeLongBlob, 1014 //mysql.TypeNewDecimal mysql.TypeEnum 1015 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1016 //mysql.TypeSet mysql.TypeTinyBlob 1017 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1018 //mysql.TypeMediumBlob mysql.TypeLongBlob 1019 mysql.TypeMediumBlob, mysql.TypeLongBlob, 1020 //mysql.TypeBlob mysql.TypeVarString 1021 mysql.TypeBlob, mysql.TypeTinyBlob, 1022 //mysql.TypeString mysql.TypeGeometry 1023 mysql.TypeTinyBlob, mysql.TypeTinyBlob, 1024 }, 1025 /* mysql.TypeMediumBlob -> */ 1026 { 1027 //mysql.TypeDecimal mysql.TypeTiny 1028 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1029 //mysql.TypeShort mysql.TypeLong 1030 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1031 //mysql.TypeFloat mysql.TypeDouble 1032 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1033 //mysql.TypeNull mysql.TypeTimestamp 1034 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1035 //mysql.TypeLonglong mysql.TypeInt24 1036 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1037 //mysql.TypeDate mysql.TypeTime 1038 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1039 //mysql.TypeDatetime mysql.TypeYear 1040 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1041 //mysql.TypeNewDate mysql.TypeVarchar 1042 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1043 //mysql.TypeBit <16>-<244> 1044 mysql.TypeMediumBlob, 1045 //mysql.TypeJSON 1046 mysql.TypeLongBlob, 1047 //mysql.TypeNewDecimal mysql.TypeEnum 1048 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1049 //mysql.TypeSet mysql.TypeTinyBlob 1050 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1051 //mysql.TypeMediumBlob mysql.TypeLongBlob 1052 mysql.TypeMediumBlob, mysql.TypeLongBlob, 1053 //mysql.TypeBlob mysql.TypeVarString 1054 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1055 //mysql.TypeString mysql.TypeGeometry 1056 mysql.TypeMediumBlob, mysql.TypeMediumBlob, 1057 }, 1058 /* mysql.TypeLongBlob -> */ 1059 { 1060 //mysql.TypeDecimal mysql.TypeTiny 1061 mysql.TypeLongBlob, mysql.TypeLongBlob, 1062 //mysql.TypeShort mysql.TypeLong 1063 mysql.TypeLongBlob, mysql.TypeLongBlob, 1064 //mysql.TypeFloat mysql.TypeDouble 1065 mysql.TypeLongBlob, mysql.TypeLongBlob, 1066 //mysql.TypeNull mysql.TypeTimestamp 1067 mysql.TypeLongBlob, mysql.TypeLongBlob, 1068 //mysql.TypeLonglong mysql.TypeInt24 1069 mysql.TypeLongBlob, mysql.TypeLongBlob, 1070 //mysql.TypeDate mysql.TypeTime 1071 mysql.TypeLongBlob, mysql.TypeLongBlob, 1072 //mysql.TypeDatetime mysql.TypeYear 1073 mysql.TypeLongBlob, mysql.TypeLongBlob, 1074 //mysql.TypeNewDate mysql.TypeVarchar 1075 mysql.TypeLongBlob, mysql.TypeLongBlob, 1076 //mysql.TypeBit <16>-<244> 1077 mysql.TypeLongBlob, 1078 //mysql.TypeJSON 1079 mysql.TypeLongBlob, 1080 //mysql.TypeNewDecimal mysql.TypeEnum 1081 mysql.TypeLongBlob, mysql.TypeLongBlob, 1082 //mysql.TypeSet mysql.TypeTinyBlob 1083 mysql.TypeLongBlob, mysql.TypeLongBlob, 1084 //mysql.TypeMediumBlob mysql.TypeLongBlob 1085 mysql.TypeLongBlob, mysql.TypeLongBlob, 1086 //mysql.TypeBlob mysql.TypeVarString 1087 mysql.TypeLongBlob, mysql.TypeLongBlob, 1088 //mysql.TypeString mysql.TypeGeometry 1089 mysql.TypeLongBlob, mysql.TypeLongBlob, 1090 }, 1091 /* mysql.TypeBlob -> */ 1092 { 1093 //mysql.TypeDecimal mysql.TypeTiny 1094 mysql.TypeBlob, mysql.TypeBlob, 1095 //mysql.TypeShort mysql.TypeLong 1096 mysql.TypeBlob, mysql.TypeBlob, 1097 //mysql.TypeFloat mysql.TypeDouble 1098 mysql.TypeBlob, mysql.TypeBlob, 1099 //mysql.TypeNull mysql.TypeTimestamp 1100 mysql.TypeBlob, mysql.TypeBlob, 1101 //mysql.TypeLonglong mysql.TypeInt24 1102 mysql.TypeBlob, mysql.TypeBlob, 1103 //mysql.TypeDate mysql.TypeTime 1104 mysql.TypeBlob, mysql.TypeBlob, 1105 //mysql.TypeDatetime mysql.TypeYear 1106 mysql.TypeBlob, mysql.TypeBlob, 1107 //mysql.TypeNewDate mysql.TypeVarchar 1108 mysql.TypeBlob, mysql.TypeBlob, 1109 //mysql.TypeBit <16>-<244> 1110 mysql.TypeBlob, 1111 //mysql.TypeJSON 1112 mysql.TypeLongBlob, 1113 //mysql.TypeNewDecimal mysql.TypeEnum 1114 mysql.TypeBlob, mysql.TypeBlob, 1115 //mysql.TypeSet mysql.TypeTinyBlob 1116 mysql.TypeBlob, mysql.TypeBlob, 1117 //mysql.TypeMediumBlob mysql.TypeLongBlob 1118 mysql.TypeMediumBlob, mysql.TypeLongBlob, 1119 //mysql.TypeBlob mysql.TypeVarString 1120 mysql.TypeBlob, mysql.TypeBlob, 1121 //mysql.TypeString mysql.TypeGeometry 1122 mysql.TypeBlob, mysql.TypeBlob, 1123 }, 1124 /* mysql.TypeVarString -> */ 1125 { 1126 //mysql.TypeDecimal mysql.TypeTiny 1127 mysql.TypeVarchar, mysql.TypeVarchar, 1128 //mysql.TypeShort mysql.TypeLong 1129 mysql.TypeVarchar, mysql.TypeVarchar, 1130 //mysql.TypeFloat mysql.TypeDouble 1131 mysql.TypeVarchar, mysql.TypeVarchar, 1132 //mysql.TypeNull mysql.TypeTimestamp 1133 mysql.TypeVarchar, mysql.TypeVarchar, 1134 //mysql.TypeLonglong mysql.TypeInt24 1135 mysql.TypeVarchar, mysql.TypeVarchar, 1136 //mysql.TypeDate mysql.TypeTime 1137 mysql.TypeVarchar, mysql.TypeVarchar, 1138 //mysql.TypeDatetime mysql.TypeYear 1139 mysql.TypeVarchar, mysql.TypeVarchar, 1140 //mysql.TypeNewDate mysql.TypeVarchar 1141 mysql.TypeVarchar, mysql.TypeVarchar, 1142 //mysql.TypeBit <16>-<244> 1143 mysql.TypeVarchar, 1144 //mysql.TypeJSON 1145 mysql.TypeVarchar, 1146 //mysql.TypeNewDecimal mysql.TypeEnum 1147 mysql.TypeVarchar, mysql.TypeVarchar, 1148 //mysql.TypeSet mysql.TypeTinyBlob 1149 mysql.TypeVarchar, mysql.TypeTinyBlob, 1150 //mysql.TypeMediumBlob mysql.TypeLongBlob 1151 mysql.TypeMediumBlob, mysql.TypeLongBlob, 1152 //mysql.TypeBlob mysql.TypeVarString 1153 mysql.TypeBlob, mysql.TypeVarchar, 1154 //mysql.TypeString mysql.TypeGeometry 1155 mysql.TypeVarchar, mysql.TypeVarchar, 1156 }, 1157 /* mysql.TypeString -> */ 1158 { 1159 //mysql.TypeDecimal mysql.TypeTiny 1160 mysql.TypeString, mysql.TypeString, 1161 //mysql.TypeShort mysql.TypeLong 1162 mysql.TypeString, mysql.TypeString, 1163 //mysql.TypeFloat mysql.TypeDouble 1164 mysql.TypeString, mysql.TypeString, 1165 //mysql.TypeNull mysql.TypeTimestamp 1166 mysql.TypeString, mysql.TypeString, 1167 //mysql.TypeLonglong mysql.TypeInt24 1168 mysql.TypeString, mysql.TypeString, 1169 //mysql.TypeDate mysql.TypeTime 1170 mysql.TypeString, mysql.TypeString, 1171 //mysql.TypeDatetime mysql.TypeYear 1172 mysql.TypeString, mysql.TypeString, 1173 //mysql.TypeNewDate mysql.TypeVarchar 1174 mysql.TypeString, mysql.TypeVarchar, 1175 //mysql.TypeBit <16>-<244> 1176 mysql.TypeString, 1177 //mysql.TypeJSON 1178 mysql.TypeString, 1179 //mysql.TypeNewDecimal mysql.TypeEnum 1180 mysql.TypeString, mysql.TypeString, 1181 //mysql.TypeSet mysql.TypeTinyBlob 1182 mysql.TypeString, mysql.TypeTinyBlob, 1183 //mysql.TypeMediumBlob mysql.TypeLongBlob 1184 mysql.TypeMediumBlob, mysql.TypeLongBlob, 1185 //mysql.TypeBlob mysql.TypeVarString 1186 mysql.TypeBlob, mysql.TypeVarchar, 1187 //mysql.TypeString mysql.TypeGeometry 1188 mysql.TypeString, mysql.TypeString, 1189 }, 1190 /* mysql.TypeGeometry -> */ 1191 { 1192 //mysql.TypeDecimal mysql.TypeTiny 1193 mysql.TypeVarchar, mysql.TypeVarchar, 1194 //mysql.TypeShort mysql.TypeLong 1195 mysql.TypeVarchar, mysql.TypeVarchar, 1196 //mysql.TypeFloat mysql.TypeDouble 1197 mysql.TypeVarchar, mysql.TypeVarchar, 1198 //mysql.TypeNull mysql.TypeTimestamp 1199 mysql.TypeGeometry, mysql.TypeVarchar, 1200 //mysql.TypeLonglong mysql.TypeInt24 1201 mysql.TypeVarchar, mysql.TypeVarchar, 1202 //mysql.TypeDate mysql.TypeTime 1203 mysql.TypeVarchar, mysql.TypeVarchar, 1204 //mysql.TypeDatetime mysql.TypeYear 1205 mysql.TypeVarchar, mysql.TypeVarchar, 1206 //mysql.TypeNewDate mysql.TypeVarchar 1207 mysql.TypeVarchar, mysql.TypeVarchar, 1208 //mysql.TypeBit <16>-<244> 1209 mysql.TypeVarchar, 1210 //mysql.TypeJSON 1211 mysql.TypeVarchar, 1212 //mysql.TypeNewDecimal mysql.TypeEnum 1213 mysql.TypeVarchar, mysql.TypeVarchar, 1214 //mysql.TypeSet mysql.TypeTinyBlob 1215 mysql.TypeVarchar, mysql.TypeTinyBlob, 1216 //mysql.TypeMediumBlob mysql.TypeLongBlob 1217 mysql.TypeMediumBlob, mysql.TypeLongBlob, 1218 //mysql.TypeBlob mysql.TypeVarString 1219 mysql.TypeBlob, mysql.TypeVarchar, 1220 //mysql.TypeString mysql.TypeGeometry 1221 mysql.TypeString, mysql.TypeGeometry, 1222 }, 1223 } 1224 1225 // SetBinChsClnFlag sets charset, collation as 'binary' and adds binaryFlag to FieldType. 1226 func SetBinChsClnFlag(ft *FieldType) { 1227 ft.Charset = mysql.CharsetBin 1228 ft.Collate = mysql.CollationBin 1229 ft.Flag |= mysql.BinaryFlag 1230 } 1231 1232 // VarStorageLen indicates this column is a variable length column. 1233 const VarStorageLen = ast.VarStorageLen