cleanup: move method

This commit is contained in:
Eric House 2016-04-22 07:08:13 -07:00
parent bf871a20fb
commit 1216ec49d7
2 changed files with 10 additions and 10 deletions

View file

@ -444,7 +444,7 @@ public class DBHelper extends SQLiteOpenHelper {
db.beginTransaction();
try {
String query;
String[] columnNames = DBUtils.getColumns( db, name );
String[] columnNames = getColumns( db, name );
if ( null != columnNames ) { // no data means no need to copy
query = String.format( "ALTER table %s RENAME TO 'temp_%s'",
name, name );
@ -516,6 +516,15 @@ public class DBHelper extends SQLiteOpenHelper {
return result;
}
private static String[] getColumns( SQLiteDatabase db, String name )
{
String query = String.format( "SELECT * FROM %s LIMIT 1", name );
Cursor cursor = db.rawQuery( query, null );
String[] colNames = cursor.getColumnNames();
cursor.close();
return colNames;
}
private class TableAndVersion {
public String name;
public int addedVersion;

View file

@ -2070,15 +2070,6 @@ public class DBUtils {
return exists;
}
public static String[] getColumns( SQLiteDatabase db, String name )
{
String query = String.format( "SELECT * FROM %s LIMIT 1", name );
Cursor cursor = db.rawQuery( query, null );
String[] colNames = cursor.getColumnNames();
cursor.close();
return colNames;
}
public static void addToStudyList( Context context, String word,
int lang )
{