1 9 package com.ziclix.python.sql; 10 11 import org.python.core.Py; 12 import org.python.core.PyList; 13 import org.python.core.PyObject; 14 15 import java.sql.PreparedStatement ; 16 import java.sql.ResultSet ; 17 import java.sql.SQLException ; 18 import java.sql.Statement ; 19 20 31 public abstract class FilterDataHandler extends DataHandler { 32 33 private DataHandler delegate; 34 35 40 public FilterDataHandler(DataHandler delegate) { 41 this.delegate = delegate; 42 } 43 44 51 public PyObject getRowId(Statement stmt) throws SQLException { 52 return this.delegate.getRowId(stmt); 53 } 54 55 61 public void preExecute(Statement stmt) throws SQLException { 62 this.delegate.preExecute(stmt); 63 } 64 65 71 public void postExecute(Statement stmt) throws SQLException { 72 this.delegate.postExecute(stmt); 73 } 74 75 83 public void setJDBCObject(PreparedStatement stmt, int index, PyObject object) throws SQLException { 84 this.delegate.setJDBCObject(stmt, index, object); 85 } 86 87 96 public void setJDBCObject(PreparedStatement stmt, int index, PyObject object, int type) throws SQLException { 97 this.delegate.setJDBCObject(stmt, index, object, type); 98 } 99 100 109 public PyObject getPyObject(ResultSet set, int col, int type) throws SQLException { 110 return this.delegate.getPyObject(set, col, type); 111 } 112 113 118 public PyObject __chain__() { 119 PyList list = new PyList(); 120 DataHandler handler = this; 121 while (handler != null) { 122 list.append(Py.java2py(handler)); 123 if (handler instanceof FilterDataHandler) { 124 handler = ((FilterDataHandler) handler).delegate; 125 } else { 126 handler = null; 127 } 128 } 129 return list; 130 } 131 } 132 | Popular Tags |