问题描述
MysqL> CREATE USER 'bugs'@'localhost' IDENTIFIED BY '***';
Query OK,0 rows affected (0.00 sec)
MysqL> GRANT ALL ON 'bugs'.'*' TO 'bugs'@'localhost';
ERROR 1064 (42000): You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ''bugs'.'*' TO 'bugs'@'localhost'' at line 1
MysqL> GRANT ALL PRIVILEGES ON 'bugs'.'*' TO 'bugs'@'localhost';
ERROR 1064 (42000): You have an error in your sql Syntax; check the manual that corresponds to your MysqL server version for the right Syntax to use near ''bugs'.'*' TO 'bugs'@'localhost'' at line 1
它是我的MysqL-> sqlite代码,我想在加载数据时显示ProgressDialog,但由于某种原因,尽管下载正在进行并且百分比已记入日志,但它却不显示它。 不久前我一直在使用这种方法,并且我不明白我在做什么错。以这种方式从主活动中调用我的方法 新的LoadDataService(this).execute();
我的gradle配置:
package com.urban.map.services;
import android.app.ProgressDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.util.Log;
import com.urban.map.App;
import com.urban.map.database.Queries;
import com.urban.map.database.TestDB;
import org.richit.easiestsqllib.Column;
import org.richit.easiestsqllib.Datum;
import org.richit.easiestsqllib.EasiestDB;
import java.util.Date;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class LoadDataService extends AsyncTask<Void,Integer,String> {
private Context mContext;
private ProgressDialog pd;
public LoadDataService(Context context) {
super();
mContext = context;
}
@Override
protected void onPreExecute() {
pd = new ProgressDialog(mContext);
pd.setProgressstyle(ProgressDialog.STYLE_HORIZONTAL);
pd.setMax(100);
pd.setMessage("Hello ");
pd.setTitle("ASSSSSSSs");
pd.show();
super.onPreExecute();
}
int current_percent = 0;
int count = 0;
@Override
protected String doInBackground(Void... voids) {
String time = String.valueOf(new Date().getTime()/1000L);
Queries q = App.getQueriesInstance(mContext);
q.insertTime();
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://100rad.ru/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
PostInterface service = retrofit.create(PostInterface.class);
Call<List<MapData>> call = service.getMap("full");
call.enqueue(new Callback<List<MapData>>() {
@Override
public void onResponse(Call<List<MapData>> call,Response<List<MapData>> response) {
List<MapData> newData = response.body();
String max = String.valueOf(newData.size());
Log.e("test","max "+max);
for (int i = 0; i < newData.size(); i++) {
String auth_id = "368067266";
if (newData.get(i).getAuth().length() > 1) {
auth_id = newData.get(i).getAuth();
}
String store_id = newData.get(i).getStore_id();
String keywords = newData.get(i).getKey();
String telephone = newData.get(i).getTel();
String latitude = newData.get(i).getLat();
String longitude = newData.get(i).getLon();
String store_desc = newData.get(i).getStore_desc();
String store_name = newData.get(i).getStore_name();
String category_id = String.valueOf(newData.get(i).getCategory());
if (!category_id.equals("15")) {
ContentValues values = new ContentValues();
values.put("store_id",store_id);
values.put("keywords",keywords);
values.put("telephone",telephone);
values.put("latitude",latitude);
values.put("longitude",longitude);
values.put("store_desc",store_desc);
values.put("store_name",store_name);
values.put("category_id",category_id);
values.put("auth_id",auth_id);
q.insertStore(values);
values.clear();
List<Value> url = newData.get(i).getPhotos();
for (Value test : url) {
String data = test.getPhoto_url();
ContentValues pvalues = new ContentValues();
pvalues.put("store_id",store_id);
pvalues.put("photo_url",data);
q.insertPhoto(pvalues);
pvalues.clear();
}
}
count++;
current_percent = (100 * count / Integer.parseInt(max));
Log.e("test",""+current_percent);
publishProgress(current_percent);
}
}
@Override
public void onFailure(Call<List<MapData>> call,Throwable t) {
}
});
return "Sucess";
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
pd.setProgress(values[0]);
}
@Override
protected void onPostExecute(String result) {
SharedPreferences sharedPreferences = mContext.getSharedPreferences("App",Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("firstLogin",false);
editor.apply();
if (pd != null && pd.isShowing()) {
pd.dismiss();
}
}
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)