/*
 * Copyright © 2019 by Data Virtuality GmbH
 */
package org.teiid.query.sql.visitor;

import org.teiid.query.sql.LanguageObject;
import org.teiid.query.sql.symbol.ElementSymbol;

/**
 * @author Roman Pedchenko
 * @date 2019.12.19
 */
public class SQLOrigStringVisitor extends SQLStringVisitor {
    public static String getSQLString2( LanguageObject obj ) {
        if (obj == null) {
            return UNDEFINED;
        }
        SQLOrigStringVisitor visitor = new SQLOrigStringVisitor();
        obj.acceptVisitor(visitor);
        return visitor.getSQLString();
    }

    public void visit( ElementSymbol obj ) {
        if (obj.getOriginalName() != null) {
            append(obj.getOriginalName());
            return;
        }
        super.visit(obj);
    }
}
