mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-23 07:27:22 +01:00
fix crash upgrading from beta 30 (which is two years old!)
This commit is contained in:
parent
01c97c5716
commit
d00e9edf55
1 changed files with 14 additions and 4 deletions
|
@ -309,9 +309,19 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
if ( null != columnNames ) {
|
if ( null != columnNames ) {
|
||||||
ArrayList<String> oldCols =
|
ArrayList<String> oldCols =
|
||||||
new ArrayList<String>( Arrays.asList( columnNames ) );
|
new ArrayList<String>( Arrays.asList( columnNames ) );
|
||||||
String[] newColNames = DBUtils.getColumns( db, name );
|
|
||||||
ArrayList<String> newCols =
|
// Make a list of columns in the new DB, using it to
|
||||||
new ArrayList<String>( Arrays.asList( newColNames ) );
|
// remove from the old list any that aren't in the
|
||||||
|
// new. Old tables may have column names we no longer
|
||||||
|
// use, but we can't try to copy them because the new
|
||||||
|
// doesn't have 'em. Note that calling getColumns() on
|
||||||
|
// the newly-created table doesn't work, perhaps
|
||||||
|
// because we're in a transaction and nothing's been
|
||||||
|
// committed.
|
||||||
|
ArrayList<String> newCols = new ArrayList<String>();
|
||||||
|
for ( int ii = 0; ii < data.length; ii += 2 ) {
|
||||||
|
newCols.add( data[ii] );
|
||||||
|
}
|
||||||
oldCols.retainAll( newCols );
|
oldCols.retainAll( newCols );
|
||||||
|
|
||||||
String cols = TextUtils.join( ",", oldCols );
|
String cols = TextUtils.join( ",", oldCols );
|
||||||
|
|
Loading…
Add table
Reference in a new issue