Browse Source

NOTIFY on roasting_log changes

Neal Wilson 10 years ago
parent
commit
77b1a9beb4
1 changed files with 12 additions and 0 deletions
  1. 12
    0
      config/Windows/navigation.xml

+ 12
- 0
config/Windows/navigation.xml View File

280
 			query = query.invalidate();
280
 			query = query.invalidate();
281
 		};
281
 		};
282
 		
282
 		
283
+		/* Asynchronous notifications */
284
+		var DBUpdateNotifications = function() {
285
+			var query = new new QSqlQuery;
286
+			query.exec("CREATE OR REPLACE FUNCTION notify_roasting_log_change() RETURNS TRIGGER AS $$ BEGIN NOTIFY RoastingLogChange; END; $$ LANGUAGE plpgsql");
287
+			query.exec("CREATE TRIGGER notify_roasting_log_change AFTER INSERT OR UPDATE ON roasting_log FOR EACH STATEMENT EXECUTE PROCEDURE notify_roasting_log_change()");
288
+			query = query.invalidate();
289
+		};
290
+		
283
 		query = new QSqlQuery();
291
 		query = new QSqlQuery();
284
 		/* A table keeps track of database versioning information. This table is created
292
 		/* A table keeps track of database versioning information. This table is created
285
 		   if required. */
293
 		   if required. */
299
 				DBUpdateMultiUser();
307
 				DBUpdateMultiUser();
300
 				DBUpdateHistory();
308
 				DBUpdateHistory();
301
 			}
309
 			}
310
+			if(query.value(2) < 3)
311
+			{
312
+				DBUpdateNotifications();
313
+			}
302
 		}
314
 		}
303
 		else
315
 		else
304
 		{
316
 		{

Loading…
Cancel
Save