1 21 22 package org.apache.derby.client.net; 23 24 import org.apache.derby.iapi.reference.DRDAConstants; 25 import org.apache.derby.iapi.reference.JDBC30Translation; 26 import org.apache.derby.client.am.Cursor; 27 import org.apache.derby.client.am.DisconnectException; 28 import org.apache.derby.client.am.SignedBinary; 29 import org.apache.derby.client.am.ClientMessageId; 30 import org.apache.derby.shared.common.reference.SQLState; 31 32 127 public class Typdef implements java.lang.Cloneable { 128 130 132 static final short CCSIDDBC = 1; 134 135 static final short CCSIDMBC = 2; 137 138 static final short CCSIDSBC = 3; 140 141 static final short NOCCSID = 0; 143 144 static final short FIXEDLENGTH = 0; 146 147 static final short TWOBYTELENGTH = 1; 149 150 static final short ONEBYTELENGTH = 2; 152 153 static final short DECIMALLENGTH = 3; 155 156 static final short LOBLENGTH = 4; 158 159 public static final String UTF8ENCODING = "UTF8"; 160 161 private static final int OVERRIDE_TABLE_SIZE = 0xff; 162 163 private static final int[] fdocaTypeToRepresentationMap_ = { 164 0, 165 Cursor.BYTES, 166 Cursor.VARIABLE_STRING, 167 Cursor.NULL_TERMINATED_BYTES, 168 0, 169 0, 170 0, 171 Cursor.VARIABLE_SHORT_STRING, 172 0, 173 0, 174 0, 175 0, 176 0, 177 0, 178 0, 179 0, 180 Cursor.STRING, 181 Cursor.VARIABLE_STRING, 182 0, 183 0, 184 Cursor.NULL_TERMINATED_STRING, 185 0, 186 0, 187 0, 188 0, 189 Cursor.VARIABLE_SHORT_STRING, 190 0, 191 0, 192 0, 193 0, 194 0, 195 0, 196 0, 197 0, 198 0, 199 SignedBinary.BIG_ENDIAN, 200 SignedBinary.LITTLE_ENDIAN, 201 0, 202 0, 203 0, 204 0, 205 0, 206 0, 207 0, 208 0, 209 0, 210 0, 211 0, 212 org.apache.derby.client.am.Decimal.PACKED_DECIMAL, 213 0, 214 0, 215 0, 216 0, 217 0, 218 0, 219 0, 220 0, 221 0, 222 0, 223 0, 224 0, 225 0, 226 0, 227 0, 228 0, 229 0, 230 0, 231 0, 232 0, 233 0, 234 0, 235 0, 236 org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, 237 0, 238 0, 239 0, 240 0, 241 0, 242 0, 243 0, 244 0, 0, 0, 247 0, 248 0, 249 0, 250 0, 251 0, 252 0, 253 0, 254 0, 255 0, 256 0, 257 0, 258 0, 259 0 260 }; 261 262 protected static final FdocaSimpleDataArray[] environmentTables_ = { 268 269 null, 270 271 null, 272 273 new FdocaSimpleDataArray(0x02, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4, FIXEDLENGTH), 274 275 new FdocaSimpleDataArray(0x03, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 4, FIXEDLENGTH), 276 277 new FdocaSimpleDataArray(0x04, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2, FIXEDLENGTH), 278 279 new FdocaSimpleDataArray(0x05, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 2, FIXEDLENGTH), 280 281 new FdocaSimpleDataArray(0x06, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH), 282 283 new FdocaSimpleDataArray(0x07, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 1, FIXEDLENGTH), 284 285 new FdocaSimpleDataArray(0x08, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 16, FIXEDLENGTH), 286 287 new FdocaSimpleDataArray(0x09, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 16, FIXEDLENGTH), 288 289 new FdocaSimpleDataArray(0x0A, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 8, FIXEDLENGTH), 290 291 new FdocaSimpleDataArray(0x0B, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 8, FIXEDLENGTH), 292 293 new FdocaSimpleDataArray(0x0C, FdocaConstants.FDOCA_TYPE_FLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 4, FIXEDLENGTH), 294 295 new FdocaSimpleDataArray(0x0D, FdocaConstants.FDOCA_TYPE_NFLOAT_IEEE, org.apache.derby.client.am.FloatingPoint.IEEE_754_FLOATING_POINT, NOCCSID, 0, 0, 4, FIXEDLENGTH), 296 297 new FdocaSimpleDataArray(0x0E, FdocaConstants.FDOCA_TYPE_DECIMAL, org.apache.derby.client.am.Decimal.PACKED_DECIMAL, NOCCSID, 0, 0, 31, DECIMALLENGTH), 298 299 new FdocaSimpleDataArray(0x0F, FdocaConstants.FDOCA_TYPE_NDECIMAL, org.apache.derby.client.am.Decimal.PACKED_DECIMAL, NOCCSID, 0, 0, 31, DECIMALLENGTH), 300 301 null, 302 303 null, 304 305 null, 306 307 null, 308 309 null, 310 311 null, 312 313 new FdocaSimpleDataArray(0x16, FdocaConstants.FDOCA_TYPE_INTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8, FIXEDLENGTH), 314 315 new FdocaSimpleDataArray(0x17, FdocaConstants.FDOCA_TYPE_NINTEGER_BE, SignedBinary.BIG_ENDIAN, NOCCSID, 0, 0, 8, FIXEDLENGTH), 316 317 new FdocaSimpleDataArray(0x18, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), 318 319 new FdocaSimpleDataArray(0x19, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), 320 321 null, 322 323 new FdocaSimpleDataArray(0x1B, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), 324 325 new FdocaSimpleDataArray(0x1C, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), 326 327 new FdocaSimpleDataArray(0x1D, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, 0x00, NOCCSID, 0, 0, 4, FIXEDLENGTH), 328 329 new FdocaSimpleDataArray(0x1E, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40, TWOBYTELENGTH), 330 331 new FdocaSimpleDataArray(0x1F, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 40, TWOBYTELENGTH), 332 333 new FdocaSimpleDataArray(0x20, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH), 334 335 new FdocaSimpleDataArray(0x21, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 10, FIXEDLENGTH), 336 337 new FdocaSimpleDataArray(0x22, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH), 338 339 new FdocaSimpleDataArray(0x23, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 8, FIXEDLENGTH), 340 341 new FdocaSimpleDataArray(0x24, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH), 342 343 new FdocaSimpleDataArray(0x25, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 26, FIXEDLENGTH), 344 345 new FdocaSimpleDataArray(0x26, FdocaConstants.FDOCA_TYPE_FIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH), 346 347 new FdocaSimpleDataArray(0x27, FdocaConstants.FDOCA_TYPE_NFIXEDBYTES, Cursor.BYTES, NOCCSID, 0, 0, 32767, FIXEDLENGTH), 348 349 new FdocaSimpleDataArray(0x28, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), 350 351 new FdocaSimpleDataArray(0x29, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), 352 353 new FdocaSimpleDataArray(0x2A, FdocaConstants.FDOCA_TYPE_VARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), 354 355 new FdocaSimpleDataArray(0x2B, FdocaConstants.FDOCA_TYPE_NVARBYTES, Cursor.VARIABLE_BYTES, NOCCSID, 0, 1, 32767, TWOBYTELENGTH), 356 357 new FdocaSimpleDataArray(0x2C, FdocaConstants.FDOCA_TYPE_NTBYTES, Cursor.NULL_TERMINATED_BYTES, NOCCSID, 0, 1, 32767, FIXEDLENGTH), 358 359 new FdocaSimpleDataArray(0x2D, FdocaConstants.FDOCA_TYPE_NNTBYTES, Cursor.NULL_TERMINATED_STRING, NOCCSID, 0, 1, 32767, FIXEDLENGTH), 360 361 new FdocaSimpleDataArray(0x2E, FdocaConstants.FDOCA_TYPE_NTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1, 32767, FIXEDLENGTH), 362 363 new FdocaSimpleDataArray(0x2F, FdocaConstants.FDOCA_TYPE_NNTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDSBC, 1, 1, 32767, FIXEDLENGTH), 364 365 new FdocaSimpleDataArray(0x30, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH), 366 367 new FdocaSimpleDataArray(0x31, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, Cursor.STRING, CCSIDSBC, 1, 0, 32767, FIXEDLENGTH), 368 369 new FdocaSimpleDataArray(0x32, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), 370 371 new FdocaSimpleDataArray(0x33, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), 372 373 new FdocaSimpleDataArray(0x34, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), 374 375 new FdocaSimpleDataArray(0x35, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), 376 377 new FdocaSimpleDataArray(0x36, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00, CCSIDDBC, 2, 0, 16383, FIXEDLENGTH), 378 379 new FdocaSimpleDataArray(0x37, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00, CCSIDDBC, 2, 0, 16383, FIXEDLENGTH), 380 381 new FdocaSimpleDataArray(0x38, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), 382 383 new FdocaSimpleDataArray(0x39, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), 384 385 new FdocaSimpleDataArray(0x3A, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), 386 387 new FdocaSimpleDataArray(0x3B, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDDBC, 2, 1, 16383, TWOBYTELENGTH), 388 389 new FdocaSimpleDataArray(0x3C, FdocaConstants.FDOCA_TYPE_FIXEDCHAR, 0x00, CCSIDMBC, 1, 0, 32767, FIXEDLENGTH), 390 391 new FdocaSimpleDataArray(0x3D, FdocaConstants.FDOCA_TYPE_NFIXEDCHAR, 0x00, CCSIDMBC, 1, 0, 32767, FIXEDLENGTH), 392 393 new FdocaSimpleDataArray(0x3E, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), 394 395 new FdocaSimpleDataArray(0x3F, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), 396 397 new FdocaSimpleDataArray(0x40, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), 398 399 new FdocaSimpleDataArray(0x41, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), 400 401 new FdocaSimpleDataArray(0x42, FdocaConstants.FDOCA_TYPE_NTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1, 32767, FIXEDLENGTH), 402 403 new FdocaSimpleDataArray(0x43, FdocaConstants.FDOCA_TYPE_NNTCHAR, Cursor.NULL_TERMINATED_STRING, CCSIDMBC, 1, 1, 32767, FIXEDLENGTH), 404 405 new FdocaSimpleDataArray(0x44, FdocaConstants.FDOCA_TYPE_PSCLBYTE, Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255, ONEBYTELENGTH), 406 407 new FdocaSimpleDataArray(0x45, FdocaConstants.FDOCA_TYPE_NPSCLBYTE, Cursor.VARIABLE_SHORT_STRING, NOCCSID, 0, 1, 255, ONEBYTELENGTH), 408 409 new FdocaSimpleDataArray(0x46, FdocaConstants.FDOCA_TYPE_PSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255, ONEBYTELENGTH), 410 411 new FdocaSimpleDataArray(0x47, FdocaConstants.FDOCA_TYPE_NPSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDSBC, 1, 1, 255, ONEBYTELENGTH), 412 413 new FdocaSimpleDataArray(0x48, FdocaConstants.FDOCA_TYPE_PSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255, ONEBYTELENGTH), 414 415 new FdocaSimpleDataArray(0x49, FdocaConstants.FDOCA_TYPE_NPSCLCHAR, Cursor.VARIABLE_SHORT_STRING, CCSIDMBC, 1, 1, 255, ONEBYTELENGTH), 416 417 null, 418 419 null, 420 421 new FdocaSimpleDataArray(0x4C, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), 422 423 new FdocaSimpleDataArray(0x4D, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDSBC, 1, 1, 32767, TWOBYTELENGTH), 424 425 new FdocaSimpleDataArray(0x4E, FdocaConstants.FDOCA_TYPE_VARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), 426 427 new FdocaSimpleDataArray(0x4F, FdocaConstants.FDOCA_TYPE_NVARCHAR, Cursor.VARIABLE_STRING, CCSIDMBC, 1, 1, 32767, TWOBYTELENGTH), 428 429 null, 430 431 null, 432 433 null, 434 435 null, 436 437 null, 438 439 null, 440 441 null, 442 443 null, 444 445 null, 446 447 null, 448 449 null, 450 451 null, 452 453 null, 454 455 null, 456 457 null, 458 459 null, 460 461 null, 462 463 null, 464 465 null, 466 467 null, 468 469 null, 470 471 null, 472 473 null, 474 475 null, 476 477 null, 478 479 null, 480 481 null, 482 483 null, 484 485 null, 486 487 null, 488 489 null, 490 491 null, 492 493 null, 494 495 null, 496 497 null, 498 499 null, 500 501 null, 502 503 null, 504 505 null, 506 507 null, 508 509 null, 510 511 null, 512 513 null, 514 515 null, 516 517 null, 518 519 null, 520 521 null, 522 523 null, 524 525 null, 526 527 null, 528 529 null, 530 531 null, 532 533 null, 534 535 null, 536 537 null, 538 539 null, 540 541 null, 542 543 null, 544 545 null, 546 547 null, 548 549 null, 550 551 null, 552 553 null, 554 555 null, 556 557 null, 558 559 null, 560 561 null, 562 563 null, 564 565 null, 566 567 null, 568 569 null, 570 571 null, 572 573 null, 574 575 null, 576 577 null, 578 579 null, 580 581 null, 582 583 null, 584 585 null, 586 587 null, 588 589 null, 590 591 null, 592 593 null, 594 595 null, 596 597 null, 598 599 null, 600 601 null, 602 603 null, 604 605 null, 606 607 null, 608 609 null, 610 611 null, 612 613 null, 614 615 null, 616 617 null, 618 619 null, 620 621 null, 622 623 null, 624 625 null, 626 627 null, 628 629 null, 630 631 null, 632 633 null, 634 635 null, 636 637 null, 638 639 null, 640 641 null, 642 643 null, 644 645 null, 646 647 null, 648 649 null, 650 651 null, 652 653 null, 654 655 null, 656 657 null, 658 659 null, 660 661 null, 662 663 null, 664 665 null, 666 667 null, 668 669 new FdocaSimpleDataArray(0xC8, FdocaConstants.FDOCA_TYPE_LOBBYTES, 0x00, NOCCSID, 0, 1, 8, LOBLENGTH), 670 671 new FdocaSimpleDataArray(0xC9, FdocaConstants.FDOCA_TYPE_NLOBBYTES, 0x00, NOCCSID, 0, 1, 8, LOBLENGTH), 672 673 new FdocaSimpleDataArray(0xCA, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH), 674 675 new FdocaSimpleDataArray(0xCB, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.SBCS_CLOB, CCSIDSBC, 1, 1, 8, LOBLENGTH), 676 677 new FdocaSimpleDataArray(0xCC, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH), 678 679 new FdocaSimpleDataArray(0xCD, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.DBCS_CLOB, CCSIDDBC, 2, 1, 8, LOBLENGTH), 680 681 new FdocaSimpleDataArray(0xCE, FdocaConstants.FDOCA_TYPE_LOBCHAR, Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH), 682 683 new FdocaSimpleDataArray(0xCF, FdocaConstants.FDOCA_TYPE_NLOBCHAR, Cursor.MBCS_CLOB, CCSIDMBC, 1, 1, 8, LOBLENGTH), 684 }; 685 686 private static final int[] protocolToJdbcTypes_ = { 687 0x00, 0x00, java.sql.Types.INTEGER, java.sql.Types.INTEGER, java.sql.Types.SMALLINT, java.sql.Types.SMALLINT, java.sql.Types.TINYINT, java.sql.Types.TINYINT, java.sql.Types.DECIMAL, java.sql.Types.DECIMAL, java.sql.Types.DOUBLE, java.sql.Types.DOUBLE, java.sql.Types.REAL, java.sql.Types.REAL, java.sql.Types.DECIMAL, java.sql.Types.DECIMAL, java.sql.Types.DECIMAL, java.sql.Types.DECIMAL, java.sql.Types.DECIMAL, java.sql.Types.DECIMAL, 0x00, 0x00, java.sql.Types.BIGINT, java.sql.Types.BIGINT, 0x00, 712 0x00, 713 0x00, 714 0x00, 715 0x00, 716 0x00, 717 0x00, 718 0x00, 719 java.sql.Types.DATE, java.sql.Types.DATE, java.sql.Types.TIME, java.sql.Types.TIME, java.sql.Types.TIMESTAMP, java.sql.Types.TIMESTAMP, java.sql.Types.BINARY, java.sql.Types.BINARY, java.sql.Types.VARBINARY, java.sql.Types.VARBINARY, java.sql.Types.LONGVARBINARY, java.sql.Types.LONGVARBINARY, java.sql.Types.VARBINARY, java.sql.Types.VARBINARY, java.sql.Types.CHAR, java.sql.Types.CHAR, java.sql.Types.CHAR, java.sql.Types.CHAR, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, java.sql.Types.LONGVARCHAR, java.sql.Types.LONGVARCHAR, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, java.sql.Types.CHAR, java.sql.Types.CHAR, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, java.sql.Types.LONGVARCHAR, java.sql.Types.LONGVARCHAR, java.sql.Types.CHAR, java.sql.Types.CHAR, java.sql.Types.VARBINARY, java.sql.Types.VARBINARY, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, 0x00, 0x00, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, java.sql.Types.VARCHAR, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, java.sql.Types.BLOB, java.sql.Types.BLOB, java.sql.Types.CLOB, java.sql.Types.CLOB, 0x00, 893 0x00, 894 java.sql.Types.CLOB, java.sql.Types.CLOB, }; 897 898 899 private NetAgent netAgent_; 900 private String typdefnam_; 901 902 private int ccsidSbc_; 903 private boolean ccsidSbcSet_; 904 private String ccsidSbcEncoding_; 905 906 private int ccsidDbc_; 907 private boolean ccsidDbcSet_; 908 private String ccsidDbcEncoding_; 909 910 911 private int ccsidMbc_; 912 private boolean ccsidMbcSet_; 913 private String ccsidMbcEncoding_; 914 915 916 protected int environment_; 917 private boolean mddOverride_ = false; 918 private FdocaSimpleDataArray overrideTable_[] = new FdocaSimpleDataArray[OVERRIDE_TABLE_SIZE]; 919 920 922 923 Typdef(NetAgent netAgent) throws DisconnectException { 924 this.initialize(netAgent, 0, false, 0, false, 0, false, null); 925 } 926 927 Typdef(NetAgent netAgent, int ccsidSbc, String typdefnam) throws DisconnectException { 928 this.initialize(netAgent, ccsidSbc, true, 0, false, 0, false, typdefnam); 929 } 930 931 public Typdef(NetAgent netAgent, int ccsidSbc, String typdefnam, int ccsidDbc, int ccsidMbc) throws DisconnectException { 932 this.initialize(netAgent, ccsidSbc, true, ccsidMbc, true, ccsidDbc, true, typdefnam); 933 } 934 935 private void initialize(NetAgent netAgent, 936 int ccsidSbc, 937 boolean ccsidSbcSet, 938 int ccsidMbc, 939 boolean ccsidMbcSet, 940 int ccsidDbc, 941 boolean ccsidDbcSet, 942 String typdefnam) throws DisconnectException { 943 netAgent_ = netAgent; 944 ccsidSbc_ = ccsidSbc; 945 ccsidSbcSet_ = ccsidSbcSet; 946 ccsidSbcEncoding_ = null; 947 ccsidMbc_ = ccsidMbc; 948 ccsidMbcSet_ = ccsidMbcSet; 949 ccsidMbcEncoding_ = null; 950 ccsidDbc_ = ccsidDbc; 951 ccsidDbcSet_ = ccsidDbcSet; 952 ccsidDbcEncoding_ = null; 953 setTypdefnam(typdefnam); 954 } 955 956 958 String getTypdefnam() { 959 return typdefnam_; 960 } 961 962 void setTypdefnam(String typdefnam) throws DisconnectException { 963 typdefnam_ = typdefnam; 964 if (typdefnam_ == null) { 965 return; 966 } 967 968 } 969 970 int getCcsidSbc() { 971 return ccsidSbc_; 972 } 973 974 void setCcsidSbc(int ccsid) { 975 ccsidSbc_ = ccsid; 976 ccsidSbcSet_ = true; 977 ccsidSbcEncoding_ = null; 978 } 979 980 void clearCcsidSbc() { 981 ccsidSbc_ = 0; 982 ccsidSbcSet_ = false; 983 ccsidSbcEncoding_ = null; 984 } 985 986 boolean isCcsidSbcSet() { 987 return ccsidSbcSet_; 988 } 989 990 String getCcsidSbcEncoding() throws DisconnectException { 992 if (ccsidSbcEncoding_ == null) { 993 ccsidSbcEncoding_ = UTF8ENCODING; 994 } 995 return ccsidSbcEncoding_; 996 } 997 998 int getCcsidDbc() { 999 return ccsidDbc_; 1000 } 1001 1002 void setCcsidDbc(int ccsid) { 1003 ccsidDbc_ = ccsid; 1004 ccsidDbcSet_ = true; 1005 ccsidDbcEncoding_ = null; 1006 } 1007 1008 void clearCcsidDbc() { 1009 ccsidDbc_ = 0; 1010 ccsidDbcSet_ = false; 1011 ccsidDbcEncoding_ = null; 1012 } 1013 1014 boolean isCcsidDbcSet() { 1015 return ccsidDbcSet_; 1016 } 1017 1018 String getCcsidDbcEncoding() throws DisconnectException { 1020 if (ccsidDbcEncoding_ == null) { 1021 ccsidDbcEncoding_ = UTF8ENCODING; 1022 } 1023 return ccsidDbcEncoding_; 1024 } 1025 1026 int getCcsidMbc() { 1027 return ccsidMbc_; 1028 } 1029 1030 void setCcsidMbc(int ccsid) { 1031 ccsidMbc_ = ccsid; 1032 ccsidMbcSet_ = true; 1033 ccsidMbcEncoding_ = null; 1034 } 1035 1036 void clearCcsidMbc() { 1037 ccsidMbc_ = 0; 1038 ccsidMbcSet_ = false; 1039 ccsidMbcEncoding_ = null; 1040 } 1041 1042 boolean isCcsidMbcSet() { 1043 return ccsidMbcSet_; 1044 } 1045 1046 String getCcsidMbcEncoding() throws DisconnectException { 1048 if (ccsidMbcEncoding_ == null) { 1049 ccsidMbcEncoding_ = UTF8ENCODING; 1050 } 1051 return ccsidMbcEncoding_; 1052 } 1053 1054 int getByteOrder() { 1055 return SignedBinary.BIG_ENDIAN; 1056 } 1057 1058 public Object clone() { 1059 try { 1060 return super.clone(); 1061 } catch (java.lang.CloneNotSupportedException e) { 1062 return null; } 1064 } 1065 1066 void updateColumn(NetCursor netCursor, 1068 int columnIndex, 1069 int protocolLid, 1070 int protocolLength) throws DisconnectException { 1071 FdocaSimpleDataArray sda = environmentTables_[protocolLid]; 1072 1073 if ((mddOverride_) && (overrideTable_[protocolLid] != null)) { 1074 sda = overrideTable_[protocolLid]; 1075 } 1076 1077 if (sda == null) { 1078 netAgent_.accumulateChainBreakingReadExceptionAndThrow( 1079 new DisconnectException(netAgent_, 1080 new ClientMessageId(SQLState.NET_INVALID_FDOCA_ID))); 1081 } 1082 1083 netCursor.nullable_[columnIndex] = ((sda.protocolType_ % 2) == 1); 1087 1088 switch (sda.ccsid_) { 1091 case CCSIDSBC: 1092 netCursor.charsetName_[columnIndex] = getCcsidSbcEncoding(); 1093 netCursor.ccsid_[columnIndex] = this.ccsidSbc_; 1094 break; 1095 case CCSIDMBC: 1096 if (isCcsidMbcSet() && (ccsidMbc_ != 0)) { 1097 netCursor.charsetName_[columnIndex] = getCcsidMbcEncoding(); 1098 netCursor.ccsid_[columnIndex] = ccsidMbc_; 1099 } else { 1100 netCursor.charsetName_[columnIndex] = null; 1103 netCursor.ccsid_[columnIndex] = 0; 1104 } 1105 break; 1106 case CCSIDDBC: 1107 if (isCcsidDbcSet() && (ccsidDbc_ != 0)) { 1108 netCursor.charsetName_[columnIndex] = getCcsidDbcEncoding(); 1109 netCursor.ccsid_[columnIndex] = this.ccsidDbc_; 1110 } else { 1111 netCursor.charsetName_[columnIndex] = null; 1116 netCursor.ccsid_[columnIndex] = 0; 1117 } 1118 break; 1119 1120 default: netCursor.charsetName_[columnIndex] = UTF8ENCODING; 1126 netCursor.ccsid_[columnIndex] = sda.ccsid_; 1127 break; 1128 } 1129 1130 if ((sda.protocolType_ >= 0xC8) && (sda.protocolType_ <= 0xCF)) { 1140 netCursor.fdocaLength_[columnIndex] = protocolLength; 1144 netCursor.hasLobs_ = true; 1145 } else { 1146 netCursor.fdocaLength_[columnIndex] = protocolLength; 1147 } 1148 1149 netCursor.jdbcTypes_[columnIndex] = protocolToJdbcTypes_[sda.protocolType_]; 1151 1152 netCursor.typeToUseForComputingDataLength_[columnIndex] = sda.typeToUseForComputingDataLength_; 1154 1155 switch (netCursor.typeToUseForComputingDataLength_[columnIndex]) { 1160 case DECIMALLENGTH: 1161 netCursor.maximumRowSize_ += 1 + 16; 1162 break; 1163 case LOBLENGTH: 1164 netCursor.maximumRowSize_ += 1 + (netCursor.fdocaLength_[columnIndex] & 0x7fff); 1165 break; 1166 default: 1167 netCursor.maximumRowSize_ += 1 + netCursor.fdocaLength_[columnIndex] + 2; break; 1169 } 1170 1171 if (sda.characterSize_ == 2) { 1173 netCursor.isGraphic_[columnIndex] = true; 1174 } 1175 1176 } 1177 1178 void clearMddOverrides() { 1180 if (mddOverride_ == false) { 1181 return; 1182 } 1183 1184 mddOverride_ = false; 1185 for (int i = 0; i < OVERRIDE_TABLE_SIZE; i++) { 1186 overrideTable_[i] = null; 1187 } 1188 } 1189 1190 void setMddOverride(int protocolType, 1192 int fdocaTripletLid, 1193 int fdocaFieldType, 1194 int ccsid, 1195 int characterSize, 1196 int mode, 1197 int length) { 1198 mddOverride_ = true; 1199 1200 1201 if (overrideTable_[fdocaTripletLid] == null) { 1202 overrideTable_[fdocaTripletLid] = new FdocaSimpleDataArray 1203 (protocolType, 1204 fdocaFieldType, 1205 fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f], 1206 ccsid, 1207 characterSize, 1208 mode, 1209 length, 1210 mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType)); 1211 } else { 1212 overrideTable_[fdocaTripletLid].update(protocolType, 1213 fdocaFieldType, 1214 fdocaTypeToRepresentationMap_[fdocaFieldType & 0x7f], 1215 ccsid, 1216 characterSize, 1217 mode, 1218 length, 1219 mapFdocaTypeToTypeToUseForComputingDataLength(fdocaFieldType)); 1220 } 1221 } 1222 1223 private int mapFdocaTypeToTypeToUseForComputingDataLength(int fdocaFieldType) { 1224 switch (fdocaFieldType & 0x7f) { case FdocaConstants.FDOCA_TYPE_VARCHAR: 1226 case FdocaConstants.FDOCA_TYPE_VARBYTES: 1227 return Typdef.TWOBYTELENGTH; 1228 case FdocaConstants.FDOCA_TYPE_DECIMAL: 1229 case FdocaConstants.FDOCA_TYPE_NUMERIC_CHAR: 1230 return Typdef.DECIMALLENGTH; 1231 case FdocaConstants.FDOCA_TYPE_LOBBYTES: 1232 case FdocaConstants.FDOCA_TYPE_LOBCHAR: 1233 return Typdef.LOBLENGTH; 1234 case FdocaConstants.FDOCA_TYPE_PSCLBYTE: 1235 case FdocaConstants.FDOCA_TYPE_PSCLCHAR: 1236 return Typdef.ONEBYTELENGTH; 1237 default: 1238 return 0; 1239 } 1240 } 1241} 1242 | Popular Tags |