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