| | |
| | | import android.database.Cursor;
|
| | | import android.database.sqlite.SQLiteDatabase;
|
| | |
|
| | | import cn.com.basic.face.base.Config;
|
| | | import cn.com.basic.face.base.MainActivity;
|
| | |
|
| | | /**
|
| | | * 数据同步dao层
|
| | |
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | //#######################以上为增删改查DEMO#################################
|
| | |
|
| | |
|
| | |
| | | /**
|
| | | * 单向同步,从客户端同步到服务器端
|
| | | * @param clientTable
|
| | | * @param serviceTable
|
| | | */
|
| | | public static void clientToService(String clientTable,String serviceTable){
|
| | | public static void clientToService(String clientTable){
|
| | | //public Cursor query(String table,String[] columns,String selection,String[] selectionArgs,String groupBy,String having,String orderBy,String limit);
|
| | | SQLiteDatabase db = MainActivity.getInstance().db;
|
| | |
|
| | | SQLiteDatabase db = Config.sqlMap.getDb();
|
| | | db.beginTransaction();
|
| | | db.execSQL("");
|
| | | db.endTransaction();
|
| | | //1.根据上次同步时间找出需要上传的数据
|
| | |
|
| | | //2.发送数据给服务器端
|
| | | db.execSQL("");
|
| | | //1.根据上次同步时间找出需要上传的数据
|
| | |
|
| | |
|
| | | String selection="is_synchron=?";
|
| | | String[] selectionArgs=new String[]{"N"};
|
| | | String orderBy="update_time desc";
|
| | | Cursor cursor = db.query(clientTable,null,selection,selectionArgs,null,null,orderBy,null);
|
| | |
|
| | | while (cursor.moveToNext())
|
| | | {
|
| | | int useid = cursor.getInt(cursor.getColumnIndex("useid"));
|
| | | String date = cursor.getString(cursor.getColumnIndex("date"));
|
| | | String content = cursor.getString(cursor.getColumnIndex("content"));
|
| | | int fangxiang =cursor.getShort(cursor.getColumnIndex("dirr"));
|
| | | boolean dirr;
|
| | | }
|
| | |
|
| | | cursor.close();
|
| | | db.close();
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | /**
|
| | | * 单向同步,从服务端同步到客户端
|
| | | * @param clientTable
|