1 21 22 package org.apache.derby.impl.sql.execute; 23 24 import org.apache.derby.iapi.reference.SQLState; 25 26 import org.apache.derby.iapi.error.StandardException; 27 28 import org.apache.derby.iapi.sql.ResultSet; 29 import org.apache.derby.iapi.sql.ResultDescription; 30 import org.apache.derby.iapi.sql.Activation; 31 32 import org.apache.derby.iapi.sql.execute.ConstantAction; 33 import org.apache.derby.iapi.sql.execute.ExecutionContext; 34 import org.apache.derby.iapi.sql.execute.NoPutResultSet; 35 36 import org.apache.derby.iapi.sql.execute.ResultSetFactory; 37 38 import org.apache.derby.iapi.sql.Activation; 39 40 import org.apache.derby.iapi.services.sanity.SanityManager; 41 42 import org.apache.derby.iapi.services.loader.GeneratedMethod; 43 44 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 45 import org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor; 46 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor; 47 48 import org.apache.derby.iapi.store.access.Qualifier; 49 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo; 50 51 import org.apache.derby.iapi.sql.conn.Authorizer; 52 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 53 54 import java.util.Properties ; 55 76 public class GenericResultSetFactory implements ResultSetFactory 77 { 78 public GenericResultSetFactory() 82 { 83 } 84 85 89 public ResultSet getInsertResultSet(NoPutResultSet source, 90 GeneratedMethod checkGM) 91 throws StandardException 92 { 93 Activation activation = source.getActivation(); 94 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 95 return new InsertResultSet(source, checkGM, activation ); 96 } 97 98 102 public ResultSet getInsertVTIResultSet(NoPutResultSet source, 103 NoPutResultSet vtiRS 104 ) 105 throws StandardException 106 { 107 Activation activation = source.getActivation(); 108 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 109 return new InsertVTIResultSet(source, vtiRS, activation ); 110 } 111 112 116 public ResultSet getDeleteVTIResultSet(NoPutResultSet source) 117 throws StandardException 118 { 119 Activation activation = source.getActivation(); 120 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 121 return new DeleteVTIResultSet(source, activation); 122 } 123 124 128 public ResultSet getDeleteResultSet(NoPutResultSet source) 129 throws StandardException 130 { 131 Activation activation = source.getActivation(); 132 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 133 return new DeleteResultSet(source, activation ); 134 } 135 136 137 141 public ResultSet getDeleteCascadeResultSet(NoPutResultSet source, 142 int constantActionItem, 143 ResultSet[] dependentResultSets, 144 String resultSetId) 145 throws StandardException 146 { 147 Activation activation = source.getActivation(); 148 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 149 return new DeleteCascadeResultSet(source, activation, 150 constantActionItem, 151 dependentResultSets, 152 resultSetId); 153 } 154 155 156 157 161 public ResultSet getUpdateResultSet(NoPutResultSet source, 162 GeneratedMethod checkGM) 163 throws StandardException 164 { 165 Activation activation = source.getActivation(); 166 if (SanityManager.DEBUG) 174 { 175 SanityManager.ASSERT(getAuthorizer(activation) != null, "Authorizer is null"); 176 } 177 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 178 return new UpdateResultSet(source, checkGM, activation); 179 } 180 181 185 public ResultSet getUpdateVTIResultSet(NoPutResultSet source) 186 throws StandardException 187 { 188 Activation activation = source.getActivation(); 189 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 190 return new UpdateVTIResultSet(source, activation); 191 } 192 193 194 195 199 public ResultSet getDeleteCascadeUpdateResultSet(NoPutResultSet source, 200 GeneratedMethod checkGM, 201 int constantActionItem, 202 int rsdItem) 203 throws StandardException 204 { 205 Activation activation = source.getActivation(); 206 getAuthorizer(activation).authorize(activation, Authorizer.SQL_WRITE_OP); 207 return new UpdateResultSet(source, checkGM, activation, 208 constantActionItem, rsdItem); 209 } 210 211 212 216 public ResultSet getCallStatementResultSet(GeneratedMethod methodCall, 217 Activation activation) 218 throws StandardException 219 { 220 getAuthorizer(activation).authorize(activation, Authorizer.SQL_CALL_OP); 221 return new CallStatementResultSet(methodCall, activation); 222 } 223 224 228 public NoPutResultSet getProjectRestrictResultSet(NoPutResultSet source, 229 GeneratedMethod restriction, 230 GeneratedMethod projection, int resultSetNumber, 231 GeneratedMethod constantRestriction, 232 int mapRefItem, 233 boolean reuseResult, 234 boolean doesProjection, 235 double optimizerEstimatedRowCount, 236 double optimizerEstimatedCost) 237 throws StandardException 238 { 239 return new ProjectRestrictResultSet(source, source.getActivation(), 240 restriction, projection, resultSetNumber, 241 constantRestriction, mapRefItem, 242 reuseResult, 243 doesProjection, 244 optimizerEstimatedRowCount, 245 optimizerEstimatedCost); 246 } 247 248 252 public NoPutResultSet getHashTableResultSet(NoPutResultSet source, 253 GeneratedMethod singleTableRestriction, 254 Qualifier[][] equijoinQualifiers, 255 GeneratedMethod projection, int resultSetNumber, 256 int mapRefItem, 257 boolean reuseResult, 258 int keyColItem, 259 boolean removeDuplicates, 260 long maxInMemoryRowCount, 261 int initialCapacity, 262 float loadFactor, 263 double optimizerEstimatedRowCount, 264 double optimizerEstimatedCost) 265 throws StandardException 266 { 267 return new HashTableResultSet(source, source.getActivation(), 268 singleTableRestriction, 269 equijoinQualifiers, 270 projection, resultSetNumber, 271 mapRefItem, 272 reuseResult, 273 keyColItem, removeDuplicates, 274 maxInMemoryRowCount, 275 initialCapacity, 276 loadFactor, 277 true, optimizerEstimatedRowCount, 279 optimizerEstimatedCost); 280 } 281 282 286 public NoPutResultSet getSortResultSet(NoPutResultSet source, 287 boolean distinct, 288 boolean isInSortedOrder, 289 int orderItem, 290 GeneratedMethod rowAllocator, 291 int maxRowSize, 292 int resultSetNumber, 293 double optimizerEstimatedRowCount, 294 double optimizerEstimatedCost) 295 throws StandardException 296 { 297 return new SortResultSet(source, 298 distinct, 299 isInSortedOrder, 300 orderItem, 301 source.getActivation(), 302 rowAllocator, 303 maxRowSize, 304 resultSetNumber, 305 optimizerEstimatedRowCount, 306 optimizerEstimatedCost); 307 } 308 309 313 public NoPutResultSet getScalarAggregateResultSet(NoPutResultSet source, 314 boolean isInSortedOrder, 315 int aggregateItem, 316 int orderItem, 317 GeneratedMethod rowAllocator, 318 int maxRowSize, 319 int resultSetNumber, 320 boolean singleInputRow, 321 double optimizerEstimatedRowCount, 322 double optimizerEstimatedCost) 323 throws StandardException 324 { 325 return new ScalarAggregateResultSet( 326 source, isInSortedOrder, aggregateItem, source.getActivation(), 327 rowAllocator, resultSetNumber, singleInputRow, 328 optimizerEstimatedRowCount, 329 optimizerEstimatedCost); 330 } 331 332 336 public NoPutResultSet getDistinctScalarAggregateResultSet(NoPutResultSet source, 337 boolean isInSortedOrder, 338 int aggregateItem, 339 int orderItem, 340 GeneratedMethod rowAllocator, 341 int maxRowSize, 342 int resultSetNumber, 343 boolean singleInputRow, 344 double optimizerEstimatedRowCount, 345 double optimizerEstimatedCost) 346 throws StandardException 347 { 348 return new DistinctScalarAggregateResultSet( 349 source, isInSortedOrder, aggregateItem, orderItem, source.getActivation(), 350 rowAllocator, maxRowSize, resultSetNumber, singleInputRow, 351 optimizerEstimatedRowCount, 352 optimizerEstimatedCost); 353 } 354 355 359 public NoPutResultSet getGroupedAggregateResultSet(NoPutResultSet source, 360 boolean isInSortedOrder, 361 int aggregateItem, 362 int orderItem, 363 GeneratedMethod rowAllocator, 364 int maxRowSize, 365 int resultSetNumber, 366 double optimizerEstimatedRowCount, 367 double optimizerEstimatedCost) 368 throws StandardException 369 { 370 return new GroupedAggregateResultSet( 371 source, isInSortedOrder, aggregateItem, orderItem, source.getActivation(), 372 rowAllocator, maxRowSize, resultSetNumber, optimizerEstimatedRowCount, 373 optimizerEstimatedCost); 374 } 375 376 380 public NoPutResultSet getDistinctGroupedAggregateResultSet(NoPutResultSet source, 381 boolean isInSortedOrder, 382 int aggregateItem, 383 int orderItem, 384 GeneratedMethod rowAllocator, 385 int maxRowSize, 386 int resultSetNumber, 387 double optimizerEstimatedRowCount, 388 double optimizerEstimatedCost) 389 throws StandardException 390 { 391 return new DistinctGroupedAggregateResultSet( 392 source, isInSortedOrder, aggregateItem, orderItem, source.getActivation(), 393 rowAllocator, maxRowSize, resultSetNumber, optimizerEstimatedRowCount, 394 optimizerEstimatedCost); 395 } 396 397 398 402 public NoPutResultSet getAnyResultSet(NoPutResultSet source, 403 GeneratedMethod emptyRowFun, int resultSetNumber, 404 int subqueryNumber, int pointOfAttachment, 405 double optimizerEstimatedRowCount, 406 double optimizerEstimatedCost) 407 throws StandardException 408 { 409 return new AnyResultSet(source, 410 source.getActivation(), emptyRowFun, resultSetNumber, 411 subqueryNumber, pointOfAttachment, 412 optimizerEstimatedRowCount, 413 optimizerEstimatedCost); 414 } 415 416 420 public NoPutResultSet getOnceResultSet(NoPutResultSet source, 421 GeneratedMethod emptyRowFun, 422 int cardinalityCheck, int resultSetNumber, 423 int subqueryNumber, int pointOfAttachment, 424 double optimizerEstimatedRowCount, 425 double optimizerEstimatedCost) 426 throws StandardException 427 { 428 return new OnceResultSet(source, 429 source.getActivation(), emptyRowFun, 430 cardinalityCheck, resultSetNumber, 431 subqueryNumber, pointOfAttachment, 432 optimizerEstimatedRowCount, 433 optimizerEstimatedCost); 434 } 435 436 439 public NoPutResultSet getRowResultSet(Activation activation, GeneratedMethod row, 440 boolean canCacheRow, 441 int resultSetNumber, 442 double optimizerEstimatedRowCount, 443 double optimizerEstimatedCost) 444 { 445 return new RowResultSet(activation, row, canCacheRow, resultSetNumber, 446 optimizerEstimatedRowCount, 447 optimizerEstimatedCost); 448 } 449 450 454 public NoPutResultSet getVTIResultSet(Activation activation, GeneratedMethod row, 455 int resultSetNumber, 456 GeneratedMethod constructor, 457 String javaClassName, 458 Qualifier[][] pushedQualifiers, 459 int erdNumber, 460 boolean version2, 461 boolean reuseablePs, 462 int ctcNumber, 463 boolean isTarget, 464 int scanIsolationLevel, 465 double optimizerEstimatedRowCount, 466 double optimizerEstimatedCost) 467 throws StandardException 468 { 469 return new VTIResultSet(activation, row, resultSetNumber, 470 constructor, 471 javaClassName, 472 pushedQualifiers, 473 erdNumber, 474 version2, reuseablePs, 475 ctcNumber, 476 isTarget, 477 scanIsolationLevel, 478 optimizerEstimatedRowCount, 479 optimizerEstimatedCost); 480 } 481 482 487 public NoPutResultSet getHashScanResultSet( 488 Activation activation, 489 long conglomId, 490 int scociItem, 491 GeneratedMethod resultRowAllocator, 492 int resultSetNumber, 493 GeneratedMethod startKeyGetter, 494 int startSearchOperator, 495 GeneratedMethod stopKeyGetter, 496 int stopSearchOperator, 497 boolean sameStartStopPosition, 498 Qualifier[][] scanQualifiers, 499 Qualifier[][] nextQualifiers, 500 int initialCapacity, 501 float loadFactor, 502 int maxCapacity, 503 int hashKeyColumn, 504 String tableName, 505 String userSuppliedOptimizerOverrides, 506 String indexName, 507 boolean isConstraint, 508 boolean forUpdate, 509 int colRefItem, 510 int indexColItem, 511 int lockMode, 512 boolean tableLocked, 513 int isolationLevel, 514 double optimizerEstimatedRowCount, 515 double optimizerEstimatedCost) 516 throws StandardException 517 { 518 StaticCompiledOpenConglomInfo scoci = (StaticCompiledOpenConglomInfo)(activation.getPreparedStatement(). 519 getSavedObject(scociItem)); 520 521 return new HashScanResultSet( 522 conglomId, 523 scoci, 524 activation, 525 resultRowAllocator, 526 resultSetNumber, 527 startKeyGetter, 528 startSearchOperator, 529 stopKeyGetter, 530 stopSearchOperator, 531 sameStartStopPosition, 532 scanQualifiers, 533 nextQualifiers, 534 initialCapacity, 535 loadFactor, 536 maxCapacity, 537 hashKeyColumn, 538 tableName, 539 userSuppliedOptimizerOverrides, 540 indexName, 541 isConstraint, 542 forUpdate, 543 colRefItem, 544 lockMode, 545 tableLocked, 546 isolationLevel, 547 true, optimizerEstimatedRowCount, 549 optimizerEstimatedCost); 550 } 551 552 557 public NoPutResultSet getDistinctScanResultSet( 558 Activation activation, 559 long conglomId, 560 int scociItem, 561 GeneratedMethod resultRowAllocator, 562 int resultSetNumber, 563 int hashKeyColumn, 564 String tableName, 565 String userSuppliedOptimizerOverrides, 566 String indexName, 567 boolean isConstraint, 568 int colRefItem, 569 int lockMode, 570 boolean tableLocked, 571 int isolationLevel, 572 double optimizerEstimatedRowCount, 573 double optimizerEstimatedCost) 574 throws StandardException 575 { 576 StaticCompiledOpenConglomInfo scoci = (StaticCompiledOpenConglomInfo)(activation.getPreparedStatement(). 577 getSavedObject(scociItem)); 578 return new DistinctScanResultSet( 579 conglomId, 580 scoci, 581 activation, 582 resultRowAllocator, 583 resultSetNumber, 584 hashKeyColumn, 585 tableName, 586 userSuppliedOptimizerOverrides, 587 indexName, 588 isConstraint, 589 colRefItem, 590 lockMode, 591 tableLocked, 592 isolationLevel, 593 optimizerEstimatedRowCount, 594 optimizerEstimatedCost); 595 } 596 597 602 public NoPutResultSet getTableScanResultSet( 603 Activation activation, 604 long conglomId, 605 int scociItem, 606 GeneratedMethod resultRowAllocator, 607 int resultSetNumber, 608 GeneratedMethod startKeyGetter, 609 int startSearchOperator, 610 GeneratedMethod stopKeyGetter, 611 int stopSearchOperator, 612 boolean sameStartStopPosition, 613 Qualifier[][] qualifiers, 614 String tableName, 615 String userSuppliedOptimizerOverrides, 616 String indexName, 617 boolean isConstraint, 618 boolean forUpdate, 619 int colRefItem, 620 int indexColItem, 621 int lockMode, 622 boolean tableLocked, 623 int isolationLevel, 624 boolean oneRowScan, 625 double optimizerEstimatedRowCount, 626 double optimizerEstimatedCost) 627 throws StandardException 628 { 629 StaticCompiledOpenConglomInfo scoci = (StaticCompiledOpenConglomInfo)(activation.getPreparedStatement(). 630 getSavedObject(scociItem)); 631 return new TableScanResultSet( 632 conglomId, 633 scoci, 634 activation, 635 resultRowAllocator, 636 resultSetNumber, 637 startKeyGetter, 638 startSearchOperator, 639 stopKeyGetter, 640 stopSearchOperator, 641 sameStartStopPosition, 642 qualifiers, 643 tableName, 644 userSuppliedOptimizerOverrides, 645 indexName, 646 isConstraint, 647 forUpdate, 648 colRefItem, 649 indexColItem, 650 lockMode, 651 tableLocked, 652 isolationLevel, 653 1, oneRowScan, 655 optimizerEstimatedRowCount, 656 optimizerEstimatedCost); 657 } 658 659 664 public NoPutResultSet getBulkTableScanResultSet( 665 Activation activation, 666 long conglomId, 667 int scociItem, 668 GeneratedMethod resultRowAllocator, 669 int resultSetNumber, 670 GeneratedMethod startKeyGetter, 671 int startSearchOperator, 672 GeneratedMethod stopKeyGetter, 673 int stopSearchOperator, 674 boolean sameStartStopPosition, 675 Qualifier[][] qualifiers, 676 String tableName, 677 String userSuppliedOptimizerOverrides, 678 String indexName, 679 boolean isConstraint, 680 boolean forUpdate, 681 int colRefItem, 682 int indexColItem, 683 int lockMode, 684 boolean tableLocked, 685 int isolationLevel, 686 int rowsPerRead, 687 boolean oneRowScan, 688 double optimizerEstimatedRowCount, 689 double optimizerEstimatedCost) 690 throws StandardException 691 { 692 699 StaticCompiledOpenConglomInfo scoci = (StaticCompiledOpenConglomInfo)(activation.getPreparedStatement(). 700 getSavedObject(scociItem)); 701 return new BulkTableScanResultSet( 702 conglomId, 703 scoci, 704 activation, 705 resultRowAllocator, 706 resultSetNumber, 707 startKeyGetter, 708 startSearchOperator, 709 stopKeyGetter, 710 stopSearchOperator, 711 sameStartStopPosition, 712 qualifiers, 713 tableName, 714 userSuppliedOptimizerOverrides, 715 indexName, 716 isConstraint, 717 forUpdate, 718 colRefItem, 719 indexColItem, 720 lockMode, 721 tableLocked, 722 isolationLevel, 723 rowsPerRead, 724 oneRowScan, 725 optimizerEstimatedRowCount, 726 optimizerEstimatedCost); 727 } 728 729 733 public NoPutResultSet getIndexRowToBaseRowResultSet( 734 long conglomId, 735 int scociItem, 736 NoPutResultSet source, 737 GeneratedMethod resultRowAllocator, 738 int resultSetNumber, 739 String indexName, 740 int heapColRefItem, 741 int indexColRefItem, 742 int indexColMapItem, 743 GeneratedMethod restriction, 744 boolean forUpdate, 745 double optimizerEstimatedRowCount, 746 double optimizerEstimatedCost) 747 throws StandardException 748 { 749 return new IndexRowToBaseRowResultSet( 750 conglomId, 751 scociItem, 752 source.getActivation(), 753 source, 754 resultRowAllocator, 755 resultSetNumber, 756 indexName, 757 heapColRefItem, 758 indexColRefItem, 759 indexColMapItem, 760 restriction, 761 forUpdate, 762 optimizerEstimatedRowCount, 763 optimizerEstimatedCost); 764 } 765 766 770 771 public NoPutResultSet getNestedLoopJoinResultSet(NoPutResultSet leftResultSet, 772 int leftNumCols, 773 NoPutResultSet rightResultSet, 774 int rightNumCols, 775 GeneratedMethod joinClause, 776 int resultSetNumber, 777 boolean oneRowRightSide, 778 boolean notExistsRightSide, 779 double optimizerEstimatedRowCount, 780 double optimizerEstimatedCost, 781 String userSuppliedOptimizerOverrides) 782 throws StandardException 783 { 784 return new NestedLoopJoinResultSet(leftResultSet, leftNumCols, 785 rightResultSet, rightNumCols, 786 leftResultSet.getActivation(), joinClause, 787 resultSetNumber, 788 oneRowRightSide, 789 notExistsRightSide, 790 optimizerEstimatedRowCount, 791 optimizerEstimatedCost, 792 userSuppliedOptimizerOverrides); 793 } 794 795 799 800 public NoPutResultSet getHashJoinResultSet(NoPutResultSet leftResultSet, 801 int leftNumCols, 802 NoPutResultSet rightResultSet, 803 int rightNumCols, 804 GeneratedMethod joinClause, 805 int resultSetNumber, 806 boolean oneRowRightSide, 807 boolean notExistsRightSide, 808 double optimizerEstimatedRowCount, 809 double optimizerEstimatedCost, 810 String userSuppliedOptimizerOverrides) 811 throws StandardException 812 { 813 return new HashJoinResultSet(leftResultSet, leftNumCols, 814 rightResultSet, rightNumCols, 815 leftResultSet.getActivation(), joinClause, 816 resultSetNumber, 817 oneRowRightSide, 818 notExistsRightSide, 819 optimizerEstimatedRowCount, 820 optimizerEstimatedCost, 821 userSuppliedOptimizerOverrides); 822 } 823 824 828 829 public NoPutResultSet getNestedLoopLeftOuterJoinResultSet(NoPutResultSet leftResultSet, 830 int leftNumCols, 831 NoPutResultSet rightResultSet, 832 int rightNumCols, 833 GeneratedMethod joinClause, 834 int resultSetNumber, 835 GeneratedMethod emptyRowFun, 836 boolean wasRightOuterJoin, 837 boolean oneRowRightSide, 838 boolean notExistsRightSide, 839 double optimizerEstimatedRowCount, 840 double optimizerEstimatedCost, 841 String userSuppliedOptimizerOverrides) 842 throws StandardException 843 { 844 return new NestedLoopLeftOuterJoinResultSet(leftResultSet, leftNumCols, 845 rightResultSet, rightNumCols, 846 leftResultSet.getActivation(), joinClause, 847 resultSetNumber, 848 emptyRowFun, 849 wasRightOuterJoin, 850 oneRowRightSide, 851 notExistsRightSide, 852 optimizerEstimatedRowCount, 853 optimizerEstimatedCost, 854 userSuppliedOptimizerOverrides); 855 } 856 857 861 862 public NoPutResultSet getHashLeftOuterJoinResultSet(NoPutResultSet leftResultSet, 863 int leftNumCols, 864 NoPutResultSet rightResultSet, 865 int rightNumCols, 866 GeneratedMethod joinClause, 867 int resultSetNumber, 868 GeneratedMethod emptyRowFun, 869 boolean wasRightOuterJoin, 870 boolean oneRowRightSide, 871 boolean notExistsRightSide, 872 double optimizerEstimatedRowCount, 873 double optimizerEstimatedCost, 874 String userSuppliedOptimizerOverrides) 875 throws StandardException 876 { 877 return new HashLeftOuterJoinResultSet(leftResultSet, leftNumCols, 878 rightResultSet, rightNumCols, 879 leftResultSet.getActivation(), joinClause, 880 resultSetNumber, 881 emptyRowFun, 882 wasRightOuterJoin, 883 oneRowRightSide, 884 notExistsRightSide, 885 optimizerEstimatedRowCount, 886 optimizerEstimatedCost, 887 userSuppliedOptimizerOverrides); 888 } 889 890 895 public ResultSet getSetTransactionResultSet(Activation activation) 896 throws StandardException 897 { 898 getAuthorizer(activation).authorize(activation, Authorizer.SQL_ARBITARY_OP); 899 return new SetTransactionResultSet(activation); 900 } 901 902 906 public NoPutResultSet getMaterializedResultSet(NoPutResultSet source, 907 int resultSetNumber, 908 double optimizerEstimatedRowCount, 909 double optimizerEstimatedCost) 910 throws StandardException 911 { 912 return new MaterializedResultSet(source, source.getActivation(), 913 resultSetNumber, 914 optimizerEstimatedRowCount, 915 optimizerEstimatedCost); 916 } 917 918 922 public NoPutResultSet getScrollInsensitiveResultSet(NoPutResultSet source, 923 Activation activation, int resultSetNumber, 924 int sourceRowWidth, 925 boolean scrollable, 926 double optimizerEstimatedRowCount, 927 double optimizerEstimatedCost) 928 throws StandardException 929 { 930 933 934 if (scrollable) 935 { 936 return new ScrollInsensitiveResultSet(source, activation, 937 resultSetNumber, 938 sourceRowWidth, 939 optimizerEstimatedRowCount, 940 optimizerEstimatedCost); 941 } 942 else 943 { 944 return source; 945 } 946 } 947 948 952 public NoPutResultSet getNormalizeResultSet(NoPutResultSet source, 953 int resultSetNumber, 954 int erdNumber, 955 double optimizerEstimatedRowCount, 956 double optimizerEstimatedCost, 957 boolean forUpdate) 958 throws StandardException 959 { 960 return new NormalizeResultSet(source, source.getActivation(), 961 resultSetNumber, erdNumber, 962 optimizerEstimatedRowCount, 963 optimizerEstimatedCost, forUpdate); 964 } 965 966 969 public NoPutResultSet getCurrentOfResultSet(String cursorName, 970 Activation activation, int resultSetNumber, String psName) 971 { 972 return new CurrentOfResultSet(cursorName, activation, resultSetNumber, psName); 973 } 974 975 979 public ResultSet getDDLResultSet(Activation activation) 980 throws StandardException 981 { 982 getAuthorizer(activation).authorize(activation, Authorizer.SQL_DDL_OP); 983 return getMiscResultSet( activation); 984 } 985 986 990 public ResultSet getMiscResultSet(Activation activation) 991 throws StandardException 992 { 993 getAuthorizer(activation).authorize(activation, Authorizer.SQL_ARBITARY_OP); 994 return new MiscResultSet(activation); 995 } 996 997 1002 public NoPutResultSet getUnionResultSet(NoPutResultSet leftResultSet, 1003 NoPutResultSet rightResultSet, 1004 int resultSetNumber, 1005 double optimizerEstimatedRowCount, 1006 double optimizerEstimatedCost) 1007 throws StandardException 1008 { 1009 return new UnionResultSet(leftResultSet, rightResultSet, 1010 leftResultSet.getActivation(), 1011 resultSetNumber, 1012 optimizerEstimatedRowCount, 1013 optimizerEstimatedCost); 1014 } 1015 1016 public NoPutResultSet getSetOpResultSet( NoPutResultSet leftSource, 1017 NoPutResultSet rightSource, 1018 Activation activation, 1019 int resultSetNumber, 1020 long optimizerEstimatedRowCount, 1021 double optimizerEstimatedCost, 1022 int opType, 1023 boolean all, 1024 int intermediateOrderByColumnsSavedObject, 1025 int intermediateOrderByDirectionSavedObject) 1026 throws StandardException 1027 { 1028 return new SetOpResultSet( leftSource, 1029 rightSource, 1030 activation, 1031 resultSetNumber, 1032 optimizerEstimatedRowCount, 1033 optimizerEstimatedCost, 1034 opType, 1035 all, 1036 intermediateOrderByColumnsSavedObject, 1037 intermediateOrderByDirectionSavedObject); 1038 } 1039 1040 1072 public NoPutResultSet getLastIndexKeyResultSet 1073 ( 1074 Activation activation, 1075 int resultSetNumber, 1076 GeneratedMethod resultRowAllocator, 1077 long conglomId, 1078 String tableName, 1079 String userSuppliedOptimizerOverrides, 1080 String indexName, 1081 int colRefItem, 1082 int lockMode, 1083 boolean tableLocked, 1084 int isolationLevel, 1085 double optimizerEstimatedRowCount, 1086 double optimizerEstimatedCost 1087 ) throws StandardException 1088 { 1089 return new LastIndexKeyResultSet( 1090 activation, 1091 resultSetNumber, 1092 resultRowAllocator, 1093 conglomId, 1094 tableName, 1095 userSuppliedOptimizerOverrides, 1096 indexName, 1097 colRefItem, 1098 lockMode, 1099 tableLocked, 1100 isolationLevel, 1101 optimizerEstimatedRowCount, 1102 optimizerEstimatedCost); 1103 } 1104 1105 1106 1107 1112 public NoPutResultSet getRaDependentTableScanResultSet( 1113 Activation activation, 1114 long conglomId, 1115 int scociItem, 1116 GeneratedMethod resultRowAllocator, 1117 int resultSetNumber, 1118 GeneratedMethod startKeyGetter, 1119 int startSearchOperator, 1120 GeneratedMethod stopKeyGetter, 1121 int stopSearchOperator, 1122 boolean sameStartStopPosition, 1123 Qualifier[][] qualifiers, 1124 String tableName, 1125 String userSuppliedOptimizerOverrides, 1126 String indexName, 1127 boolean isConstraint, 1128 boolean forUpdate, 1129 int colRefItem, 1130 int indexColItem, 1131 int lockMode, 1132 boolean tableLocked, 1133 int isolationLevel, 1134 boolean oneRowScan, 1135 double optimizerEstimatedRowCount, 1136 double optimizerEstimatedCost, 1137 String parentResultSetId, 1138 long fkIndexConglomId, 1139 int fkColArrayItem, 1140 int rltItem) 1141 throws StandardException 1142 { 1143 StaticCompiledOpenConglomInfo scoci = (StaticCompiledOpenConglomInfo)(activation.getPreparedStatement(). 1144 getSavedObject(scociItem)); 1145 return new DependentResultSet( 1146 conglomId, 1147 scoci, 1148 activation, 1149 resultRowAllocator, 1150 resultSetNumber, 1151 startKeyGetter, 1152 startSearchOperator, 1153 stopKeyGetter, 1154 stopSearchOperator, 1155 sameStartStopPosition, 1156 qualifiers, 1157 tableName, 1158 userSuppliedOptimizerOverrides, 1159 indexName, 1160 isConstraint, 1161 forUpdate, 1162 colRefItem, 1163 lockMode, 1164 tableLocked, 1165 isolationLevel, 1166 1, 1167 oneRowScan, 1168 optimizerEstimatedRowCount, 1169 optimizerEstimatedCost, 1170 parentResultSetId, 1171 fkIndexConglomId, 1172 fkColArrayItem, 1173 rltItem); 1174 } 1175 1176 static private Authorizer getAuthorizer(Activation activation) 1177 { 1178 LanguageConnectionContext lcc = activation.getLanguageConnectionContext(); 1179 return lcc.getAuthorizer(); 1180 } 1181 1182 1183 1189} 1190 | Popular Tags |