-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy pathFilterDataHandler.java
More file actions
128 lines (116 loc) · 3.2 KB
/
FilterDataHandler.java
File metadata and controls
128 lines (116 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
* Jython Database Specification API 2.0
*
*
* Copyright (c) 2001 brian zimmer <bzimmer@ziclix.com>
*
*/
package com.ziclix.python.sql;
import org.python.core.Py;
import org.python.core.PyList;
import org.python.core.PyObject;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
/**
* A FilterDataHandler contains some other DataHandler, which it uses
* as its basic source of functionality, possibly transforming the calls
* along the way or providing additional functionality. The class FilterDataHandler
* itself simply overrides all methods of DataHandler with versions that
* pass all requests to the contained data handler.
*
* @author brian zimmer
*/
public abstract class FilterDataHandler extends DataHandler {
private DataHandler delegate;
/**
* Constructor FilterDataHandler
*
* @param delegate
*/
public FilterDataHandler(DataHandler delegate) {
this.delegate = delegate;
}
/**
* Returns the row id of the last executed statement.
*
* @param stmt
* @return PyObject
* @throws SQLException
*/
public PyObject getRowId(Statement stmt) throws SQLException {
return this.delegate.getRowId(stmt);
}
/**
* Method preExecute
*
* @param stmt
* @throws SQLException
*/
public void preExecute(Statement stmt) throws SQLException {
this.delegate.preExecute(stmt);
}
/**
* Method postExecute
*
* @param stmt
* @throws SQLException
*/
public void postExecute(Statement stmt) throws SQLException {
this.delegate.postExecute(stmt);
}
/**
* Method setJDBCObject
*
* @param stmt
* @param index
* @param object
* @throws SQLException
*/
public void setJDBCObject(PreparedStatement stmt, int index, PyObject object) throws SQLException {
this.delegate.setJDBCObject(stmt, index, object);
}
/**
* Method setJDBCObject
*
* @param stmt
* @param index
* @param object
* @param type
* @throws SQLException
*/
public void setJDBCObject(PreparedStatement stmt, int index, PyObject object, int type) throws SQLException {
this.delegate.setJDBCObject(stmt, index, object, type);
}
/**
* Method getPyObject
*
* @param set
* @param col
* @param type
* @return PyObject
* @throws SQLException
*/
public PyObject getPyObject(ResultSet set, int col, int type) throws SQLException {
return this.delegate.getPyObject(set, col, type);
}
/**
* Returns a list of datahandlers chained together through the use of delegation.
*
* @return a list of datahandlers chained together through the use of delegation
*/
public PyObject __chain__() {
PyList list = new PyList();
DataHandler handler = this;
while (handler != null) {
list.append(Py.java2py(handler));
if (handler instanceof FilterDataHandler) {
handler = ((FilterDataHandler) handler).delegate;
} else {
handler = null;
}
}
return list;
}
}