我在钛手机中使用 sqlite。我在同一个数据库中的另一个表上运行更新没有问题,所以我的连接似乎没问题。但是,当我在表上运行插入时,我没有插入任何数据,也没有抛出错误/异常。所以我对正在发生的事情感到困惑。这是我的表结构
CREATE TABLE events (
gCal_uid VARCHAR,
title VARCHAR,
content VARCHAR,
location VARCHAR,
startTime VARCHAR,
endTime VARCHAR,
published VARCHAR,
updated VARCHAR,
eventStatus VARCHAR
);
这是代码。你可以看到下面的插入语句。在变量的输出上,它们都有数据。可能我的语法错误?
var db = Ti.Database.open('content');
Titanium.API.info(" number or results returned = " + cal.feed.entry.length);
var i;
for (i=0; i < cal.feed.entry.length; i++){
var e = cal.feed.entry[i];
var calUid = e.gCal$uid.value;
var title = e.title.$t;
var content = e.content.$t;
var location = e.gd$where.valueString;
var startTime = e.gd$when[0].startTime;
var endTime = e.gd$when[0].endTime;
var published = e.published.$t;
var updated = e.updated.$t;
var eventStatus = e.gd$eventStatus.value;
Titanium.API.info(calUid + title + content + location + startTime + endTime + published + updated + eventStatus);
var theData = db.execute('INSERT INTO events (gCal_uid, title, content, location, startTime, endTime, published, updated, eventStatus) VALUES("'+calUid+'","'+title+'", "'+content+'", "'+location+'", "'+startTime+'", "'+endTime+'", "'+published+'", "'+updated+'", "'+eventStatus+'")');
theData;
Ti.API.info("rows inserted" + i);
}
Ti.API.info("closed the db");
db.close();