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);

It seems cannot drop trigger, because each time I re-execute this code will alert
trigger exists error.

waiter.james
  • 591
  • 2
  • 6
  • 16

0 Answers0