This is somewhat brute wanna-be hack allowing sqlite triggers to
recurse up to certain depth. I'd guess that trigger deletetion might be
broken, as well as other things depending on triggers being non recursive.

Also its utterly slow, even for precompiled statements .. I have no idea why.

/me calling for enlightenment on this subject.

Index: src/sqliteInt.h
===================================================================
RCS file: /sqlite/sqlite/src/sqliteInt.h,v
retrieving revision 1.510
diff -n -u -r1.510 sqliteInt.h
--- src/sqliteInt.h	17 Jun 2006 10:44:42 -0000	1.510
+++ src/sqliteInt.h	21 Jun 2006 21:40:22 -0000
@@ -102,6 +102,20 @@
 #endif
 
 /*
+** This defines how many times is a chain of triggers
+** allowed to recurse (recursion depth). Still not
+** really recursive triggers, but better than nothing.
+** It would be cool to make this user-settable
+** per-table||trigger - volunteers are welcome.
+**/
+
+#ifdef SQLITE_TRIGGER_MAXDEPTH
+# define TRIGGER_MAXDEPTH SQLITE_TRIGGER_MAXDEPTH
+#else
+# define TRIGGER_MAXDEPTH 16
+#endif
+
+/*
 ** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
 ** afterward. Having this macro allows us to cause the C compiler 
 ** to omit code used by TEMP tables without messy #ifndef statements.
@@ -1275,6 +1289,7 @@
   u8 checkSchema;      /* Causes schema cookie check after an error */
   u8 nested;           /* Number of nested calls to the parser/code generator */
   u8 parseError;       /* True if a parsing error has been seen */
+  int trigdepth;       /* number of recursive triggers */
   int nErr;            /* Number of errors seen */
   int nTab;            /* Number of previously allocated VDBE cursors */
   int nMem;            /* Number of memory cells used so far */
Index: src/trigger.c
===================================================================
RCS file: /sqlite/sqlite/src/trigger.c,v
retrieving revision 1.100
diff -n -u -r1.100 trigger.c
--- src/trigger.c	14 Jun 2006 19:00:21 -0000	1.100
+++ src/trigger.c	21 Jun 2006 21:40:22 -0000
@@ -764,7 +764,12 @@
       for(pS=pParse->trigStack; pS && p!=pS->pTrigger; pS=pS->pNext){}
       if( !pS ){
         fire_this = 1;
-      }
+      } else {
+        /* permit to recurse trigger(s) up to certain depth. */ 
+        pParse->trigdepth++;
+        if (pParse->trigdepth < TRIGGER_MAXDEPTH)
+	    fire_this = 1;
+	}
 #if 0    /* Give no warning for recursive triggers.  Just do not do them */
       else{
         sqlite3ErrorMsg(pParse, "recursive triggers not supported (%s)",
