mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
set initial rowID based on clock to avoid duplicates after an
uninstall/reinstall.
This commit is contained in:
parent
c75ecef240
commit
f3a063698c
1 changed files with 14 additions and 0 deletions
|
@ -169,6 +169,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
createTable( db, TABLE_NAME_OBITS, s_obitsColsAndTypes );
|
createTable( db, TABLE_NAME_OBITS, s_obitsColsAndTypes );
|
||||||
createTable( db, TABLE_NAME_DICTINFO, s_dictInfoColsAndTypes );
|
createTable( db, TABLE_NAME_DICTINFO, s_dictInfoColsAndTypes );
|
||||||
createTable( db, TABLE_NAME_DICTBROWSE, s_dictBrowseColsAndTypes );
|
createTable( db, TABLE_NAME_DICTBROWSE, s_dictBrowseColsAndTypes );
|
||||||
|
forceRowidHigh( db, TABLE_NAME_SUM );
|
||||||
createGroupsTable( db );
|
createGroupsTable( db );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +304,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
db.execSQL( query );
|
db.execSQL( query );
|
||||||
}
|
}
|
||||||
createTable( db, name, data );
|
createTable( db, name, data );
|
||||||
|
forceRowidHigh( db, name );
|
||||||
|
|
||||||
if ( null != columnNames ) {
|
if ( null != columnNames ) {
|
||||||
ArrayList<String> oldCols =
|
ArrayList<String> oldCols =
|
||||||
|
@ -333,4 +335,16 @@ public class DBHelper extends SQLiteOpenHelper {
|
||||||
dest, src );
|
dest, src );
|
||||||
db.execSQL( query );
|
db.execSQL( query );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void forceRowidHigh( SQLiteDatabase db, String name )
|
||||||
|
{
|
||||||
|
long now = Utils.getCurSeconds();
|
||||||
|
// knock 20 years off; whose clock can be that far back?
|
||||||
|
now -= 622080000;
|
||||||
|
String query = String.format( "INSERT INTO %s (rowid) VALUES (%d)",
|
||||||
|
name, now );
|
||||||
|
db.execSQL( query );
|
||||||
|
query = String.format( "DELETE FROM %s", name );
|
||||||
|
db.execSQL( query );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue