1 19 20 package org.apache.cayenne.access; 21 22 import java.sql.Connection ; 23 import java.sql.SQLException ; 24 import java.util.List ; 25 26 import org.apache.cayenne.query.Query; 27 import org.apache.cayenne.query.SQLAction; 28 29 37 class DataNodeQueryAction implements OperationObserver { 38 39 OperationObserver observer; 40 DataNode node; 41 42 private Query currentQuery; 43 44 public DataNodeQueryAction(DataNode node, OperationObserver observer) { 45 this.observer = observer; 46 this.node = node; 47 } 48 49 public void runQuery(Connection connection, Query query) throws SQLException , 50 Exception { 51 52 this.currentQuery = query; 55 56 SQLAction action = node.getAdapter().getAction(query, node); 57 action.performAction(connection, this); 58 } 59 60 public void nextBatchCount(Query query, int[] resultCount) { 61 observer.nextBatchCount(currentQuery, resultCount); 62 } 63 64 public void nextCount(Query query, int resultCount) { 65 observer.nextCount(currentQuery, resultCount); 66 } 67 68 public void nextDataRows(Query query, List dataRows) { 69 observer.nextDataRows(currentQuery, dataRows); 70 } 71 72 public void nextDataRows(Query q, ResultIterator it) { 73 observer.nextDataRows(currentQuery, it); 74 } 75 76 public void nextGeneratedDataRows(Query query, ResultIterator keysIterator) { 77 observer.nextGeneratedDataRows(currentQuery, keysIterator); 78 } 79 80 public void nextGlobalException(Exception ex) { 81 observer.nextGlobalException(ex); 82 } 83 84 public void nextQueryException(Query query, Exception ex) { 85 observer.nextQueryException(currentQuery, ex); 86 } 87 88 public boolean isIteratedResult() { 89 return observer.isIteratedResult(); 90 } 91 } 92 | Popular Tags |