1 56 57 package org.objectstyle.cayenne.access; 58 59 import java.sql.Connection ; 60 import java.sql.SQLException ; 61 import java.util.List ; 62 63 import org.apache.log4j.Level; 64 import org.objectstyle.cayenne.query.Query; 65 import org.objectstyle.cayenne.query.SQLAction; 66 67 75 class DataNodeQueryAction implements OperationObserver { 76 77 OperationObserver observer; 78 DataNode node; 79 80 private Query currentQuery; 81 82 public DataNodeQueryAction(DataNode node, OperationObserver observer) { 83 this.observer = observer; 84 this.node = node; 85 } 86 87 public void runQuery(Connection connection, Query query) throws SQLException , 88 Exception { 89 90 this.currentQuery = query; 93 94 SQLAction action = node.getAdapter().getAction(query, node); 95 action.performAction(connection, this); 96 } 97 98 public void nextBatchCount(Query query, int[] resultCount) { 99 observer.nextBatchCount(currentQuery, resultCount); 100 } 101 102 public void nextCount(Query query, int resultCount) { 103 observer.nextCount(currentQuery, resultCount); 104 } 105 106 public void nextDataRows(Query query, List dataRows) { 107 observer.nextDataRows(currentQuery, dataRows); 108 } 109 110 public void nextDataRows(Query q, ResultIterator it) { 111 observer.nextDataRows(currentQuery, it); 112 } 113 114 public void nextGeneratedDataRows(Query query, ResultIterator keysIterator) { 115 observer.nextGeneratedDataRows(currentQuery, keysIterator); 116 } 117 118 public void nextGlobalException(Exception ex) { 119 observer.nextGlobalException(ex); 120 } 121 122 public void nextQueryException(Query query, Exception ex) { 123 observer.nextQueryException(currentQuery, ex); 124 } 125 126 public Level getLoggingLevel() { 127 return observer.getLoggingLevel(); 128 } 129 130 public boolean isIteratedResult() { 131 return observer.isIteratedResult(); 132 } 133 } 134 | Popular Tags |