我正在尝试将一些不一致的bot数据插入数据库。我做了参数方法,但是没有用。我是刚开始使用python处理MYSQL。
我的代码
GraphRequest
我的错误
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
System.out.println("onSuccess");
token = loginResult.getAccessToken().getToken();
GraphRequest request = GraphRequest.newMeRequest(loginResult.getAccessToken(), new GraphRequest
.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object, GraphResponse response) {
Log.d("response", response.toString());
getData(object);
try {
Bundle bundle = new Bundle();
bundle.putString("firstName",object.getString("first_name"));
bundle.putString("lastName",object.getString("lastName"));
Intent i = new Intent(SignUpActivity.this,RegistrationActivity.class);
i.putExtras(bundle);
startActivity(i);
} catch (Exception e) {
e.printStackTrace();
}
}
});
//Graph API
Bundle parameter = new Bundle();
parameter.putString("fields", "id,first_name,last_name");
request.setParameters(parameter);
request.executeAsync();
}
}
答案 0 :(得分:0)
显然,错误消息建议您使用tuple
而不是list
在您的cursor.execute
通话中。除此之外,您的sql
查询的格式不正确(请参见examples部分)。您的execute
通话应该看起来像这样:
sql = "INSERT INTO Editedmsg VALUES (%d, %d, %d, %s, %s)"
params = (before.id, before.author.id, before.author.id,
before.content, after.content)
cursor.execute(sql, params)