Permalink
Browse files

0001913: DbFill now has the capability to print the sql to the comman…

…d line and to the Sql Editor.
  • Loading branch information...
adambailey- committed Aug 18, 2014
1 parent f28f5ab commit 65cdef0d46469d9fa96df4f4f6965a6a381cd6a6
@@ -170,21 +170,18 @@ protected boolean executeWithOptions(CommandLine line) throws Exception {
tableName);
if (table != null) {
for (int i = 0; i < dbFill.getRecordCount(); i++) {
for (int j = 0; j < dbFill.getInsertWeight(); j++) {
dbFill.createInsertRandomRecord(table);
String sql = dbFill.getSql() + ";";
System.out.println(sql);
}
for (int j = 0; j < dbFill.getUpdateWeight(); j++) {
dbFill.createUpdateRandomRecord(table);
String sql = dbFill.getSql() + ";";
System.out.println(sql);
}
for (int j = 0; j < dbFill.getDeleteWeight(); j++) {
dbFill.createDeleteRandomRecord(table, null);
String sql = dbFill.getSql() + ";";
System.out.println(sql);
}
for (int j = 0; j < dbFill.getInsertWeight(); j++) {
String sql = dbFill.createDynamicRandomInsertSql(table);
System.out.println(sql);
}
for (int j = 0; j < dbFill.getUpdateWeight(); j++) {
String sql = dbFill.createDynamicRandomUpdateSql(table);
System.out.println(sql);
}
for (int j = 0; j < dbFill.getDeleteWeight(); j++) {
String sql = dbFill.createDynamicRandomDeleteSql(table);
System.out.println(sql);
}
}
}
}
@@ -388,8 +388,8 @@ public DmlType getDmlType() {
}
public String buildDynamicSql(BinaryEncoding encoding, Row row,
boolean useVariableDates, boolean useJdbcTimestampFormat) {
final String QUESTION_MARK = "<!QUESTION_MARK!>";
boolean useVariableDates, boolean useJdbcTimestampFormat, Column[] columns) {
final String QUESTION_MARK = "<!QUESTION_MARK!>";
String newSql = sql;
String quote = databaseInfo.getValueQuoteToken();
String binaryQuoteStart = databaseInfo.getBinaryQuoteStart();
@@ -398,7 +398,6 @@ public String buildDynamicSql(BinaryEncoding encoding, Row row,
List<Column> columnsToProcess = new ArrayList<Column>();
columnsToProcess.addAll(Arrays.asList(columns));
columnsToProcess.addAll(Arrays.asList(keys));
for (int i = 0; i < columnsToProcess.size(); i++) {
Column column = columnsToProcess.get(i);
@@ -455,7 +454,17 @@ public String buildDynamicSql(BinaryEncoding encoding, Row row,
}
newSql = newSql.replace(QUESTION_MARK, "?");
return newSql + databaseInfo.getSqlCommandDelimiter();
return newSql + databaseInfo.getSqlCommandDelimiter();
}
public String buildDynamicDeleteSql(BinaryEncoding encoding, Row row,
boolean useVariableDates, boolean useJdbcTimestampFormat) {
return buildDynamicSql(encoding, row, useVariableDates, useJdbcTimestampFormat, keys);
}
public String buildDynamicSql(BinaryEncoding encoding, Row row,
boolean useVariableDates, boolean useJdbcTimestampFormat) {
return buildDynamicSql(encoding, row, useVariableDates, useJdbcTimestampFormat, (Column[]) ArrayUtils.addAll(columns, keys));
}
public boolean isUpsertSupported() {
Oops, something went wrong.

0 comments on commit 65cdef0

Please sign in to comment.