Android examples for Database:Table Index
Creates the SQL used by the database to create an index in a table.
//package com.book2s; public class Main { /**// ww w .j a va 2s .com * Creates the string used by the database to create an index in a table. * This string can be used in the function * {@link SQLiteDatabase#execSQL(String)} * * @param tableName The name of the table * @param columnName The name of the column to index * @return The index string */ public static String getCreateIndexString(final String tableName, final String columnName) { return "create index " + tableName.toLowerCase() + '_' + columnName + " on " + tableName + " (" + columnName + ");"; } }