반응형
Android SQLite에서 Maria로 여러 데이터 동기화DB
저는 동기화하기 쉬운 방법을 찾습니다.SQLLite
저장된 데이터 대상MariaDB
SQL 데이터베이스.
WebService
문제는 없지만 한 번에 여러 개의 데이터 동기화를 얻을 수 있는 단서가 없습니다.
나는.DBAdapter
이 경우 id는 공유 기본 설정에 저장됩니다.
public projekt getprojekt(int id){
// 2. build projekt query
Cursor cursor =
db.query(DATABASE_TABLE_P, // a. table
TABLE_P_COLUMNS_ALL, // b. column names
" id = ?", // c. selections
new String[] { String.valueOf(id) }, // d. selections args
null, // e. group by
null, // f. having
null, // g. order by
null); // h. limit
// 3. if we got results get the first one
if (cursor != null)
cursor.moveToFirst();
// 4. build projekt object
projekt projekt = new projekt();
projekt.setId(Integer.parseInt(cursor.getString(0)));
projekt.setKostenstelle(cursor.getString(1));
projekt.setAG(cursor.getString(2));
....
// 5. return projekt
return projekt;
}
그리고 이것은:
// Get Room List
public ArrayList<HashMap<String, String>> GetRaum(int pid){
ArrayList<HashMap<String, String>> raumList = new ArrayList<>();
String query = "SELECT * FROM "+ DATABASE_TABLE_R + " where pid = '"+ pid +"' order by "+KEY_R_BEZEICHNUNG+" asc";
Cursor cursor = db.rawQuery(query,null);
while (cursor.moveToNext()){
HashMap<String,String> raum = new HashMap<>();
raum.put("id",cursor.getString(cursor.getColumnIndex(KEY_M_ID)));
raum.put("bezeichnung",cursor.getString(cursor.getColumnIndex(KEY_M_BEZEICHNUNG)));
raumList.add(raum);
}
return raumList;
}
비트 전송을 위해 몇 개의 "방"을 선택하는 방법.POST/JSON
로.WebService
?
현재 데이터를 전송하는 기능이 완료되지 않았습니다... 단지 데이터를 가져오는 중입니다.projekt_id
부터sharedpreferences
.
public void postData() throws JSONException {
final SharedPreferences sharedPreferences = this.getSharedPreferences("de.dasal.dguvv3", Context.MODE_PRIVATE);
final Integer projektidsp = sharedPreferences.getInt("projekt_id", 0);
final projekt projekt = db.getprojekt(projektidsp);
}
추가 정보가 필요하면 알려주시기 바랍니다.에 대한 첫 번째 질문입니다.stackoverflow
.
언급URL : https://stackoverflow.com/questions/53634390/sync-several-data-from-android-sqllite-to-mariadb
반응형
'programing' 카테고리의 다른 글
중첩 예외는 java.dll입니다.잘못된 인수예외:관리되지 않는 유형: 클래스 (0) | 2023.08.29 |
---|---|
기본 및 특정 요청 시간 초과 (0) | 2023.08.29 |
두 SQL Server 데이터베이스를 비교하는 무료 도구는 무엇입니까? (0) | 2023.08.29 |
MySQL: #1075 - 잘못된 테이블 정의; 자동 증분과 다른 키? (0) | 2023.08.29 |
함수 호출에 여러 별표를 사용하면 무슨 소용이 있습니까? (0) | 2023.08.29 |