+ update
This commit is contained in:
@@ -32,9 +32,7 @@ public class SQLColumn extends IColumn {
|
||||
|
||||
/**
|
||||
* CHAR 类型常用构造器
|
||||
*
|
||||
* @param columnType
|
||||
* @param columnName
|
||||
* new SQLColumn(SQLColumnType.CHAR, 1, "data");
|
||||
*/
|
||||
public SQLColumn(SQLColumnType columnType, int m, String columnName) {
|
||||
this(columnType, m, 0, columnName, null);
|
||||
@@ -56,6 +54,10 @@ public class SQLColumn extends IColumn {
|
||||
this(columnType, 0, 0, columnName, defaultValue);
|
||||
}
|
||||
|
||||
public SQLColumn(SQLColumnType columnType, String columnName, Object defaultValue, SQLColumnOption... columnOptions) {
|
||||
this(columnType, 0, 0, columnName, defaultValue, columnOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整构造器
|
||||
*
|
||||
|
||||
@@ -49,11 +49,11 @@ public class SQLTable {
|
||||
}
|
||||
|
||||
public String deleteQuery() {
|
||||
return Strings.replaceWithOrder("drop table if exists `{0}`" + tableName);
|
||||
return Strings.replaceWithOrder("drop table if exists `{0}`", tableName);
|
||||
}
|
||||
|
||||
public String cleanQuery() {
|
||||
return Strings.replaceWithOrder("delete from `{0}`" + tableName);
|
||||
return Strings.replaceWithOrder("delete from `{0}`", tableName);
|
||||
}
|
||||
|
||||
public String truncateQuery() {
|
||||
|
||||
@@ -19,6 +19,7 @@ public class RunnableQuery {
|
||||
private TaskStatement statement;
|
||||
private TaskResult result;
|
||||
private TaskResult resultNext;
|
||||
private TaskResult resultAutoNext;
|
||||
private Connection connection;
|
||||
private boolean autoClose;
|
||||
private String query;
|
||||
@@ -47,6 +48,11 @@ public class RunnableQuery {
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunnableQuery resultAutoNext(TaskResult result) {
|
||||
this.resultAutoNext = result;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RunnableQuery connection(Connection connection) {
|
||||
return connection(connection, false);
|
||||
}
|
||||
@@ -113,6 +119,12 @@ public class RunnableQuery {
|
||||
return resultNext.execute(resultSet);
|
||||
} else if (result != null) {
|
||||
return result.execute(resultSet);
|
||||
} else if (resultAutoNext != null) {
|
||||
Object result = null;
|
||||
while (resultSet.next()) {
|
||||
result = resultAutoNext.execute(resultSet);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -30,16 +30,6 @@ public class SQLiteColumn extends IColumn {
|
||||
this(columnType, 0, 0, columnName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* CHAR 类型常用构造器
|
||||
*
|
||||
* @param columnType
|
||||
* @param columnName
|
||||
*/
|
||||
public SQLiteColumn(SQLiteColumnType columnType, int m, String columnName) {
|
||||
this(columnType, m, 0, columnName, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 主键 类型常用构造器
|
||||
* new SQLColumn(SQLiteColumnType.TEXT, "username", SQLiteColumnOption.PRIMARY_KEY, SQLiteColumnOption.AUTO_INCREMENT);
|
||||
@@ -56,6 +46,10 @@ public class SQLiteColumn extends IColumn {
|
||||
this(columnType, 0, 0, columnName, defaultValue);
|
||||
}
|
||||
|
||||
public SQLiteColumn(SQLiteColumnType columnType, String columnName, Object defaultValue, SQLiteColumnOption... columnOptions) {
|
||||
this(columnType, 0, 0, columnName, defaultValue, columnOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完整构造器
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user