当我使用JayData和SQL Lite Provider(在手机间隙中)添加或保存一些数据时。我得到follwing错误:JayData上的默认错误回拨返回
DefaultError:DEFAULT ERROR CALLBACK!
异常 数据:参数[1] 0:的SQLError 代码:0 消息: “该语句回调引发异常或声明错误回调没有返回假” 原:的SQLError .... .. length:1 proto:Object get stack:function(){[native code]} message:“DEFAULT ERROR CALLBACK!” 名: “DefaultError” 设置堆栈:功能(){[本地代码]} 原:对象 jaydata.min.js:53个 Guard.raise jaydata.min.js:53 未捕获DefaultError:默认的错误回电话!
但是,记录添加/更新确定。不知道问题可能是什么......任何想法?
的代码是:
//Entities:
var Task = $data.Entity.extend("$org.types.Task", {
Id: { type: "int", key: true },
TaskType: { type: String, required: false },
StatusId: { type: "int", required: false },
DateScheduled: { type: Date, required: false },
TimeSlot: { type: String, required: false },
LastUpdated: { type: Date,required: false },
TaskName: { type: String, required: false },
SpecialInstructions: { type: String},
PropertyAddress: { type: String, required: false },
PropertyPostCode: { type: String, required: false },
PropertyType: { type: String, required: false },
NumberOfBedrooms: { type: "int", required: false },
HasGarage: { type: Boolean, required: false },
HasOutHouse: { type: Boolean, required: false },
IsReadyForReportGeneration: {type: Boolean},
TaskStatus: {type: String},
DateOfTaskDisplayName: {type: String}
});
//inside a look etc:
taskToUpdate.TaskType = task.TaskType;
taskToUpdate.StatusId = task.TaskStatusId;
taskToUpdate.TaskStatus = task.TaskStatus;
taskToUpdate.DateScheduled = task.Date;
taskToUpdate.TimeSlot = task.Time;
taskToUpdate.LastUpdated = new Date();
taskToUpdate.TaskName = "Job " + task.TaskId + " " + task.TaskType + " @" + task.AddressOfTask + ", " + task.PropertyPostCode;
taskToUpdate.SpecialInstructions = specialInstructions;
taskToUpdate.PropertyAddress = task.AddressOfTask;
taskToUpdate.PropertyPostCode = task.PropertyPostCode;
taskToUpdate.PropertyType = task.PropertyType;
taskToUpdate.NumberOfBedrooms = task.NumberOfBedrooms;
taskToUpdate.HasGarage = task.HasGarage;
taskToUpdate.HasOutHouse = task.HasOutHouse;
taskToUpdate.DateOfTaskDisplayName = task.DateOfTaskDisplayName,
taskToUpdate.IsReadyForReportGeneration = task.ReportReady;
if (result.length == 0) {
$org.context.Task.add(taskToUpdate);
}
rowsProcessed++;
if (rowsProcessed == rowsToProcess) {
$org.context.saveChanges({
success: function(db) {
viewModel.messages.push({message:"Tasks saved to local device."});
showNotificationInfo("Tasks saved to local device.");
hideLoader();
}, error: function(err) {
console.log(err);
viewModel.messages.push({message:"Errors saving tasks: " + err});
showNotificationError("Errors saving tasks: " + err);
hideLoader();
}
});
}
你怎么实例taskToUpdate? –
随着attachOrGet ...有趣的事情,它曾经工作正常,直到我改变了一些表定义..我也尝试使用dropAllTables选项,以检查它是否与模型更改有关的问题。 –
将computed = true添加到定义Id将有助于确保您拥有独特的价值。这是否会改变行为? – Robesz