@@ -36,6 +36,9 @@ class RunGenerator implements OddgenGenerator2 {
3636 public static var RESET_PACKAGE = UtplsqlResources . getString(" PREF_RESET_PACKAGE_LABEL" )
3737 public static var CLEAR_SCREEN = UtplsqlResources . getString(" PREF_CLEAR_SCREEN_LABEL" )
3838 public static var INDENT_SPACES = UtplsqlResources . getString(" PREF_INDENT_SPACES_LABEL" )
39+
40+ // oddgen node cache
41+ var List<Node > runnables = null ;
3942
4043 override isSupported (Connection conn ) {
4144 var ret = false
@@ -75,17 +78,22 @@ class RunGenerator implements OddgenGenerator2 {
7578 }
7679
7780 override getNodes (Connection conn , String parentNodeId ) {
78- val preferences = PreferenceModel . getInstance(Preferences . preferences)
79- val params = new LinkedHashMap<String , String > ()
80- params. put(RESET_PACKAGE , if (preferences. resetPackage) {YES } else {NO })
81- params. put(CLEAR_SCREEN , if (preferences. clearScreen) {YES } else {NO })
82- params. put(INDENT_SPACES , String . valueOf(preferences. indentSpaces))
83- val UtplsqlDao dao = new UtplsqlDao (conn)
84- val nodes = dao. runnables
85- for (node : nodes) {
86- node. params = params
81+ // oddgen asks for children for each parent node, regardless of load strategy (eager/lazy)
82+ // oddgen does not know about the load strategy, hence caching is the responsibility of the generator
83+ if (runnables == = null ) {
84+ val preferences = PreferenceModel . getInstance(Preferences . preferences)
85+ val params = new LinkedHashMap<String , String > ()
86+ params. put(RESET_PACKAGE , if (preferences. resetPackage) {YES } else {NO })
87+ params. put(CLEAR_SCREEN , if (preferences. clearScreen) {YES } else {NO })
88+ params. put(INDENT_SPACES , String . valueOf(preferences. indentSpaces))
89+ val UtplsqlDao dao = new UtplsqlDao (conn)
90+ // load node tree eagerly (all nodes in one go)
91+ runnables = dao. runnables
92+ for (node : runnables) {
93+ node. params = params
94+ }
8795 }
88- return nodes
96+ return runnables
8997 }
9098
9199 override getLov (Connection conn , LinkedHashMap<String , String > params , List<Node > nodes ) {
0 commit comments