1
我有一张表,可以获得高分条目。但是,如果用户已在表中有一个条目(通过GUID字段进行跟踪,而不是用户参数),我想更新它,如果新条目有更好的时间,否则不要更改现有记录。但是,如果用户在高分表中没有记录,则添加新记录。我也有两个查询参数传递给查询。在HighScore表中插入或更新记录
我想插入操作来处理这个表。我有这到目前为止,但我得到了异常,当我在高分表调用InsertAsync(...)
function insert(item, user, request) {
var sql ="select Id from HighScore where PlayerGUID=? AND PlayerBadge=?";
mssql.query(sql, [user.PlayerGUID], [user.PlayerBadge], {
success: function(results) {
if(results.length > 0) {
// leader board record exists so update the current record
// Check the existing record and update it is the new time is better
console.log("Found existing entry");
} else {
// no record exists for this user to insert one
request.execute();
console.log("Found existing entry");
}
}
});
}
任何人都可以提供我实现我的目标的任何援助?
非常感谢,
J.