com.centit.support.database.utils.QueryAndParams Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of centit-database Show documentation
Show all versions of centit-database Show documentation
数据库操作通用方法和函数,从以前的util包中分离出来,并且整合了部分sys-module中的函数
package com.centit.support.database.utils;
import com.centit.support.compiler.Lexer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public class QueryAndParams {
public String queryStmt;
public Object[] params;
@Deprecated
public String getSql() {
return queryStmt;
}
@Deprecated
public void setSql(String hql) {
this.queryStmt = hql;
}
public String getQuery() {
return queryStmt;
}
public void setQuery(String hql) {
this.queryStmt = hql;
}
@Deprecated
public String getHql() {
return queryStmt;
}
@Deprecated
public void setHql(String hql) {
this.queryStmt = hql;
}
public Object[] getParams() {
return params;
}
public Object getParam(int index){
if( params==null)
return null;
if(index>=params.length)
return null;
return params[index];
}
public QueryAndParams() {
this.queryStmt = null;
this.params = null;
}
public QueryAndParams(String shql) {
this.queryStmt = shql;
this.params = null;
}
public QueryAndParams(String shql,final Object[] values) {
this.queryStmt = shql;
this.params = values;
}
public static QueryAndParams creepArrayParamForInQuery(String sql, Object[] sqlParams){
StringBuilder sqlb = new StringBuilder();
List