update sqlite database
This commit is contained in:
parent
e65bae23ad
commit
2bdda9250c
@ -18,5 +18,5 @@ public class AppData {
|
||||
private String adNativeKey;
|
||||
}
|
||||
/*
|
||||
{"file":"ad.db","table":[{"name":"app","item":[{"name":"id","type":"int","isNull":false,"isKey":true},{"name":"appName","type":"String","isNull":false,"isKey":false},{"name":"packageName","type":"String","isNull":false,"isKey":false},{"name":"appId","type":"String","isNull":false,"isKey":false}]},{"name":"app_ad","item":[{"name":"id","type":"int","isNull":false,"isKey":true},{"name":"appId","type":"String","isNull":false,"isKey":false},{"name":"adSrc","type":"String","isNull":false,"isKey":false},{"name":"adAppId","type":"String","isNull":false,"isKey":false},{"name":"adAppKey","type":"String","isNull":false,"isKey":false},{"name":"adOpenKey","type":"String","isNull":true,"isKey":false},{"name":"adInterKey","type":"String","isNull":true,"isKey":false},{"name":"adBannerKey","type":"String","isNull":true,"isKey":false},{"name":"adVideoKey","type":"String","isNull":true,"isKey":false},{"name":"adNativeKey","type":"String","isNull":true,"isKey":false}]},{"name":"ad_log","table":[{"name":"id","type":"int","isNull":false,"isKey":true},{"name":"appId","type":"String","isNull":false,"isKey":false},{"name":"adSrc","type":"String","isNull":false,"isKey":false},{"name":"adType","type":"String","isNull":false,"isKey":false},{"name":"model","type":"String","isNull":false,"isKey":false},{"name":"subtime","type":"String","isNull":false,"isKey":false}]}]}
|
||||
{"file":"ad.db","table":[{"name":"app","item":[{"name":"id","type":"int","isNull":false,"isKey":true},{"name":"appName","type":"String","isNull":false,"isKey":false},{"name":"packageName","type":"String","isNull":false,"isKey":false},{"name":"appId","type":"String","isNull":false,"isKey":false}]},{"name":"app_ad","item":[{"name":"id","type":"int","isNull":false,"isKey":true},{"name":"appId","type":"String","isNull":false,"isKey":false},{"name":"show","type":"int","isNull":false,"isKey":false},{"name":"adSrc","type":"String","isNull":false,"isKey":false},{"name":"adAppId","type":"String","isNull":false,"isKey":false},{"name":"adAppKey","type":"String","isNull":false,"isKey":false},{"name":"adOpenKey","type":"String","isNull":true,"isKey":false},{"name":"adInterKey","type":"String","isNull":true,"isKey":false},{"name":"adBannerKey","type":"String","isNull":true,"isKey":false},{"name":"adVideoKey","type":"String","isNull":true,"isKey":false},{"name":"adNativeKey","type":"String","isNull":true,"isKey":false}]},{"name":"ad_log","item":[{"name":"id","type":"int","isNull":false,"isKey":true},{"name":"appId","type":"String","isNull":false,"isKey":false},{"name":"adSrc","type":"String","isNull":false,"isKey":false},{"name":"adType","type":"String","isNull":false,"isKey":false},{"name":"model","type":"String","isNull":false,"isKey":false},{"name":"subtime","type":"String","isNull":false,"isKey":false}]}]}
|
||||
*/
|
@ -20,7 +20,7 @@ public class ADSQLiteManager extends SQLiteManager {
|
||||
|
||||
private ADSQLiteManager() {
|
||||
super();
|
||||
JSONObject json = JSONObject.parseObject("{\"file\":\"ad.db\",\"table\":[{\"name\":\"app\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"appName\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"packageName\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"appId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false}]},{\"name\":\"app_ad\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"appId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adSrc\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adAppId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adAppKey\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adOpenKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adInterKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adBannerKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adVideoKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adNativeKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false}]},{\"name\":\"ad_log\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"appId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adSrc\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adType\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"model\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"subtime\",\"type\":\"String\",\"isNull\":false,\"isKey\":false}]}]}");
|
||||
JSONObject json = JSONObject.parseObject("{\"file\":\"ad.db\",\"table\":[{\"name\":\"app\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"appName\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"packageName\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"appId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false}]},{\"name\":\"app_ad\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"appId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"show\",\"type\":\"int\",\"isNull\":false,\"isKey\":false},{\"name\":\"adSrc\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adAppId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adAppKey\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adOpenKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adInterKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adBannerKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adVideoKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false},{\"name\":\"adNativeKey\",\"type\":\"String\",\"isNull\":true,\"isKey\":false}]},{\"name\":\"ad_log\",\"item\":[{\"name\":\"id\",\"type\":\"int\",\"isNull\":false,\"isKey\":true},{\"name\":\"appId\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adSrc\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"adType\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"model\",\"type\":\"String\",\"isNull\":false,\"isKey\":false},{\"name\":\"subtime\",\"type\":\"String\",\"isNull\":false,\"isKey\":false}]}]}");
|
||||
build(json);
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ public class ADSQLiteManager extends SQLiteManager {
|
||||
return false;
|
||||
}
|
||||
Statement statement = conn.createStatement();
|
||||
String sql = "insert into `app_ad` (`appId`,`adSrc`,`adAppId`,`adAppKey`,`adOpenKey`,`adInterKey`,`adBannerKey`,`adVideoKey`,`adNativeKey`) values " +
|
||||
"('" + appId + "','" + adSrc + "','" + adAppId + "','" + adAppKey + "','" + adOpenKey + "','" + adInterKey + "','" + adBannerKey + "','" + adVideoKey + "','" + adNativeKey + "');";
|
||||
String sql = "insert into `app_ad` (`appId`,`adSrc`,`adAppId`,`adAppKey`,`adOpenKey`,`adInterKey`,`adBannerKey`,`adVideoKey`,`adNativeKey`,`show`) values " +
|
||||
"('" + appId + "','" + adSrc + "','" + adAppId + "','" + adAppKey + "','" + adOpenKey + "','" + adInterKey + "','" + adBannerKey + "','" + adVideoKey + "','" + adNativeKey + "',1);";
|
||||
boolean flag = statement.execute(sql);
|
||||
statement.close();
|
||||
return flag;
|
||||
@ -103,13 +103,24 @@ public class ADSQLiteManager extends SQLiteManager {
|
||||
json=new JSONObject();
|
||||
json.put("appId", set.getString("appId"));
|
||||
json.put("adSrc", set.getString("adSrc"));
|
||||
json.put("adAppId", set.getString("adAppId"));
|
||||
json.put("adAppKey", set.getString("adAppKey"));
|
||||
json.put("adOpenKey", set.getString("adOpenKey"));
|
||||
json.put("adInterKey", set.getString("adInterKey"));
|
||||
json.put("adBannerKey", set.getString("adBannerKey"));
|
||||
json.put("adVideoKey", set.getString("adVideoKey"));
|
||||
json.put("adNativeKey", set.getString("adNativeKey"));
|
||||
json.put("show", set.getInt("show"));
|
||||
if(json.getInteger("show")==1) {
|
||||
json.put("adAppId", set.getString("adAppId"));
|
||||
json.put("adAppKey", set.getString("adAppKey"));
|
||||
json.put("adOpenKey", set.getString("adOpenKey"));
|
||||
json.put("adInterKey", set.getString("adInterKey"));
|
||||
json.put("adBannerKey", set.getString("adBannerKey"));
|
||||
json.put("adVideoKey", set.getString("adVideoKey"));
|
||||
json.put("adNativeKey", set.getString("adNativeKey"));
|
||||
}else{
|
||||
json.put("adAppId", "");
|
||||
json.put("adAppKey", "");
|
||||
json.put("adOpenKey", "");
|
||||
json.put("adInterKey", "");
|
||||
json.put("adBannerKey", "");
|
||||
json.put("adVideoKey", "");
|
||||
json.put("adNativeKey", "");
|
||||
}
|
||||
}
|
||||
set.close();
|
||||
statement.close();
|
||||
|
Loading…
Reference in New Issue
Block a user