01: package org.dbbrowser.db.engine;
02:
03: import java.util.Observable;
04:
05: /**
06: * This class is an observable and a singleton. It logs all the SQL statements run by the DBEngines. It updates all registered observers when an SQL statement is run
07: */
08: public class SQLLog extends Observable {
09: public static SQLLog sqlLog = new SQLLog();
10:
11: /**
12: * Constructer is private as it is a singleton
13: */
14: private SQLLog() {
15: }
16:
17: /**
18: * Get the singleton object
19: * @return
20: */
21: public static SQLLog getInstance() {
22: return sqlLog;
23: }
24:
25: /**
26: * Log the SQL statement
27: * @param sql
28: */
29: public void logSQLStatement(String sql) {
30: this.setChanged();
31: notifyObservers(sql);
32: }
33: }
|