今天我的应用程序遇到了一些非常奇怪的行为:我有这个函数来创建表,然后,成功后,继续编写代码。
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS newsDetail(id unique, title, text, created, createdTS, imageSmall, imageBig, facebook, gameNumber)');
tx.executeSql('CREATE TABLE IF NOT EXISTS lastModified(id unique, ts)');
tx.executeSql('CREATE TABLE IF NOT EXISTS teams(pos unique, name, games, gd, points, s, snv, gl, glo, goals)');
tx.executeSql('CREATE TABLE IF NOT EXISTS players(number unique, name, nickname, birthdate, height, married, children, profession, clubs, position, image)');
tx.executeSql('CREATE TABLE IF NOT EXISTS games(id unique, home, away, score, date, shortDate)');
tx.executeSql('CREATE TABLE IF NOT EXISTS galleryCategories(id unique, name, date, thumb, ordering)');
tx.executeSql('CREATE TABLE IF NOT EXISTS galleryImages(id unique, url, description, catid, ordering)');
tx.executeSql('CREATE TABLE IF NOT EXISTS videos(id unique, url, title, image)');
}, errorCB, function () {
loadData('newslist', createNewslist, true);
loadData('refresh', loadNewOnes, true);
});
现在的问题是,成功回调函数被调用了 8 次。这是为什么?我已经使用这个代码几个月了,以前从来没有遇到过这个问题。有没有人遇到过类似的事情?任何帮助表示赞赏。