mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-05 20:45:49 +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();
|
db.beginTransaction();
|
||||||
try {
|
try {
|
||||||
String query;
|
String query;
|
||||||
String[] columnNames = DBUtils.getColumns( db, name );
|
String[] columnNames = getColumns( db, name );
|
||||||
if ( null != columnNames ) { // no data means no need to copy
|
if ( null != columnNames ) { // no data means no need to copy
|
||||||
query = String.format( "ALTER table %s RENAME TO 'temp_%s'",
|
query = String.format( "ALTER table %s RENAME TO 'temp_%s'",
|
||||||
name, name );
|
name, name );
|
||||||
|
@ -516,6 +516,15 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
return result;
|
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 {
|
private class TableAndVersion {
|
||||||
public String name;
|
public String name;
|
||||||
public int addedVersion;
|
public int addedVersion;
|
||||||
|
|
|
@ -2070,15 +2070,6 @@ public class DBUtils {
|
||||||
return exists;
|
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,
|
public static void addToStudyList( Context context, String word,
|
||||||
int lang )
|
int lang )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue