1
String  sql1 = "DROP TRIGGER IF EXISTS Trigger_Insert_"  + table  +  " ;"  ;       
db.execSQL(sql1);


String  sql2 = "CREATE TRIGGER Trigger_Insert_" +  table  +
                "    AFTER INSERT "+ 
                " ON "+ table + 
                "  BEGIN "+ 
                " SELECT last_insert_rowid(); "+
                " insert into Metadata(NID, tableName , rowId, timeStamp , sync) values(hex(randomblob(16)),'" + table + "'," +
                        "  CAST( last_insert_rowid()  AS INTEGER), datetime('now'),0); END;";

db.execSQL(sql1);

似乎无法删除触发器,因为每次我重新执行此代码都会警告
触发器存在错误。

4

0 回答 0