com.antsdb.saltedfish.sql.mysql.System_variable_referenceGenerator.java Source code

Java tutorial

Introduction

Here is the source code for com.antsdb.saltedfish.sql.mysql.System_variable_referenceGenerator.java

Source

/*-------------------------------------------------------------------------------------------------
 _______ __   _ _______ _______ ______  ______
 |_____| | \  |    |    |______ |     \ |_____]
 |     | |  \_|    |    ______| |_____/ |_____]
    
 Copyright (c) 2016, antsdb.com and/or its affiliates. All rights reserved. *-xguo0<@
    
 This program is free software: you can redistribute it and/or modify it under the terms of the
 GNU Affero General Public License, version 3, as published by the Free Software Foundation.
    
 You should have received a copy of the GNU Affero General Public License along with this program.
 If not, see <https://www.gnu.org/licenses/agpl-3.0.txt>
-------------------------------------------------------------------------------------------------*/
package com.antsdb.saltedfish.sql.mysql;

import org.apache.commons.lang.StringUtils;

import com.antsdb.saltedfish.lexer.MysqlParser.System_variable_referenceContext;
import com.antsdb.saltedfish.sql.Generator;
import com.antsdb.saltedfish.sql.GeneratorContext;
import com.antsdb.saltedfish.sql.OrcaException;
import com.antsdb.saltedfish.sql.vdm.GetSystemVarible;
import com.antsdb.saltedfish.sql.vdm.Instruction;

public class System_variable_referenceGenerator extends Generator<System_variable_referenceContext> {

    @Override
    public Instruction gen(GeneratorContext ctx, System_variable_referenceContext rule) throws OrcaException {
        String name = rule.SYSTEM_VARIABLE().getText();
        name = StringUtils.removeStart(name, "@@");
        return new GetSystemVarible(name);
    }

}