opt switch logic
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.enums.RouteType;
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.mogo.module.navi.ui.NaviActivity;
|
||||
import com.mogo.module.navi.ui.search.SearchFragment;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
|
||||
public class ARouter$$Group$$navi implements IRouteGroup {
|
||||
@Override
|
||||
public void loadInto(Map<String, RouteMeta> atlas) {
|
||||
atlas.put("/navi/search", RouteMeta.build(RouteType.FRAGMENT, SearchFragment.class, "/navi/search", "navi", null, -1, -2147483648));
|
||||
atlas.put("/navi/search/ui/activity", RouteMeta.build(RouteType.ACTIVITY, NaviActivity.class, "/navi/search/ui/activity", "navi", null, -1, -2147483648));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.model.RouteMeta;
|
||||
import com.alibaba.android.arouter.facade.template.IProviderGroup;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
|
||||
public class ARouter$$Providers$$mogomodulenavi implements IProviderGroup {
|
||||
@Override
|
||||
public void loadInto(Map<String, RouteMeta> providers) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.alibaba.android.arouter.routes;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IRouteGroup;
|
||||
import com.alibaba.android.arouter.facade.template.IRouteRoot;
|
||||
import java.lang.Class;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DO NOT EDIT THIS FILE!!! IT WAS GENERATED BY AROUTER. */
|
||||
public class ARouter$$Root$$mogomodulenavi implements IRouteRoot {
|
||||
@Override
|
||||
public void loadInto(Map<String, Class<? extends IRouteGroup>> routes) {
|
||||
routes.put("navi", ARouter$$Group$$navi.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
package com.mogo.module.navi.dao;
|
||||
|
||||
import android.database.Cursor;
|
||||
import androidx.room.EmptyResultSetException;
|
||||
import androidx.room.EntityDeletionOrUpdateAdapter;
|
||||
import androidx.room.EntityInsertionAdapter;
|
||||
import androidx.room.RoomDatabase;
|
||||
import androidx.room.RoomSQLiteQuery;
|
||||
import androidx.sqlite.db.SupportSQLiteStatement;
|
||||
import com.mogo.module.navi.bean.SearchPoi;
|
||||
import io.reactivex.Single;
|
||||
import java.lang.Exception;
|
||||
import java.lang.Long;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.lang.SuppressWarnings;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class SearchPoiDao_Impl implements SearchPoiDao {
|
||||
private final RoomDatabase __db;
|
||||
|
||||
private final EntityInsertionAdapter __insertionAdapterOfSearchPoi;
|
||||
|
||||
private final EntityDeletionOrUpdateAdapter __deletionAdapterOfSearchPoi;
|
||||
|
||||
public SearchPoiDao_Impl(RoomDatabase __db) {
|
||||
this.__db = __db;
|
||||
this.__insertionAdapterOfSearchPoi = new EntityInsertionAdapter<SearchPoi>(__db) {
|
||||
@Override
|
||||
public String createQuery() {
|
||||
return "INSERT OR REPLACE INTO `t_search_poi`(`pId`,`name`,`address`,`lat`,`lng`,`district`,`adCode`,`typeCode`,`province`,`city`,`type`,`time`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(SupportSQLiteStatement stmt, SearchPoi value) {
|
||||
if (value.pId == null) {
|
||||
stmt.bindNull(1);
|
||||
} else {
|
||||
stmt.bindString(1, value.pId);
|
||||
}
|
||||
if (value.getName() == null) {
|
||||
stmt.bindNull(2);
|
||||
} else {
|
||||
stmt.bindString(2, value.getName());
|
||||
}
|
||||
if (value.getAddress() == null) {
|
||||
stmt.bindNull(3);
|
||||
} else {
|
||||
stmt.bindString(3, value.getAddress());
|
||||
}
|
||||
stmt.bindDouble(4, value.getLat());
|
||||
stmt.bindDouble(5, value.getLng());
|
||||
if (value.getDistrict() == null) {
|
||||
stmt.bindNull(6);
|
||||
} else {
|
||||
stmt.bindString(6, value.getDistrict());
|
||||
}
|
||||
if (value.getAdCode() == null) {
|
||||
stmt.bindNull(7);
|
||||
} else {
|
||||
stmt.bindString(7, value.getAdCode());
|
||||
}
|
||||
if (value.getTypeCode() == null) {
|
||||
stmt.bindNull(8);
|
||||
} else {
|
||||
stmt.bindString(8, value.getTypeCode());
|
||||
}
|
||||
if (value.getProvince() == null) {
|
||||
stmt.bindNull(9);
|
||||
} else {
|
||||
stmt.bindString(9, value.getProvince());
|
||||
}
|
||||
if (value.getCity() == null) {
|
||||
stmt.bindNull(10);
|
||||
} else {
|
||||
stmt.bindString(10, value.getCity());
|
||||
}
|
||||
stmt.bindLong(11, value.getType());
|
||||
stmt.bindLong(12, value.getTime());
|
||||
}
|
||||
};
|
||||
this.__deletionAdapterOfSearchPoi = new EntityDeletionOrUpdateAdapter<SearchPoi>(__db) {
|
||||
@Override
|
||||
public String createQuery() {
|
||||
return "DELETE FROM `t_search_poi` WHERE `pId` = ?";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(SupportSQLiteStatement stmt, SearchPoi value) {
|
||||
if (value.pId == null) {
|
||||
stmt.bindNull(1);
|
||||
} else {
|
||||
stmt.bindString(1, value.pId);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> insert(SearchPoi... datums) {
|
||||
__db.beginTransaction();
|
||||
try {
|
||||
List<Long> _result = __insertionAdapterOfSearchPoi.insertAndReturnIdsList(datums);
|
||||
__db.setTransactionSuccessful();
|
||||
return _result;
|
||||
} finally {
|
||||
__db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int delete(SearchPoi poi) {
|
||||
int _total = 0;
|
||||
__db.beginTransaction();
|
||||
try {
|
||||
_total +=__deletionAdapterOfSearchPoi.handle(poi);
|
||||
__db.setTransactionSuccessful();
|
||||
return _total;
|
||||
} finally {
|
||||
__db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteAll(List<SearchPoi> list) {
|
||||
int _total = 0;
|
||||
__db.beginTransaction();
|
||||
try {
|
||||
_total +=__deletionAdapterOfSearchPoi.handleMultiple(list);
|
||||
__db.setTransactionSuccessful();
|
||||
return _total;
|
||||
} finally {
|
||||
__db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SearchPoi>> getLastN(int limit) {
|
||||
final String _sql = "SELECT * FROM t_search_poi WHERE type=0 ORDER BY time DESC LIMIT ?";
|
||||
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 1);
|
||||
int _argIndex = 1;
|
||||
_statement.bindLong(_argIndex, limit);
|
||||
return Single.fromCallable(new Callable<List<SearchPoi>>() {
|
||||
@Override
|
||||
public List<SearchPoi> call() throws Exception {
|
||||
final Cursor _cursor = __db.query(_statement);
|
||||
try {
|
||||
final int _cursorIndexOfPId = _cursor.getColumnIndexOrThrow("pId");
|
||||
final int _cursorIndexOfName = _cursor.getColumnIndexOrThrow("name");
|
||||
final int _cursorIndexOfAddress = _cursor.getColumnIndexOrThrow("address");
|
||||
final int _cursorIndexOfLat = _cursor.getColumnIndexOrThrow("lat");
|
||||
final int _cursorIndexOfLng = _cursor.getColumnIndexOrThrow("lng");
|
||||
final int _cursorIndexOfDistrict = _cursor.getColumnIndexOrThrow("district");
|
||||
final int _cursorIndexOfAdCode = _cursor.getColumnIndexOrThrow("adCode");
|
||||
final int _cursorIndexOfTypeCode = _cursor.getColumnIndexOrThrow("typeCode");
|
||||
final int _cursorIndexOfProvince = _cursor.getColumnIndexOrThrow("province");
|
||||
final int _cursorIndexOfCity = _cursor.getColumnIndexOrThrow("city");
|
||||
final int _cursorIndexOfType = _cursor.getColumnIndexOrThrow("type");
|
||||
final int _cursorIndexOfTime = _cursor.getColumnIndexOrThrow("time");
|
||||
final java.util.List<com.mogo.module.navi.bean.SearchPoi> _result = new java.util.ArrayList<com.mogo.module.navi.bean.SearchPoi>(_cursor.getCount());
|
||||
while(_cursor.moveToNext()) {
|
||||
final com.mogo.module.navi.bean.SearchPoi _item;
|
||||
final java.lang.String _tmpPId;
|
||||
_tmpPId = _cursor.getString(_cursorIndexOfPId);
|
||||
final java.lang.String _tmpName;
|
||||
_tmpName = _cursor.getString(_cursorIndexOfName);
|
||||
final java.lang.String _tmpAddress;
|
||||
_tmpAddress = _cursor.getString(_cursorIndexOfAddress);
|
||||
final double _tmpLat;
|
||||
_tmpLat = _cursor.getDouble(_cursorIndexOfLat);
|
||||
final double _tmpLng;
|
||||
_tmpLng = _cursor.getDouble(_cursorIndexOfLng);
|
||||
final java.lang.String _tmpDistrict;
|
||||
_tmpDistrict = _cursor.getString(_cursorIndexOfDistrict);
|
||||
final java.lang.String _tmpAdCode;
|
||||
_tmpAdCode = _cursor.getString(_cursorIndexOfAdCode);
|
||||
final java.lang.String _tmpTypeCode;
|
||||
_tmpTypeCode = _cursor.getString(_cursorIndexOfTypeCode);
|
||||
_item = new com.mogo.module.navi.bean.SearchPoi(_tmpPId,_tmpName,_tmpAddress,_tmpLat,_tmpLng,_tmpDistrict,_tmpAdCode,_tmpTypeCode);
|
||||
final java.lang.String _tmpProvince;
|
||||
_tmpProvince = _cursor.getString(_cursorIndexOfProvince);
|
||||
_item.setProvince(_tmpProvince);
|
||||
final java.lang.String _tmpCity;
|
||||
_tmpCity = _cursor.getString(_cursorIndexOfCity);
|
||||
_item.setCity(_tmpCity);
|
||||
final int _tmpType;
|
||||
_tmpType = _cursor.getInt(_cursorIndexOfType);
|
||||
_item.setType(_tmpType);
|
||||
final long _tmpTime;
|
||||
_tmpTime = _cursor.getLong(_cursorIndexOfTime);
|
||||
_item.setTime(_tmpTime);
|
||||
_result.add(_item);
|
||||
}
|
||||
if(_result == null) {
|
||||
throw new EmptyResultSetException("Query returned empty result set: " + _statement.getSql());
|
||||
}
|
||||
return _result;
|
||||
} finally {
|
||||
_cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
_statement.release();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SearchPoi>> getAll() {
|
||||
final String _sql = "SELECT * FROM t_search_poi WHERE type=0";
|
||||
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
|
||||
return Single.fromCallable(new Callable<List<SearchPoi>>() {
|
||||
@Override
|
||||
public List<SearchPoi> call() throws Exception {
|
||||
final Cursor _cursor = __db.query(_statement);
|
||||
try {
|
||||
final int _cursorIndexOfPId = _cursor.getColumnIndexOrThrow("pId");
|
||||
final int _cursorIndexOfName = _cursor.getColumnIndexOrThrow("name");
|
||||
final int _cursorIndexOfAddress = _cursor.getColumnIndexOrThrow("address");
|
||||
final int _cursorIndexOfLat = _cursor.getColumnIndexOrThrow("lat");
|
||||
final int _cursorIndexOfLng = _cursor.getColumnIndexOrThrow("lng");
|
||||
final int _cursorIndexOfDistrict = _cursor.getColumnIndexOrThrow("district");
|
||||
final int _cursorIndexOfAdCode = _cursor.getColumnIndexOrThrow("adCode");
|
||||
final int _cursorIndexOfTypeCode = _cursor.getColumnIndexOrThrow("typeCode");
|
||||
final int _cursorIndexOfProvince = _cursor.getColumnIndexOrThrow("province");
|
||||
final int _cursorIndexOfCity = _cursor.getColumnIndexOrThrow("city");
|
||||
final int _cursorIndexOfType = _cursor.getColumnIndexOrThrow("type");
|
||||
final int _cursorIndexOfTime = _cursor.getColumnIndexOrThrow("time");
|
||||
final java.util.List<com.mogo.module.navi.bean.SearchPoi> _result = new java.util.ArrayList<com.mogo.module.navi.bean.SearchPoi>(_cursor.getCount());
|
||||
while(_cursor.moveToNext()) {
|
||||
final com.mogo.module.navi.bean.SearchPoi _item;
|
||||
final java.lang.String _tmpPId;
|
||||
_tmpPId = _cursor.getString(_cursorIndexOfPId);
|
||||
final java.lang.String _tmpName;
|
||||
_tmpName = _cursor.getString(_cursorIndexOfName);
|
||||
final java.lang.String _tmpAddress;
|
||||
_tmpAddress = _cursor.getString(_cursorIndexOfAddress);
|
||||
final double _tmpLat;
|
||||
_tmpLat = _cursor.getDouble(_cursorIndexOfLat);
|
||||
final double _tmpLng;
|
||||
_tmpLng = _cursor.getDouble(_cursorIndexOfLng);
|
||||
final java.lang.String _tmpDistrict;
|
||||
_tmpDistrict = _cursor.getString(_cursorIndexOfDistrict);
|
||||
final java.lang.String _tmpAdCode;
|
||||
_tmpAdCode = _cursor.getString(_cursorIndexOfAdCode);
|
||||
final java.lang.String _tmpTypeCode;
|
||||
_tmpTypeCode = _cursor.getString(_cursorIndexOfTypeCode);
|
||||
_item = new com.mogo.module.navi.bean.SearchPoi(_tmpPId,_tmpName,_tmpAddress,_tmpLat,_tmpLng,_tmpDistrict,_tmpAdCode,_tmpTypeCode);
|
||||
final java.lang.String _tmpProvince;
|
||||
_tmpProvince = _cursor.getString(_cursorIndexOfProvince);
|
||||
_item.setProvince(_tmpProvince);
|
||||
final java.lang.String _tmpCity;
|
||||
_tmpCity = _cursor.getString(_cursorIndexOfCity);
|
||||
_item.setCity(_tmpCity);
|
||||
final int _tmpType;
|
||||
_tmpType = _cursor.getInt(_cursorIndexOfType);
|
||||
_item.setType(_tmpType);
|
||||
final long _tmpTime;
|
||||
_tmpTime = _cursor.getLong(_cursorIndexOfTime);
|
||||
_item.setTime(_tmpTime);
|
||||
_result.add(_item);
|
||||
}
|
||||
if(_result == null) {
|
||||
throw new EmptyResultSetException("Query returned empty result set: " + _statement.getSql());
|
||||
}
|
||||
return _result;
|
||||
} finally {
|
||||
_cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
_statement.release();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SearchPoi>> getHomeAddress() {
|
||||
final String _sql = "SELECT * FROM t_search_poi WHERE type=1";
|
||||
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
|
||||
return Single.fromCallable(new Callable<List<SearchPoi>>() {
|
||||
@Override
|
||||
public List<SearchPoi> call() throws Exception {
|
||||
final Cursor _cursor = __db.query(_statement);
|
||||
try {
|
||||
final int _cursorIndexOfPId = _cursor.getColumnIndexOrThrow("pId");
|
||||
final int _cursorIndexOfName = _cursor.getColumnIndexOrThrow("name");
|
||||
final int _cursorIndexOfAddress = _cursor.getColumnIndexOrThrow("address");
|
||||
final int _cursorIndexOfLat = _cursor.getColumnIndexOrThrow("lat");
|
||||
final int _cursorIndexOfLng = _cursor.getColumnIndexOrThrow("lng");
|
||||
final int _cursorIndexOfDistrict = _cursor.getColumnIndexOrThrow("district");
|
||||
final int _cursorIndexOfAdCode = _cursor.getColumnIndexOrThrow("adCode");
|
||||
final int _cursorIndexOfTypeCode = _cursor.getColumnIndexOrThrow("typeCode");
|
||||
final int _cursorIndexOfProvince = _cursor.getColumnIndexOrThrow("province");
|
||||
final int _cursorIndexOfCity = _cursor.getColumnIndexOrThrow("city");
|
||||
final int _cursorIndexOfType = _cursor.getColumnIndexOrThrow("type");
|
||||
final int _cursorIndexOfTime = _cursor.getColumnIndexOrThrow("time");
|
||||
final java.util.List<com.mogo.module.navi.bean.SearchPoi> _result = new java.util.ArrayList<com.mogo.module.navi.bean.SearchPoi>(_cursor.getCount());
|
||||
while(_cursor.moveToNext()) {
|
||||
final com.mogo.module.navi.bean.SearchPoi _item;
|
||||
final java.lang.String _tmpPId;
|
||||
_tmpPId = _cursor.getString(_cursorIndexOfPId);
|
||||
final java.lang.String _tmpName;
|
||||
_tmpName = _cursor.getString(_cursorIndexOfName);
|
||||
final java.lang.String _tmpAddress;
|
||||
_tmpAddress = _cursor.getString(_cursorIndexOfAddress);
|
||||
final double _tmpLat;
|
||||
_tmpLat = _cursor.getDouble(_cursorIndexOfLat);
|
||||
final double _tmpLng;
|
||||
_tmpLng = _cursor.getDouble(_cursorIndexOfLng);
|
||||
final java.lang.String _tmpDistrict;
|
||||
_tmpDistrict = _cursor.getString(_cursorIndexOfDistrict);
|
||||
final java.lang.String _tmpAdCode;
|
||||
_tmpAdCode = _cursor.getString(_cursorIndexOfAdCode);
|
||||
final java.lang.String _tmpTypeCode;
|
||||
_tmpTypeCode = _cursor.getString(_cursorIndexOfTypeCode);
|
||||
_item = new com.mogo.module.navi.bean.SearchPoi(_tmpPId,_tmpName,_tmpAddress,_tmpLat,_tmpLng,_tmpDistrict,_tmpAdCode,_tmpTypeCode);
|
||||
final java.lang.String _tmpProvince;
|
||||
_tmpProvince = _cursor.getString(_cursorIndexOfProvince);
|
||||
_item.setProvince(_tmpProvince);
|
||||
final java.lang.String _tmpCity;
|
||||
_tmpCity = _cursor.getString(_cursorIndexOfCity);
|
||||
_item.setCity(_tmpCity);
|
||||
final int _tmpType;
|
||||
_tmpType = _cursor.getInt(_cursorIndexOfType);
|
||||
_item.setType(_tmpType);
|
||||
final long _tmpTime;
|
||||
_tmpTime = _cursor.getLong(_cursorIndexOfTime);
|
||||
_item.setTime(_tmpTime);
|
||||
_result.add(_item);
|
||||
}
|
||||
if(_result == null) {
|
||||
throw new EmptyResultSetException("Query returned empty result set: " + _statement.getSql());
|
||||
}
|
||||
return _result;
|
||||
} finally {
|
||||
_cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
_statement.release();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Single<List<SearchPoi>> getCompanyAddress() {
|
||||
final String _sql = "SELECT * FROM t_search_poi WHERE type=2";
|
||||
final RoomSQLiteQuery _statement = RoomSQLiteQuery.acquire(_sql, 0);
|
||||
return Single.fromCallable(new Callable<List<SearchPoi>>() {
|
||||
@Override
|
||||
public List<SearchPoi> call() throws Exception {
|
||||
final Cursor _cursor = __db.query(_statement);
|
||||
try {
|
||||
final int _cursorIndexOfPId = _cursor.getColumnIndexOrThrow("pId");
|
||||
final int _cursorIndexOfName = _cursor.getColumnIndexOrThrow("name");
|
||||
final int _cursorIndexOfAddress = _cursor.getColumnIndexOrThrow("address");
|
||||
final int _cursorIndexOfLat = _cursor.getColumnIndexOrThrow("lat");
|
||||
final int _cursorIndexOfLng = _cursor.getColumnIndexOrThrow("lng");
|
||||
final int _cursorIndexOfDistrict = _cursor.getColumnIndexOrThrow("district");
|
||||
final int _cursorIndexOfAdCode = _cursor.getColumnIndexOrThrow("adCode");
|
||||
final int _cursorIndexOfTypeCode = _cursor.getColumnIndexOrThrow("typeCode");
|
||||
final int _cursorIndexOfProvince = _cursor.getColumnIndexOrThrow("province");
|
||||
final int _cursorIndexOfCity = _cursor.getColumnIndexOrThrow("city");
|
||||
final int _cursorIndexOfType = _cursor.getColumnIndexOrThrow("type");
|
||||
final int _cursorIndexOfTime = _cursor.getColumnIndexOrThrow("time");
|
||||
final java.util.List<com.mogo.module.navi.bean.SearchPoi> _result = new java.util.ArrayList<com.mogo.module.navi.bean.SearchPoi>(_cursor.getCount());
|
||||
while(_cursor.moveToNext()) {
|
||||
final com.mogo.module.navi.bean.SearchPoi _item;
|
||||
final java.lang.String _tmpPId;
|
||||
_tmpPId = _cursor.getString(_cursorIndexOfPId);
|
||||
final java.lang.String _tmpName;
|
||||
_tmpName = _cursor.getString(_cursorIndexOfName);
|
||||
final java.lang.String _tmpAddress;
|
||||
_tmpAddress = _cursor.getString(_cursorIndexOfAddress);
|
||||
final double _tmpLat;
|
||||
_tmpLat = _cursor.getDouble(_cursorIndexOfLat);
|
||||
final double _tmpLng;
|
||||
_tmpLng = _cursor.getDouble(_cursorIndexOfLng);
|
||||
final java.lang.String _tmpDistrict;
|
||||
_tmpDistrict = _cursor.getString(_cursorIndexOfDistrict);
|
||||
final java.lang.String _tmpAdCode;
|
||||
_tmpAdCode = _cursor.getString(_cursorIndexOfAdCode);
|
||||
final java.lang.String _tmpTypeCode;
|
||||
_tmpTypeCode = _cursor.getString(_cursorIndexOfTypeCode);
|
||||
_item = new com.mogo.module.navi.bean.SearchPoi(_tmpPId,_tmpName,_tmpAddress,_tmpLat,_tmpLng,_tmpDistrict,_tmpAdCode,_tmpTypeCode);
|
||||
final java.lang.String _tmpProvince;
|
||||
_tmpProvince = _cursor.getString(_cursorIndexOfProvince);
|
||||
_item.setProvince(_tmpProvince);
|
||||
final java.lang.String _tmpCity;
|
||||
_tmpCity = _cursor.getString(_cursorIndexOfCity);
|
||||
_item.setCity(_tmpCity);
|
||||
final int _tmpType;
|
||||
_tmpType = _cursor.getInt(_cursorIndexOfType);
|
||||
_item.setType(_tmpType);
|
||||
final long _tmpTime;
|
||||
_tmpTime = _cursor.getLong(_cursorIndexOfTime);
|
||||
_item.setTime(_tmpTime);
|
||||
_result.add(_item);
|
||||
}
|
||||
if(_result == null) {
|
||||
throw new EmptyResultSetException("Query returned empty result set: " + _statement.getSql());
|
||||
}
|
||||
return _result;
|
||||
} finally {
|
||||
_cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() {
|
||||
_statement.release();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.mogo.module.navi.database;
|
||||
|
||||
import androidx.room.DatabaseConfiguration;
|
||||
import androidx.room.InvalidationTracker;
|
||||
import androidx.room.RoomOpenHelper;
|
||||
import androidx.room.RoomOpenHelper.Delegate;
|
||||
import androidx.room.util.TableInfo;
|
||||
import androidx.room.util.TableInfo.Column;
|
||||
import androidx.room.util.TableInfo.ForeignKey;
|
||||
import androidx.room.util.TableInfo.Index;
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper;
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper.Callback;
|
||||
import androidx.sqlite.db.SupportSQLiteOpenHelper.Configuration;
|
||||
import com.mogo.module.navi.dao.SearchPoiDao;
|
||||
import com.mogo.module.navi.dao.SearchPoiDao_Impl;
|
||||
import java.lang.IllegalStateException;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.lang.SuppressWarnings;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class AppDataBase_Impl extends AppDataBase {
|
||||
private volatile SearchPoiDao _searchPoiDao;
|
||||
|
||||
@Override
|
||||
protected SupportSQLiteOpenHelper createOpenHelper(DatabaseConfiguration configuration) {
|
||||
final SupportSQLiteOpenHelper.Callback _openCallback = new RoomOpenHelper(configuration, new RoomOpenHelper.Delegate(1) {
|
||||
@Override
|
||||
public void createAllTables(SupportSQLiteDatabase _db) {
|
||||
_db.execSQL("CREATE TABLE IF NOT EXISTS `t_search_poi` (`pId` TEXT NOT NULL, `name` TEXT, `address` TEXT, `lat` REAL NOT NULL, `lng` REAL NOT NULL, `district` TEXT, `adCode` TEXT, `typeCode` TEXT, `province` TEXT, `city` TEXT, `type` INTEGER NOT NULL, `time` INTEGER NOT NULL, PRIMARY KEY(`pId`))");
|
||||
_db.execSQL("CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)");
|
||||
_db.execSQL("INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"3c76b4248850c6e62d751825b93ce372\")");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropAllTables(SupportSQLiteDatabase _db) {
|
||||
_db.execSQL("DROP TABLE IF EXISTS `t_search_poi`");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(SupportSQLiteDatabase _db) {
|
||||
if (mCallbacks != null) {
|
||||
for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) {
|
||||
mCallbacks.get(_i).onCreate(_db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpen(SupportSQLiteDatabase _db) {
|
||||
mDatabase = _db;
|
||||
internalInitInvalidationTracker(_db);
|
||||
if (mCallbacks != null) {
|
||||
for (int _i = 0, _size = mCallbacks.size(); _i < _size; _i++) {
|
||||
mCallbacks.get(_i).onOpen(_db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateMigration(SupportSQLiteDatabase _db) {
|
||||
final HashMap<String, TableInfo.Column> _columnsTSearchPoi = new HashMap<String, TableInfo.Column>(12);
|
||||
_columnsTSearchPoi.put("pId", new TableInfo.Column("pId", "TEXT", true, 1));
|
||||
_columnsTSearchPoi.put("name", new TableInfo.Column("name", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("address", new TableInfo.Column("address", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("lat", new TableInfo.Column("lat", "REAL", true, 0));
|
||||
_columnsTSearchPoi.put("lng", new TableInfo.Column("lng", "REAL", true, 0));
|
||||
_columnsTSearchPoi.put("district", new TableInfo.Column("district", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("adCode", new TableInfo.Column("adCode", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("typeCode", new TableInfo.Column("typeCode", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("province", new TableInfo.Column("province", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("city", new TableInfo.Column("city", "TEXT", false, 0));
|
||||
_columnsTSearchPoi.put("type", new TableInfo.Column("type", "INTEGER", true, 0));
|
||||
_columnsTSearchPoi.put("time", new TableInfo.Column("time", "INTEGER", true, 0));
|
||||
final HashSet<TableInfo.ForeignKey> _foreignKeysTSearchPoi = new HashSet<TableInfo.ForeignKey>(0);
|
||||
final HashSet<TableInfo.Index> _indicesTSearchPoi = new HashSet<TableInfo.Index>(0);
|
||||
final TableInfo _infoTSearchPoi = new TableInfo("t_search_poi", _columnsTSearchPoi, _foreignKeysTSearchPoi, _indicesTSearchPoi);
|
||||
final TableInfo _existingTSearchPoi = TableInfo.read(_db, "t_search_poi");
|
||||
if (! _infoTSearchPoi.equals(_existingTSearchPoi)) {
|
||||
throw new IllegalStateException("Migration didn't properly handle t_search_poi(com.mogo.module.navi.bean.SearchPoi).\n"
|
||||
+ " Expected:\n" + _infoTSearchPoi + "\n"
|
||||
+ " Found:\n" + _existingTSearchPoi);
|
||||
}
|
||||
}
|
||||
}, "3c76b4248850c6e62d751825b93ce372", "1e694e62e3fb46f02d0cfcf9314e2afb");
|
||||
final SupportSQLiteOpenHelper.Configuration _sqliteConfig = SupportSQLiteOpenHelper.Configuration.builder(configuration.context)
|
||||
.name(configuration.name)
|
||||
.callback(_openCallback)
|
||||
.build();
|
||||
final SupportSQLiteOpenHelper _helper = configuration.sqliteOpenHelperFactory.create(_sqliteConfig);
|
||||
return _helper;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InvalidationTracker createInvalidationTracker() {
|
||||
return new InvalidationTracker(this, "t_search_poi");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAllTables() {
|
||||
super.assertNotMainThread();
|
||||
final SupportSQLiteDatabase _db = super.getOpenHelper().getWritableDatabase();
|
||||
try {
|
||||
super.beginTransaction();
|
||||
_db.execSQL("DELETE FROM `t_search_poi`");
|
||||
super.setTransactionSuccessful();
|
||||
} finally {
|
||||
super.endTransaction();
|
||||
_db.query("PRAGMA wal_checkpoint(FULL)").close();
|
||||
if (!_db.inTransaction()) {
|
||||
_db.execSQL("VACUUM");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchPoiDao poiDao() {
|
||||
if (_searchPoiDao != null) {
|
||||
return _searchPoiDao;
|
||||
} else {
|
||||
synchronized(this) {
|
||||
if(_searchPoiDao == null) {
|
||||
_searchPoiDao = new SearchPoiDao_Impl(this);
|
||||
}
|
||||
return _searchPoiDao;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user