Refactored create table statements to use constants from schema.
This commit is contained in:
parent
2ffd4ae428
commit
131978ad02
@ -24,74 +24,81 @@ class DBHelper extends SQLiteOpenHelper {
|
|||||||
private static final String DATABASE_NAME = "fdroid";
|
private static final String DATABASE_NAME = "fdroid";
|
||||||
|
|
||||||
private static final String CREATE_TABLE_REPO = "create table "
|
private static final String CREATE_TABLE_REPO = "create table "
|
||||||
+ RepoTable.NAME + " (_id integer primary key, "
|
+ RepoTable.NAME + " ("
|
||||||
+ "address text not null, "
|
+ RepoTable.Cols._ID + " integer primary key, "
|
||||||
+ "name text, description text, inuse integer not null, "
|
+ RepoTable.Cols.ADDRESS + " text not null, "
|
||||||
+ "priority integer not null, pubkey text, fingerprint text, "
|
+ RepoTable.Cols.NAME + " text, "
|
||||||
+ "maxage integer not null default 0, "
|
+ RepoTable.Cols.DESCRIPTION + " text, "
|
||||||
+ "version integer not null default 0, "
|
+ RepoTable.Cols.IN_USE + " integer not null, "
|
||||||
+ "lastetag text, lastUpdated string,"
|
+ RepoTable.Cols.PRIORITY + " integer not null, "
|
||||||
+ "isSwap integer boolean default 0,"
|
+ RepoTable.Cols.SIGNING_CERT + " text, "
|
||||||
+ "username string, password string,"
|
+ RepoTable.Cols.FINGERPRINT + " text, "
|
||||||
+ "timestamp integer not null default 0"
|
+ RepoTable.Cols.MAX_AGE + " integer not null default 0, "
|
||||||
|
+ RepoTable.Cols.VERSION + " integer not null default 0, "
|
||||||
|
+ RepoTable.Cols.LAST_ETAG + " text, "
|
||||||
|
+ RepoTable.Cols.LAST_UPDATED + " string,"
|
||||||
|
+ RepoTable.Cols.IS_SWAP + " integer boolean default 0,"
|
||||||
|
+ RepoTable.Cols.USERNAME + " string, "
|
||||||
|
+ RepoTable.Cols.PASSWORD + " string,"
|
||||||
|
+ RepoTable.Cols.TIMESTAMP + " integer not null default 0"
|
||||||
+ ");";
|
+ ");";
|
||||||
|
|
||||||
private static final String CREATE_TABLE_APK =
|
private static final String CREATE_TABLE_APK =
|
||||||
"CREATE TABLE " + ApkTable.NAME + " ( "
|
"CREATE TABLE " + ApkTable.NAME + " ( "
|
||||||
+ "id text not null, "
|
+ ApkTable.Cols.PACKAGE_NAME + " text not null, "
|
||||||
+ "version text not null, "
|
+ ApkTable.Cols.VERSION_NAME + " text not null, "
|
||||||
+ "repo integer not null, "
|
+ ApkTable.Cols.REPO_ID + " integer not null, "
|
||||||
+ "hash text not null, "
|
+ ApkTable.Cols.HASH + " text not null, "
|
||||||
+ "vercode int not null,"
|
+ ApkTable.Cols.VERSION_CODE + " int not null,"
|
||||||
+ "apkName text not null, "
|
+ ApkTable.Cols.NAME + " text not null, "
|
||||||
+ "size int not null, "
|
+ ApkTable.Cols.SIZE + " int not null, "
|
||||||
+ "sig string, "
|
+ ApkTable.Cols.SIGNATURE + " string, "
|
||||||
+ "srcname string, "
|
+ ApkTable.Cols.SOURCE_NAME + " string, "
|
||||||
+ "minSdkVersion integer, "
|
+ ApkTable.Cols.MIN_SDK_VERSION + " integer, "
|
||||||
+ "targetSdkVersion integer, "
|
+ ApkTable.Cols.TARGET_SDK_VERSION + " integer, "
|
||||||
+ "maxSdkVersion integer, "
|
+ ApkTable.Cols.MAX_SDK_VERSION + " integer, "
|
||||||
+ "permissions string, "
|
+ ApkTable.Cols.PERMISSIONS + " string, "
|
||||||
+ "features string, "
|
+ ApkTable.Cols.FEATURES + " string, "
|
||||||
+ "nativecode string, "
|
+ ApkTable.Cols.NATIVE_CODE + " string, "
|
||||||
+ "hashType string, "
|
+ ApkTable.Cols.HASH_TYPE + " string, "
|
||||||
+ "added string, "
|
+ ApkTable.Cols.ADDED_DATE + " string, "
|
||||||
+ "compatible int not null, "
|
+ ApkTable.Cols.IS_COMPATIBLE + " int not null, "
|
||||||
+ "incompatibleReasons text, "
|
+ ApkTable.Cols.INCOMPATIBLE_REASONS + " text, "
|
||||||
+ "primary key(id, vercode)"
|
+ "primary key(" + ApkTable.Cols.PACKAGE_NAME + ", " + ApkTable.Cols.VERSION_CODE + ")"
|
||||||
+ ");";
|
+ ");";
|
||||||
|
|
||||||
private static final String CREATE_TABLE_APP = "CREATE TABLE " + AppTable.NAME
|
private static final String CREATE_TABLE_APP = "CREATE TABLE " + AppTable.NAME
|
||||||
+ " ( "
|
+ " ( "
|
||||||
+ "id text not null, "
|
+ AppTable.Cols.PACKAGE_NAME + "id text not null, "
|
||||||
+ "name text not null, "
|
+ AppTable.Cols.NAME + "name text not null, "
|
||||||
+ "summary text not null, "
|
+ AppTable.Cols.SUMMARY + "summary text not null, "
|
||||||
+ "icon text, "
|
+ AppTable.Cols.ICON + "icon text, "
|
||||||
+ "description text not null, "
|
+ AppTable.Cols.DESCRIPTION + "description text not null, "
|
||||||
+ "license text not null, "
|
+ AppTable.Cols.LICENSE + "license text not null, "
|
||||||
+ "author text, "
|
+ AppTable.Cols.AUTHOR + "author text, "
|
||||||
+ "email text, "
|
+ AppTable.Cols.EMAIL + "email text, "
|
||||||
+ "webURL text, "
|
+ AppTable.Cols.WEB_URL + "webURL text, "
|
||||||
+ "trackerURL text, "
|
+ AppTable.Cols.TRACKER_URL + "trackerURL text, "
|
||||||
+ "sourceURL text, "
|
+ AppTable.Cols.SOURCE_URL + "sourceURL text, "
|
||||||
+ "changelogURL text, "
|
+ AppTable.Cols.CHANGELOG_URL + "changelogURL text, "
|
||||||
+ "suggestedVercode text,"
|
+ AppTable.Cols.SUGGESTED_VERSION_CODE + "suggestedVercode text,"
|
||||||
+ "upstreamVersion text,"
|
+ AppTable.Cols.UPSTREAM_VERSION_NAME + "upstreamVersion text,"
|
||||||
+ "upstreamVercode integer,"
|
+ AppTable.Cols.UPSTREAM_VERSION_CODE + "upstreamVercode integer,"
|
||||||
+ "antiFeatures string,"
|
+ AppTable.Cols.ANTI_FEATURES + "antiFeatures string,"
|
||||||
+ "donateURL string,"
|
+ AppTable.Cols.DONATE_URL + "donateURL string,"
|
||||||
+ "bitcoinAddr string,"
|
+ AppTable.Cols.BITCOIN_ADDR + "bitcoinAddr string,"
|
||||||
+ "litecoinAddr string,"
|
+ AppTable.Cols.LITECOIN_ADDR + "litecoinAddr string,"
|
||||||
+ "flattrID string,"
|
+ AppTable.Cols.FLATTR_ID + "flattrID string,"
|
||||||
+ "requirements string,"
|
+ AppTable.Cols.REQUIREMENTS + "requirements string,"
|
||||||
+ "categories string,"
|
+ AppTable.Cols.CATEGORIES + "categories string,"
|
||||||
+ "added string,"
|
+ AppTable.Cols.ADDED + "added string,"
|
||||||
+ "lastUpdated string,"
|
+ AppTable.Cols.LAST_UPDATED + "lastUpdated string,"
|
||||||
+ "compatible int not null,"
|
+ AppTable.Cols.IS_COMPATIBLE + "compatible int not null,"
|
||||||
+ "ignoreAllUpdates int not null,"
|
+ AppTable.Cols.IGNORE_ALLUPDATES + "ignoreAllUpdates int not null,"
|
||||||
+ "ignoreThisUpdate int not null,"
|
+ AppTable.Cols.IGNORE_THISUPDATE + "ignoreThisUpdate int not null,"
|
||||||
+ "iconUrl text, "
|
+ AppTable.Cols.ICON_URL + "iconUrl text, "
|
||||||
+ "iconUrlLarge text, "
|
+ AppTable.Cols.ICON_URL_LARGE + "iconUrlLarge text, "
|
||||||
+ "primary key(id));";
|
+ "primary key(" + AppTable.Cols.PACKAGE_NAME + "));";
|
||||||
|
|
||||||
private static final String CREATE_TABLE_INSTALLED_APP = "CREATE TABLE " + InstalledAppTable.NAME
|
private static final String CREATE_TABLE_INSTALLED_APP = "CREATE TABLE " + InstalledAppTable.NAME
|
||||||
+ " ( "
|
+ " ( "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user