View Javadoc
1 /* Generated By:JavaCC: Do not edit this line. SQLParser.java */ 2 package com.sun.ebxml.registry.query.sql; 3 import java.io.*; 4 import java.util.*; 5 6 import org.oasis.ebxml.registry.bindings.query.*; 7 import org.oasis.ebxml.registry.bindings.query.types.*; 8 import org.oasis.ebxml.registry.bindings.rim.*; 9 10 import com.sun.ebxml.registry.*; 11 import com.sun.ebxml.registry.persistence.rdb.*; 12 import com.sun.ebxml.registry.security.authentication.*; 13 14 /*** 15 * Based on grammar by Kevin (mailto:kevinh@empower.com.au) at: http://www.cobase.cs.ucla.edu/pub/javacc/sql-oracle.jj 16 */ 17 public class SQLParser implements SQLParserConstants { 18 19 SQLPersistenceManagerImpl pm = SQLPersistenceManagerImpl.getInstance(); 20 21 private static void runRegressionTest() throws ParseException { 22 String[] queries = { 23 /***/ 24 "SELECT DISTINCT obj FROM Object WHERE obj.name LIKE '%bicycle%' AND obj.majorVersion >= 1 AND (obj.majorVersion >= 2 OR obj.minorVersion > 3)", 25 26 "SELECT FROM ClassificationNode WHERE parent IS NULL", 27 28 "SELECT FROM ClassificationNode WHERE parent = 'id'", 29 30 "SELECT assoc FROM Association WHERE assoc.sourceObject = 'id'", 31 32 "SELECT assoc FROM Association WHERE assoc.targetObject = 'id'", 33 34 "SELECT assoc FROM Association WHERE assoc.name = 'name'", 35 36 "SELECT assoc FROM Association WHERE assoc.sourceRole = 'roleName'", 37 38 "SELECT assoc FROM Association WHERE assoc.targetRole = 'roleName'", 39 40 "SELECT DISTINCT assoc FROM Association WHERE assoc.associationType = 'associationType'", 41 42 "SELECT DISTINCT assoc FROM Association WHERE Assoc.sourceObject = 'id' AND assoc.sourceRole = 'buysFrom' AND assoc.sourceRole = 'sellsTo'", 43 44 45 "SELECT DISTINCT eo FROM ExtrinsicObject eo, ClassificationNode auto, ClassificationNode geo WHERE (geo IN (eo.classificationNodes) AND geo.path = 'Geography.Asia.Japan') AND\u0009(auto IN (eo.classificationNodes) AND auto.path = 'Industry.Automotive')", 46 47 "SELECT cn FROM ClassificationNode cn, ExtrinsicObject o WHERE o.ID = 'id' AND cn IN (o.classificationNodes)", 48 49 "SELECT p FROM Package p, ExtrinsicObject obj WHERE obj.ID = 'id' AND p IN (obj.packages)", 50 51 "SELECT a FROM Association, Package p WHERE p.ID = 'id' AND a IN (p.memberObjects)", 52 53 "SELECT p FROM Package p, ExtrinsicObject obj WHERE obj.ID = 'id' AND p IN (obj.packages) AND p.name LIKE '%RosettaNet%' AND p.status != 'DEPRECATED'", 54 55 "SELECT l FROM ExternalLink, ExtrinsicObject obj WHERE obj.ID = 'id' AND l IN (obj.externalLinks)", 56 57 "SELECT obj FROM ExtrinsicObject, ExternalLink l WHERE l.ID = 'id' AND obj IN (l.linkedObjects)", 58 59 "SELECT l FROM ExternalLink, ExtrinsicObject obj WHERE obj.ID = 'id' AND l IN (obj.externalLinks) AND l.description LIKE '%legal%' AND l.externalURI LIKE '%http://%'", 60 61 "SELECT ev FROM AuditableEvent, ExtrinsicObject obj WHERE obj.ID = 'id' AND ev IN (obj.auditTrail)", 62 63 // 64 "SELECT o FROM ManagedObject WHERE o.name IS NULL", 65 66 //"SELECT o FROM ManagedObject WHERE o.packages IS NULL", 67 68 "SELECT ev FROM AuditableEvent, ExtrinsicObject obj WHERE obj.ID = 'id' AND ev IN (obj.auditTrail)", 69 70 71 }; 72 73 //Run each query through the queryProcessor 74 for (int i=0; i< queries.length; i++) { 75 InputStream stream = new ByteArrayInputStream(queries[i].getBytes()); 76 SQLParser parser = new SQLParser(stream); 77 ResponseOption responseOption = new ResponseOption(); 78 responseOption.setReturnType(ReturnTypeType.LEAFCLASS); 79 responseOption.setReturnComposedObjects(true); 80 81 System.err.println("Begin query: " + queries[i]); 82 String modifiedQuery = parser.processQuery(null, responseOption); 83 84 85 //Now test the modifiedQuery 86 stream = new ByteArrayInputStream(modifiedQuery.getBytes()); 87 parser = new SQLParser(stream); 88 89 System.err.println("Begin query: " + modifiedQuery); 90 parser.processQuery(null, null); 91 } 92 } 93 94 public static void main(String[] args) throws ParseException { 95 96 if (args.length == 0) { 97 runRegressionTest(); 98 } 99 else { 100 InputStream stream = new ByteArrayInputStream(args[0].getBytes()); 101 SQLParser parser = new SQLParser(stream); 102 103 ResponseOption responseOption = new ResponseOption(); 104 responseOption.setReturnType(ReturnTypeType.LEAFCLASS); 105 responseOption.setReturnComposedObjects(true); 106 parser.processQuery(null, responseOption); 107 } 108 } 109 110 private ResponseOption responseOption = null; 111 public String firstTableName = null; 112 public HashMap aliasToTableNameMap = new HashMap(); 113 public String selectColName = null; 114 public String selectColAlias = null; 115 public String selectColAndAlias = null; 116 117 private static HashMap collectionAttributeMap = new HashMap(); 118 private boolean inINClause = false; 119 120 //Track last tableName and aliasName 121 private String tableNameStr=null; 122 private String aliasNameStr=null; 123 private boolean beginAssocQuery = false; 124 private User user = null; 125 private AuthenticationServiceImpl ac = AuthenticationServiceImpl.getInstance(); 126 127 static { 128 //FROM RIM: All attributes made lower case for case insensitive comparison 129 collectionAttributeMap.put("associatedobjects", null); 130 collectionAttributeMap.put("audittrail", null); 131 collectionAttributeMap.put("classificationnodes", null); 132 collectionAttributeMap.put("externallinks", null); 133 collectionAttributeMap.put("packages", null); 134 collectionAttributeMap.put("memberobjects", null); 135 collectionAttributeMap.put("classifiedobjects", null); 136 collectionAttributeMap.put("permissions", null); 137 collectionAttributeMap.put("privileges", null); 138 collectionAttributeMap.put("privilegeattributes", null); 139 collectionAttributeMap.put("groups", null); 140 collectionAttributeMap.put("identities", null); 141 collectionAttributeMap.put("roles", null); 142 } 143 144 private String getSelectColumn(String idName) { 145 String selectCol = idName; 146 147 int index = idName.indexOf('.'); 148 149 if ((!inINClause) && (index == -1) ) { 150 151 if (responseOption.getReturnType() == ReturnTypeType.OBJECTREF) { 152 selectCol = "id"; 153 } 154 else { 155 selectCol = "*"; 156 } 157 } 158 159 return selectCol; 160 } 161 162 private String getAttributeNameFromColRef(String colRef) { 163 String attributeName = null; 164 165 //Get the last path element 166 int lastPeriodIndex = colRef.lastIndexOf('.'); 167 attributeName = colRef.substring(lastPeriodIndex+1); 168 169 return attributeName.toLowerCase(); 170 } 171 172 private boolean isPrimitiveAttribute(String colRef) { 173 boolean primitiveAttribute = true; 174 175 String attributeName = getAttributeNameFromColRef(colRef); 176 177 if (collectionAttributeMap.containsKey(attributeName)) { 178 primitiveAttribute = false; 179 } 180 181 //System.err.println("attributeName='" + attributeName + "' isPrimitiveAttribute=" + primitiveAttribute); 182 183 return primitiveAttribute; 184 } 185 186 private String mapCollectionAttributeToIdList(String attributeName) { 187 String idList = "1, 2, 3, 4, 5"; 188 189 190 191 return idList; 192 } 193 194 /******************************************************************** 195 * The Registry Query (Subset of SQL-92) grammar starts here 196 *******************************************************************/ 197 final public String processQuery(User user, ResponseOption responseOption) throws ParseException { 198 this.responseOption = responseOption; 199 String rs = new String(""); 200 this.user = user; 201 rs = SQLSelect(); 202 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 203 case SEMICOLON: 204 jj_consume_token(SEMICOLON); 205 break; 206 default: 207 jj_la1[0] = jj_gen; 208 ; 209 } 210 jj_consume_token(0); 211 {if (true) return rs;} 212 throw new Error("Missing return statement in function"); 213 } 214 215 final public String SQLSelect() throws ParseException { 216 String rs = new String(""), ts; 217 jj_consume_token(SELECT); 218 rs = " SELECT "; 219 ts = SQLSelectCols(); 220 rs = rs + ts; 221 jj_consume_token(FROM); 222 rs = rs + " FROM "; 223 ts = SQLTableList(); 224 rs = rs + ts; 225 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 226 case WHERE: 227 ts = SQLWhere(); 228 rs = rs + ts; 229 break; 230 default: 231 jj_la1[1] = jj_gen; 232 ; 233 } 234 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 235 case ORDER: 236 ts = SQLOrderBy(); 237 rs = rs + ts; 238 break; 239 default: 240 jj_la1[2] = jj_gen; 241 ; 242 } 243 {if (true) return rs;} 244 throw new Error("Missing return statement in function"); 245 } 246 247 final public String SQLSelectCols() throws ParseException { 248 String idName=null; 249 String rs = new String(""); 250 label_1: 251 while (true) { 252 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 253 case ALL: 254 case DISTINCT: 255 ; 256 break; 257 default: 258 jj_la1[3] = jj_gen; 259 break label_1; 260 } 261 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 262 case ALL: 263 jj_consume_token(ALL); 264 rs = rs + " ALL "; 265 break; 266 case DISTINCT: 267 jj_consume_token(DISTINCT); 268 rs = rs + " DISTINCT "; 269 break; 270 default: 271 jj_la1[4] = jj_gen; 272 jj_consume_token(-1); 273 throw new ParseException(); 274 } 275 } 276 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 277 case ASTERISK: 278 jj_consume_token(ASTERISK); 279 idName = "*"; 280 break; 281 case ID: 282 idName = SQLLvalueTerm(); 283 break; 284 default: 285 jj_la1[5] = jj_gen; 286 jj_consume_token(-1); 287 throw new ParseException(); 288 } 289 selectColAndAlias = idName; 290 int index = idName.indexOf('.'); 291 if (index == -1) { 292 selectColName = idName; 293 selectColAlias = null; 294 } 295 else { 296 selectColName = idName.substring(index+1, idName.length()); 297 selectColAlias = idName.substring(0, index); 298 } 299 /* 300 if ((!(selectColName.equalsIgnoreCase("id") || (selectColName.equalsIgnoreCase("*")) ) { 301 throw new ParseException("Invalid select column '" + selectColName + "'. The only select columns allowed is 'id' or '*'."); 302 } 303 */ 304 305 String selectCol = getSelectColumn(idName); 306 rs = rs + selectCol + " "; 307 308 {if (true) return rs;} 309 throw new Error("Missing return statement in function"); 310 } 311 312 final public String SQLTableList() throws ParseException { 313 String rs = new String(""), ts; 314 ts = SQLTableRef(); 315 rs = rs + ts; 316 label_2: 317 while (true) { 318 if (jj_2_1(2)) { 319 ; 320 } else { 321 break label_2; 322 } 323 jj_consume_token(57); 324 rs = rs + ", "; 325 ts = SQLTableRef(); 326 rs = rs + ts; 327 } 328 {if (true) return rs;} 329 throw new Error("Missing return statement in function"); 330 } 331 332 final public String SQLTableRef() throws ParseException { 333 Token tableName; 334 Token aliasName; 335 String rs = new String(""); 336 tableName = jj_consume_token(ID); 337 tableNameStr = tableName.image; 338 339 //Be forgiving to those that use the infomodel class name rather than the 340 //SQL table name which had to be different due to the name being a reserved word in SQL 341 tableNameStr = pm.mapTableName(tableNameStr); 342 343 //Special case processing for extramural Associations 344 if (tableNameStr.equalsIgnoreCase("Association")) { 345 //??beginAssocQuery = true; 346 } 347 348 rs = rs + tableNameStr + " "; 349 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 350 case ID: 351 aliasName = jj_consume_token(ID); 352 aliasNameStr = aliasName.image; 353 rs = rs + aliasName.image + " "; 354 break; 355 default: 356 jj_la1[6] = jj_gen; 357 ; 358 } 359 if (firstTableName == null) { 360 firstTableName = tableNameStr; 361 } 362 if (aliasNameStr != null) { 363 aliasToTableNameMap.put(aliasNameStr, tableNameStr); 364 } 365 {if (true) return rs.trim();} 366 throw new Error("Missing return statement in function"); 367 } 368 369 final public String SQLWhere() throws ParseException { 370 String rs = new String(""), ts; 371 jj_consume_token(WHERE); 372 //Special case processing for extramural Associations 373 if ((beginAssocQuery) && (user != null) && (!(user.getId().equalsIgnoreCase(ac.ALIAS_REGISTRY_OPERATOR)))) { 374 beginAssocQuery = false; 375 376 String userId = user.getId(); 377 378 String pred = "(((isConfirmedBySourceOwner = true) AND (isConfirmedByTargetOwner = true)) OR "; 379 pred += " ('" + userId + "' IN (SELECT id from User_ u1 WHERE u1.id IN (SELECT user_ from AuditableEvent ae1 where ae1.registryObject = id AND ae1.eventType = 'Created'))) OR "; 380 pred += " ('" + userId + "' IN (SELECT id from User_ u2 WHERE u2.id IN (SELECT user_ from AuditableEvent ae2 where ae2.registryObject = sourceObject AND ae2.eventType = 'Created'))) OR "; 381 pred += " ('" + userId + "' IN (SELECT id from User_ u3 WHERE u3.id IN (SELECT user_ from AuditableEvent ae3 where ae3.registryObject = targetObject AND ae3.eventType = 'Created')))) "; 382 383 384 rs = rs + " WHERE " + pred + " AND "; 385 } 386 else { 387 rs = rs + " WHERE "; 388 } 389 ts = SQLOrExpr(); 390 rs = rs + ts; 391 {if (true) return rs;} 392 throw new Error("Missing return statement in function"); 393 } 394 395 final public String SQLOrExpr() throws ParseException { 396 String rs = new String(""), ts; 397 ts = SQLAndExpr(); 398 rs = rs + ts; 399 label_3: 400 while (true) { 401 if (jj_2_2(2)) { 402 ; 403 } else { 404 break label_3; 405 } 406 jj_consume_token(OR); 407 rs = rs + " OR "; 408 ts = SQLAndExpr(); 409 rs = rs + ts; 410 } 411 {if (true) return rs;} 412 throw new Error("Missing return statement in function"); 413 } 414 415 final public String SQLAndExpr() throws ParseException { 416 String rs = new String(""), ts; 417 ts = SQLNotExpr(); 418 rs = rs + ts; 419 label_4: 420 while (true) { 421 if (jj_2_3(2)) { 422 ; 423 } else { 424 break label_4; 425 } 426 jj_consume_token(AND); 427 rs = rs + " AND "; 428 ts = SQLNotExpr(); 429 rs = rs + ts; 430 } 431 {if (true) return rs;} 432 throw new Error("Missing return statement in function"); 433 } 434 435 final public String SQLNotExpr() throws ParseException { 436 String rs = new String(""), ts; 437 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 438 case NOT: 439 jj_consume_token(NOT); 440 rs = rs + " NOT "; 441 break; 442 default: 443 jj_la1[7] = jj_gen; 444 ; 445 } 446 ts = SQLCompareExpr(); 447 rs = rs + ts; 448 {if (true) return rs;} 449 throw new Error("Missing return statement in function"); 450 } 451 452 final public String SQLCompareExpr() throws ParseException { 453 String rs = new String(""), ts; 454 if (jj_2_4(2147483647)) { 455 ts = SQLIsClause(); 456 rs = rs + ts; 457 } else { 458 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 459 case UPPER: 460 case INTEGER_LITERAL: 461 case FLOATING_POINT_LITERAL: 462 case STRING_LITERAL: 463 case ID: 464 case OPENPAREN: 465 case PLUS: 466 case MINUS: 467 ts = SQLSumExpr(); 468 rs = rs + ts; 469 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 470 case IN: 471 case LIKE: 472 case NOT: 473 case LESS: 474 case LESSEQUAL: 475 case GREATER: 476 case GREATEREQUAL: 477 case EQUAL: 478 case NOTEQUAL: 479 case NOTEQUAL2: 480 ts = SQLCompareExprRight(); 481 rs = rs + ts; 482 break; 483 default: 484 jj_la1[8] = jj_gen; 485 ; 486 } 487 break; 488 default: 489 jj_la1[9] = jj_gen; 490 jj_consume_token(-1); 491 throw new ParseException(); 492 } 493 } 494 {if (true) return rs;} 495 throw new Error("Missing return statement in function"); 496 } 497 498 final public String SQLCompareExprRight() throws ParseException { 499 String rs = new String(""), ts; 500 if (jj_2_5(2)) { 501 ts = SQLLikeClause(); 502 rs = rs + ts; 503 } else if (jj_2_6(2)) { 504 ts = SQLInClause(); 505 rs = rs + ts; 506 } else { 507 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 508 case LESS: 509 case LESSEQUAL: 510 case GREATER: 511 case GREATEREQUAL: 512 case EQUAL: 513 case NOTEQUAL: 514 case NOTEQUAL2: 515 ts = SQLCompareOp(); 516 rs = rs + ts; 517 ts = SQLSumExpr(); 518 rs = rs + ts; 519 break; 520 default: 521 jj_la1[10] = jj_gen; 522 jj_consume_token(-1); 523 throw new ParseException(); 524 } 525 } 526 {if (true) return rs;} 527 throw new Error("Missing return statement in function"); 528 } 529 530 final public String SQLCompareOp() throws ParseException { 531 String rs = new String(""); 532 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 533 case EQUAL: 534 jj_consume_token(EQUAL); 535 rs = rs + " = "; 536 break; 537 case NOTEQUAL: 538 jj_consume_token(NOTEQUAL); 539 rs = rs + " <> "; 540 break; 541 case NOTEQUAL2: 542 jj_consume_token(NOTEQUAL2); 543 rs = rs + " <> "; 544 break; 545 case GREATER: 546 jj_consume_token(GREATER); 547 rs = rs + " > "; 548 break; 549 case GREATEREQUAL: 550 jj_consume_token(GREATEREQUAL); 551 rs = rs + " >= "; 552 break; 553 case LESS: 554 jj_consume_token(LESS); 555 rs = rs + " < "; 556 break; 557 case LESSEQUAL: 558 jj_consume_token(LESSEQUAL); 559 rs = rs + " <= "; 560 break; 561 default: 562 jj_la1[11] = jj_gen; 563 jj_consume_token(-1); 564 throw new ParseException(); 565 } 566 {if (true) return rs;} 567 throw new Error("Missing return statement in function"); 568 } 569 570 final public String SQLFunction() throws ParseException { 571 Token otherFunction; 572 String rs = new String(""), ts; 573 jj_consume_token(UPPER); 574 rs = rs + " UPPER "; 575 ts = SQLFunctionArgs(); 576 rs = rs + ts; 577 {if (true) return rs;} 578 throw new Error("Missing return statement in function"); 579 } 580 581 final public String SQLFunctionArgs() throws ParseException { 582 String rs = new String(""), ts; 583 jj_consume_token(OPENPAREN); 584 rs = rs + " ( "; 585 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 586 case UPPER: 587 case INTEGER_LITERAL: 588 case FLOATING_POINT_LITERAL: 589 case STRING_LITERAL: 590 case ID: 591 case OPENPAREN: 592 case PLUS: 593 case MINUS: 594 ts = SQLSumExpr(); 595 rs = rs + ts; 596 label_5: 597 while (true) { 598 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 599 case 57: 600 ; 601 break; 602 default: 603 jj_la1[12] = jj_gen; 604 break label_5; 605 } 606 jj_consume_token(57); 607 rs = rs + ", "; 608 ts = SQLSumExpr(); 609 rs = rs + ts; 610 } 611 break; 612 default: 613 jj_la1[13] = jj_gen; 614 ; 615 } 616 jj_consume_token(CLOSEPAREN); 617 rs = rs + " ) "; {if (true) return rs;} 618 throw new Error("Missing return statement in function"); 619 } 620 621 final public String SQLInClause() throws ParseException { 622 String rs = new String(""), ts; 623 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 624 case NOT: 625 jj_consume_token(NOT); 626 rs = rs + " NOT "; 627 break; 628 default: 629 jj_la1[14] = jj_gen; 630 ; 631 } 632 jj_consume_token(IN); 633 rs = rs + " IN "; 634 jj_consume_token(OPENPAREN); 635 rs = rs + "( "; inINClause = true; 636 ts = SQLLValueListOrProcedureCall(); 637 rs = rs + ts; 638 jj_consume_token(CLOSEPAREN); 639 rs = rs + ") "; inINClause = true; 640 {if (true) return rs;} 641 throw new Error("Missing return statement in function"); 642 } 643 644 final public String SQLLValueListOrProcedureCall() throws ParseException { 645 String rs = new String(""), ts; 646 if (jj_2_7(2)) { 647 ts = ProcedureCall(); 648 rs = rs + ts; 649 } else if (jj_2_8(2)) { 650 ts = SQLLValueList(); 651 rs = rs + ts; 652 } else { 653 jj_consume_token(-1); 654 throw new ParseException(); 655 } 656 {if (true) return rs;} 657 throw new Error("Missing return statement in function"); 658 } 659 660 final public String ProcedureCall() throws ParseException { 661 String rs = new String(""), ts; 662 Token procName = null; 663 Token param = null; 664 procName = jj_consume_token(ID); 665 jj_consume_token(OPENPAREN); 666 param = jj_consume_token(STRING_LITERAL); 667 jj_consume_token(CLOSEPAREN); 668 669 String id = param.image.substring(1, param.image.length()-1); 670 671 String sqlQuery = null; 672 String tableName = null; 673 674 if (procName.image.equalsIgnoreCase("RegistryObject_auditTrail")) { 675 sqlQuery = "SELECT id FROM AuditableEvent WHERE registryObject = '" + id + "' "; 676 tableName = "AuditableEvent"; 677 } 678 else if (procName.image.equalsIgnoreCase("RegistryObject_externalLinks")) { 679 sqlQuery = "SELECT sourceObject FROM Association WHERE associationType = 'ExternallyLinks' AND targetObject = '" + id + "' "; 680 tableName = "Association"; 681 } 682 else if (procName.image.equalsIgnoreCase("RegistryObject_externalIdentifiers")) { 683 sqlQuery = "SELECT id FROM ExternalIdentifier WHERE registryObject = '" + id + "' "; 684 tableName = "ExternalIdentifier"; 685 } 686 else if (procName.image.equalsIgnoreCase("RegistryObject_classifications")) { 687 sqlQuery = "SELECT id FROM Classification WHERE classifiedObject = '" + id + "' "; 688 tableName = "Classification"; 689 } 690 else if (procName.image.equalsIgnoreCase("RegistryObject_registryPackages")) { 691 sqlQuery = "SELECT sourceObject FROM Association WHERE associationType = 'HasMember' AND targetObject = '" + id + "' "; 692 tableName = "Association"; 693 } 694 else if (procName.image.equalsIgnoreCase("RegistryPackage_memberObjects")) { 695 sqlQuery = "SELECT targetObject FROM Association WHERE associationType = 'HasMember' AND sourceObject = '" + id + "' "; 696 tableName = "Association"; 697 } 698 else if (procName.image.equalsIgnoreCase("ExternalLink_linkedObjects")) { 699 sqlQuery = "SELECT targetObject FROM Association WHERE associationType = 'ExternallyLinks' AND sourceObject = '" + id + "' "; 700 tableName = "Association"; 701 } 702 else if (procName.image.equalsIgnoreCase("ClassificationNode_classifiedObjects")) { 703 sqlQuery = "SELECT classifiedObject FROM ClassificationNode WHERE id = '" + id + "' "; 704 tableName = "Association"; 705 } 706 else { 707 {if (true) throw new ParseException("Invalid stored procedure name " + procName.image);} 708 } 709 710 /* 711 ResponseOption responseOption = new ResponseOption(); 712 responseOption.setReturnType(ReturnTypeType.OBJECTREF); 713 responseOption.setReturnComposedObjects(false); 714 715 ArrayList ids = null; 716 try { 717 ids = pm.executeSQLQuery(sqlQuery, responseOption, tableName); 718 } 719 catch (RegistryException e) { 720 e.printStackTrace(); 721 throw new ParseException(e.toString()); 722 } 723 724 Iterator iter = ids.iterator(); 725 726 while(iter.hasNext()) { 727 ObjectRef or = (ObjectRef)iter.next(); 728 String id_ = or.getId(); 729 730 if (iter.hasNext()) { 731 rs = rs + "'" + id_ + "', "; 732 } 733 else { 734 rs = rs + "'" + id_ + "' "; 735 } 736 } 737 */ 738 739 rs = sqlQuery; 740 741 {if (true) return rs;} 742 throw new Error("Missing return statement in function"); 743 } 744 745 final public String SQLLValueList() throws ParseException { 746 String rs = new String(""), ts; 747 ts = SQLLValueElement(); 748 rs = rs + ts; 749 label_6: 750 while (true) { 751 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 752 case 57: 753 ; 754 break; 755 default: 756 jj_la1[15] = jj_gen; 757 break label_6; 758 } 759 jj_consume_token(57); 760 rs = rs + ", "; 761 ts = SQLLValueElement(); 762 rs = rs + ts; 763 } 764 {if (true) return rs;} 765 throw new Error("Missing return statement in function"); 766 } 767 768 final public String SQLLValueElement() throws ParseException { 769 String rs = new String(""), ts; 770 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 771 case NULL: 772 jj_consume_token(NULL); 773 rs = rs + " NULL "; 774 break; 775 case UPPER: 776 case INTEGER_LITERAL: 777 case FLOATING_POINT_LITERAL: 778 case STRING_LITERAL: 779 case ID: 780 case OPENPAREN: 781 case PLUS: 782 case MINUS: 783 ts = SQLSumExpr(); 784 rs = rs + ts; 785 break; 786 case SELECT: 787 ts = SQLSelect(); 788 rs = rs + ts; 789 break; 790 default: 791 jj_la1[16] = jj_gen; 792 jj_consume_token(-1); 793 throw new ParseException(); 794 } 795 {if (true) return rs;} 796 throw new Error("Missing return statement in function"); 797 } 798 799 final public String SQLIsClause() throws ParseException { 800 String rs = new String(""), ts; 801 ts = SQLColRef(); 802 rs = rs + ts; 803 jj_consume_token(IS); 804 rs = rs + " IS "; 805 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 806 case NOT: 807 jj_consume_token(NOT); 808 rs = rs + " NOT "; 809 break; 810 default: 811 jj_la1[17] = jj_gen; 812 ; 813 } 814 jj_consume_token(NULL); 815 rs = rs + " NULL "; 816 {if (true) return rs;} 817 throw new Error("Missing return statement in function"); 818 } 819 820 final public String SQLLikeClause() throws ParseException { 821 String rs = new String(""), ts; 822 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 823 case NOT: 824 jj_consume_token(NOT); 825 rs = rs + " NOT "; 826 break; 827 default: 828 jj_la1[18] = jj_gen; 829 ; 830 } 831 jj_consume_token(LIKE); 832 rs = rs + " LIKE "; 833 ts = SQLPattern(); 834 rs = rs + ts; 835 {if (true) return rs;} 836 throw new Error("Missing return statement in function"); 837 } 838 839 final public String SQLPattern() throws ParseException { 840 Token x; 841 String rs = new String(""), ts; 842 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 843 case STRING_LITERAL: 844 x = jj_consume_token(STRING_LITERAL); 845 rs = rs + x.image + " "; 846 break; 847 case QUESTIONMARK: 848 jj_consume_token(QUESTIONMARK); 849 rs = rs + "?"; 850 break; 851 case ID: 852 ts = SQLLvalue(); 853 rs = rs + ts; 854 break; 855 case UPPER: 856 ts = SQLFunction(); 857 rs = rs + ts; 858 break; 859 default: 860 jj_la1[19] = jj_gen; 861 jj_consume_token(-1); 862 throw new ParseException(); 863 } 864 {if (true) return rs;} 865 throw new Error("Missing return statement in function"); 866 } 867 868 final public String SQLColRef() throws ParseException { 869 Token columnName; 870 String s, rs = new String(""); 871 s = SQLLvalue(); 872 //Be forgiving to those that use the infomodel attribute name rather than the 873 //SQL column name which had to be different due to the name being a reserved word in SQL 874 s = pm.mapColumnName(s); 875 rs = (rs + s).trim(); 876 877 if ((!inINClause) && (!isPrimitiveAttribute(rs))) { 878 {if (true) throw new ParseException("Invalid Query: Collection attribute " + rs + " is only valid in an IN clause");} 879 } 880 else if ((inINClause) && (!isPrimitiveAttribute(rs))) { 881 //Need to map collection attribute to a list of IDs 882 rs = mapCollectionAttributeToIdList(rs); 883 } 884 885 {if (true) return rs;} 886 throw new Error("Missing return statement in function"); 887 } 888 889 final public String SQLLvalue() throws ParseException { 890 Token x, y; 891 String s = new String(""), t; 892 t = SQLLvalueTerm(); 893 s = s + t + " "; 894 {if (true) return s;} 895 throw new Error("Missing return statement in function"); 896 } 897 898 final public String SQLLvalueTerm() throws ParseException { 899 Token x, y; 900 String s = new String(""); 901 x = jj_consume_token(ID); 902 s = x.image + " "; 903 label_7: 904 while (true) { 905 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 906 case DOT: 907 ; 908 break; 909 default: 910 jj_la1[20] = jj_gen; 911 break label_7; 912 } 913 jj_consume_token(DOT); 914 y = jj_consume_token(ID); 915 s = s.trim() + "."; 916 s = s + pm.mapColumnName(y.image) + " "; 917 } 918 {if (true) return s;} 919 throw new Error("Missing return statement in function"); 920 } 921 922 final public String SQLSumExpr() throws ParseException { 923 String rs = new String(""), ts; 924 ts = SQLProductExpr(); 925 rs = rs + ts; 926 label_8: 927 while (true) { 928 if (jj_2_9(2)) { 929 ; 930 } else { 931 break label_8; 932 } 933 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 934 case PLUS: 935 jj_consume_token(PLUS); 936 rs = rs + "+ "; 937 break; 938 case MINUS: 939 jj_consume_token(MINUS); 940 rs = rs + "- "; 941 break; 942 default: 943 jj_la1[21] = jj_gen; 944 jj_consume_token(-1); 945 throw new ParseException(); 946 } 947 ts = SQLProductExpr(); 948 rs = rs + ts; 949 } 950 {if (true) return rs;} 951 throw new Error("Missing return statement in function"); 952 } 953 954 final public String SQLProductExpr() throws ParseException { 955 String rs = new String(""), ts; 956 ts = SQLUnaryExpr(); 957 rs = rs + ts; 958 label_9: 959 while (true) { 960 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 961 case ASTERISK: 962 case SLASH: 963 ; 964 break; 965 default: 966 jj_la1[22] = jj_gen; 967 break label_9; 968 } 969 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 970 case ASTERISK: 971 jj_consume_token(ASTERISK); 972 rs = rs + "* "; 973 break; 974 case SLASH: 975 jj_consume_token(SLASH); 976 rs = rs + "/ "; 977 break; 978 default: 979 jj_la1[23] = jj_gen; 980 jj_consume_token(-1); 981 throw new ParseException(); 982 } 983 ts = SQLUnaryExpr(); 984 rs = rs + ts; 985 } 986 {if (true) return rs;} 987 throw new Error("Missing return statement in function"); 988 } 989 990 final public String SQLUnaryExpr() throws ParseException { 991 String rs = new String(""), ts; 992 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 993 case PLUS: 994 case MINUS: 995 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 996 case PLUS: 997 jj_consume_token(PLUS); 998 rs = rs + "+ "; 999 break; 1000 case MINUS: 1001 jj_consume_token(MINUS); 1002 rs = rs + "- "; 1003 break; 1004 default: 1005 jj_la1[24] = jj_gen; 1006 jj_consume_token(-1); 1007 throw new ParseException(); 1008 } 1009 break; 1010 default: 1011 jj_la1[25] = jj_gen; 1012 ; 1013 } 1014 ts = SQLTerm(); 1015 rs = rs + ts; 1016 {if (true) return rs;} 1017 throw new Error("Missing return statement in function"); 1018 } 1019 1020 final public String SQLTerm() throws ParseException { 1021 Token other; 1022 String rs = new String(""), ts; 1023 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1024 case OPENPAREN: 1025 jj_consume_token(OPENPAREN); 1026 rs = rs + "( "; 1027 ts = SQLOrExpr(); 1028 rs = rs + ts; 1029 jj_consume_token(CLOSEPAREN); 1030 rs = rs + ") "; 1031 break; 1032 case ID: 1033 ts = SQLColRef(); 1034 rs = rs + ts; 1035 break; 1036 case INTEGER_LITERAL: 1037 case FLOATING_POINT_LITERAL: 1038 case STRING_LITERAL: 1039 ts = SQLLiteral(); 1040 rs = rs + ts; 1041 break; 1042 case UPPER: 1043 ts = SQLFunction(); 1044 rs = rs + ts; 1045 break; 1046 default: 1047 jj_la1[26] = jj_gen; 1048 jj_consume_token(-1); 1049 throw new ParseException(); 1050 } 1051 {if (true) return rs;} 1052 throw new Error("Missing return statement in function"); 1053 } 1054 1055 final public String SQLLiteral() throws ParseException { 1056 Token x; 1057 String rs = new String(""); 1058 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1059 case STRING_LITERAL: 1060 x = jj_consume_token(STRING_LITERAL); 1061 rs = rs + x.image + " "; 1062 break; 1063 case INTEGER_LITERAL: 1064 x = jj_consume_token(INTEGER_LITERAL); 1065 rs = rs + x.image + " "; 1066 break; 1067 case FLOATING_POINT_LITERAL: 1068 x = jj_consume_token(FLOATING_POINT_LITERAL); 1069 rs = rs + x.image + " "; 1070 break; 1071 default: 1072 jj_la1[27] = jj_gen; 1073 jj_consume_token(-1); 1074 throw new ParseException(); 1075 } 1076 {if (true) return rs;} 1077 throw new Error("Missing return statement in function"); 1078 } 1079 1080 final public String SQLOrderBy() throws ParseException { 1081 String rs = new String(""), ts; 1082 jj_consume_token(ORDER); 1083 jj_consume_token(BY); 1084 rs = rs + "ORDER BY "; 1085 ts = SQLOrderByList(); 1086 rs = rs + ts; 1087 {if (true) return rs;} 1088 throw new Error("Missing return statement in function"); 1089 } 1090 1091 final public String SQLOrderByElem() throws ParseException { 1092 String rs = new String(""), ts; 1093 ts = SQLColRef(); 1094 rs = rs + ts; 1095 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1096 case ASC: 1097 case DESC: 1098 ts = SQLOrderDirection(); 1099 rs = rs + ts; 1100 break; 1101 default: 1102 jj_la1[28] = jj_gen; 1103 ; 1104 } 1105 {if (true) return rs;} 1106 throw new Error("Missing return statement in function"); 1107 } 1108 1109 final public String SQLOrderByList() throws ParseException { 1110 String rs = new String(""), ts; 1111 ts = SQLOrderByElem(); 1112 rs = rs + ts; 1113 label_10: 1114 while (true) { 1115 if (jj_2_10(2)) { 1116 ; 1117 } else { 1118 break label_10; 1119 } 1120 jj_consume_token(57); 1121 rs = rs + ", "; 1122 ts = SQLOrderByElem(); 1123 rs = rs + ts; 1124 } 1125 {if (true) return rs;} 1126 throw new Error("Missing return statement in function"); 1127 } 1128 1129 final public String SQLOrderDirection() throws ParseException { 1130 String rs = new String(""); 1131 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { 1132 case ASC: 1133 jj_consume_token(ASC); 1134 rs = rs + " ASC"; 1135 break; 1136 case DESC: 1137 jj_consume_token(DESC); 1138 rs = rs + " DESC"; 1139 break; 1140 default: 1141 jj_la1[29] = jj_gen; 1142 jj_consume_token(-1); 1143 throw new ParseException(); 1144 } 1145 {if (true) return rs;} 1146 throw new Error("Missing return statement in function"); 1147 } 1148 1149 final private boolean jj_2_1(int xla) { 1150 jj_la = xla; jj_lastpos = jj_scanpos = token; 1151 boolean retval = !jj_3_1(); 1152 jj_save(0, xla); 1153 return retval; 1154 } 1155 1156 final private boolean jj_2_2(int xla) { 1157 jj_la = xla; jj_lastpos = jj_scanpos = token; 1158 boolean retval = !jj_3_2(); 1159 jj_save(1, xla); 1160 return retval; 1161 } 1162 1163 final private boolean jj_2_3(int xla) { 1164 jj_la = xla; jj_lastpos = jj_scanpos = token; 1165 boolean retval = !jj_3_3(); 1166 jj_save(2, xla); 1167 return retval; 1168 } 1169 1170 final private boolean jj_2_4(int xla) { 1171 jj_la = xla; jj_lastpos = jj_scanpos = token; 1172 boolean retval = !jj_3_4(); 1173 jj_save(3, xla); 1174 return retval; 1175 } 1176 1177 final private boolean jj_2_5(int xla) { 1178 jj_la = xla; jj_lastpos = jj_scanpos = token; 1179 boolean retval = !jj_3_5(); 1180 jj_save(4, xla); 1181 return retval; 1182 } 1183 1184 final private boolean jj_2_6(int xla) { 1185 jj_la = xla; jj_lastpos = jj_scanpos = token; 1186 boolean retval = !jj_3_6(); 1187 jj_save(5, xla); 1188 return retval; 1189 } 1190 1191 final private boolean jj_2_7(int xla) { 1192 jj_la = xla; jj_lastpos = jj_scanpos = token; 1193 boolean retval = !jj_3_7(); 1194 jj_save(6, xla); 1195 return retval; 1196 } 1197 1198 final private boolean jj_2_8(int xla) { 1199 jj_la = xla; jj_lastpos = jj_scanpos = token; 1200 boolean retval = !jj_3_8(); 1201 jj_save(7, xla); 1202 return retval; 1203 } 1204 1205 final private boolean jj_2_9(int xla) { 1206 jj_la = xla; jj_lastpos = jj_scanpos = token; 1207 boolean retval = !jj_3_9(); 1208 jj_save(8, xla); 1209 return retval; 1210 } 1211 1212 final private boolean jj_2_10(int xla) { 1213 jj_la = xla; jj_lastpos = jj_scanpos = token; 1214 boolean retval = !jj_3_10(); 1215 jj_save(9, xla); 1216 return retval; 1217 } 1218 1219 final private boolean jj_3R_54() { 1220 if (jj_3R_47()) return true; 1221 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1222 return false; 1223 } 1224 1225 final private boolean jj_3R_14() { 1226 if (jj_3R_25()) return true; 1227 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1228 return false; 1229 } 1230 1231 final private boolean jj_3R_53() { 1232 if (jj_3R_56()) return true; 1233 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1234 return false; 1235 } 1236 1237 final private boolean jj_3R_60() { 1238 if (jj_3R_34()) return true; 1239 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1240 return false; 1241 } 1242 1243 final private boolean jj_3R_52() { 1244 if (jj_3R_14()) return true; 1245 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1246 return false; 1247 } 1248 1249 final private boolean jj_3R_59() { 1250 if (jj_scan_token(ASTERISK)) return true; 1251 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1252 return false; 1253 } 1254 1255 final private boolean jj_3R_47() { 1256 if (jj_scan_token(UPPER)) return true; 1257 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1258 if (jj_3R_69()) return true; 1259 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1260 return false; 1261 } 1262 1263 final private boolean jj_3R_51() { 1264 if (jj_scan_token(OPENPAREN)) return true; 1265 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1266 if (jj_3R_68()) return true; 1267 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1268 return false; 1269 } 1270 1271 final private boolean jj_3R_43() { 1272 Token xsp; 1273 xsp = jj_scanpos; 1274 if (jj_3R_51()) { 1275 jj_scanpos = xsp; 1276 if (jj_3R_52()) { 1277 jj_scanpos = xsp; 1278 if (jj_3R_53()) { 1279 jj_scanpos = xsp; 1280 if (jj_3R_54()) return true; 1281 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1282 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1283 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1284 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1285 return false; 1286 } 1287 1288 final private boolean jj_3R_38() { 1289 if (jj_3R_47()) return true; 1290 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1291 return false; 1292 } 1293 1294 final private boolean jj_3R_67() { 1295 if (jj_scan_token(DISTINCT)) return true; 1296 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1297 return false; 1298 } 1299 1300 final private boolean jj_3R_66() { 1301 if (jj_scan_token(ALL)) return true; 1302 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1303 return false; 1304 } 1305 1306 final private boolean jj_3R_58() { 1307 Token xsp; 1308 xsp = jj_scanpos; 1309 if (jj_3R_66()) { 1310 jj_scanpos = xsp; 1311 if (jj_3R_67()) return true; 1312 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1313 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1314 return false; 1315 } 1316 1317 final private boolean jj_3R_37() { 1318 if (jj_3R_25()) return true; 1319 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1320 return false; 1321 } 1322 1323 final private boolean jj_3R_36() { 1324 if (jj_scan_token(QUESTIONMARK)) return true; 1325 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1326 return false; 1327 } 1328 1329 final private boolean jj_3R_55() { 1330 Token xsp; 1331 while (true) { 1332 xsp = jj_scanpos; 1333 if (jj_3R_58()) { jj_scanpos = xsp; break; } 1334 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1335 } 1336 xsp = jj_scanpos; 1337 if (jj_3R_59()) { 1338 jj_scanpos = xsp; 1339 if (jj_3R_60()) return true; 1340 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1341 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1342 return false; 1343 } 1344 1345 final private boolean jj_3R_50() { 1346 if (jj_scan_token(MINUS)) return true; 1347 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1348 return false; 1349 } 1350 1351 final private boolean jj_3R_35() { 1352 if (jj_scan_token(STRING_LITERAL)) return true; 1353 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1354 return false; 1355 } 1356 1357 final private boolean jj_3R_49() { 1358 if (jj_scan_token(PLUS)) return true; 1359 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1360 return false; 1361 } 1362 1363 final private boolean jj_3R_27() { 1364 Token xsp; 1365 xsp = jj_scanpos; 1366 if (jj_3R_35()) { 1367 jj_scanpos = xsp; 1368 if (jj_3R_36()) { 1369 jj_scanpos = xsp; 1370 if (jj_3R_37()) { 1371 jj_scanpos = xsp; 1372 if (jj_3R_38()) return true; 1373 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1374 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1375 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1376 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1377 return false; 1378 } 1379 1380 final private boolean jj_3R_42() { 1381 Token xsp; 1382 xsp = jj_scanpos; 1383 if (jj_3R_49()) { 1384 jj_scanpos = xsp; 1385 if (jj_3R_50()) return true; 1386 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1387 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1388 return false; 1389 } 1390 1391 final private boolean jj_3R_20() { 1392 if (jj_scan_token(MINUS)) return true; 1393 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1394 return false; 1395 } 1396 1397 final private boolean jj_3R_19() { 1398 if (jj_scan_token(PLUS)) return true; 1399 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1400 return false; 1401 } 1402 1403 final private boolean jj_3R_31() { 1404 Token xsp; 1405 xsp = jj_scanpos; 1406 if (jj_3R_42()) jj_scanpos = xsp; 1407 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1408 if (jj_3R_43()) return true; 1409 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1410 return false; 1411 } 1412 1413 final private boolean jj_3R_65() { 1414 if (jj_scan_token(SLASH)) return true; 1415 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1416 return false; 1417 } 1418 1419 final private boolean jj_3R_64() { 1420 if (jj_scan_token(ASTERISK)) return true; 1421 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1422 return false; 1423 } 1424 1425 final private boolean jj_3R_26() { 1426 if (jj_scan_token(NOT)) return true; 1427 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1428 return false; 1429 } 1430 1431 final private boolean jj_3R_57() { 1432 Token xsp; 1433 xsp = jj_scanpos; 1434 if (jj_3R_64()) { 1435 jj_scanpos = xsp; 1436 if (jj_3R_65()) return true; 1437 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1438 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1439 return false; 1440 } 1441 1442 final private boolean jj_3R_15() { 1443 Token xsp; 1444 xsp = jj_scanpos; 1445 if (jj_3R_26()) jj_scanpos = xsp; 1446 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1447 if (jj_scan_token(LIKE)) return true; 1448 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1449 if (jj_3R_27()) return true; 1450 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1451 return false; 1452 } 1453 1454 final private boolean jj_3_4() { 1455 if (jj_3R_14()) return true; 1456 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1457 if (jj_scan_token(IS)) return true; 1458 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1459 return false; 1460 } 1461 1462 final private boolean jj_3_6() { 1463 if (jj_3R_16()) return true; 1464 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1465 return false; 1466 } 1467 1468 final private boolean jj_3_5() { 1469 if (jj_3R_15()) return true; 1470 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1471 return false; 1472 } 1473 1474 final private boolean jj_3R_21() { 1475 if (jj_3R_31()) return true; 1476 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1477 Token xsp; 1478 while (true) { 1479 xsp = jj_scanpos; 1480 if (jj_3R_57()) { jj_scanpos = xsp; break; } 1481 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1482 } 1483 return false; 1484 } 1485 1486 final private boolean jj_3_9() { 1487 Token xsp; 1488 xsp = jj_scanpos; 1489 if (jj_3R_19()) { 1490 jj_scanpos = xsp; 1491 if (jj_3R_20()) return true; 1492 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1493 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1494 if (jj_3R_21()) return true; 1495 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1496 return false; 1497 } 1498 1499 final private boolean jj_3R_45() { 1500 if (jj_3R_21()) return true; 1501 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1502 Token xsp; 1503 while (true) { 1504 xsp = jj_scanpos; 1505 if (jj_3_9()) { jj_scanpos = xsp; break; } 1506 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1507 } 1508 return false; 1509 } 1510 1511 final private boolean jj_3R_33() { 1512 if (jj_3R_45()) return true; 1513 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1514 return false; 1515 } 1516 1517 final private boolean jj_3R_32() { 1518 if (jj_3R_44()) return true; 1519 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1520 return false; 1521 } 1522 1523 final private boolean jj_3R_44() { 1524 if (jj_3R_14()) return true; 1525 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1526 return false; 1527 } 1528 1529 final private boolean jj_3R_48() { 1530 if (jj_scan_token(SELECT)) return true; 1531 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1532 if (jj_3R_55()) return true; 1533 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1534 return false; 1535 } 1536 1537 final private boolean jj_3R_24() { 1538 Token xsp; 1539 xsp = jj_scanpos; 1540 if (jj_3R_32()) { 1541 jj_scanpos = xsp; 1542 if (jj_3R_33()) return true; 1543 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1544 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1545 return false; 1546 } 1547 1548 final private boolean jj_3R_41() { 1549 if (jj_3R_48()) return true; 1550 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1551 return false; 1552 } 1553 1554 final private boolean jj_3R_40() { 1555 if (jj_3R_45()) return true; 1556 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1557 return false; 1558 } 1559 1560 final private boolean jj_3R_39() { 1561 if (jj_scan_token(NULL)) return true; 1562 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1563 return false; 1564 } 1565 1566 final private boolean jj_3R_46() { 1567 if (jj_scan_token(DOT)) return true; 1568 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1569 if (jj_scan_token(ID)) return true; 1570 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1571 return false; 1572 } 1573 1574 final private boolean jj_3R_17() { 1575 if (jj_scan_token(ID)) return true; 1576 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1577 if (jj_scan_token(OPENPAREN)) return true; 1578 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1579 return false; 1580 } 1581 1582 final private boolean jj_3R_29() { 1583 Token xsp; 1584 xsp = jj_scanpos; 1585 if (jj_3R_39()) { 1586 jj_scanpos = xsp; 1587 if (jj_3R_40()) { 1588 jj_scanpos = xsp; 1589 if (jj_3R_41()) return true; 1590 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1591 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1592 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1593 return false; 1594 } 1595 1596 final private boolean jj_3_10() { 1597 if (jj_scan_token(57)) return true; 1598 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1599 if (jj_3R_22()) return true; 1600 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1601 return false; 1602 } 1603 1604 final private boolean jj_3R_34() { 1605 if (jj_scan_token(ID)) return true; 1606 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1607 Token xsp; 1608 while (true) { 1609 xsp = jj_scanpos; 1610 if (jj_3R_46()) { jj_scanpos = xsp; break; } 1611 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1612 } 1613 return false; 1614 } 1615 1616 final private boolean jj_3R_11() { 1617 if (jj_scan_token(ID)) return true; 1618 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1619 return false; 1620 } 1621 1622 final private boolean jj_3R_23() { 1623 if (jj_scan_token(NOT)) return true; 1624 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1625 return false; 1626 } 1627 1628 final private boolean jj_3R_13() { 1629 Token xsp; 1630 xsp = jj_scanpos; 1631 if (jj_3R_23()) jj_scanpos = xsp; 1632 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1633 if (jj_3R_24()) return true; 1634 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1635 return false; 1636 } 1637 1638 final private boolean jj_3R_30() { 1639 if (jj_scan_token(57)) return true; 1640 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1641 return false; 1642 } 1643 1644 final private boolean jj_3_8() { 1645 if (jj_3R_18()) return true; 1646 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1647 return false; 1648 } 1649 1650 final private boolean jj_3R_18() { 1651 if (jj_3R_29()) return true; 1652 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1653 Token xsp; 1654 while (true) { 1655 xsp = jj_scanpos; 1656 if (jj_3R_30()) { jj_scanpos = xsp; break; } 1657 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1658 } 1659 return false; 1660 } 1661 1662 final private boolean jj_3_7() { 1663 if (jj_3R_17()) return true; 1664 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1665 return false; 1666 } 1667 1668 final private boolean jj_3R_22() { 1669 if (jj_3R_14()) return true; 1670 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1671 return false; 1672 } 1673 1674 final private boolean jj_3_3() { 1675 if (jj_scan_token(AND)) return true; 1676 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1677 if (jj_3R_13()) return true; 1678 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1679 return false; 1680 } 1681 1682 final private boolean jj_3_1() { 1683 if (jj_scan_token(57)) return true; 1684 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1685 if (jj_3R_11()) return true; 1686 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1687 return false; 1688 } 1689 1690 final private boolean jj_3R_25() { 1691 if (jj_3R_34()) return true; 1692 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1693 return false; 1694 } 1695 1696 final private boolean jj_3R_12() { 1697 if (jj_3R_13()) return true; 1698 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1699 return false; 1700 } 1701 1702 final private boolean jj_3R_28() { 1703 if (jj_scan_token(NOT)) return true; 1704 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1705 return false; 1706 } 1707 1708 final private boolean jj_3R_16() { 1709 Token xsp; 1710 xsp = jj_scanpos; 1711 if (jj_3R_28()) jj_scanpos = xsp; 1712 else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1713 if (jj_scan_token(IN)) return true; 1714 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1715 if (jj_scan_token(OPENPAREN)) return true; 1716 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1717 return false; 1718 } 1719 1720 final private boolean jj_3_2() { 1721 if (jj_scan_token(OR)) return true; 1722 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1723 if (jj_3R_12()) return true; 1724 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1725 return false; 1726 } 1727 1728 final private boolean jj_3R_63() { 1729 if (jj_scan_token(FLOATING_POINT_LITERAL)) return true; 1730 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1731 return false; 1732 } 1733 1734 final private boolean jj_3R_68() { 1735 if (jj_3R_12()) return true; 1736 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1737 return false; 1738 } 1739 1740 final private boolean jj_3R_62() { 1741 if (jj_scan_token(INTEGER_LITERAL)) return true; 1742 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1743 return false; 1744 } 1745 1746 final private boolean jj_3R_61() { 1747 if (jj_scan_token(STRING_LITERAL)) return true; 1748 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1749 return false; 1750 } 1751 1752 final private boolean jj_3R_56() { 1753 Token xsp; 1754 xsp = jj_scanpos; 1755 if (jj_3R_61()) { 1756 jj_scanpos = xsp; 1757 if (jj_3R_62()) { 1758 jj_scanpos = xsp; 1759 if (jj_3R_63()) return true; 1760 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1761 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1762 } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1763 return false; 1764 } 1765 1766 final private boolean jj_3R_69() { 1767 if (jj_scan_token(OPENPAREN)) return true; 1768 if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; 1769 return false; 1770 } 1771 1772 public SQLParserTokenManager token_source; 1773 ASCII_CharStream jj_input_stream; 1774 public Token token, jj_nt; 1775 private int jj_ntk; 1776 private Token jj_scanpos, jj_lastpos; 1777 private int jj_la; 1778 public boolean lookingAhead = false; 1779 private boolean jj_semLA; 1780 private int jj_gen; 1781 final private int[] jj_la1 = new int[30]; 1782 final private int[] jj_la1_0 = {0x0,0x80000000,0x4000000,0x2080,0x2080,0x0,0x0,0x800000,0x940000,0x40000000,0x0,0x0,0x0,0x40000000,0x800000,0x0,0x49000000,0x800000,0x800000,0x40000000,0x0,0x0,0x0,0x0,0x0,0x0,0x40000000,0x0,0x1200,0x1200,}; 1783 final private int[] jj_la1_1 = {0x200,0x0,0x0,0x0,0x0,0x100040,0x40,0x0,0x3f800,0xc4006c,0x3f800,0x3f800,0x2000000,0xc4006c,0x0,0x2000000,0xc4006c,0x0,0x0,0x1000060,0x400,0xc00000,0x300000,0x300000,0xc00000,0xc00000,0x4006c,0x2c,0x0,0x0,}; 1784 final private JJCalls[] jj_2_rtns = new JJCalls[10]; 1785 private boolean jj_rescan = false; 1786 private int jj_gc = 0; 1787 1788 public SQLParser(java.io.InputStream stream) { 1789 jj_input_stream = new ASCII_CharStream(stream, 1, 1); 1790 token_source = new SQLParserTokenManager(jj_input_stream); 1791 token = new Token(); 1792 jj_ntk = -1; 1793 jj_gen = 0; 1794 for (int i = 0; i < 30; i++) jj_la1[i] = -1; 1795 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1796 } 1797 1798 public void ReInit(java.io.InputStream stream) { 1799 jj_input_stream.ReInit(stream, 1, 1); 1800 token_source.ReInit(jj_input_stream); 1801 token = new Token(); 1802 jj_ntk = -1; 1803 jj_gen = 0; 1804 for (int i = 0; i < 30; i++) jj_la1[i] = -1; 1805 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1806 } 1807 1808 public SQLParser(java.io.Reader stream) { 1809 jj_input_stream = new ASCII_CharStream(stream, 1, 1); 1810 token_source = new SQLParserTokenManager(jj_input_stream); 1811 token = new Token(); 1812 jj_ntk = -1; 1813 jj_gen = 0; 1814 for (int i = 0; i < 30; i++) jj_la1[i] = -1; 1815 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1816 } 1817 1818 public void ReInit(java.io.Reader stream) { 1819 jj_input_stream.ReInit(stream, 1, 1); 1820 token_source.ReInit(jj_input_stream); 1821 token = new Token(); 1822 jj_ntk = -1; 1823 jj_gen = 0; 1824 for (int i = 0; i < 30; i++) jj_la1[i] = -1; 1825 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1826 } 1827 1828 public SQLParser(SQLParserTokenManager tm) { 1829 token_source = tm; 1830 token = new Token(); 1831 jj_ntk = -1; 1832 jj_gen = 0; 1833 for (int i = 0; i < 30; i++) jj_la1[i] = -1; 1834 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1835 } 1836 1837 public void ReInit(SQLParserTokenManager tm) { 1838 token_source = tm; 1839 token = new Token(); 1840 jj_ntk = -1; 1841 jj_gen = 0; 1842 for (int i = 0; i < 30; i++) jj_la1[i] = -1; 1843 for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); 1844 } 1845 1846 final private Token jj_consume_token(int kind) throws ParseException { 1847 Token oldToken; 1848 if ((oldToken = token).next != null) token = token.next; 1849 else token = token.next = token_source.getNextToken(); 1850 jj_ntk = -1; 1851 if (token.kind == kind) { 1852 jj_gen++; 1853 if (++jj_gc > 100) { 1854 jj_gc = 0; 1855 for (int i = 0; i < jj_2_rtns.length; i++) { 1856 JJCalls c = jj_2_rtns[i]; 1857 while (c != null) { 1858 if (c.gen < jj_gen) c.first = null; 1859 c = c.next; 1860 } 1861 } 1862 } 1863 return token; 1864 } 1865 token = oldToken; 1866 jj_kind = kind; 1867 throw generateParseException(); 1868 } 1869 1870 final private boolean jj_scan_token(int kind) { 1871 if (jj_scanpos == jj_lastpos) { 1872 jj_la--; 1873 if (jj_scanpos.next == null) { 1874 jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); 1875 } else { 1876 jj_lastpos = jj_scanpos = jj_scanpos.next; 1877 } 1878 } else { 1879 jj_scanpos = jj_scanpos.next; 1880 } 1881 if (jj_rescan) { 1882 int i = 0; Token tok = token; 1883 while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } 1884 if (tok != null) jj_add_error_token(kind, i); 1885 } 1886 return (jj_scanpos.kind != kind); 1887 } 1888 1889 final public Token getNextToken() { 1890 if (token.next != null) token = token.next; 1891 else token = token.next = token_source.getNextToken(); 1892 jj_ntk = -1; 1893 jj_gen++; 1894 return token; 1895 } 1896 1897 final public Token getToken(int index) { 1898 Token t = lookingAhead ? jj_scanpos : token; 1899 for (int i = 0; i < index; i++) { 1900 if (t.next != null) t = t.next; 1901 else t = t.next = token_source.getNextToken(); 1902 } 1903 return t; 1904 } 1905 1906 final private int jj_ntk() { 1907 if ((jj_nt=token.next) == null) 1908 return (jj_ntk = (token.next=token_source.getNextToken()).kind); 1909 else 1910 return (jj_ntk = jj_nt.kind); 1911 } 1912 1913 private java.util.Vector jj_expentries = new java.util.Vector(); 1914 private int[] jj_expentry; 1915 private int jj_kind = -1; 1916 private int[] jj_lasttokens = new int[100]; 1917 private int jj_endpos; 1918 1919 private void jj_add_error_token(int kind, int pos) { 1920 if (pos >= 100) return; 1921 if (pos == jj_endpos + 1) { 1922 jj_lasttokens[jj_endpos++] = kind; 1923 } else if (jj_endpos != 0) { 1924 jj_expentry = new int[jj_endpos]; 1925 for (int i = 0; i < jj_endpos; i++) { 1926 jj_expentry[i] = jj_lasttokens[i]; 1927 } 1928 boolean exists = false; 1929 for (java.util.Enumeration enum = jj_expentries.elements(); enum.hasMoreElements();) { 1930 int[] oldentry = (int[])(enum.nextElement()); 1931 if (oldentry.length == jj_expentry.length) { 1932 exists = true; 1933 for (int i = 0; i < jj_expentry.length; i++) { 1934 if (oldentry[i] != jj_expentry[i]) { 1935 exists = false; 1936 break; 1937 } 1938 } 1939 if (exists) break; 1940 } 1941 } 1942 if (!exists) jj_expentries.addElement(jj_expentry); 1943 if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; 1944 } 1945 } 1946 1947 final public ParseException generateParseException() { 1948 jj_expentries.removeAllElements(); 1949 boolean[] la1tokens = new boolean[58]; 1950 for (int i = 0; i < 58; i++) { 1951 la1tokens[i] = false; 1952 } 1953 if (jj_kind >= 0) { 1954 la1tokens[jj_kind] = true; 1955 jj_kind = -1; 1956 } 1957 for (int i = 0; i < 30; i++) { 1958 if (jj_la1[i] == jj_gen) { 1959 for (int j = 0; j < 32; j++) { 1960 if ((jj_la1_0[i] & (1<<j)) != 0) { 1961 la1tokens[j] = true; 1962 } 1963 if ((jj_la1_1[i] & (1<<j)) != 0) { 1964 la1tokens[32+j] = true; 1965 } 1966 } 1967 } 1968 } 1969 for (int i = 0; i < 58; i++) { 1970 if (la1tokens[i]) { 1971 jj_expentry = new int[1]; 1972 jj_expentry[0] = i; 1973 jj_expentries.addElement(jj_expentry); 1974 } 1975 } 1976 jj_endpos = 0; 1977 jj_rescan_token(); 1978 jj_add_error_token(0, 0); 1979 int[][] exptokseq = new int[jj_expentries.size()][]; 1980 for (int i = 0; i < jj_expentries.size(); i++) { 1981 exptokseq[i] = (int[])jj_expentries.elementAt(i); 1982 } 1983 return new ParseException(token, exptokseq, tokenImage); 1984 } 1985 1986 final public void enable_tracing() { 1987 } 1988 1989 final public void disable_tracing() { 1990 } 1991 1992 final private void jj_rescan_token() { 1993 jj_rescan = true; 1994 for (int i = 0; i < 10; i++) { 1995 JJCalls p = jj_2_rtns[i]; 1996 do { 1997 if (p.gen > jj_gen) { 1998 jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; 1999 switch (i) { 2000 case 0: jj_3_1(); break; 2001 case 1: jj_3_2(); break; 2002 case 2: jj_3_3(); break; 2003 case 3: jj_3_4(); break; 2004 case 4: jj_3_5(); break; 2005 case 5: jj_3_6(); break; 2006 case 6: jj_3_7(); break; 2007 case 7: jj_3_8(); break; 2008 case 8: jj_3_9(); break; 2009 case 9: jj_3_10(); break; 2010 } 2011 } 2012 p = p.next; 2013 } while (p != null); 2014 } 2015 jj_rescan = false; 2016 } 2017 2018 final private void jj_save(int index, int xla) { 2019 JJCalls p = jj_2_rtns[index]; 2020 while (p.gen > jj_gen) { 2021 if (p.next == null) { p = p.next = new JJCalls(); break; } 2022 p = p.next; 2023 } 2024 p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; 2025 } 2026 2027 static final class JJCalls { 2028 int gen; 2029 Token first; 2030 int arg; 2031 JJCalls next; 2032 } 2033 2034 }

This page was automatically generated by Maven