2010-02-11 51 views

回答

10

我認爲你只能添加列到你的表,並創建觸發器更新列值與datetime('現在');

+2

這就是我想要做的。有關'insert'的示例,請參見http://www.shokhirev.com/nikolai/abc/sql/triggers.html。你也必須爲'update'添加一個類似的觸發器。 (另) – bart 2010-02-12 00:51:03

4

添加上次更改時間列到表(S),並更新該行上的修改。

2
CREATE TRIGGER update_appInfo_updatetime BEFORE update ON appInfo 
begin 
update appinfo set updatedatetime = strftime('%Y-%m-%d %H:%M:%S:%s','now', 'localtime') where bundle_id = old.bundle_id; 
end 

CREATE TABLE "appInfo" (bundle_id text NOT NULL PRIMARY KEY,appname text,title text DEFAULT appname,display_image text DEFAULT "default.gif",full_size_image text DEFAULT "default.gif",bundle_version text DEFAULT "1.0",company_id text,ipaname text,createdatetime text DEFAULT (strftime('%Y-%m-%d %H:%M:%S:%s','now', 'localtime')),updatedatetime text DEFAULT (strftime('%Y-%m-%d %H:%M:%S:%s','now', 'localtime')))