private String createIndexTableStatementForIndex(String indexName, List<String> columns) { String tableName = IndexManager.tableNameForIndex(indexName); Joiner joiner = Joiner.on(" NONE,").skipNulls(); String cols = joiner.join(columns); return String.format("CREATE TABLE %s ( %s NONE )", tableName, cols); }
private String createIndexIndexStatementForIndex(String indexName, List<String> columns) { String tableName = IndexManager.tableNameForIndex(indexName); String sqlIndexName = tableName.concat("_index"); Joiner joiner = Joiner.on(",").skipNulls(); String cols = joiner.join(columns); return String.format("CREATE INDEX %s ON %s ( %s )", sqlIndexName, tableName, cols); }
/** * This method generates the virtual table create SQL for the specified index. Note: Any column * that contains an '=' will cause the statement to fail because it triggers SQLite to expect that * a parameter/value is being passed in. * * @param indexName the index name to be used when creating the SQLite virtual table * @param columns the columns in the table * @param indexSettings the special settings to apply to the virtual table - (only 'tokenize' is * current supported) * @return the SQL to create the SQLite virtual table */ private String createVirtualTableStatementForIndex( String indexName, List<String> columns, List<String> indexSettings) { String tableName = IndexManager.tableNameForIndex(indexName); Joiner joiner = Joiner.on(",").skipNulls(); String cols = joiner.join(columns); String settings = joiner.join(indexSettings); return String.format( "CREATE VIRTUAL TABLE %s USING FTS4 ( %s, %s )", tableName, cols, settings); }