"List to Array to List to Set" becomes "to Set".
This commit is contained in:
@@ -748,8 +748,8 @@ public class DepotMarshaller<T extends PersistentRecord>
|
||||
|
||||
// next we create any full text search indexes that exist on the record but not in the
|
||||
// table, first step being to do a dialect-sensitive enumeration of existing indexes
|
||||
Set<String> tableFts = new HashSet<String>(Arrays.asList(
|
||||
builder.getFtsIndexes(metaData.tableColumns, metaData.indexColumns.keySet())));
|
||||
Set<String> tableFts = new HashSet<String>();
|
||||
builder.getFtsIndexes(metaData.tableColumns, metaData.indexColumns.keySet(), tableFts);
|
||||
|
||||
// then iterate over what should be there
|
||||
for (final FullTextIndex recordFts : _fullTextIndexes.values()) {
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.samskivert.Log;
|
||||
import com.samskivert.jdbc.JDBCUtil;
|
||||
@@ -137,15 +138,14 @@ public class MySQLBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFtsIndexes (Iterable<String> columns, Iterable<String> indexes)
|
||||
public void getFtsIndexes (
|
||||
Iterable<String> columns, Iterable<String> indexes, Set<String> target)
|
||||
{
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (String index : indexes) {
|
||||
if (index.startsWith("ftsIx_")) {
|
||||
result.add(index.substring("ftsIx_".length()));
|
||||
target.add(index.substring("ftsIx_".length()));
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.sql.Time;
|
||||
import java.sql.Timestamp;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.samskivert.jdbc.DatabaseLiaison;
|
||||
import com.samskivert.jdbc.JDBCUtil;
|
||||
@@ -111,15 +112,14 @@ public class PostgreSQLBuilder
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getFtsIndexes (Iterable<String> columns, Iterable<String> indexes)
|
||||
public void getFtsIndexes (
|
||||
Iterable<String> columns, Iterable<String> indexes, Set<String> target)
|
||||
{
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (String column : columns) {
|
||||
if (column.startsWith("ftsCol_")) {
|
||||
result.add(column.substring("ftsCol_".length()));
|
||||
target.add(column.substring("ftsCol_".length()));
|
||||
}
|
||||
}
|
||||
return result.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
package com.samskivert.jdbc.depot;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Set;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
@@ -187,11 +189,11 @@ public abstract class SQLBuilder
|
||||
public abstract boolean isPrivateColumn (String column);
|
||||
|
||||
/**
|
||||
* Figure out what full text search indexes already exist on this table and return the names
|
||||
* of those indexes as an array.
|
||||
* Figure out what full text search indexes already exist on this table and add the names of
|
||||
* those indexes to the supplied target set.
|
||||
*/
|
||||
public abstract String[] getFtsIndexes (
|
||||
Iterable<String> columns, Iterable<String> indexes);
|
||||
public abstract void getFtsIndexes (
|
||||
Iterable<String> columns, Iterable<String> indexes, Set<String> target);
|
||||
|
||||
/**
|
||||
* Overridden by subclasses to create a dialect-specific {@link BuildVisitor}.
|
||||
|
||||
Reference in New Issue
Block a user