From 93c7bf3dd5a0a0017ec99c23fee4db6a72f050f7 Mon Sep 17 00:00:00 2001 From: servertude Date: Sat, 8 Mar 2008 07:38:30 +0000 Subject: [PATCH] implement flush menus --- extra/jheidi/flushEvents.ajl | 26 ++++++++++++++++++++++++++ extra/jheidi/showMainWindow.ajl | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 extra/jheidi/flushEvents.ajl diff --git a/extra/jheidi/flushEvents.ajl b/extra/jheidi/flushEvents.ajl new file mode 100644 index 00000000..f663b3d2 --- /dev/null +++ b/extra/jheidi/flushEvents.ajl @@ -0,0 +1,26 @@ + +String who = arg("source"); + +WindowContext context = argObj("windowContext"); + +log.debug("Event received: " + who); + +String curDB = context.get("currentDB"); +if ( curDB != null ) +{ + String cmd = who.toLowerCase(); + DB db = context.get("db"); + db.begin(); + db.execute("use " + curDB); + db.execute("flush " + cmd); + if ( cmd.endsWith("lock") ) + { + ((Frame)context.get("/")).popupMessage("Tables have been flushed and read lock acquired.\nPerform backup or snapshot of table data files now.\nClick OK to unlock when done..."); + db.execute("unlock tables"); + } + db.end(); +} + + + + diff --git a/extra/jheidi/showMainWindow.ajl b/extra/jheidi/showMainWindow.ajl index 07b77b13..70553373 100644 --- a/extra/jheidi/showMainWindow.ajl +++ b/extra/jheidi/showMainWindow.ajl @@ -15,7 +15,7 @@ app.menu("&Edit").item("Cut", "Copy", "Paste"); Menu m = app.menu("&Tools").item("Refresh", "separator", "Create Database", "Drop Database", "Create Table", "Drop Table" , "separator"); Menu flush = m.submenu("Flush"); - flush.item("Hosts", "Logs", "Privledges", "Tables", "Tables with Read Lock", "Status" ); + flush.events("flushEvents").item("Hosts", "Logs", "Privileges", "Tables", "Tables with Read Lock", "Status" ); m.item("separator", "User-Manager", "Maintenance", "separator", "Preferences"); app.menu("&Import").item("Import CSV File", "Load SQL File", "Insert Files into Blob Fields"); app.menu("E&xport").item("Export Tables as SQL","separator", "Copy as CSV Data", "Copy as HTML Data", "Copy as XML Data","Export Data...");