1 21 22 package org.apache.derby.client.net; 23 24 import org.apache.derby.client.am.ColumnMetaData; 25 import org.apache.derby.client.am.DisconnectException; 26 import org.apache.derby.client.am.PreparedStatementCallbackInterface; 27 import org.apache.derby.client.am.ResultSetCallbackInterface; 28 import org.apache.derby.client.am.Section; 29 import org.apache.derby.client.am.SqlState; 30 import org.apache.derby.client.am.SqlException; 31 import org.apache.derby.client.am.Statement; 32 import org.apache.derby.client.am.StatementCallbackInterface; 33 import org.apache.derby.client.am.Types; 34 import org.apache.derby.client.am.Utils; 35 import org.apache.derby.jdbc.ClientDriver; 36 import org.apache.derby.client.am.ClientJDBCObjectFactory; 37 import org.apache.derby.shared.common.i18n.MessageUtil; 38 import org.apache.derby.shared.common.reference.JDBC30Translation; 39 import org.apache.derby.client.am.ClientMessageId; 40 import org.apache.derby.shared.common.reference.SQLState; 41 import org.apache.derby.shared.common.reference.MessageId; 42 43 public class NetStatementReply extends NetPackageReply implements StatementReplyInterface { 44 NetStatementReply(NetAgent netAgent, int bufferSize) { 45 super(netAgent, bufferSize); 46 } 47 48 50 public void readPrepareDescribeOutput(StatementCallbackInterface statement) throws DisconnectException { 51 startSameIdChainParse(); 52 parsePRPSQLSTTreply(statement); 53 endOfSameIdChainData(); 54 } 55 56 public void readExecuteImmediate(StatementCallbackInterface statement) throws DisconnectException { 57 startSameIdChainParse(); 58 parseEXCSQLIMMreply(statement); 59 endOfSameIdChainData(); 60 } 61 62 public void readOpenQuery(StatementCallbackInterface statement) throws DisconnectException { 63 startSameIdChainParse(); 64 parseOPNQRYreply(statement); 65 endOfSameIdChainData(); 66 } 67 68 public void readExecute(PreparedStatementCallbackInterface preparedStatement) throws DisconnectException { 69 startSameIdChainParse(); 70 parseEXCSQLSTTreply(preparedStatement); 71 endOfSameIdChainData(); 72 } 73 74 public void readPrepare(StatementCallbackInterface statement) throws DisconnectException { 75 startSameIdChainParse(); 76 parsePRPSQLSTTreply(statement); 77 endOfSameIdChainData(); 78 } 79 80 public void readDescribeInput(PreparedStatementCallbackInterface preparedStatement) throws DisconnectException { 81 if (longBufferForDecryption_ != null) { 82 buffer_ = longBufferForDecryption_; 83 pos_ = longPosForDecryption_; 84 count_ = longCountForDecryption_; 85 if (longBufferForDecryption_ != null && count_ > longBufferForDecryption_.length) { 86 count_ = longBufferForDecryption_.length; 87 } 88 dssLength_ = 0; 89 longBufferForDecryption_ = null; 90 } 91 92 startSameIdChainParse(); 93 parseDSCSQLSTTreply(preparedStatement, 1); endOfSameIdChainData(); 95 } 96 97 public void readDescribeOutput(PreparedStatementCallbackInterface preparedStatement) throws DisconnectException { 98 startSameIdChainParse(); 99 parseDSCSQLSTTreply(preparedStatement, 0); endOfSameIdChainData(); 101 } 102 103 public void readExecuteCall(StatementCallbackInterface statement) throws DisconnectException { 104 startSameIdChainParse(); 105 parseEXCSQLSTTreply(statement); 106 endOfSameIdChainData(); 107 } 108 109 110 112 114 118 private void parsePRPSQLSTTreply(StatementCallbackInterface statement) throws DisconnectException { 119 int peekCP = parseTypdefsOrMgrlvlovrs(); 120 121 if (peekCP == CodePoint.SQLDARD) { 122 ColumnMetaData columnMetaData = null; 128 NetSqlca netSqlca = null; 129 boolean nullSqlca = peekForNullSqlcagrp(); 130 if (nullSqlca && peekNumOfColumns() == 0) { 131 netSqlca = parseSQLDARD(columnMetaData, true); } else { 133 columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_); 134 netSqlca = parseSQLDARD(columnMetaData, false); } 136 137 statement.completePrepareDescribeOutput(columnMetaData, 138 netSqlca); 139 } else if (peekCP == CodePoint.SQLCARD) { 140 NetSqlca netSqlca = parseSQLCARD(null); 141 statement.completePrepare(netSqlca); 142 } else { 143 parsePrepareError(statement); 144 } 145 146 } 147 148 private void parseDSCSQLSTTreply(PreparedStatementCallbackInterface ps, 152 int metaDataType) throws DisconnectException { 154 int peekCP = parseTypdefsOrMgrlvlovrs(); 155 156 if (peekCP == CodePoint.SQLDARD) { 157 ColumnMetaData columnMetaData = null; 158 159 if (columnMetaData == null) { 160 columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_); 161 } 162 163 NetSqlca netSqlca = parseSQLDARD(columnMetaData, false); if (columnMetaData.columns_ == 0) { 165 columnMetaData = null; 166 } 167 168 if (metaDataType == 0) { 170 ps.completeDescribeOutput(columnMetaData, netSqlca); 171 } else { 172 ps.completeDescribeInput(columnMetaData, netSqlca); 173 } 174 } else if (peekCP == CodePoint.SQLCARD) { 175 NetSqlca netSqlca = parseSQLCARD(null); 176 if (metaDataType == 0) { 178 ps.completeDescribeOutput(null, netSqlca); 179 } else { 180 ps.completeDescribeInput(null, netSqlca); 181 } 182 } else { 183 parseDescribeError(ps); 184 } 185 186 } 187 188 private void parseEXCSQLIMMreply(StatementCallbackInterface statement) throws DisconnectException { 192 int peekCP = parseTypdefsOrMgrlvlovrs(); 193 194 if (peekCP == CodePoint.RDBUPDRM) { 195 parseRDBUPDRM(); 196 peekCP = parseTypdefsOrMgrlvlovrs(); 197 } 198 199 switch (peekCP) { 200 case CodePoint.ENDUOWRM: 201 parseENDUOWRM(statement.getConnectionCallbackInterface()); 202 parseTypdefsOrMgrlvlovrs(); 203 case CodePoint.SQLCARD: 204 NetSqlca netSqlca = parseSQLCARD(null); 205 206 207 statement.completeExecuteImmediate(netSqlca); 208 break; 209 default: 210 parseExecuteImmediateError(statement); 211 break; 212 } 213 214 } 215 216 private void parseOPNQRYreply(StatementCallbackInterface statementI) throws DisconnectException { 220 int peekCP = peekCodePoint(); 221 222 if (peekCP == CodePoint.OPNQRYRM) { 223 parseOpenQuery(statementI); 224 peekCP = peekCodePoint(); 225 if (peekCP == CodePoint.RDBUPDRM) { 226 parseRDBUPDRM(); 227 peekCP = peekCodePoint(); 228 } 229 } else if (peekCP == CodePoint.RDBUPDRM) { 230 parseRDBUPDRM(); 231 parseOpenQuery(statementI); 232 peekCP = peekCodePoint(); 233 } else if (peekCP == CodePoint.OPNQFLRM) { 234 parseOpenQueryFailure(statementI); 235 peekCP = peekCodePoint(); 236 } else { 237 parseOpenQueryError(statementI); 238 peekCP = peekCodePoint(); 239 } 240 241 } 242 243 private void parseEXCSQLSETreply(StatementCallbackInterface statement) throws DisconnectException { 245 int peekCP = parseTypdefsOrMgrlvlovrs(); 246 247 if (peekCP == CodePoint.RDBUPDRM) { 248 parseRDBUPDRM(); 249 parseTypdefsOrMgrlvlovrs(); 250 } else if (peekCP == CodePoint.ENDUOWRM) { 251 parseENDUOWRM(statement.getConnectionCallbackInterface()); 252 parseTypdefsOrMgrlvlovrs(); 253 } 254 255 if (peekCP == CodePoint.SQLCARD) { 256 NetSqlca netSqlca = parseSQLCARD(null); 257 statement.completeExecuteSetStatement(netSqlca); 258 } else { 259 parseExecuteSetStatementError(statement); 260 } 261 262 } 263 264 private void parseEXCSQLSTTreply(StatementCallbackInterface statementI) throws DisconnectException { 269 int peekCP = peekCodePoint(); 274 if (peekCP == CodePoint.RDBUPDRM) { 275 parseRDBUPDRM(); 276 peekCP = peekCodePoint(); 277 } 278 279 if (peekCP == CodePoint.ENDUOWRM) { 280 parseENDUOWRM(statementI.getConnectionCallbackInterface()); 281 peekCP = peekCodePoint(); 282 } 283 284 if (peekCP == CodePoint.RSLSETRM) { 287 parseResultSetProcedure(statementI); 288 peekCP = peekCodePoint(); 289 if (peekCP == CodePoint.RDBUPDRM) { 290 parseRDBUPDRM(); 291 } 292 return; 293 } 294 295 peekCP = parseTypdefsOrMgrlvlovrs(); 298 299 if (peekCP == CodePoint.SQLCARD) { 302 NetSqlca netSqlca = parseSQLCARD(null); 303 304 statementI.completeExecute(netSqlca); 305 } else if (peekCP == CodePoint.SQLDTARD) { 306 NetSqldta netSqldta = null; 311 boolean useCachedSingletonRowData = false; 312 if (((Statement) statementI).cachedSingletonRowData_ == null) { 313 netSqldta = new NetSqldta(netAgent_); 314 } else { 315 netSqldta = (NetSqldta) ((Statement) statementI).cachedSingletonRowData_; 316 netSqldta.resetDataBuffer(); 317 netSqldta.extdtaData_.clear(); 318 useCachedSingletonRowData = true; 319 } 320 NetSqlca netSqlca = 321 parseSQLDTARD(netSqldta); 322 323 peekCP = peekCodePoint(); 325 while (peekCP == CodePoint.EXTDTA) { 326 copyEXTDTA(netSqldta); 327 peekCP = peekCodePoint(); 328 } 329 statementI.completeExecuteCall(netSqlca, netSqldta); 330 } else { 331 parseExecuteError(statementI); 333 } 334 335 } 336 337 protected void parseResultSetProcedure(StatementCallbackInterface statementI) throws DisconnectException { 338 350 java.util.ArrayList sectionAL = parseRSLSETRM(); 352 353 int peekCP = parseTypdefsOrMgrlvlovrs(); 356 357 NetSqldta netSqldta = null; 362 NetSqlca netSqlca = null; 363 if (peekCP == CodePoint.SQLCARD) { 364 netSqlca = parseSQLCARD(null); 365 } else { 366 netSqldta = new NetSqldta(netAgent_); 369 netSqlca = parseSQLDTARD(netSqldta); 370 } 371 372 peekCP = parseTypdefsOrMgrlvlovrs(); 375 376 int numberOfResultSets = parseSQLRSLRD(sectionAL); 377 378 NetResultSet[] resultSets = new NetResultSet[numberOfResultSets]; 383 for (int i = 0; i < numberOfResultSets; i++) { 384 NetResultSet netResultSet = parseResultSetCursor(statementI, (Section) sectionAL.get(i)); 386 resultSets[i] = netResultSet; 387 } 388 389 peekCP = peekCodePoint(); 392 while (peekCP == CodePoint.EXTDTA) { 393 copyEXTDTA(netSqldta); 394 peekCP = peekCodePoint(); 395 } 396 statementI.completeExecuteCall(netSqlca, netSqldta, resultSets); 397 } 398 399 protected NetResultSet parseResultSetCursor(StatementCallbackInterface statementI, 406 Section section) throws DisconnectException { 407 NetResultSet netResultSet = parseOPNQRYRM(statementI, false); 409 410 int peekCP = parseTypdefsOrMgrlvlovrs(); 412 413 NetSqlca netSqlca = null; 415 if (peekCP == CodePoint.SQLCARD) { 416 netSqlca = parseSQLCARD(null); 417 peekCP = parseTypdefsOrMgrlvlovrs(); 418 } 419 420 ColumnMetaData resultSetMetaData = null; 422 if (peekCP == CodePoint.SQLCINRD) { 423 resultSetMetaData = parseSQLCINRD(); 424 peekCP = parseTypdefsOrMgrlvlovrs(); 425 } 426 427 parseQRYDSC(netResultSet.netCursor_); 431 peekCP = peekCodePoint(); 432 statementI.completeExecuteCallOpenQuery(netSqlca, netResultSet, resultSetMetaData, section); 433 434 while (peekCP == CodePoint.QRYDTA) { 436 parseQRYDTA(netResultSet); 437 peekCP = peekCodePoint(); 438 } 439 440 if (peekCP == CodePoint.ENDQRYRM) { 443 parseEndQuery((ResultSetCallbackInterface) netResultSet); 444 } 445 446 return netResultSet; 447 } 448 449 protected void parseOpenQuery(StatementCallbackInterface statementI) throws DisconnectException { 450 NetResultSet netResultSet = parseOPNQRYRM(statementI, true); 451 452 NetSqlca sqlca = null; 453 int peekCP = peekCodePoint(); 454 if (peekCP != CodePoint.QRYDSC) { 455 456 peekCP = parseTypdefsOrMgrlvlovrs(); 457 458 if (peekCP == CodePoint.SQLDARD) { 459 ColumnMetaData columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_); 460 NetSqlca netSqlca = parseSQLDARD(columnMetaData, false); 462 statementI.completePrepareDescribeOutput(columnMetaData, netSqlca); 470 peekCP = parseTypdefsOrMgrlvlovrs(); 471 } 472 474 if (peekCP == CodePoint.SQLCARD) { 475 sqlca = parseSQLCARD(null); 476 peekCP = parseTypdefsOrMgrlvlovrs(); 477 } 478 } 479 parseQRYDSC(netResultSet.netCursor_); 480 481 peekCP = peekCodePoint(); 482 while (peekCP == CodePoint.QRYDTA) { 483 parseQRYDTA(netResultSet); 484 peekCP = peekCodePoint(); 485 } 486 487 if (peekCP == CodePoint.SQLCARD) { 488 NetSqlca netSqlca = parseSQLCARD(null); 489 statementI.completeSqlca(netSqlca); 490 peekCP = peekCodePoint(); 491 } 492 493 if (peekCP == CodePoint.ENDQRYRM) { 494 parseEndQuery(netResultSet); 495 } 496 497 statementI.completeOpenQuery(sqlca, netResultSet); 498 } 499 500 protected void parseEndQuery(ResultSetCallbackInterface resultSetI) throws DisconnectException { 501 parseENDQRYRM(resultSetI); 502 parseTypdefsOrMgrlvlovrs(); 503 NetSqlca netSqlca = parseSQLCARD(null); 504 resultSetI.earlyCloseComplete(netSqlca); 505 } 506 507 void parseOpenQueryFailure(StatementCallbackInterface statementI) throws DisconnectException { 508 parseOPNQFLRM(statementI); 509 parseTypdefsOrMgrlvlovrs(); 510 NetSqlca netSqlca = parseSQLCARD(null); 511 statementI.completeOpenQuery(netSqlca, null); 512 } 513 514 void parsePrepareError(StatementCallbackInterface statement) throws DisconnectException { 515 int peekCP = peekCodePoint(); 516 switch (peekCP) { 517 case CodePoint.ABNUOWRM: 518 { 519 NetSqlca sqlca = parseAbnormalEndUow(statement); 523 statement.completeSqlca(sqlca); 524 break; 525 } 526 case CodePoint.CMDCHKRM: 527 parseCMDCHKRM(); 528 break; 529 case CodePoint.DTAMCHRM: 530 parseDTAMCHRM(); 531 break; 532 case CodePoint.OBJNSPRM: 533 parseOBJNSPRM(); 534 break; 535 case CodePoint.RDBNACRM: 536 parseRDBNACRM(); 537 break; 538 case CodePoint.SQLERRRM: 539 { 540 NetSqlca sqlca = parseSqlErrorCondition(); 541 statement.completeSqlca(sqlca); 542 break; 543 } 544 default: 545 parseCommonError(peekCP); 546 } 547 } 548 549 void parseExecuteImmediateError(StatementCallbackInterface statement) throws DisconnectException { 550 int peekCP = peekCodePoint(); 551 switch (peekCP) { 552 case CodePoint.ABNUOWRM: 553 { 554 NetSqlca sqlca = parseAbnormalEndUow(statement); 558 statement.completeSqlca(sqlca); 559 break; 560 } 561 case CodePoint.CMDCHKRM: 562 parseCMDCHKRM(); 563 break; 564 case CodePoint.DTAMCHRM: 565 parseDTAMCHRM(); 566 break; 567 case CodePoint.OBJNSPRM: 568 parseOBJNSPRM(); 569 break; 570 case CodePoint.RDBNACRM: 571 parseRDBNACRM(); 572 break; 573 case CodePoint.SQLERRRM: 574 { 575 NetSqlca sqlca = parseSqlErrorCondition(); 576 statement.completeSqlca(sqlca); 577 break; 578 } 579 default: 580 parseCommonError(peekCP); 581 break; 582 } 583 } 584 585 586 void parseDescribeError(StatementCallbackInterface statement) throws DisconnectException { 587 int peekCP = peekCodePoint(); 588 switch (peekCP) { 589 case CodePoint.ABNUOWRM: 590 { 591 NetSqlca sqlca = parseAbnormalEndUow(statement); 595 statement.completeSqlca(sqlca); 596 break; 597 } 598 case CodePoint.CMDCHKRM: 599 parseCMDCHKRM(); 600 break; 601 case CodePoint.RDBNACRM: 602 parseRDBNACRM(); 603 break; 604 case CodePoint.SQLERRRM: 605 { 606 NetSqlca sqlca = parseSqlErrorCondition(); 607 statement.completeSqlca(sqlca); 608 break; 609 } 610 default: 611 parseCommonError(peekCP); 612 } 613 } 614 615 616 void parseOpenQueryError(StatementCallbackInterface statementI) throws DisconnectException { 617 int peekCP = peekCodePoint(); 618 switch (peekCP) { 619 case CodePoint.ABNUOWRM: 620 { 621 NetSqlca sqlca = parseAbnormalEndUow(statementI); 625 statementI.completeSqlca(sqlca); 626 break; 627 } 628 case CodePoint.CMDCHKRM: 629 parseCMDCHKRM(); 630 break; 631 case CodePoint.DTAMCHRM: 632 parseDTAMCHRM(); 633 break; 634 case CodePoint.OBJNSPRM: 635 parseOBJNSPRM(); 636 break; 637 case CodePoint.QRYPOPRM: 638 parseQRYPOPRM(); 639 break; 640 case CodePoint.RDBNACRM: 641 parseRDBNACRM(); 642 break; 643 default: 644 parseCommonError(peekCP); 645 } 646 } 647 648 void parseExecuteError(StatementCallbackInterface statementI) throws DisconnectException { 649 int peekCP = peekCodePoint(); 650 switch (peekCP) { 651 case CodePoint.ABNUOWRM: 652 { 653 NetSqlca sqlca = parseAbnormalEndUow(statementI); 657 statementI.completeSqlca(sqlca); 658 break; 659 } 660 case CodePoint.CMDCHKRM: 661 parseCMDCHKRM(); 662 break; 663 case CodePoint.DTAMCHRM: 664 parseDTAMCHRM(); 665 break; 666 case CodePoint.OBJNSPRM: 667 parseOBJNSPRM(); 668 break; 669 case CodePoint.RDBNACRM: 670 parseRDBNACRM(); 671 break; 672 case CodePoint.SQLERRRM: 673 { 674 NetSqlca sqlca = parseSqlErrorCondition(); 675 statementI.completeSqlca(sqlca); 676 break; 677 } 678 default: 679 parseCommonError(peekCP); 680 break; 681 } 682 } 683 684 void parseExecuteSetStatementError(StatementCallbackInterface statement) throws DisconnectException { 685 int peekCP = peekCodePoint(); 686 switch (peekCP) { 687 case CodePoint.ABNUOWRM: 688 { 689 NetSqlca sqlca = parseAbnormalEndUow(statement); 693 statement.completeSqlca(sqlca); 694 break; 695 } 696 case CodePoint.CMDCHKRM: 697 parseCMDCHKRM(); 698 break; 699 case CodePoint.DTAMCHRM: 700 parseDTAMCHRM(); 701 break; 702 case CodePoint.OBJNSPRM: 703 parseOBJNSPRM(); 704 break; 705 case CodePoint.RDBNACRM: 706 parseRDBNACRM(); 707 break; 708 case CodePoint.SQLERRRM: 709 { 710 NetSqlca sqlca = parseSqlErrorCondition(); 711 statement.completeSqlca(sqlca); 712 break; 713 } 714 default: 715 parseCommonError(peekCP); 716 break; 717 } 718 } 719 720 721 723 739 protected NetResultSet parseOPNQRYRM(StatementCallbackInterface statementI, 740 boolean isOPNQRYreply) 741 throws DisconnectException 742 { 743 int svrcod = CodePoint.SVRCOD_INFO; 745 boolean svrcodReceived = false; 746 int qryprctyp = 0; 747 boolean qryprctypReceived = false; 748 int sqlcsrhld = 0xF0; boolean sqlcsrhldReceived = false; 750 int qryattscr = 0xF0; boolean qryattscrReceived = false; 752 int qryattsns = CodePoint.QRYUNK; 753 boolean qryattsnsReceived = false; 754 int qryattupd = CodePoint.QRYUNK; 755 boolean qryattupdReceived = false; 756 long qryinsid = 0; 757 boolean qryinsidReceived = false; 758 759 760 int qryattset = 0xF0; boolean qryattsetReceived = false; 762 763 parseLengthAndMatchCodePoint(CodePoint.OPNQRYRM); 764 int ddmLength = getDdmLength(); 766 ensureBLayerDataInBuffer(ddmLength); 767 int peekCP = peekCodePoint(); 768 int length = 0; 769 770 while (ddmLength > 0) { 772 773 boolean foundInPass = false; 774 775 if (peekCP == CodePoint.SVRCOD) { 776 foundInPass = true; 777 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 778 length = peekedLength_; 779 svrcod = parseFastSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_SESDMG); 780 ddmLength = adjustDdmLength(ddmLength, length); 781 peekCP = peekCodePoint(); 782 } 783 784 if (peekCP == CodePoint.QRYPRCTYP) { 785 foundInPass = true; 786 qryprctypReceived = checkAndGetReceivedFlag(qryprctypReceived); 787 length = peekedLength_; 788 qryprctyp = parseFastQRYPRCTYP(); 789 ddmLength = adjustDdmLength(ddmLength, length); 790 peekCP = peekCodePoint(); 791 } 792 793 if (peekCP == CodePoint.SQLCSRHLD) { 794 foundInPass = true; 797 sqlcsrhldReceived = checkAndGetReceivedFlag(sqlcsrhldReceived); 798 length = peekedLength_; 799 sqlcsrhld = parseFastSQLCSRHLD(); 800 ddmLength = adjustDdmLength(ddmLength, length); 801 peekCP = peekCodePoint(); 802 } 803 804 if (peekCP == CodePoint.QRYATTSCR) { 805 foundInPass = true; 806 qryattscrReceived = checkAndGetReceivedFlag(qryattscrReceived); 807 length = peekedLength_; 808 qryattscr = parseFastQRYATTSCR(); 809 ddmLength = adjustDdmLength(ddmLength, length); 810 peekCP = peekCodePoint(); 811 } 812 813 if (peekCP == CodePoint.QRYATTSNS) { 814 foundInPass = true; 815 qryattsnsReceived = checkAndGetReceivedFlag(qryattsnsReceived); 816 length = peekedLength_; 817 qryattsns = parseFastQRYATTSNS(); 818 ddmLength = adjustDdmLength(ddmLength, length); 819 peekCP = peekCodePoint(); 820 } 821 822 if (peekCP == CodePoint.QRYATTUPD) { 823 foundInPass = true; 824 qryattupdReceived = checkAndGetReceivedFlag(qryattupdReceived); 825 length = peekedLength_; 826 qryattupd = parseFastQRYATTUPD(); 827 ddmLength = adjustDdmLength(ddmLength, length); 828 peekCP = peekCodePoint(); 829 } 830 831 if (peekCP == CodePoint.QRYINSID) { 832 foundInPass = true; 833 qryinsidReceived = checkAndGetReceivedFlag(qryinsidReceived); 834 length = peekedLength_; 835 qryinsid = parseFastQRYINSID(); 836 ddmLength = adjustDdmLength(ddmLength, length); 837 peekCP = peekCodePoint(); 838 } 839 840 if (peekCP == CodePoint.QRYATTSET) { 841 foundInPass = true; 842 qryattsetReceived = checkAndGetReceivedFlag(qryattsetReceived); 843 length = peekedLength_; 844 qryattset = parseFastQRYATTSET(); 845 ddmLength = adjustDdmLength(ddmLength, length); 846 peekCP = peekCodePoint(); 847 } 848 849 850 if (!foundInPass) { 851 doPrmnsprmSemantics(peekCP); 852 } 853 854 } 855 checkRequiredObjects(svrcodReceived, qryprctypReceived, qryinsidReceived); 856 857 netAgent_.setSvrcod(svrcod); 858 859 Statement statement = (Statement) statementI; 861 862 NetResultSet rs = null; 864 if (statement.cachedCursor_ != null) { 865 statement.cachedCursor_.resetDataBuffer(); 866 ((NetCursor) statement.cachedCursor_).extdtaData_.clear(); 867 try { 868 rs = (NetResultSet)ClientDriver.getFactory().newNetResultSet 869 (netAgent_, 870 (NetStatement) statement.materialStatement_, 871 statement.cachedCursor_, 872 qryprctyp, sqlcsrhld, qryattscr, qryattsns, qryattset, 880 qryinsid, calculateResultSetType(qryattscr, qryattsns, statement.resultSetType_), 882 calculateResultSetConcurrency(qryattupd, statement.resultSetConcurrency_), 883 calculateResultSetHoldability(sqlcsrhld)); 884 } catch(SqlException sqle) { 885 throw new DisconnectException(netAgent_,sqle); 886 } 887 } else { 888 try { 889 rs = (NetResultSet)ClientDriver.getFactory().newNetResultSet 890 (netAgent_, 891 (NetStatement) statement.materialStatement_, 892 new NetCursor(netAgent_, qryprctyp), 893 qryprctyp, sqlcsrhld, qryattscr, qryattsns, qryattset, 899 qryinsid, calculateResultSetType(qryattscr, qryattsns, statement.resultSetType_), 901 calculateResultSetConcurrency(qryattupd, statement.resultSetConcurrency_), 902 calculateResultSetHoldability(sqlcsrhld)); 903 } catch(SqlException sqle) { 904 throw new DisconnectException(netAgent_,sqle); 905 } 906 907 } 908 909 final boolean qryclsimp = 911 isOPNQRYreply && 912 (rs.resultSetType_ == java.sql.ResultSet.TYPE_FORWARD_ONLY) && 913 netAgent_.netConnection_.serverSupportsQryclsimp(); 914 rs.netCursor_.setQryclsimpEnabled(qryclsimp); 915 916 return rs; 917 } 918 919 920 protected void parseENDQRYRM(ResultSetCallbackInterface resultSetI) throws DisconnectException { 926 boolean svrcodReceived = false; 927 int svrcod = CodePoint.SVRCOD_INFO; 928 boolean rdbnamReceived = false; 929 String rdbnam = null; 930 931 parseLengthAndMatchCodePoint(CodePoint.ENDQRYRM); 932 pushLengthOnCollectionStack(); 933 int peekCP = peekCodePoint(); 934 935 while (peekCP != Reply.END_OF_COLLECTION) { 936 937 boolean foundInPass = false; 938 939 if (peekCP == CodePoint.SVRCOD) { 940 foundInPass = true; 941 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 942 svrcod = parseSVRCOD(CodePoint.SVRCOD_WARNING, CodePoint.SVRCOD_ERROR); 943 peekCP = peekCodePoint(); 944 } 945 946 if (peekCP == CodePoint.RDBNAM) { 947 foundInPass = true; 948 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 949 rdbnam = parseRDBNAM(true); 950 peekCP = peekCodePoint(); 951 } 952 if (!foundInPass) { 953 doPrmnsprmSemantics(peekCP); 954 } 955 956 } 957 popCollectionStack(); 958 checkRequiredObjects(svrcodReceived); 959 960 netAgent_.setSvrcod(svrcod); 961 962 } 963 964 965 private void parseQRYPOPRM() throws DisconnectException { 999 boolean svrcodReceived = false; 1000 int svrcod = CodePoint.SVRCOD_INFO; 1001 boolean rdbnamReceived = false; 1002 String rdbnam = null; 1003 boolean pkgnamcsnReceived = false; 1004 Object pkgnamcsn = null; 1005 1006 parseLengthAndMatchCodePoint(CodePoint.QRYPOPRM); 1007 pushLengthOnCollectionStack(); 1008 int peekCP = peekCodePoint(); 1009 1010 while (peekCP != Reply.END_OF_COLLECTION) { 1011 1012 boolean foundInPass = false; 1013 1014 if (peekCP == CodePoint.SVRCOD) { 1015 foundInPass = true; 1016 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1017 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1018 peekCP = peekCodePoint(); 1019 } 1020 1021 if (peekCP == CodePoint.RDBNAM) { 1022 foundInPass = true; 1023 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1024 rdbnam = parseRDBNAM(true); 1025 peekCP = peekCodePoint(); 1026 } 1027 if (peekCP == CodePoint.PKGNAMCSN) { 1028 foundInPass = true; 1029 pkgnamcsnReceived = checkAndGetReceivedFlag(pkgnamcsnReceived); 1030 pkgnamcsn = parsePKGNAMCSN(true); 1031 peekCP = peekCodePoint(); 1032 } 1033 1034 if (!foundInPass) { 1035 doPrmnsprmSemantics(peekCP); 1036 } 1037 1038 } 1039 popCollectionStack(); 1040 checkRequiredObjects(svrcodReceived, 1041 rdbnamReceived, 1042 pkgnamcsnReceived); 1043 1044 netAgent_.setSvrcod(svrcod); 1045 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1046 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 1047 MessageUtil.getCompleteMessage(MessageId.CONN_DRDA_QRYOPEN, 1048 SqlException.CLIENT_MESSAGE_RESOURCE_NAME, 1049 (Object [])null))); 1050 } 1051 1052 private void parseOPNQFLRM(StatementCallbackInterface statement) throws DisconnectException { 1064 boolean svrcodReceived = false; 1065 int svrcod = CodePoint.SVRCOD_INFO; 1066 boolean rdbnamReceived = false; 1067 String rdbnam = null; 1068 1069 parseLengthAndMatchCodePoint(CodePoint.OPNQFLRM); 1070 pushLengthOnCollectionStack(); 1071 int peekCP = peekCodePoint(); 1072 1073 while (peekCP != Reply.END_OF_COLLECTION) { 1074 1075 boolean foundInPass = false; 1076 1077 if (peekCP == CodePoint.SVRCOD) { 1078 foundInPass = true; 1079 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1080 svrcod = parseSVRCOD(CodePoint.SVRCOD_ERROR, CodePoint.SVRCOD_ERROR); 1081 peekCP = peekCodePoint(); 1082 } 1083 1084 if (peekCP == CodePoint.RDBNAM) { 1085 foundInPass = true; 1089 rdbnamReceived = checkAndGetReceivedFlag(rdbnamReceived); 1090 rdbnam = parseRDBNAM(true); 1091 peekCP = peekCodePoint(); 1092 } 1093 if (!foundInPass) { 1094 doPrmnsprmSemantics(peekCP); 1095 } 1096 1097 } 1098 popCollectionStack(); 1099 checkRequiredObjects(svrcodReceived, rdbnamReceived); 1100 1101 netAgent_.setSvrcod(svrcod); 1102 1103 } 1105 1106 protected java.util.ArrayList parseRSLSETRM() throws DisconnectException { 1117 boolean svrcodReceived = false; 1118 int svrcod = CodePoint.SVRCOD_INFO; 1119 boolean pkgsnlstReceived = false; 1120 java.util.ArrayList pkgsnlst = null; 1121 1122 parseLengthAndMatchCodePoint(CodePoint.RSLSETRM); 1123 pushLengthOnCollectionStack(); 1124 int peekCP = peekCodePoint(); 1125 1126 while (peekCP != Reply.END_OF_COLLECTION) { 1127 1128 boolean foundInPass = false; 1129 1130 if (peekCP == CodePoint.SVRCOD) { 1131 foundInPass = true; 1132 svrcodReceived = checkAndGetReceivedFlag(svrcodReceived); 1133 svrcod = parseSVRCOD(CodePoint.SVRCOD_INFO, CodePoint.SVRCOD_INFO); 1134 peekCP = peekCodePoint(); 1135 } 1136 1137 if (peekCP == CodePoint.PKGSNLST) { 1138 foundInPass = true; 1140 pkgsnlstReceived = checkAndGetReceivedFlag(pkgsnlstReceived); 1141 pkgsnlst = parsePKGSNLST(); 1142 peekCP = peekCodePoint(); 1143 } 1144 1145 if (!foundInPass) { 1146 doPrmnsprmSemantics(peekCP); 1147 } 1148 1149 } 1150 popCollectionStack(); 1151 checkRequiredObjects(svrcodReceived, pkgsnlstReceived); 1152 1153 netAgent_.setSvrcod(svrcod); 1154 1155 return pkgsnlst; 1156 } 1157 1158 1160 1161 protected NetSqlca parseSQLDTARD(NetSqldta netSqldta) throws DisconnectException { 1168 boolean fdodscReceived = false; 1169 boolean fdodtaReceived = false; 1170 1171 parseLengthAndMatchCodePoint(CodePoint.SQLDTARD); 1172 pushLengthOnCollectionStack(); 1173 1174 NetSqlca netSqlca = null; 1175 int peekCP = peekCodePoint(); 1176 while (peekCP != Reply.END_OF_COLLECTION) { 1177 1178 boolean foundInPass = false; 1179 1180 if (peekCP == CodePoint.FDODSC) { 1181 foundInPass = true; 1182 fdodscReceived = checkAndGetReceivedFlag(fdodscReceived); 1183 parseFDODSC(netSqldta); 1184 peekCP = peekCodePoint(); 1185 } 1186 1187 if (peekCP == CodePoint.FDODTA) { 1188 foundInPass = true; 1189 fdodtaReceived = checkAndGetReceivedFlag(fdodtaReceived); 1190 netSqlca = parseFDODTA(netSqldta); 1191 peekCP = peekCodePoint(); 1192 } 1193 1194 if (!foundInPass) { 1195 doPrmnsprmSemantics(peekCP); 1196 } 1197 1198 } 1199 popCollectionStack(); 1200 checkRequiredObjects(fdodscReceived, fdodtaReceived); 1201 netSqldta.calculateColumnOffsetsForRow(); 1202 return netSqlca; 1203 } 1204 1205 protected void parseQRYDSC(NetCursor cursor) throws DisconnectException { 1206 parseLengthAndMatchCodePoint(CodePoint.QRYDSC); 1207 parseSQLDTARDarray(cursor, false); } 1209 1210 private void parseFDODSC(NetCursor cursor) throws DisconnectException { 1211 parseLengthAndMatchCodePoint(CodePoint.FDODSC); 1212 parseSQLDTARDarray(cursor, false); } 1214 1215 private void parseSQLDTARDarray(NetCursor cursor, boolean skipBytes) throws DisconnectException { 1216 if (skipBytes) { 1217 skipBytes(); 1218 } 1219 int previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_START; 1220 int previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_START; 1221 int mddProtocolType = 0; 1222 int columnCount = 0; 1223 netAgent_.targetTypdef_.clearMddOverrides(); 1224 1225 int ddmLength = getDdmLength(); 1226 ensureBLayerDataInBuffer(ddmLength); 1227 1228 while (ddmLength > 0) { 1229 1230 int tripletLength = readFastUnsignedByte(); 1231 int tripletType = readFastUnsignedByte(); 1232 int tripletId = readFastUnsignedByte(); 1233 1234 switch (tripletType) { 1235 1236 case FdocaConstants.MDD_TRIPLET_TYPE: 1237 if ((tripletLength != FdocaConstants.MDD_TRIPLET_SIZE) || 1238 (tripletId != FdocaConstants.NULL_LID)) { 1239 descriptorErrorDetected(); 1240 } 1241 checkPreviousSQLDTARDtriplet(previousTripletType, 1242 FdocaConstants.SQLDTARD_TRIPLET_TYPE_MDD, 1243 previousTripletId, 1244 FdocaConstants.SQLDTARD_TRIPLET_ID_0); 1245 previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_MDD; 1246 previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_0; 1247 1248 int mddClass = readFastUnsignedByte(); 1250 int mddType = readFastUnsignedByte(); 1251 int mddRefType = readFastUnsignedByte(); 1252 mddProtocolType = readFastUnsignedByte(); 1253 break; 1254 1255 case FdocaConstants.NGDA_TRIPLET_TYPE: if (tripletId != FdocaConstants.SQLDTAGRP_LID) { 1257 descriptorErrorDetected(); 1258 } 1259 checkPreviousSQLDTARDtriplet(previousTripletType, 1260 FdocaConstants.SQLDTARD_TRIPLET_TYPE_GDA, 1261 previousTripletId, 1262 FdocaConstants.SQLDTARD_TRIPLET_ID_D0); 1263 previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_GDA; 1264 previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_0; 1265 1266 int columns = peekTotalColumnCount(tripletLength); 1271 cursor.initializeColumnInfoArrays(netAgent_.targetTypdef_, columns, netAgent_.targetSqlam_); 1273 columnCount += parseSQLDTAGRPdataLabelsAndUpdateColumn(cursor, columnCount, tripletLength); 1274 break; 1275 1276 1277 case FdocaConstants.RLO_TRIPLET_TYPE: 1279 switch (tripletId) { 1280 case FdocaConstants.SQLCADTA_LID: 1281 if (tripletLength != FdocaConstants.SQLCADTA_RLO_SIZE) { 1282 descriptorErrorDetected(); } 1284 checkPreviousSQLDTARDtriplet(previousTripletType, 1285 FdocaConstants.SQLDTARD_TRIPLET_TYPE_RLO, 1286 previousTripletId, 1287 FdocaConstants.SQLDTARD_TRIPLET_ID_E0); 1288 previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_RLO; 1289 previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_E0; 1290 checkFastRLO(FdocaConstants.RLO_SQLCADTA); 1291 break; 1292 1293 case FdocaConstants.SQLDTARD_LID: 1294 if (tripletLength != FdocaConstants.SQLDTARD_RLO_SIZE) { 1295 descriptorErrorDetected(); } 1297 checkPreviousSQLDTARDtriplet(previousTripletType, 1298 FdocaConstants.SQLDTARD_TRIPLET_TYPE_RLO, 1299 previousTripletId, 1300 FdocaConstants.SQLDTARD_TRIPLET_ID_F0); 1301 previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_RLO; 1302 previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_F0; 1303 checkFastRLO(FdocaConstants.RLO_SQLDTARD); 1304 break; 1305 default: 1306 descriptorErrorDetected(); break; 1308 } 1309 break; 1310 1311 case FdocaConstants.CPT_TRIPLET_TYPE: if (tripletId != FdocaConstants.NULL_LID) { 1313 descriptorErrorDetected(); 1314 } 1315 checkPreviousSQLDTARDtriplet(previousTripletType, 1316 FdocaConstants.SQLDTARD_TRIPLET_TYPE_CPT, 1317 previousTripletId, 1318 FdocaConstants.SQLDTARD_TRIPLET_ID_0); 1319 previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_CPT; 1320 previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_0; 1321 1322 columnCount += parseSQLDTAGRPdataLabelsAndUpdateColumn(cursor, columnCount, tripletLength); 1323 break; 1324 1325 1326 case FdocaConstants.SDA_TRIPLET_TYPE: if (tripletLength != FdocaConstants.SDA_TRIPLET_SIZE) { 1328 descriptorErrorDetected(); } 1330 checkPreviousSQLDTARDtriplet(previousTripletType, 1331 FdocaConstants.SQLDTARD_TRIPLET_TYPE_SDA, 1332 previousTripletId, 1333 FdocaConstants.SQLDTARD_TRIPLET_ID_SDA); 1334 previousTripletType = FdocaConstants.SQLDTARD_TRIPLET_TYPE_SDA; 1335 previousTripletId = FdocaConstants.SQLDTARD_TRIPLET_ID_SDA; 1336 netAgent_.targetTypdef_.setMddOverride(mddProtocolType, tripletId, readFastUnsignedByte(), readFastInt(), readFastUnsignedByte(), readFastUnsignedByte(), readFastShort()); 1343 break; 1344 1345 default: 1346 descriptorErrorDetected(); break; 1348 } 1349 1350 ddmLength -= tripletLength; 1351 } 1352 1353 adjustLengths(getDdmLength()); 1354 1355 cursor.allocateCharBuffer(); 1357 1358 checkPreviousSQLDTARDtriplet(previousTripletType, 1359 FdocaConstants.SQLDTARD_TRIPLET_TYPE_END, 1360 previousTripletId, 1361 FdocaConstants.SQLDTARD_TRIPLET_ID_END); 1362 1363 } 1364 1365 private void checkPreviousSQLDTARDtriplet(int previousTripletType, 1366 int tripletType, 1367 int previousTripletId, 1368 int tripletId) throws DisconnectException { 1369 if (FdocaConstants.SQLDTARD_TRIPLET_TYPES[previousTripletType][tripletType] == false) { 1370 descriptorErrorDetected(); } 1372 if (FdocaConstants.SQLDTARD_TRIPLET_IDS[previousTripletId][tripletId] == false) { 1373 descriptorErrorDetected(); } 1375 } 1376 1377 1378 private void checkFastRLO(int[][] rlo) throws DisconnectException { 1379 for (int i = 0; i < rlo.length; i++) { 1380 int lid = readFastUnsignedByte(); 1381 if (lid != rlo[i][FdocaConstants.RLO_GROUP_LID]) { 1382 descriptorErrorDetected(); } 1384 int elementTaken = readFastUnsignedByte(); 1385 if (elementTaken != rlo[i][FdocaConstants.RLO_ELEMENT_TAKEN]) { 1386 descriptorErrorDetected(); } 1388 int repFactor = readFastUnsignedByte(); 1389 if (repFactor != rlo[i][FdocaConstants.RLO_REP_FACTOR]) { 1390 descriptorErrorDetected(); } 1392 } 1393 } 1394 1395 private void descriptorErrorDetected() throws DisconnectException { 1418 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1419 new ClientMessageId(SQLState.DRDA_CONNECTION_TERMINATED), 1420 MessageUtil.getCompleteMessage(MessageId.CONN_DRDA_INVALIDFDOCA, 1421 SqlException.CLIENT_MESSAGE_RESOURCE_NAME, 1422 (Object [])null))); 1423 } 1424 1425 protected void parseQRYDTA(NetResultSet netResultSet) throws DisconnectException { 1426 parseLengthAndMatchCodePoint(CodePoint.QRYDTA); 1427 if (longValueForDecryption_ == null) { 1428 int ddmLength = getDdmLength(); 1429 ensureBLayerDataInBuffer(ddmLength); 1430 } 1431 parseSQLDTARDdata(netResultSet.netCursor_); 1432 if (longValueForDecryption_ == null) { 1433 adjustLengths(getDdmLength()); 1434 } else { 1435 longValueForDecryption_ = null; 1436 } 1437 if (longBufferForDecryption_ != null) { 1438 buffer_ = longBufferForDecryption_; 1439 pos_ = longPosForDecryption_; 1440 if (count_ > longBufferForDecryption_.length) { 1441 count_ = longBufferForDecryption_.length; 1442 } else if (longCountForDecryption_ != 0) { 1443 count_ = longCountForDecryption_; 1444 longCountForDecryption_ = 0; 1445 } 1446 dssLength_ = 0; 1447 longBufferForDecryption_ = null; 1448 } 1449 1450 1451 } 1452 1453 NetSqlca parseFDODTA(NetCursor netCursor) throws DisconnectException { 1454 parseLengthAndMatchCodePoint(CodePoint.FDODTA); 1455 int ddmLength = getDdmLength(); 1456 ensureBLayerDataInBuffer(ddmLength); 1457 mark(); 1458 NetSqlca netSqlca = parseSQLCARDrow(null); 1459 int length = getFastSkipSQLCARDrowLength(); 1460 adjustLengths(length); 1461 parseFastSQLDTARDdata(netCursor); 1462 return netSqlca; 1463 } 1464 1465 void parseFastSQLDTARDdata(NetCursor netCursor) throws DisconnectException { 1466 netCursor.dataBufferStream_ = getFastData(netCursor.dataBufferStream_); 1467 netCursor.dataBuffer_ = netCursor.dataBufferStream_.toByteArray(); 1468 netCursor.lastValidBytePosition_ = netCursor.dataBuffer_.length; 1469 } 1470 1471 void parseSQLDTARDdata(NetCursor netCursor) throws DisconnectException { 1472 if (longValueForDecryption_ == null) { 1473 netCursor.dataBufferStream_ = getData(netCursor.dataBufferStream_); 1474 netCursor.dataBuffer_ = netCursor.dataBufferStream_.toByteArray(); 1475 } else { 1476 int size = netCursor.dataBufferStream_.size(); 1477 if (size == 0) { 1478 netCursor.dataBuffer_ = longValueForDecryption_; 1479 } else { 1481 byte[] newArray = new byte[size + longValueForDecryption_.length]; 1482 System.arraycopy(netCursor.dataBuffer_, 0, newArray, 0, size); 1483 System.arraycopy(longValueForDecryption_, 0, newArray, size, longValueForDecryption_.length); 1484 netCursor.dataBuffer_ = newArray; 1485 } 1487 } 1488 1489 netCursor.lastValidBytePosition_ = netCursor.dataBuffer_.length; 1490 } 1491 1492 protected void copyEXTDTA(NetCursor netCursor) throws DisconnectException { 1493 try { 1494 parseLengthAndMatchCodePoint(CodePoint.EXTDTA); 1495 byte[] data = null; 1496 if (longValueForDecryption_ == null) { 1497 data = (getData(null)).toByteArray(); 1498 } else { 1499 data = longValueForDecryption_; 1500 dssLength_ = 0; 1501 longValueForDecryption_ = null; 1502 } 1503 netCursor.extdtaData_.add(data); 1504 } catch (java.lang.OutOfMemoryError e) { 1505 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1506 new ClientMessageId(SQLState.NET_LOB_DATA_TOO_LARGE_FOR_JVM), null, e)); 1507 } 1508 } 1509 1510 1512 protected Object parsePKGNAMCSN(boolean skip) throws DisconnectException { 1520 parseLengthAndMatchCodePoint(CodePoint.PKGNAMCSN); 1521 if (skip) { 1522 skipBytes(); 1523 return null; 1524 } 1525 1526 String rdbnam = null; 1528 String rdbcolid = null; 1529 String pkgid = null; 1530 byte[] pkgcnstkn = null; 1531 1532 int pkgsn = 0; 1533 byte[] pkgnamcsnBytes = null; 1534 int pkgnamcsnLength = 0; 1535 1536 int ddmLength = getDdmLength(); 1537 int offset = 0; 1538 1539 ensureBLayerDataInBuffer(ddmLength); 1540 1541 if (ddmLength == 64) { 1542 pkgnamcsnLength = ddmLength - 2; 1544 pkgnamcsnBytes = new byte[pkgnamcsnLength]; 1546 offset = peekFastBytes(pkgnamcsnBytes, offset, pkgnamcsnLength); 1548 1549 rdbnam = readFastString(18); rdbcolid = readFastString(18); pkgid = readFastString(18); pkgcnstkn = readFastBytes(8); } else if ((ddmLength >= 71) && (ddmLength <= 781)) { 1555 1557 pkgnamcsnBytes = new byte[ddmLength - 2]; 1559 1560 int scldtaLen = peekFastLength(); 1562 if (scldtaLen < 18 || scldtaLen > 255) { 1563 agent_.accumulateChainBreakingReadExceptionAndThrow( 1564 new DisconnectException(agent_, 1565 new ClientMessageId( 1566 SQLState.NET_SQLCDTA_INVALID_FOR_RDBNAM), 1567 new Integer (scldtaLen))); 1568 return null; 1569 } 1570 offset = peekFastBytes(pkgnamcsnBytes, offset, 2 + scldtaLen); 1573 skipFastBytes(2); 1574 rdbnam = readFastString(scldtaLen); 1575 1576 scldtaLen = peekFastLength(); 1578 if (scldtaLen < 18 || scldtaLen > 255) { 1579 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1580 new ClientMessageId(SQLState.NET_SQLCDTA_INVALID_FOR_RDBCOLID), 1581 new Integer (scldtaLen))); 1582 return null; 1583 } 1584 offset = peekFastBytes(pkgnamcsnBytes, offset, 2 + scldtaLen); 1586 skipFastBytes(2); 1587 rdbcolid = readFastString(scldtaLen); 1588 1589 scldtaLen = peekFastLength(); 1591 if (scldtaLen < 18 || scldtaLen > 255) { 1592 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1593 new ClientMessageId(SQLState.NET_SQLCDTA_INVALID_FOR_PKGID), 1594 new Integer (scldtaLen))); 1595 return null; } 1597 offset = peekFastBytes(pkgnamcsnBytes, offset, 2 + scldtaLen); 1599 skipFastBytes(2); 1600 pkgid = readFastString(scldtaLen); 1601 1602 offset = peekFastBytes(pkgnamcsnBytes, offset, 8); 1604 pkgcnstkn = readFastBytes(8); 1605 1606 } else { 1607 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 1608 new ClientMessageId(SQLState.NET_PGNAMCSN_INVALID_AT_SQLAM), 1609 new Integer (ddmLength), new Integer (netAgent_.targetSqlam_))); 1610 return null; } 1612 1613 pkgsn = readFastUnsignedShort(); adjustLengths(ddmLength); 1615 Section section = new Section(this.agent_, pkgid, pkgsn, null, -1, true); 1618 section.setPKGNAMCBytes(pkgnamcsnBytes); 1619 return section; 1620 } 1621 1622 protected int parseQRYPRCTYP() throws DisconnectException { 1625 parseLengthAndMatchCodePoint(CodePoint.QRYPRCTYP); 1626 int qryprctyp = parseCODPNTDR(); 1627 if ((qryprctyp != CodePoint.FIXROWPRC) && (qryprctyp != CodePoint.LMTBLKPRC)) { 1628 doValnsprmSemantics(CodePoint.QRYPRCTYP, qryprctyp); 1629 } 1630 return qryprctyp; 1631 } 1632 1633 protected int parseFastQRYPRCTYP() throws DisconnectException { 1634 matchCodePoint(CodePoint.QRYPRCTYP); 1635 int qryprctyp = readFastUnsignedShort(); 1636 if ((qryprctyp != CodePoint.FIXROWPRC) && (qryprctyp != CodePoint.LMTBLKPRC)) { 1637 doValnsprmSemantics(CodePoint.QRYPRCTYP, qryprctyp); 1638 } 1639 return qryprctyp; 1640 } 1641 1642 protected int parseSQLCSRHLD() throws DisconnectException { 1650 parseLengthAndMatchCodePoint(CodePoint.SQLCSRHLD); 1651 int sqlcsrhld = readUnsignedByte(); 1652 if ((sqlcsrhld != 0xF0) && (sqlcsrhld != 0xF1)) { 1654 doValnsprmSemantics(CodePoint.SQLCSRHLD, sqlcsrhld); 1655 } 1656 return sqlcsrhld; 1657 } 1658 1659 protected int parseFastSQLCSRHLD() throws DisconnectException { 1660 matchCodePoint(CodePoint.SQLCSRHLD); 1661 int sqlcsrhld = readFastUnsignedByte(); 1662 if ((sqlcsrhld != 0xF0) && (sqlcsrhld != 0xF1)) { 1664 doValnsprmSemantics(CodePoint.SQLCSRHLD, sqlcsrhld); 1665 } 1666 return sqlcsrhld; 1667 } 1668 1669 protected int parseQRYATTSCR() throws DisconnectException { 1672 parseLengthAndMatchCodePoint(CodePoint.QRYATTSCR); 1673 int qryattscr = readUnsignedByte(); if ((qryattscr != 0xF0) && (qryattscr != 0xF1)) { 1675 doValnsprmSemantics(CodePoint.QRYATTSCR, qryattscr); 1676 } 1677 return qryattscr; 1678 } 1679 1680 protected int parseFastQRYATTSCR() throws DisconnectException { 1681 matchCodePoint(CodePoint.QRYATTSCR); 1682 int qryattscr = readFastUnsignedByte(); if ((qryattscr != 0xF0) && (qryattscr != 0xF1)) { 1684 doValnsprmSemantics(CodePoint.QRYATTSCR, qryattscr); 1685 } 1686 return qryattscr; 1687 } 1688 1689 protected int parseQRYATTSET() throws DisconnectException { 1691 parseLengthAndMatchCodePoint(CodePoint.QRYATTSET); 1692 int qryattset = readUnsignedByte(); if ((qryattset != 0xF0) && (qryattset != 0xF1)) { 1694 doValnsprmSemantics(CodePoint.QRYATTSET, qryattset); 1695 } 1696 return qryattset; 1697 } 1698 1699 protected int parseFastQRYATTSET() throws DisconnectException { 1700 matchCodePoint(CodePoint.QRYATTSET); 1701 int qryattset = readFastUnsignedByte(); if ((qryattset != 0xF0) && (qryattset != 0xF1)) { 1703 doValnsprmSemantics(CodePoint.QRYATTSET, qryattset); 1704 } 1705 return qryattset; 1706 } 1707 1708 protected int parseQRYATTSNS() throws DisconnectException { 1712 parseLengthAndMatchCodePoint(CodePoint.QRYATTSNS); 1713 int qryattsns = readUnsignedByte(); 1714 switch (qryattsns) { 1715 case CodePoint.QRYUNK: 1716 case CodePoint.QRYINS: 1717 break; 1718 default: 1719 doValnsprmSemantics(CodePoint.QRYATTSNS, qryattsns); 1720 break; 1721 } 1722 return qryattsns; 1723 } 1724 1725 protected int parseFastQRYATTSNS() throws DisconnectException { 1726 matchCodePoint(CodePoint.QRYATTSNS); 1727 int qryattsns = readFastUnsignedByte(); 1728 switch (qryattsns) { 1729 case CodePoint.QRYUNK: 1730 case CodePoint.QRYSNSSTC: 1731 case CodePoint.QRYINS: 1732 break; 1733 default: 1734 doValnsprmSemantics(CodePoint.QRYATTSNS, qryattsns); 1735 break; 1736 } 1737 return qryattsns; 1738 } 1739 1740 protected int parseQRYATTUPD() throws DisconnectException { 1743 parseLengthAndMatchCodePoint(CodePoint.QRYATTUPD); 1744 int qryattupd = readUnsignedByte(); 1745 switch (qryattupd) { 1746 case CodePoint.QRYUNK: 1747 case CodePoint.QRYRDO: 1748 case CodePoint.QRYUPD: 1749 break; 1750 default: 1751 doValnsprmSemantics(CodePoint.QRYATTUPD, qryattupd); 1752 break; 1753 } 1754 return qryattupd; 1755 } 1756 1757 protected int parseFastQRYATTUPD() throws DisconnectException { 1758 matchCodePoint(CodePoint.QRYATTUPD); 1759 int qryattupd = readFastUnsignedByte(); 1760 switch (qryattupd) { 1761 case CodePoint.QRYUNK: 1762 case CodePoint.QRYRDO: 1763 case CodePoint.QRYUPD: 1764 break; 1765 default: 1766 doValnsprmSemantics(CodePoint.QRYATTUPD, qryattupd); 1767 break; 1768 } 1769 return qryattupd; 1770 } 1771 1772 1773 private long parseFastQRYINSID() throws DisconnectException { 1774 matchCodePoint(CodePoint.QRYINSID); 1775 return readFastLong(); 1776 } 1777 1778 1779 protected java.util.ArrayList parsePKGSNLST() throws DisconnectException { 1783 Object pkgnamcsn = null; 1784 java.util.ArrayList pkgsnlst = new java.util.ArrayList (); 1786 parseLengthAndMatchCodePoint(CodePoint.PKGSNLST); 1787 pushLengthOnCollectionStack(); 1788 while (peekCodePoint() != Reply.END_OF_COLLECTION) { 1789 pkgnamcsn = parsePKGNAMCSN(false); 1790 pkgsnlst.add(pkgnamcsn); 1791 } 1792 popCollectionStack(); 1793 return pkgsnlst; 1794 } 1795 1796 protected NetSqlca parseSQLDARD(ColumnMetaData columnMetaData, 1797 boolean skipBytes) throws DisconnectException { 1798 parseLengthAndMatchCodePoint(CodePoint.SQLDARD); 1799 return parseSQLDARDarray(columnMetaData, skipBytes); 1800 } 1801 1802 protected int parseSQLRSLRD(java.util.ArrayList sectionAL) throws DisconnectException { 1803 parseLengthAndMatchCodePoint(CodePoint.SQLRSLRD); 1804 return parseSQLRSLRDarray(sectionAL); 1805 } 1806 1807 protected ColumnMetaData parseSQLCINRD() throws DisconnectException { 1808 parseLengthAndMatchCodePoint(CodePoint.SQLCINRD); 1809 int ddmLength = getDdmLength(); 1810 ensureBLayerDataInBuffer(ddmLength); 1811 ColumnMetaData cm = parseSQLCINRDarray(); 1812 adjustLengths(getDdmLength()); 1813 return cm; 1814 } 1815 1816 1817 1819 NetSqlca parseSQLDARDarray(ColumnMetaData columnMetaData, 1833 boolean skipBytes) throws DisconnectException { 1834 int ddmLength = 0; 1835 if (!ensuredLengthForDecryption_ && longValueForDecryption_ == null) { ddmLength = getDdmLength(); 1837 ensureBLayerDataInBuffer(ddmLength); 1838 1839 } 1840 if (longValueForDecryption_ != null) { 1841 buffer_ = longValueForDecryption_; 1842 pos_ = 0; 1843 count_ = longValueForDecryption_.length; 1844 } 1846 1847 1848 NetSqlca netSqlca = null; 1849 if (skipBytes) { 1850 mark(); 1851 netSqlca = parseSQLCARDrow(null); 1852 skipFastBytes(ddmLength - getFastSkipSQLCARDrowLength()); 1853 adjustLengths(getDdmLength()); 1854 return netSqlca; 1855 } else { 1856 netSqlca = parseSQLCARDrow(null); 1857 } 1858 1859 parseSQLDHROW(columnMetaData); 1860 1861 int columns = parseSQLNUMROW(); 1862 if (columns > columnMetaData.columns_) { 1865 columnMetaData.initializeCache(columns); 1866 } else { 1868 columnMetaData.columns_ = columns; 1869 } 1870 1871 1876 for (int i = 0; i < columnMetaData.columns_; i++) { 1877 parseSQLDAROW(columnMetaData, i); 1878 } 1879 1880 if (longValueForDecryption_ == null) { 1881 adjustLengths(getDdmLength()); 1882 } else { 1883 dssLength_ = 0; 1884 longValueForDecryption_ = null; 1885 } 1886 1887 1888 return netSqlca; 1889 } 1890 1891 1892 int parseSQLRSLRDarray(java.util.ArrayList sectionAL) throws DisconnectException { 1903 int numOfResultSets = parseSQLNUMROW(); 1904 for (int i = 0; i < numOfResultSets; i++) { 1905 parseSQLRSROW((Section) sectionAL.get(i)); 1906 } 1907 return numOfResultSets; 1908 } 1909 1910 ColumnMetaData parseSQLCINRDarray() throws DisconnectException { 1927 ColumnMetaData columnMetaData = ClientDriver.getFactory().newColumnMetaData(netAgent_.logWriter_); 1928 1929 parseSQLDHROW(columnMetaData); 1930 1931 columnMetaData.initializeCache(parseFastSQLNUMROW()); 1934 1935 for (int i = 0; i < columnMetaData.columns_; i++) { 1940 parseSQLDAROW(columnMetaData, i); 1941 } 1942 1943 return columnMetaData; 1944 } 1945 1946 private void parseSQLDAROW(ColumnMetaData columnMetaData, 1952 int columnNumber) throws DisconnectException { 1953 parseSQLDAGRP(columnMetaData, columnNumber); 1954 } 1955 1956 private void parseSQLDHROW(ColumnMetaData columnMetaData) throws DisconnectException { 1962 parseSQLDHGRP(columnMetaData); 1963 } 1964 1965 private void parseSQLRSROW(Section section) throws DisconnectException { 1971 parseSQLRSGRP(section); 1972 } 1973 1974 1975 1979 private void parseSQLDAGRP(ColumnMetaData columnMetaData, 2017 int columnNumber) throws DisconnectException { 2018 long columnLength = 0; 2019 2020 int precision = readFastShort(); 2022 2023 int scale = readFastShort(); 2025 2026 columnLength = readFastLong(); 2028 2029 int sqlType = readFastShort(); 2032 2033 int ccsid = readFastUnsignedShort(); 2040 2041 columnMetaData.sqlPrecision_[columnNumber] = precision; 2042 columnMetaData.sqlScale_[columnNumber] = scale; 2043 columnMetaData.sqlLength_[columnNumber] = columnLength; 2044 columnMetaData.sqlType_[columnNumber] = sqlType; 2045 columnMetaData.nullable_[columnNumber] = Utils.isSqlTypeNullable(sqlType); 2047 columnMetaData.sqlCcsid_[columnNumber] = ccsid; 2048 columnMetaData.types_[columnNumber] = 2049 Types.mapDERBYTypeToDriverType(true, sqlType, columnLength, ccsid); parseSQLDOPTGRP(columnMetaData, columnNumber); 2051 } 2052 2053 private void parseSQLUDTGRP(ColumnMetaData columnMetaData, 2064 int columnNumber) throws DisconnectException { 2065 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2066 return; 2067 } 2068 2069 } 2070 2071 private void parseSQLDOPTGRP(ColumnMetaData columnMetaData, 2085 int columnNumber) throws DisconnectException { 2086 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2087 return; 2088 } 2089 2090 short sqlunnamed = readFastShort(); 2092 2093 String name = parseFastVCMorVCS(); 2096 2097 String label = parseFastVCMorVCS(); 2100 2101 String colComments = parseFastVCMorVCS(); 2104 2105 if (columnMetaData.sqlName_ == null) { 2106 columnMetaData.sqlName_ = new String [columnMetaData.columns_]; 2107 } 2108 if (columnMetaData.sqlLabel_ == null) { 2109 columnMetaData.sqlLabel_ = new String [columnMetaData.columns_]; 2110 } 2111 if (columnMetaData.sqlUnnamed_ == null) { 2112 columnMetaData.sqlUnnamed_ = new short[columnMetaData.columns_]; 2113 } 2114 if (columnMetaData.sqlComment_ == null) { 2115 columnMetaData.sqlComment_ = new String [columnMetaData.columns_]; 2116 } 2117 columnMetaData.sqlName_[columnNumber] = name; 2118 columnMetaData.sqlLabel_[columnNumber] = label; 2119 columnMetaData.sqlUnnamed_[columnNumber] = sqlunnamed; 2120 columnMetaData.sqlComment_[columnNumber] = colComments; 2121 2122 2124 parseSQLUDTGRP(columnMetaData, columnNumber); 2125 parseSQLDXGRP(columnMetaData, columnNumber); 2126 } 2127 2128 private void parseSQLDXGRP(ColumnMetaData columnMetaData, 2146 int column) throws DisconnectException { 2147 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2148 return; 2149 } 2150 2151 2152 short sqlxkeymem = readFastShort(); 2154 2155 short sqlxupdateable = readFastShort(); 2157 2158 short sqlxgenerated = readFastShort(); 2160 2161 short sqlxparmmode = readFastShort(); 2163 2164 String sqlxrdbnam = parseFastVCS(); 2166 2167 String sqlxcorname = parseFastVCMorVCS(); 2170 2171 String sqlxbasename = parseFastVCMorVCS(); 2174 2175 String sqlxschema = parseFastVCMorVCS(); 2178 2179 String sqlxname = parseFastVCMorVCS(); 2182 2183 if (columnMetaData.sqlxKeymem_ == null) { 2184 columnMetaData.sqlxKeymem_ = new short[columnMetaData.columns_]; 2185 } 2186 if (columnMetaData.sqlxGenerated_ == null) { 2187 columnMetaData.sqlxGenerated_ = new short[columnMetaData.columns_]; 2188 } 2189 if (columnMetaData.sqlxParmmode_ == null) { 2190 columnMetaData.sqlxParmmode_ = new short[columnMetaData.columns_]; 2191 } 2192 if (columnMetaData.sqlxCorname_ == null) { 2193 columnMetaData.sqlxCorname_ = new String [columnMetaData.columns_]; 2194 } 2195 if (columnMetaData.sqlxName_ == null) { 2196 columnMetaData.sqlxName_ = new String [columnMetaData.columns_]; 2197 } 2198 if (columnMetaData.sqlxBasename_ == null) { 2199 columnMetaData.sqlxBasename_ = new String [columnMetaData.columns_]; 2200 } 2201 if (columnMetaData.sqlxUpdatable_ == null) { 2202 columnMetaData.sqlxUpdatable_ = new int[columnMetaData.columns_]; 2203 } 2204 if (columnMetaData.sqlxSchema_ == null) { 2205 columnMetaData.sqlxSchema_ = new String [columnMetaData.columns_]; 2206 } 2207 if (columnMetaData.sqlxRdbnam_ == null) { 2208 columnMetaData.sqlxRdbnam_ = new String [columnMetaData.columns_]; 2209 } 2210 2211 columnMetaData.sqlxKeymem_[column] = sqlxkeymem; 2212 columnMetaData.sqlxGenerated_[column] = sqlxgenerated; 2213 columnMetaData.sqlxParmmode_[column] = sqlxparmmode; 2214 columnMetaData.sqlxCorname_[column] = sqlxcorname; 2215 columnMetaData.sqlxName_[column] = sqlxname; 2216 columnMetaData.sqlxBasename_[column] = sqlxbasename; 2217 columnMetaData.sqlxUpdatable_[column] = sqlxupdateable; 2218 columnMetaData.sqlxSchema_[column] = (sqlxschema == null) ? columnMetaData.sqldSchema_ : sqlxschema; 2219 columnMetaData.sqlxRdbnam_[column] = (sqlxrdbnam == null) ? columnMetaData.sqldRdbnam_ : sqlxrdbnam; 2220 } 2221 2222 private void parseSQLDHGRP(ColumnMetaData columnMetaData) throws DisconnectException { 2236 if (readFastUnsignedByte() == CodePoint.NULLDATA) { 2237 return; 2238 } 2239 2240 2241 short sqldhold = readFastShort(); 2243 2244 short sqldreturn = readFastShort(); 2246 2247 short sqldscroll = readFastShort(); 2249 2250 short sqldsensitive = readFastShort(); 2252 2253 short sqldfcode = readFastShort(); 2255 2256 short sqldkeytype = readFastShort(); 2258 2259 String sqldrdbnam = parseFastVCS(); 2261 2262 String sqldschema = parseFastVCMorVCS(); 2265 2266 columnMetaData.sqldHold_ = sqldhold; 2267 columnMetaData.sqldReturn_ = sqldreturn; 2268 columnMetaData.sqldScroll_ = sqldscroll; 2269 columnMetaData.sqldSensitive_ = sqldsensitive; 2270 columnMetaData.sqldFcode_ = sqldfcode; 2271 columnMetaData.sqldKeytype_ = sqldkeytype; 2272 columnMetaData.sqldRdbnam_ = sqldrdbnam; 2273 columnMetaData.sqldSchema_ = sqldschema; 2274 } 2275 2276 private void parseSQLRSGRP(Section section) throws DisconnectException { 2285 2286 int rsLocator = readInt(); 2287 String rsName = parseVCMorVCS(); int rsNumRows = readInt(); 2289 section.setCursorName(rsName); 2291 } 2292 2293 2294 private String parseFastVCMorVCS() throws DisconnectException { 2298 String stringToBeSet = null; 2299 2300 int vcm_length = readFastUnsignedShort(); 2301 if (vcm_length > 0) { 2302 stringToBeSet = readFastString(vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding()); 2303 } 2304 int vcs_length = readFastUnsignedShort(); 2305 if (vcm_length > 0 && vcs_length > 0) { 2306 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2307 new ClientMessageId(SQLState.NET_VCM_VCS_LENGTHS_INVALID))); 2308 } else if (vcs_length > 0) { 2309 stringToBeSet = readFastString(vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding()); 2310 } 2311 2312 return stringToBeSet; 2313 } 2314 2315 private String parseVCMorVCS() throws DisconnectException { 2316 String stringToBeSet = null; 2317 2318 int vcm_length = readUnsignedShort(); 2319 if (vcm_length > 0) { 2320 stringToBeSet = readString(vcm_length, netAgent_.targetTypdef_.getCcsidMbcEncoding()); 2321 } 2322 int vcs_length = readUnsignedShort(); 2323 if (vcm_length > 0 && vcs_length > 0) { 2324 agent_.accumulateChainBreakingReadExceptionAndThrow(new DisconnectException(agent_, 2325 new ClientMessageId(SQLState.NET_VCM_VCS_LENGTHS_INVALID))); 2326 } else if (vcs_length > 0) { 2327 stringToBeSet = readString(vcs_length, netAgent_.targetTypdef_.getCcsidSbcEncoding()); 2328 } 2329 2330 return stringToBeSet; 2331 } 2332 2333 private int calculateResultSetType(int qryattscr, int qryattsns, int defaultType) { 2335 2339 if (qryattscr == 0xF0) { 2340 return java.sql.ResultSet.TYPE_FORWARD_ONLY; 2341 } 2342 2343 switch (qryattsns) { 2344 case CodePoint.QRYINS: 2345 return java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE; 2346 default: 2347 return defaultType; 2348 } 2349 } 2350 2351 private int calculateResultSetConcurrency(int qryattupd, int defaultConcurrency) { 2352 switch (qryattupd) { 2356 case CodePoint.QRYRDO: 2357 return java.sql.ResultSet.CONCUR_READ_ONLY; 2358 case CodePoint.QRYUPD: 2359 return java.sql.ResultSet.CONCUR_UPDATABLE; 2360 default: 2361 return defaultConcurrency; 2362 } 2363 } 2364 2365 private int calculateResultSetHoldability(int sqlcsrhld) { 2366 if (sqlcsrhld == 0xF0) { 2367 return JDBC30Translation.CLOSE_CURSORS_AT_COMMIT; 2368 } else { 2369 return JDBC30Translation.HOLD_CURSORS_OVER_COMMIT; 2370 } 2371 } 2372 2373 private int parseSQLDTAGRPdataLabelsAndUpdateColumn(NetCursor cursor, int columnIndex, int tripletLength) 2374 throws DisconnectException { 2375 int numColumns = (tripletLength - 3) / 3; 2376 for (int i = columnIndex; i < columnIndex + numColumns; i++) { 2377 cursor.qrydscTypdef_.updateColumn(cursor, i, readFastUnsignedByte(), readFastUnsignedShort()); 2378 } 2379 return numColumns; 2380 } 2381 2382 2383 private String parseSQLSTT() throws DisconnectException { 2384 parseLengthAndMatchCodePoint(CodePoint.SQLSTT); 2385 return parseSQLSTTGRP(); 2386 } 2387 2388 private String parseSQLSTTGRP() throws DisconnectException { 2389 int mixedNullInd = readUnsignedByte(); 2390 int singleNullInd = 0; 2391 String sqlsttString = null; 2392 int stringLength = 0; 2393 2394 if (mixedNullInd == CodePoint.NULLDATA) { 2395 singleNullInd = readUnsignedByte(); 2396 if (singleNullInd == CodePoint.NULLDATA) { 2397 doDtamchrmSemantics(); 2399 } 2400 stringLength = readInt(); 2402 sqlsttString = readString(stringLength, netAgent_.targetTypdef_.getCcsidSbcEncoding()); 2404 } else { 2405 stringLength = readInt(); 2407 sqlsttString = readString(stringLength, netAgent_.targetTypdef_.getCcsidMbcEncoding()); 2409 singleNullInd = readUnsignedByte(); 2411 } 2412 return sqlsttString; 2413 } 2414 2415 public void readSetSpecialRegister(StatementCallbackInterface statement) throws DisconnectException { 2416 startSameIdChainParse(); 2417 parseEXCSQLSETreply(statement); 2418 endOfSameIdChainData(); 2419 } 2420} 2421 2422 2423 2424 2425 | Popular Tags |