mirror of
https://github.com/CarmJos/EasySQL.git
synced 2026-06-04 15:28:20 +08:00
[v0.3.1] 修复一些小的规范问题
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ public class PreparedSQLBatchUpdateActionImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedSQLUpdateBatchAction addParamsBatch(Object[] params) {
|
||||
public PreparedSQLUpdateBatchAction addParamsBatch(Object... params) {
|
||||
this.allParams.add(params);
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ public class PreparedSQLUpdateActionImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedSQLUpdateActionImpl setParams(Object[] params) {
|
||||
public PreparedSQLUpdateActionImpl setParams(Object... params) {
|
||||
this.params = params;
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class PreparedQueryActionImpl extends QueryActionImpl implements Prepared
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreparedQueryActionImpl setParams(@Nullable Object[] params) {
|
||||
public PreparedQueryActionImpl setParams(@Nullable Object... params) {
|
||||
this.params = params;
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public abstract class AbstractConditionalBuilder<B extends ConditionalBuilder<B,
|
||||
public B addCondition(
|
||||
@NotNull String[] queryNames, @Nullable Object[] queryValues
|
||||
) {
|
||||
if (queryNames.length != queryValues.length) {
|
||||
if (queryValues == null || queryNames.length != queryValues.length) {
|
||||
throw new RuntimeException("queryNames are not match with queryValues");
|
||||
}
|
||||
for (int i = 0; i < queryNames.length; i++) {
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ public class TableCreateBuilderImpl extends AbstractSQLBuilder implements TableC
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableCreateBuilder setColumns(@NotNull String[] columns) {
|
||||
public TableCreateBuilder setColumns(@NotNull String... columns) {
|
||||
this.columns = Arrays.asList(columns);
|
||||
return this;
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class TableQueryBuilderImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableQueryBuilderImpl selectColumns(@NotNull String[] columnNames) {
|
||||
public TableQueryBuilderImpl selectColumns(@NotNull String... columnNames) {
|
||||
this.columns = columnNames;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ public class SQLManagerImpl implements SQLManager {
|
||||
if (isDebugMode()) getLogger().info("[DEBUG] " + msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return LOGGER;
|
||||
}
|
||||
@@ -103,7 +104,7 @@ public class SQLManagerImpl implements SQLManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> executeSQLBatch(@NotNull String sql, String[] moreSQL) {
|
||||
public List<Integer> executeSQLBatch(@NotNull String sql, String... moreSQL) {
|
||||
SQLUpdateBatchAction action = new SQLUpdateBatchActionImpl(this, sql);
|
||||
if (moreSQL != null && moreSQL.length > 0) {
|
||||
Arrays.stream(moreSQL).forEach(action::addBatch);
|
||||
|
||||
@@ -128,16 +128,12 @@ public class StatementUtil {
|
||||
* @return 数据类型,默认为 {@link Types#VARCHAR}
|
||||
*/
|
||||
public static int getNullType(PreparedStatement statement, int paramIndex) {
|
||||
int sqlType = Types.VARCHAR;
|
||||
|
||||
final ParameterMetaData pmd;
|
||||
try {
|
||||
pmd = statement.getParameterMetaData();
|
||||
sqlType = pmd.getParameterType(paramIndex);
|
||||
ParameterMetaData pmd = statement.getParameterMetaData();
|
||||
return pmd.getParameterType(paramIndex);
|
||||
} catch (SQLException ignore) {
|
||||
return Types.VARCHAR;
|
||||
}
|
||||
|
||||
return sqlType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user