All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.onetwo.common.db.parser.SqlStatment Maven / Gradle / Ivy

The newest version!
package org.onetwo.common.db.parser;

import java.util.List;

import org.onetwo.common.db.parser.SqlKeywords.SqlType;
import org.onetwo.common.utils.LangUtils;

public class SqlStatment {
	
	private List sqlObjects = LangUtils.newArrayList();

	public List getSqlObjects() {
		return sqlObjects;
	}

	public void addSqlObject(SqlObject sqlObj){
		this.sqlObjects.add(sqlObj);
	}
	
	public String toSql(){
		StringBuilder sql = new StringBuilder();
		for(SqlObject sqlobj : sqlObjects){
			sql.append(sqlobj.toFragmentSql());
		}
		return sql.toString().trim();
	}
	
	public SqlType getSqlType(){
		SqlObject sqlobj = LangUtils.getFirst(sqlObjects);
		return SqlParserUtils.getSqlType(sqlobj);
	}
	
	public String toString(){
		StringBuilder sql = new StringBuilder();
		for(SqlObject so : sqlObjects)
			sql.append(so);
		return sql.toString();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy