mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
cleanup: move method
This commit is contained in:
parent
bf871a20fb
commit
1216ec49d7
2 changed files with 10 additions and 10 deletions
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue