File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,17 +36,17 @@ class DatabaseTriggers(object):
3636 }
3737 <BLANKLINE>
3838 private static final String tr_archive =
39- "CREATE TEMP TRIGGER IF NOT EXISTS tr_archive
40- BEFORE DELETE ON notes
41- BEGIN
42- INSERT INTO archive (noteid,notetext) VALUES (old._id,old.text);
43- END";
39+ "CREATE TEMP TRIGGER IF NOT EXISTS tr_archive"
40+ +" BEFORE DELETE ON notes"
41+ +" BEGIN"
42+ +" INSERT INTO archive (noteid,notetext) VALUES (old._id,old.text);"
43+ +" END";
4444 private static final String tr_log =
45- "CREATE TRIGGER IF NOT EXISTS tr_log
46- BEFORE UPDATE ON notes
47- BEGIN
48- INSERT INTO log (noteid,notetext) VALUES (new._id,new.text);
49- END";
45+ "CREATE TRIGGER IF NOT EXISTS tr_log"
46+ +" BEFORE UPDATE ON notes"
47+ +" BEGIN"
48+ +" INSERT INTO log (noteid,notetext) VALUES (new._id,new.text);"
49+ +" END";
5050 }
5151
5252 """
@@ -93,7 +93,7 @@ def def_triggers(self):
9393
9494_D_T = '''
9595 private static final String {0.name} =
96- "{0}";'''
96+ "{0.java_string }";'''
9797
9898_C_P = '''
9999 db.execSQL("DROP TRIGGER IF EXISTS {0.name}";
Original file line number Diff line number Diff line change @@ -307,11 +307,12 @@ def __init__(self, name):
307307 self ._when = None
308308 self ._body = []
309309
310- def __repr__ (self ):
311- sql = self .sql_trigger ()
310+ @property
311+ def java_string (self ):
312+ sql = str (self )
312313 return '"\n +"' .join (sql .split ('\n ' ))
313314
314- def sql_trigger (self ):
315+ def __repr__ (self ):
315316 if self ._when is None :
316317 raise ValueError ('You must specify a trigger time, like:\
317318 Trigger("bob").after, .before or .instead_of' )
You can’t perform that action at this time.
0 commit comments