1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import java.util.Properties ; 25 import java.util.Vector ; 26 27 import org.apache.derby.iapi.services.context.ContextManager; 28 29 import org.apache.derby.iapi.services.monitor.ModuleControl; 30 import org.apache.derby.iapi.services.monitor.ModuleSupportable; 31 import org.apache.derby.iapi.services.monitor.Monitor; 32 33 import org.apache.derby.iapi.sql.compile.Optimizer; 34 35 import org.apache.derby.iapi.sql.compile.NodeFactory; 36 import org.apache.derby.iapi.sql.compile.C_NodeTypes; 37 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 38 39 import org.apache.derby.iapi.services.sanity.SanityManager; 40 import org.apache.derby.iapi.services.property.PropertyUtil; 41 42 import org.apache.derby.iapi.error.StandardException; 43 import org.apache.derby.iapi.reference.SQLState; 44 45 import org.apache.derby.catalog.AliasInfo; 46 import org.apache.derby.iapi.services.loader.ClassInfo; 47 import org.apache.derby.iapi.util.StringUtil; 48 49 57 58 public class NodeFactoryImpl extends NodeFactory implements ModuleControl, ModuleSupportable 59 { 60 66 72 73 private Boolean joinOrderOptimization = Boolean.TRUE; 74 75 private final ClassInfo[] nodeCi = new ClassInfo[205]; 76 77 private static final Vector emptyVector = new Vector (0); 78 79 85 public boolean canSupport(Properties startParams) 86 { 87 return Monitor.isDesiredType( startParams, org.apache.derby.iapi.reference.EngineType.NONE ); 88 } 89 90 94 95 public void boot(boolean create, Properties startParams) 96 throws StandardException 97 { 98 103 String opt = 104 PropertyUtil.getSystemProperty(Optimizer.JOIN_ORDER_OPTIMIZATION); 105 if (opt != null) 106 { 107 joinOrderOptimization = Boolean.valueOf(opt); 108 } 109 } 110 111 114 115 public void stop() { 116 } 117 118 121 public NodeFactoryImpl() {} 122 123 124 public Boolean doJoinOrderOptimization() 125 { 126 return joinOrderOptimization; 127 } 128 129 134 public QueryTreeNode getNode(int nodeType, ContextManager cm) 135 throws StandardException 136 { 137 138 ClassInfo ci = nodeCi[nodeType]; 139 140 Class nodeClass = null; 141 if (ci == null) 142 { 143 String nodeName = nodeName(nodeType); 144 145 try 146 { 147 nodeClass = Class.forName(nodeName); 148 } 149 catch (ClassNotFoundException cnfe) 150 { 151 if (SanityManager.DEBUG) 152 { 153 SanityManager.THROWASSERT("Unexpected ClassNotFoundException", 154 cnfe); 155 } 156 } 157 158 ci = new ClassInfo(nodeClass); 159 nodeCi[nodeType] = ci; 160 } 161 162 QueryTreeNode retval = null; 163 164 try 165 { 166 retval = (QueryTreeNode) ci.getNewInstance(); 167 } 169 catch (Exception iae) 170 { 171 if (SanityManager.DEBUG) 172 { 173 SanityManager.THROWASSERT("Unexpected Exception", iae); 174 } 175 } 176 177 retval.setContextManager(cm); 178 retval.setNodeType(nodeType); 179 180 return retval; 181 } 182 183 190 protected String nodeName(int nodeType) 191 throws StandardException 192 { 193 switch (nodeType) 194 { 195 case C_NodeTypes.CURRENT_ROW_LOCATION_NODE: 200 return C_NodeNames.CURRENT_ROW_LOCATION_NODE_NAME; 201 202 case C_NodeTypes.GROUP_BY_LIST: 203 return C_NodeNames.GROUP_BY_LIST_NAME; 204 205 case C_NodeTypes.ORDER_BY_LIST: 206 return C_NodeNames.ORDER_BY_LIST_NAME; 207 208 case C_NodeTypes.PREDICATE_LIST: 209 return C_NodeNames.PREDICATE_LIST_NAME; 210 211 case C_NodeTypes.RESULT_COLUMN_LIST: 212 return C_NodeNames.RESULT_COLUMN_LIST_NAME; 213 214 case C_NodeTypes.SUBQUERY_LIST: 215 return C_NodeNames.SUBQUERY_LIST_NAME; 216 217 case C_NodeTypes.TABLE_ELEMENT_LIST: 218 return C_NodeNames.TABLE_ELEMENT_LIST_NAME; 219 220 case C_NodeTypes.UNTYPED_NULL_CONSTANT_NODE: 221 return C_NodeNames.UNTYPED_NULL_CONSTANT_NODE_NAME; 222 223 case C_NodeTypes.TABLE_ELEMENT_NODE: 224 return C_NodeNames.TABLE_ELEMENT_NODE_NAME; 225 226 case C_NodeTypes.VALUE_NODE_LIST: 227 return C_NodeNames.VALUE_NODE_LIST_NAME; 228 229 case C_NodeTypes.ALL_RESULT_COLUMN: 230 return C_NodeNames.ALL_RESULT_COLUMN_NAME; 231 232 case C_NodeTypes.GET_CURRENT_CONNECTION_NODE: 233 return C_NodeNames.GET_CURRENT_CONNECTION_NODE_NAME; 234 235 case C_NodeTypes.NOP_STATEMENT_NODE: 236 return C_NodeNames.NOP_STATEMENT_NODE_NAME; 237 238 case C_NodeTypes.SET_TRANSACTION_ISOLATION_NODE: 239 return C_NodeNames.SET_TRANSACTION_ISOLATION_NODE_NAME; 240 241 case C_NodeTypes.CHAR_LENGTH_OPERATOR_NODE: 242 return C_NodeNames.LENGTH_OPERATOR_NODE_NAME; 243 244 case C_NodeTypes.IS_NOT_NULL_NODE: 246 case C_NodeTypes.IS_NULL_NODE: 247 return C_NodeNames.IS_NULL_NODE_NAME; 248 249 case C_NodeTypes.NOT_NODE: 250 return C_NodeNames.NOT_NODE_NAME; 251 252 case C_NodeTypes.SQL_TO_JAVA_VALUE_NODE: 253 return C_NodeNames.SQL_TO_JAVA_VALUE_NODE_NAME; 254 255 case C_NodeTypes.TABLE_NAME: 256 return C_NodeNames.TABLE_NAME_NAME; 257 258 case C_NodeTypes.GROUP_BY_COLUMN: 259 return C_NodeNames.GROUP_BY_COLUMN_NAME; 260 261 case C_NodeTypes.JAVA_TO_SQL_VALUE_NODE: 262 return C_NodeNames.JAVA_TO_SQL_VALUE_NODE_NAME; 263 264 case C_NodeTypes.FROM_LIST: 265 return C_NodeNames.FROM_LIST_NAME; 266 267 case C_NodeTypes.BOOLEAN_CONSTANT_NODE: 268 return C_NodeNames.BOOLEAN_CONSTANT_NODE_NAME; 269 270 case C_NodeTypes.AND_NODE: 271 return C_NodeNames.AND_NODE_NAME; 272 273 case C_NodeTypes.BINARY_EQUALS_OPERATOR_NODE: 274 case C_NodeTypes.BINARY_GREATER_EQUALS_OPERATOR_NODE: 275 case C_NodeTypes.BINARY_GREATER_THAN_OPERATOR_NODE: 276 case C_NodeTypes.BINARY_LESS_EQUALS_OPERATOR_NODE: 277 case C_NodeTypes.BINARY_LESS_THAN_OPERATOR_NODE: 278 case C_NodeTypes.BINARY_NOT_EQUALS_OPERATOR_NODE: 279 return C_NodeNames.BINARY_RELATIONAL_OPERATOR_NODE_NAME; 280 281 case C_NodeTypes.BINARY_MINUS_OPERATOR_NODE: 282 case C_NodeTypes.BINARY_PLUS_OPERATOR_NODE: 283 case C_NodeTypes.BINARY_TIMES_OPERATOR_NODE: 284 case C_NodeTypes.BINARY_DIVIDE_OPERATOR_NODE: 285 case C_NodeTypes.MOD_OPERATOR_NODE: 286 return C_NodeNames.BINARY_ARITHMETIC_OPERATOR_NODE_NAME; 287 288 case C_NodeTypes.COALESCE_FUNCTION_NODE: 289 return C_NodeNames.COALESCE_FUNCTION_NODE_NAME; 290 291 case C_NodeTypes.CONCATENATION_OPERATOR_NODE: 292 return C_NodeNames.CONCATENATION_OPERATOR_NODE_NAME; 293 294 case C_NodeTypes.LIKE_OPERATOR_NODE: 295 return C_NodeNames.LIKE_OPERATOR_NODE_NAME; 296 297 case C_NodeTypes.OR_NODE: 298 return C_NodeNames.OR_NODE_NAME; 299 300 case C_NodeTypes.BETWEEN_OPERATOR_NODE: 301 return C_NodeNames.BETWEEN_OPERATOR_NODE_NAME; 302 303 case C_NodeTypes.CONDITIONAL_NODE: 304 return C_NodeNames.CONDITIONAL_NODE_NAME; 305 306 case C_NodeTypes.IN_LIST_OPERATOR_NODE: 307 return C_NodeNames.IN_LIST_OPERATOR_NODE_NAME; 308 309 case C_NodeTypes.BIT_CONSTANT_NODE: 310 return C_NodeNames.BIT_CONSTANT_NODE_NAME; 311 312 case C_NodeTypes.LONGVARBIT_CONSTANT_NODE: 313 case C_NodeTypes.VARBIT_CONSTANT_NODE: 314 case C_NodeTypes.BLOB_CONSTANT_NODE: 315 return C_NodeNames.VARBIT_CONSTANT_NODE_NAME; 316 317 case C_NodeTypes.CAST_NODE: 318 return C_NodeNames.CAST_NODE_NAME; 319 320 case C_NodeTypes.CHAR_CONSTANT_NODE: 321 case C_NodeTypes.LONGVARCHAR_CONSTANT_NODE: 322 case C_NodeTypes.VARCHAR_CONSTANT_NODE: 323 case C_NodeTypes.CLOB_CONSTANT_NODE: 324 return C_NodeNames.CHAR_CONSTANT_NODE_NAME; 325 326 case C_NodeTypes.XML_CONSTANT_NODE: 327 return C_NodeNames.XML_CONSTANT_NODE_NAME; 328 329 case C_NodeTypes.COLUMN_REFERENCE: 330 return C_NodeNames.COLUMN_REFERENCE_NAME; 331 332 case C_NodeTypes.DROP_INDEX_NODE: 333 return C_NodeNames.DROP_INDEX_NODE_NAME; 334 335 case C_NodeTypes.DROP_TRIGGER_NODE: 336 return C_NodeNames.DROP_TRIGGER_NODE_NAME; 337 338 case C_NodeTypes.READ_CURSOR_NODE: 339 return C_NodeNames.READ_CURSOR_NODE_NAME; 340 341 case C_NodeTypes.TINYINT_CONSTANT_NODE: 342 case C_NodeTypes.SMALLINT_CONSTANT_NODE: 343 case C_NodeTypes.INT_CONSTANT_NODE: 344 case C_NodeTypes.LONGINT_CONSTANT_NODE: 345 case C_NodeTypes.DECIMAL_CONSTANT_NODE: 346 case C_NodeTypes.DOUBLE_CONSTANT_NODE: 347 case C_NodeTypes.FLOAT_CONSTANT_NODE: 348 return C_NodeNames.NUMERIC_CONSTANT_NODE_NAME; 349 350 case C_NodeTypes.USERTYPE_CONSTANT_NODE: 351 return C_NodeNames.USERTYPE_CONSTANT_NODE_NAME; 352 353 case C_NodeTypes.PREDICATE: 354 return C_NodeNames.PREDICATE_NAME; 355 356 case C_NodeTypes.RESULT_COLUMN: 357 return C_NodeNames.RESULT_COLUMN_NAME; 358 359 case C_NodeTypes.SET_SCHEMA_NODE: 360 return C_NodeNames.SET_SCHEMA_NODE_NAME; 361 362 case C_NodeTypes.SIMPLE_STRING_OPERATOR_NODE: 363 return C_NodeNames.SIMPLE_STRING_OPERATOR_NODE_NAME; 364 365 case C_NodeTypes.STATIC_CLASS_FIELD_REFERENCE_NODE: 366 return C_NodeNames.STATIC_CLASS_FIELD_REFERENCE_NODE_NAME; 367 368 case C_NodeTypes.STATIC_METHOD_CALL_NODE: 369 return C_NodeNames.STATIC_METHOD_CALL_NODE_NAME; 370 371 case C_NodeTypes.EXTRACT_OPERATOR_NODE: 372 return C_NodeNames.EXTRACT_OPERATOR_NODE_NAME; 373 374 case C_NodeTypes.PARAMETER_NODE: 375 return C_NodeNames.PARAMETER_NODE_NAME; 376 377 case C_NodeTypes.DROP_SCHEMA_NODE: 378 return C_NodeNames.DROP_SCHEMA_NODE_NAME; 379 380 case C_NodeTypes.DROP_TABLE_NODE: 381 return C_NodeNames.DROP_TABLE_NODE_NAME; 382 383 case C_NodeTypes.DROP_VIEW_NODE: 384 return C_NodeNames.DROP_VIEW_NODE_NAME; 385 386 case C_NodeTypes.SUBQUERY_NODE: 387 return C_NodeNames.SUBQUERY_NODE_NAME; 388 389 case C_NodeTypes.BASE_COLUMN_NODE: 390 return C_NodeNames.BASE_COLUMN_NODE_NAME; 391 392 case C_NodeTypes.CALL_STATEMENT_NODE: 393 return C_NodeNames.CALL_STATEMENT_NODE_NAME; 394 395 case C_NodeTypes.MODIFY_COLUMN_DEFAULT_NODE: 396 case C_NodeTypes.MODIFY_COLUMN_TYPE_NODE: 397 case C_NodeTypes.MODIFY_COLUMN_CONSTRAINT_NODE: 398 case C_NodeTypes.MODIFY_COLUMN_CONSTRAINT_NOT_NULL_NODE: 399 return C_NodeNames.MODIFY_COLUMN_NODE_NAME; 400 401 case C_NodeTypes.NON_STATIC_METHOD_CALL_NODE: 402 return C_NodeNames.NON_STATIC_METHOD_CALL_NODE_NAME; 403 404 case C_NodeTypes.CURRENT_OF_NODE: 405 return C_NodeNames.CURRENT_OF_NODE_NAME; 406 407 case C_NodeTypes.DEFAULT_NODE: 408 return C_NodeNames.DEFAULT_NODE_NAME; 409 410 case C_NodeTypes.DELETE_NODE: 411 return C_NodeNames.DELETE_NODE_NAME; 412 413 case C_NodeTypes.UPDATE_NODE: 414 return C_NodeNames.UPDATE_NODE_NAME; 415 416 case C_NodeTypes.ORDER_BY_COLUMN: 417 return C_NodeNames.ORDER_BY_COLUMN_NAME; 418 419 case C_NodeTypes.ROW_RESULT_SET_NODE: 420 return C_NodeNames.ROW_RESULT_SET_NODE_NAME; 421 422 case C_NodeTypes.VIRTUAL_COLUMN_NODE: 423 return C_NodeNames.VIRTUAL_COLUMN_NODE_NAME; 424 425 case C_NodeTypes.CURRENT_DATETIME_OPERATOR_NODE: 426 return C_NodeNames.CURRENT_DATETIME_OPERATOR_NODE_NAME; 427 428 case C_NodeTypes.USER_NODE: 429 case C_NodeTypes.CURRENT_USER_NODE: 430 case C_NodeTypes.SESSION_USER_NODE: 431 case C_NodeTypes.SYSTEM_USER_NODE: 432 case C_NodeTypes.CURRENT_ISOLATION_NODE: 433 case C_NodeTypes.IDENTITY_VAL_NODE: 434 case C_NodeTypes.CURRENT_SCHEMA_NODE: 435 return C_NodeNames.SPECIAL_FUNCTION_NODE_NAME; 436 437 case C_NodeTypes.IS_NODE: 438 return C_NodeNames.IS_NODE_NAME; 439 440 case C_NodeTypes.LOCK_TABLE_NODE: 441 return C_NodeNames.LOCK_TABLE_NODE_NAME; 442 443 case C_NodeTypes.ALTER_TABLE_NODE: 444 return C_NodeNames.ALTER_TABLE_NODE_NAME; 445 446 case C_NodeTypes.AGGREGATE_NODE: 447 return C_NodeNames.AGGREGATE_NODE_NAME; 448 449 case C_NodeTypes.COLUMN_DEFINITION_NODE: 450 return C_NodeNames.COLUMN_DEFINITION_NODE_NAME; 451 452 case C_NodeTypes.EXEC_SPS_NODE: 453 return C_NodeNames.EXEC_SPS_NODE_NAME; 454 455 case C_NodeTypes.FK_CONSTRAINT_DEFINITION_NODE: 456 return C_NodeNames.FK_CONSTRAINT_DEFINITION_NODE_NAME; 457 458 case C_NodeTypes.FROM_VTI: 459 return C_NodeNames.FROM_VTI_NAME; 460 461 case C_NodeTypes.MATERIALIZE_RESULT_SET_NODE: 462 return C_NodeNames.MATERIALIZE_RESULT_SET_NODE_NAME; 463 464 case C_NodeTypes.NORMALIZE_RESULT_SET_NODE: 465 return C_NodeNames.NORMALIZE_RESULT_SET_NODE_NAME; 466 467 case C_NodeTypes.SCROLL_INSENSITIVE_RESULT_SET_NODE: 468 return C_NodeNames.SCROLL_INSENSITIVE_RESULT_SET_NODE_NAME; 469 470 case C_NodeTypes.ORDER_BY_NODE: 471 return C_NodeNames.ORDER_BY_NODE_NAME; 472 473 case C_NodeTypes.DISTINCT_NODE: 474 return C_NodeNames.DISTINCT_NODE_NAME; 475 476 case C_NodeTypes.LOCATE_FUNCTION_NODE: 477 case C_NodeTypes.SUBSTRING_OPERATOR_NODE: 478 case C_NodeTypes.TRIM_OPERATOR_NODE: 479 case C_NodeTypes.TIMESTAMP_ADD_FN_NODE: 480 case C_NodeTypes.TIMESTAMP_DIFF_FN_NODE: 481 return C_NodeNames.TERNARY_OPERATOR_NODE_NAME; 482 483 case C_NodeTypes.SELECT_NODE: 484 return C_NodeNames.SELECT_NODE_NAME; 485 486 case C_NodeTypes.CREATE_VIEW_NODE: 487 return C_NodeNames.CREATE_VIEW_NODE_NAME; 488 489 case C_NodeTypes.CONSTRAINT_DEFINITION_NODE: 490 return C_NodeNames.CONSTRAINT_DEFINITION_NODE_NAME; 491 492 case C_NodeTypes.NEW_INVOCATION_NODE: 493 return C_NodeNames.NEW_INVOCATION_NODE_NAME; 494 495 case C_NodeTypes.CREATE_SCHEMA_NODE: 496 return C_NodeNames.CREATE_SCHEMA_NODE_NAME; 497 498 case C_NodeTypes.FROM_BASE_TABLE: 499 return C_NodeNames.FROM_BASE_TABLE_NAME; 500 501 case C_NodeTypes.FROM_SUBQUERY: 502 return C_NodeNames.FROM_SUBQUERY_NAME; 503 504 case C_NodeTypes.GROUP_BY_NODE: 505 return C_NodeNames.GROUP_BY_NODE_NAME; 506 507 case C_NodeTypes.INSERT_NODE: 508 return C_NodeNames.INSERT_NODE_NAME; 509 510 case C_NodeTypes.JOIN_NODE: 511 return C_NodeNames.JOIN_NODE_NAME; 512 513 case C_NodeTypes.CREATE_TABLE_NODE: 514 return C_NodeNames.CREATE_TABLE_NODE_NAME; 515 516 case C_NodeTypes.RENAME_NODE: 517 return C_NodeNames.RENAME_NODE_NAME; 518 519 case C_NodeTypes.UNION_NODE: 520 return C_NodeNames.UNION_NODE_NAME; 521 522 case C_NodeTypes.INTERSECT_OR_EXCEPT_NODE: 523 return C_NodeNames.INTERSECT_OR_EXCEPT_NODE_NAME; 524 525 case C_NodeTypes.CREATE_TRIGGER_NODE: 526 return C_NodeNames.CREATE_TRIGGER_NODE_NAME; 527 528 case C_NodeTypes.HALF_OUTER_JOIN_NODE: 529 return C_NodeNames.HALF_OUTER_JOIN_NODE_NAME; 530 531 case C_NodeTypes.CREATE_INDEX_NODE: 532 return C_NodeNames.CREATE_INDEX_NODE_NAME; 533 534 case C_NodeTypes.CURSOR_NODE: 535 return C_NodeNames.CURSOR_NODE_NAME; 536 537 case C_NodeTypes.HASH_TABLE_NODE: 538 return C_NodeNames.HASH_TABLE_NODE_NAME; 539 540 case C_NodeTypes.INDEX_TO_BASE_ROW_NODE: 541 return C_NodeNames.INDEX_TO_BASE_ROW_NODE_NAME; 542 543 case C_NodeTypes.CREATE_ALIAS_NODE: 544 return C_NodeNames.CREATE_ALIAS_NODE_NAME; 545 546 case C_NodeTypes.PROJECT_RESTRICT_NODE: 547 return C_NodeNames.PROJECT_RESTRICT_NODE_NAME; 548 549 case C_NodeTypes.SQL_BOOLEAN_CONSTANT_NODE: 550 return C_NodeNames.SQL_BOOLEAN_CONSTANT_NODE_NAME; 551 552 case C_NodeTypes.DROP_ALIAS_NODE: 553 return C_NodeNames.DROP_ALIAS_NODE_NAME; 554 555 case C_NodeTypes.TEST_CONSTRAINT_NODE: 556 return C_NodeNames.TEST_CONSTRAINT_NODE_NAME; 557 558 case C_NodeTypes.ABSOLUTE_OPERATOR_NODE: 559 case C_NodeTypes.SQRT_OPERATOR_NODE: 560 case C_NodeTypes.UNARY_PLUS_OPERATOR_NODE: 561 case C_NodeTypes.UNARY_MINUS_OPERATOR_NODE: 562 return C_NodeNames.UNARY_ARITHMETIC_OPERATOR_NODE_NAME; 563 564 case C_NodeTypes.SAVEPOINT_NODE: 565 return C_NodeNames.SAVEPOINT_NODE_NAME; 566 567 case C_NodeTypes.UNARY_DATE_TIMESTAMP_OPERATOR_NODE: 568 return C_NodeNames.UNARY_DATE_TIMESTAMP_OPERATOR_NODE_NAME; 569 570 case C_NodeTypes.TIMESTAMP_OPERATOR_NODE: 571 return C_NodeNames.TIMESTAMP_OPERATOR_NODE_NAME; 572 573 case C_NodeTypes.DB2_LENGTH_OPERATOR_NODE: 574 return C_NodeNames.DB2_LENGTH_OPERATOR_NODE_NAME; 575 576 case C_NodeTypes.XML_PARSE_OPERATOR_NODE: 577 case C_NodeTypes.XML_SERIALIZE_OPERATOR_NODE: 578 return C_NodeNames.UNARY_OPERATOR_NODE_NAME; 579 580 case C_NodeTypes.XML_EXISTS_OPERATOR_NODE: 581 case C_NodeTypes.XML_QUERY_OPERATOR_NODE: 582 return C_NodeNames.BINARY_OPERATOR_NODE_NAME; 583 584 case C_NodeTypes.GRANT_NODE: 585 return C_NodeNames.GRANT_NODE_NAME; 586 case C_NodeTypes.REVOKE_NODE: 587 return C_NodeNames.REVOKE_NODE_NAME; 588 589 case C_NodeTypes.PRIVILEGE_NODE: 590 return C_NodeNames.PRIVILEGE_NAME; 591 592 case C_NodeTypes.TABLE_PRIVILEGES_NODE: 593 return C_NodeNames.TABLE_PRIVILEGES_NAME; 594 595 598 default: 599 throw StandardException.newException(SQLState.NOT_IMPLEMENTED); 600 } 601 } 602 603 604 622 public QueryTreeNode 623 getCreateAliasNode( 624 Object aliasName, 625 Object targetName, 626 Object aliasSpecificInfo, 627 char aliasType, 628 Boolean delimitedIdentifier, 629 ContextManager cm) 630 throws StandardException 631 { 632 int nodeType; 633 String methodName = null; 634 String targetMethodName = null; 635 String targetClassName = null; 636 637 nodeType = C_NodeTypes.CREATE_ALIAS_NODE; 638 639 if (aliasType != AliasInfo.ALIAS_TYPE_SYNONYM_AS_CHAR) 640 { 641 int lastPeriod; 642 String fullStaticMethodName = (String ) targetName; 643 int paren = fullStaticMethodName.indexOf('('); 644 if (paren == -1) { 645 lastPeriod = fullStaticMethodName.lastIndexOf('.'); 647 } else { 648 lastPeriod = fullStaticMethodName.substring(0, paren).lastIndexOf('.'); 650 } 651 if (lastPeriod == -1 || lastPeriod == fullStaticMethodName.length()-1) { 652 throw StandardException.newException(SQLState.LANG_INVALID_FULL_STATIC_METHOD_NAME, fullStaticMethodName); 653 } 654 String javaClassName = fullStaticMethodName.substring(0, lastPeriod); 655 methodName = fullStaticMethodName.substring(lastPeriod + 1); 656 targetName = javaClassName; 657 } 658 659 return getNode( 660 nodeType, 661 aliasName, 662 targetName, 663 methodName, 664 aliasSpecificInfo, 665 new Character (aliasType), 666 delimitedIdentifier, 667 cm ); 668 } 669 670 682 public ResultSetNode mapTableAsVTI( 683 TableDescriptor td, 684 String vtiClass, 685 String correlationName, 686 ResultColumnList resultColumns, 687 Properties tableProperties, 688 ContextManager cm) 689 throws StandardException { 690 691 692 QueryTreeNode newNode = getNode(C_NodeTypes.NEW_INVOCATION_NODE, 693 vtiClass, 694 emptyVector, Boolean.FALSE, 695 cm); 696 697 QueryTreeNode vtiNode; 698 699 if (correlationName != null) 700 { 701 vtiNode = getNode(C_NodeTypes.FROM_VTI, 702 newNode, 703 correlationName, 704 resultColumns, 705 tableProperties, 706 cm); 707 } 708 else 709 { 710 TableName exposedName = newNode.makeTableName(td.getSchemaName(), 711 td.getDescriptorName()); 712 713 vtiNode = getNode(C_NodeTypes.FROM_VTI, 714 newNode, 715 correlationName, 716 resultColumns, 717 tableProperties, 718 exposedName, 719 cm); 720 } 721 722 return (ResultSetNode) vtiNode; 723 } 724 } 725 726 727 | Popular Tags |