Package org.gdbms.parser

Examples of org.gdbms.parser.SimpleNode


     *
     * @return DOCUMENT ME!
     */
    private int getOperator(SimpleNode expr) {
        if (operator == UNDEFINED) {
            SimpleNode sn1 = (SimpleNode) expr.jjtGetChild(0);
            SimpleNode sn2 = (SimpleNode) expr.jjtGetChild(1);
            int pos1 = sn1.last_token.endColumn;
            int pos2 = sn2.first_token.beginColumn;
            String text = getInstructionContext().getSql();
            text = text.substring(pos1, pos2 - 1);

View Full Code Here


  /**
   * @see org.gdbms.engine.instruction.Expression#getFieldName()
   */
  public String getFieldName() {
    SimpleNode child = (SimpleNode) getEntity().jjtGetChild(0);

    if (child.first_token.image.equals("(")) {
      child = (SimpleNode) getEntity().jjtGetChild(0);
    }

    if (child.getClass() == ASTSQLColRef.class) {
      return Utilities.getText(child);
    } else {
      return null;
    }
  }
View Full Code Here

  /**
   * @see org.gdbms.engine.instruction.Expression#isLiteral()
   */
  public boolean isLiteral() {
    SimpleNode child = (SimpleNode) getEntity().jjtGetChild(0);

    if (child.first_token.image.equals("(")) {
      child = (SimpleNode) getEntity().jjtGetChild(0);
    }

    if (child.getClass() == ASTSQLColRef.class) {
      return false;
    } else if (child.getClass() == ASTSQLFunction.class) {
      return false;
    } else if (child.getClass() == ASTSQLLiteral.class) {
      return true;
    } else if (child.getClass() == ASTSQLOrExpr.class) {
      return ((Expression) getChilds()[0]).isLiteral();
    } else {
      throw new RuntimeException("really passed the parse???");
    }
  }
View Full Code Here

   *
   * @return Tipo del token del nodo. Una constante de la interfaz
   *        SQLEngineConstants
   */
  public static int getType(Node n) {
    SimpleNode node = (SimpleNode) n;

    if (node.first_token == node.last_token) {
      return node.first_token.kind;
    }

View Full Code Here

   */
  private void translateColRefs(Adapter adapter, HashMap<String, String> instrNameDBName,
      DataSource[] tables) throws DriverException, SemanticException {
      if (adapter instanceof ColRefAdapter) {
          ColRefAdapter tra = (ColRefAdapter) adapter;
          SimpleNode s = tra.getEntity();
 
          if (s.first_token != s.last_token) {
              String name = s.first_token.image;
              s.first_token.image = instrNameDBName.get(name);
          } else {
View Full Code Here

   *        database name as the values.
   */
  private void translateFromTables(Adapter adapter, HashMap<String, String> instrNameDBName) {
      if (adapter instanceof TableRefAdapter) {
          TableRefAdapter tra = (TableRefAdapter) adapter;
          SimpleNode s = tra.getEntity();
 
          if (s.first_token == s.last_token) {
              String alias = "gdbms" + System.currentTimeMillis();
              String name = s.first_token.image;
              s.first_token.image = gdbmsNameViewName.get(name) + " " + alias;
View Full Code Here

  /**
   * @see org.gdbms.engine.instruction.CachedExpression#evaluate(long)
   */
  public Value evaluate(long row) throws EvaluationException {
    SimpleNode n = getEntity();

    try {
            return ValueFactory.createValue(Utilities.getText(n),
              Utilities.getType(n));
        } catch (SemanticException e) {
View Full Code Here

   * @see org.gdbms.engine.instruction.Adapter#setEntity(org.gdbms.parser.Node)
   */
  public void setEntity(Node o) {
    super.setEntity(o);

    SimpleNode sn = (SimpleNode) o;

    if (sn.first_token.kind == SQLEngineConstants.STRING_LITERAL) {
      name = sn.first_token.image.substring(1);
      name = name.substring(0, name.length() - 1);
    } else {
View Full Code Here

   *
   * @return DOCUMENT ME!
   */
  private int getOperator(SimpleNode expr) {
    if (operator == UNDEFINED) {
      SimpleNode sn1 = (SimpleNode) expr.jjtGetChild(0);
      SimpleNode sn2 = (SimpleNode) expr.jjtGetChild(1);
      int pos1 = sn1.last_token.endColumn;
      int pos2 = sn2.first_token.beginColumn;
      String text = getInstructionContext().getSql();
      text = text.substring(pos1, pos2 - 1);

View Full Code Here

TOP

Related Classes of org.gdbms.parser.SimpleNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.