Nao sei o que acontece que na hora de replicar os dados para o banco de dados Mysql, ele nao grava o campo LO
oBS. O “LO”, contem conteudo, os demais campos grava normalmente
public void run() {
SQLiteDatabase db = openOrCreateDatabase("vendas.db", Context.MODE_PRIVATE, null);
Cursor cursor = db.rawQuery("SELECT * FROM vendas", null);
int totalDB = cursor.getCount();
int totalReplicado = 0;
while(cursor.moveToNext()){
StringBuilder strURL = new StringBuilder();
strURL.append("http://xxxxxxxxx/vendas/inserir.php?produto=");
strURL.append(cursor.getInt(cursor.getColumnIndex("produto")));
strURL.append("&preco=");
strURL.append(cursor.getDouble(cursor.getColumnIndex("preco")));
strURL.append("&latitude=");
strURL.append(cursor.getDouble(cursor.getColumnIndex("la")));
strURL.append("&longitude=");
strURL.append(cursor.getDouble(cursor.getColumnIndex("lo")));
//strURL.append(cursor.getDouble(9));
Log.d("ExportarVendasService", "lo " + cursor.getDouble(cursor.getColumnIndex("lo")));
Log.d("ExportarVendasService", strURL.toString());
try{
URL url = new URL(strURL.toString());
HttpURLConnection http = (HttpURLConnection)url.openConnection();
InputStreamReader ips = new InputStreamReader(http.getInputStream());
BufferedReader line = new BufferedReader(ips);
String linhaRetorno = line.readLine();
if(linhaRetorno.equals("Y")){
Log.d("ExportarVendasService", "id " + String.valueOf(cursor.getInt(0)));
db.delete("vendas", "_id=?", new String[]{String.valueOf(cursor.getInt(0))});
totalReplicado++;
Log.d("ExportarVendasService", "OK");
}
}catch(Exception ex){
Log.d("ExportarVendasService", ex.getMessage());
}
}
db.close();