
sf.database.jdbc.sql.CommonSql Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sorm Show documentation
Show all versions of sorm Show documentation
java jpa tool for spring
The newest version!
package sf.database.jdbc.sql;
import sf.spring.util.CollectionUtils;
import sf.tools.ArrayUtils;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Collection;
import java.util.List;
/**
* 通用common
*/
public class CommonSql {
public static void fillStatement(PreparedStatement pst, Object paras) throws SQLException {
if (paras.getClass().isArray()) {
fillArrayStatement(pst, (Object[]) paras);
} else if (Collection.class.isAssignableFrom(paras.getClass())) {
Type[] types = ((ParameterizedType) paras.getClass().getGenericSuperclass()).getActualTypeArguments();
Type type = null;
if (types != null && types.length > 0) {
type = types[0];
}
if (SQLParameter.class.equals(type)) {
fillSQLStatement(pst, (List) paras);
} else {
fillListStatement(pst, (List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy