What's the meaning of this error message “insertId: Error: INVALID_ACCESS_ERR: DOM Exception 15”?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 07:48:01

问题


I'm developing an app using jquery mobile, phonegap and openDatabase. When the app is executed, I can see in the console of Safari browser the SQLResultSet with this message:

insertId: Error: INVALID_ACCESS_ERR: DOM Exception 15. 

However, my app is working ok. But I don't understand why that message is shown.

Please, help me.


回答1:


It means that no row was inserted by a transaction, by that it's more an information than an error.

If an INSERT-statement wasn't successfull or an transaction wasn't an INSERT at all, the insertId-property of the resultSet contains this message instead of the ID of the last inserted row.

http://docs.phonegap.com/phonegap_storage_storage.md.html#SQLResultSet




回答2:


I had this and it was driving me completely crazy.

What happens is that, if the operation is not an INSERT statement, the insertId is nullified, since no rows have been inserted, but instead of just showing 0 it gives a cryptic DOM error.

You simply have to ignore it and concentrate on the rows.

The big question is why the hell have it in the first place, why not just have a sqlInsertResultSet and a sqlRetrieveResultSet and stop messing with our minds :(




回答3:


On my side following gave the mentioned error:

results.rows[0].x

and this worked:

results.rows.item(0).x


来源:https://stackoverflow.com/questions/4586618/whats-the-meaning-of-this-error-message-insertid-error-invalid-access-err-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!