2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
10 import java.io.InputStream;
11 import java.io.Reader;
12 import java.io.Serializable;
13 import java.lang.reflect.Method;
14 import java.math.BigDecimal;
16 import java.sql.Array;
20 import java.sql.NClob;
22 import java.sql.ResultSet;
23 import java.sql.ResultSetMetaData;
24 import java.sql.RowId;
25 import java.sql.SQLException;
26 import java.sql.SQLWarning;
27 import java.sql.SQLXML;
28 import java.sql.Statement;
30 import java.sql.Timestamp;
31 import java.util.ArrayList;
32 import java.util.Calendar;
33 import java.util.Collection;
34 import java.util.HashMap;
35 import java.util.HashSet;
36 import java.util.LinkedList;
37 import java.util.List;
40 import java.util.concurrent.ConcurrentHashMap;
42 import org.opendaylight.controller.md.sal.dom.xsql.XSQLAdapter;
43 import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
44 import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
45 import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn;
46 import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria;
47 import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils;
48 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
51 * @author Sharon Aicler(saichler@gmail.com)
53 public class JDBCResultSet implements Serializable, ResultSet, ResultSetMetaData {
54 private static final long serialVersionUID = -7450200738431047057L;
55 private static final ClassLoader CLASS_LOADER = JDBCResultSet.class.getClassLoader();
56 private static final Class<?>[] PROXY_INTERFACES = new Class[] { ResultSet.class };
57 private static int nextID = 0;
59 private String sql = null;
60 private List<XSQLBluePrintNode> tablesInQuery = new ArrayList<XSQLBluePrintNode>();
61 private Map<String, XSQLBluePrintNode> tablesInQueryMap = new ConcurrentHashMap<String, XSQLBluePrintNode>();
62 private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
63 private transient LinkedList<Map<String, Object>> records = new LinkedList<>();
64 private transient Map<String, Object> currentRecord = null;
65 private boolean finished = false;
67 public int numberOfTasks = 0;
68 private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria = new ConcurrentHashMap<String, Map<XSQLColumn, List<XSQLCriteria>>>();
69 private Exception err = null;
70 private List<Record> EMPTY_RESULT = new LinkedList<Record>();
71 private transient Map<String, JDBCResultSet> subQueries = new HashMap<String, JDBCResultSet>();
73 public ResultSet getProxy() {
75 //return (ResultSet) Proxy.newProxyInstance(CLASS_LOADER, PROXY_INTERFACES, new JDBCProxy(this));
78 public void setSQL(String _sql) {
82 public JDBCResultSet addSubQuery(String _sql, String logicalName) {
83 if (subQueries == null) {
84 subQueries = new HashMap<String, JDBCResultSet>();
86 JDBCResultSet rs = new JDBCResultSet(_sql);
87 this.subQueries.put(logicalName, rs);
91 public Map<String, JDBCResultSet> getSubQueries() {
92 if (this.subQueries == null) {
93 this.subQueries = new HashMap<>();
95 return this.subQueries;
98 public JDBCResultSet(String _sql) {
99 synchronized (JDBCResultSet.class) {
106 public String getSQL() {
110 public void setError(Exception _err) {
114 public Exception getError() {
118 public void updateData(JDBCResultSet rs) {
119 synchronized (this) {
120 this.tablesInQuery = rs.tablesInQuery;
121 this.tablesInQueryMap = rs.tablesInQueryMap;
122 this.fieldsInQuery = rs.fieldsInQuery;
127 public int isObjectFitCriteria(Map<String, Object> objValues,
129 Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria
131 if (tblCriteria == null) {
134 for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
136 for (XSQLCriteria c : cc.getValue()) {
137 Object value = objValues.get(cc.getKey().toString());
138 int result = c.checkValue(value);
147 public int isObjectFitCriteria(Object element, Class<?> cls) {
148 Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria.get(cls
150 if (tblCriteria == null) {
153 for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
155 for (XSQLCriteria c : cc.getValue()) {
156 int result = c.isObjectFitCriteria(element, cc.getKey()
166 public Map<String, Map<XSQLColumn, List<XSQLCriteria>>> getCriteria() {
167 return this.criteria;
174 public List<XSQLBluePrintNode> getTables() {
175 return tablesInQuery;
178 public void addTableToQuery(XSQLBluePrintNode node) {
179 if (this.tablesInQueryMap.containsKey(node.getBluePrintNodeName())) {
182 this.tablesInQuery.add(node);
183 this.tablesInQueryMap.put(node.getBluePrintNodeName(), node);
186 public List<XSQLColumn> getFields() {
187 return this.fieldsInQuery;
190 public XSQLBluePrintNode getMainTable() {
191 if (tablesInQuery.size() == 1) {
192 return tablesInQuery.get(0);
194 XSQLBluePrintNode result = null;
195 for (XSQLBluePrintNode node : tablesInQuery) {
196 if (result == null) {
198 } else if (result.getLevel() < node.getLevel()) {
205 public boolean isFinished() {
209 public void setFinished(boolean b) {
214 return this.records.size();
217 public void addRecord(Map<String, Object> r) {
218 synchronized (this) {
219 if (records == null) {
220 records = new LinkedList<>();
227 public void addRecord(ArrayList<?> hierarchy) {
228 Map<String, Object> rec = new HashMap<>();
229 for (int i = hierarchy.size() - 1; i >= 0; i--) {
230 Object element = hierarchy.get(i);
231 for (XSQLColumn c : fieldsInQuery) {
232 if (c.getTableName().equals(element.getClass().getSimpleName())) {
234 Method m = element.getClass().getMethod(c.getName(),
236 Object value = m.invoke(element, null);
237 rec.put(c.getName(), value);
238 } catch (Exception err) {
239 err.printStackTrace();
244 this.records.add(rec);
247 public boolean next() {
248 this.currentRecord = null;
249 if (records == null) {
250 records = new LinkedList<>();
252 while (!finished || records.size() > 0) {
253 synchronized (this) {
254 if (records.size() == 0) {
257 } catch (Exception err) {
259 if (records.size() > 0) {
261 currentRecord = records.removeFirst();
269 currentRecord = records.removeFirst();
280 public Map<String, Object> getCurrent() {
281 return this.currentRecord;
284 private void createRecord(Object data, XSQLBluePrintNode node) {
285 Map<String, Object> rec = new HashMap<>();
286 for (XSQLColumn c : this.fieldsInQuery) {
287 if (c.getTableName().equals(node.getBluePrintNodeName())) {
289 Method m = node.getInterface().getMethod(c.getName(), null);
290 Object value = m.invoke(data, null);
292 rec.put(c.getName(), value);
294 rec.put(c.getName(), "");
296 } catch (Exception err) {
297 err.printStackTrace();
304 public static class Record {
305 // The map container the Attribute 2 the attribute value
306 public Map<String, Object> data = new HashMap<>();
307 // The Element Object (Possibly some kind of NormalizedNode
308 public Object element = null;
309 // Does this record fit the criteria
310 // In case of a list property, we first collect the list and only then
312 // we decide which list item should be included or not.
313 public boolean fitCriteria = true;
315 public Map<String, Object> getRecord() {
320 public static class RecordsContainer {
321 public List<Record> records = new LinkedList<Record>();
322 public List<Record> fitRecords = new LinkedList<Record>();
323 public Object currentObject = null;
326 private void collectColumnValues(RecordsContainer rContainer,
327 XSQLBluePrintNode bpn) {
328 Collection<?> subChildren = XSQLODLUtils
329 .getChildrenCollection(rContainer.currentObject);
330 Record r = new Record();
331 r.element = rContainer.currentObject;
332 for (Object stc : subChildren) {
333 if (stc.getClass().getName()
334 .endsWith("ImmutableUnkeyedListEntryNode")) {
335 r.fitCriteria = false;
336 rContainer.currentObject = stc;
337 collectColumnValues(rContainer, bpn);
338 } else if (stc.getClass().getName()
339 .endsWith("ImmutableAugmentationNode")) {
340 Map<?, ?> values = XSQLODLUtils.getChildren(stc);
341 for (Object key : values.keySet()) {
342 Object val = values.get(key);
343 if (val.getClass().getName().endsWith("ImmutableLeafNode")) {
344 Object value = XSQLODLUtils.getValue(val);
345 String k = XSQLODLUtils.getNodeName(val);
347 r.data.put(bpn.getBluePrintNodeName() + "." + k,
352 } else if (stc.getClass().getName().endsWith("ImmutableLeafNode")) {
353 String k = XSQLODLUtils.getNodeName(stc);
354 Object value = XSQLODLUtils.getValue(stc);
356 r.data.put(bpn.getBluePrintNodeName() + "." + k,
362 rContainer.records.add(r);
366 private void addToData(Record rec, XSQLBluePrintNode bpn,XSQLBluePrint bluePrint, Map<String, Object> fullRecord) {
367 XSQLBluePrintNode eNodes[] = bluePrint
368 .getBluePrintNodeByODLTableName(XSQLODLUtils
369 .getNodeIdentiofier(rec.element));
371 for (XSQLColumn c : fieldsInQuery) {
372 for (XSQLBluePrintNode eNode : eNodes) {
373 if (((XSQLBluePrintNode) c.getBluePrintNode())
374 .getBluePrintNodeName().equals(
375 eNode.getBluePrintNodeName())) {
376 // Object value = Criteria.getValue(rec.element,
378 String columnName = c.toString();
379 Object value = fullRecord.get(columnName);
382 Object rsValue = c.getResultSetValue(value);
383 c.setCharWidth(rsValue.toString().length());
384 rec.data.put(columnName, rsValue);
385 } catch (Exception err) {
394 private boolean beenHere(Set<String> beenHereElement, Object element) {
395 if (beenHereElement == null) {
396 beenHereElement = new HashSet<String>();
399 String elementKey = null;
402 elementKey = element.toString();
403 } catch (Exception err) {
404 elementKey = "Unknown";
407 if (beenHereElement.contains(elementKey)) {
411 beenHereElement.add(elementKey);
415 public List<Object> getChildren(Object node, String tableName,
416 XSQLBluePrint bluePrint) {
418 List<Object> children = XSQLODLUtils.getMChildren(node);
419 List<Object> result = new LinkedList<Object>();
421 for (Object child : children) {
423 String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
424 if (odlNodeName == null) {
425 if (child instanceof DataContainerNode) {
426 List<Object> augChidlren = getChildren(child, tableName,
428 result.addAll(augChidlren);
433 XSQLBluePrintNode eNodes[] = bluePrint
434 .getBluePrintNodeByODLTableName(odlNodeName);
435 if (eNodes == null) {
439 boolean match = false;
440 for (XSQLBluePrintNode enode : eNodes) {
441 if (tableName.startsWith(enode.toString())) {
451 if (child.getClass().getName().endsWith("ImmutableUnkeyedListNode")) {
453 } else if (child.getClass().getName()
454 .endsWith("ImmutableContainerNode")) {
456 } else if (child.getClass().getName()
457 .endsWith("ImmutableAugmentationNode")) {
458 List<Object> _children = XSQLODLUtils.getMChildren(child);
459 for (Object c : _children) {
460 if (c.getClass().getName()
461 .endsWith("ImmutableContainerNode")) {
465 } else if (child.getClass().getName().endsWith("ImmutableMapNode")) {
466 result.addAll(XSQLODLUtils.getMChildren(child));
468 XSQLAdapter.log("Missed Node Data OF Type="
469 + child.getClass().getName());
475 public List<Record> addRecords(Object element, XSQLBluePrintNode node,
476 boolean root, String tableName, XSQLBluePrint bluePrint) {
477 List<Record> result = new LinkedList<Record>();
478 String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
479 if (node.getODLTableName().equals(nodeID)) {
480 XSQLBluePrintNode bluePrintNode = bluePrint
481 .getBluePrintNodeByODLTableName(nodeID)[0];
482 RecordsContainer rContainer = new RecordsContainer();
483 rContainer.currentObject = element;
484 XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode
485 .getBluePrintNodeName());
486 if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName())
488 collectColumnValues(rContainer, bpn);
489 for (Record r : rContainer.records) {
490 if (!(isObjectFitCriteria(r.data,
491 bpn.getBluePrintNodeName()) == 1)) {
492 r.fitCriteria = false;
495 Record rec = new Record();
496 rec.element = r.element;
497 addToData(rec, bpn, bluePrint, r.data);
498 rContainer.fitRecords.add(rec);
501 if (rContainer.fitRecords.isEmpty())
504 if (rContainer.records.isEmpty()) {
505 Record rec = new Record();
506 rec.element = rContainer.currentObject;
513 for (Record rec : rContainer.fitRecords) {
524 XSQLBluePrintNode parent = node.getParent();
525 List<Record> subRecords = addRecords(element, parent, false, tableName,
527 for (Record subRec : subRecords) {
528 List<Object> subO = getChildren(subRec.element, tableName,
531 for (Object subData : subO) {
532 RecordsContainer rContainer = new RecordsContainer();
533 rContainer.currentObject = subData;
535 String recID = XSQLODLUtils
536 .getNodeIdentiofier(rContainer.currentObject);
537 XSQLBluePrintNode eNodes[] = bluePrint
538 .getBluePrintNodeByODLTableName(recID);
539 XSQLBluePrintNode bpn = null;
540 for (XSQLBluePrintNode eNode : eNodes) {
541 bpn = this.tablesInQueryMap.get(eNode
542 .getBluePrintNodeName());
548 collectColumnValues(rContainer, bpn);
549 for (Record r : rContainer.records) {
550 if ((isObjectFitCriteria(r.data,
551 bpn.getBluePrintNodeName()) == 1)) {
552 Record rec = new Record();
553 rec.data.putAll(subRec.data);
554 rec.element = r.element;
555 addToData(rec, bpn, bluePrint, r.data);
557 r.fitCriteria = false;
561 if (rContainer.records.isEmpty()) {
562 Record rec = new Record();
563 rec.data.putAll(subRec.data);
564 rec.element = rContainer.currentObject;
566 if (!rec.data.isEmpty()) {
573 for (Record r : rContainer.records) {
574 r.data.putAll(subRec.data);
577 if (!r.data.isEmpty()) {
593 public boolean isWrapperFor(Class<?> iface) throws SQLException {
594 // TODO Auto-generated method stub
599 public <T> T unwrap(Class<T> iface) throws SQLException {
600 // TODO Auto-generated method stub
605 public boolean absolute(int row) throws SQLException {
606 // TODO Auto-generated method stub
611 public void afterLast() throws SQLException {
612 // TODO Auto-generated method stub
617 public void beforeFirst() throws SQLException {
618 // TODO Auto-generated method stub
623 public void cancelRowUpdates() throws SQLException {
624 // TODO Auto-generated method stub
629 public void clearWarnings() throws SQLException {
630 // TODO Auto-generated method stub
635 public void close() throws SQLException {
636 // TODO Auto-generated method stub
641 public void deleteRow() throws SQLException {
642 // TODO Auto-generated method stub
647 public int findColumn(String columnLabel) throws SQLException {
648 // TODO Auto-generated method stub
653 public boolean first() throws SQLException {
654 // TODO Auto-generated method stub
659 public Array getArray(int columnIndex) throws SQLException {
660 // TODO Auto-generated method stub
665 public Array getArray(String columnLabel) throws SQLException {
666 // TODO Auto-generated method stub
671 public InputStream getAsciiStream(int columnIndex) throws SQLException {
672 // TODO Auto-generated method stub
677 public InputStream getAsciiStream(String columnLabel) throws SQLException {
678 // TODO Auto-generated method stub
683 public BigDecimal getBigDecimal(int columnIndex, int scale)
684 throws SQLException {
685 // TODO Auto-generated method stub
690 public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
691 // TODO Auto-generated method stub
696 public BigDecimal getBigDecimal(String columnLabel, int scale)
697 throws SQLException {
698 // TODO Auto-generated method stub
703 public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
704 // TODO Auto-generated method stub
709 public InputStream getBinaryStream(int columnIndex) throws SQLException {
710 // TODO Auto-generated method stub
715 public InputStream getBinaryStream(String columnLabel) throws SQLException {
716 // TODO Auto-generated method stub
721 public Blob getBlob(int columnIndex) throws SQLException {
722 // TODO Auto-generated method stub
727 public Blob getBlob(String columnLabel) throws SQLException {
728 // TODO Auto-generated method stub
733 public boolean getBoolean(int columnIndex) throws SQLException {
734 // TODO Auto-generated method stub
739 public boolean getBoolean(String columnLabel) throws SQLException {
740 // TODO Auto-generated method stub
745 public byte getByte(int columnIndex) throws SQLException {
746 // TODO Auto-generated method stub
751 public byte getByte(String columnLabel) throws SQLException {
752 // TODO Auto-generated method stub
757 public byte[] getBytes(int columnIndex) throws SQLException {
758 // TODO Auto-generated method stub
763 public byte[] getBytes(String columnLabel) throws SQLException {
764 // TODO Auto-generated method stub
769 public Reader getCharacterStream(int columnIndex) throws SQLException {
770 // TODO Auto-generated method stub
775 public Reader getCharacterStream(String columnLabel) throws SQLException {
776 // TODO Auto-generated method stub
781 public Clob getClob(int columnIndex) throws SQLException {
782 // TODO Auto-generated method stub
787 public Clob getClob(String columnLabel) throws SQLException {
788 // TODO Auto-generated method stub
793 public int getConcurrency() throws SQLException {
794 // TODO Auto-generated method stub
799 public String getCursorName() throws SQLException {
800 // TODO Auto-generated method stub
805 public Date getDate(int columnIndex, Calendar cal) throws SQLException {
806 // TODO Auto-generated method stub
811 public Date getDate(int columnIndex) throws SQLException {
812 // TODO Auto-generated method stub
817 public Date getDate(String columnLabel, Calendar cal) throws SQLException {
818 // TODO Auto-generated method stub
823 public Date getDate(String columnLabel) throws SQLException {
824 // TODO Auto-generated method stub
829 public double getDouble(int columnIndex) throws SQLException {
830 // TODO Auto-generated method stub
835 public double getDouble(String columnLabel) throws SQLException {
836 // TODO Auto-generated method stub
841 public int getFetchDirection() throws SQLException {
842 // TODO Auto-generated method stub
847 public int getFetchSize() throws SQLException {
848 // TODO Auto-generated method stub
853 public float getFloat(int columnIndex) throws SQLException {
854 // TODO Auto-generated method stub
859 public float getFloat(String columnLabel) throws SQLException {
860 // TODO Auto-generated method stub
865 public int getHoldability() throws SQLException {
866 // TODO Auto-generated method stub
871 public int getInt(int columnIndex) throws SQLException {
872 // TODO Auto-generated method stub
877 public int getInt(String columnLabel) throws SQLException {
878 // TODO Auto-generated method stub
883 public long getLong(int columnIndex) throws SQLException {
884 // TODO Auto-generated method stub
889 public long getLong(String columnLabel) throws SQLException {
890 // TODO Auto-generated method stub
895 public ResultSetMetaData getMetaData() throws SQLException {
900 public Reader getNCharacterStream(int columnIndex) throws SQLException {
901 // TODO Auto-generated method stub
906 public Reader getNCharacterStream(String columnLabel) throws SQLException {
907 // TODO Auto-generated method stub
912 public NClob getNClob(int columnIndex) throws SQLException {
913 // TODO Auto-generated method stub
918 public NClob getNClob(String columnLabel) throws SQLException {
919 // TODO Auto-generated method stub
924 public String getNString(int columnIndex) throws SQLException {
925 // TODO Auto-generated method stub
930 public String getNString(String columnLabel) throws SQLException {
931 // TODO Auto-generated method stub
936 public Object getObject(int columnIndex, Map<String, Class<?>> map)
937 throws SQLException {
938 return getObject(columnIndex);
942 public Object getObject(int columnIndex) throws SQLException {
943 return currentRecord.get(this.fieldsInQuery.get(columnIndex - 1)
948 public Object getObject(String columnLabel, Map<String, Class<?>> map)
949 throws SQLException {
950 return getObject(columnLabel);
954 public Object getObject(String columnLabel) throws SQLException {
955 return currentRecord.get(columnLabel);
959 public Ref getRef(int columnIndex) throws SQLException {
960 // TODO Auto-generated method stub
965 public Ref getRef(String columnLabel) throws SQLException {
966 // TODO Auto-generated method stub
971 public int getRow() throws SQLException {
972 // TODO Auto-generated method stub
977 public RowId getRowId(int columnIndex) throws SQLException {
978 // TODO Auto-generated method stub
983 public RowId getRowId(String columnLabel) throws SQLException {
984 // TODO Auto-generated method stub
989 public SQLXML getSQLXML(int columnIndex) throws SQLException {
990 // TODO Auto-generated method stub
995 public SQLXML getSQLXML(String columnLabel) throws SQLException {
996 // TODO Auto-generated method stub
1001 public short getShort(int columnIndex) throws SQLException {
1002 // TODO Auto-generated method stub
1007 public short getShort(String columnLabel) throws SQLException {
1008 // TODO Auto-generated method stub
1013 public Statement getStatement() throws SQLException {
1014 // TODO Auto-generated method stub
1019 public String getString(int columnIndex) throws SQLException {
1024 public String getString(String columnLabel) throws SQLException {
1029 public Time getTime(int columnIndex, Calendar cal) throws SQLException {
1030 // TODO Auto-generated method stub
1035 public Time getTime(int columnIndex) throws SQLException {
1036 // TODO Auto-generated method stub
1041 public Time getTime(String columnLabel, Calendar cal) throws SQLException {
1042 // TODO Auto-generated method stub
1047 public Time getTime(String columnLabel) throws SQLException {
1048 // TODO Auto-generated method stub
1053 public Timestamp getTimestamp(int columnIndex, Calendar cal)
1054 throws SQLException {
1055 // TODO Auto-generated method stub
1060 public Timestamp getTimestamp(int columnIndex) throws SQLException {
1061 // TODO Auto-generated method stub
1066 public Timestamp getTimestamp(String columnLabel, Calendar cal)
1067 throws SQLException {
1068 // TODO Auto-generated method stub
1073 public Timestamp getTimestamp(String columnLabel) throws SQLException {
1074 // TODO Auto-generated method stub
1079 public int getType() throws SQLException {
1080 return ResultSet.TYPE_FORWARD_ONLY;
1084 public URL getURL(int columnIndex) throws SQLException {
1085 // TODO Auto-generated method stub
1090 public URL getURL(String columnLabel) throws SQLException {
1091 // TODO Auto-generated method stub
1096 public InputStream getUnicodeStream(int columnIndex) throws SQLException {
1097 // TODO Auto-generated method stub
1102 public InputStream getUnicodeStream(String columnLabel) throws SQLException {
1103 // TODO Auto-generated method stub
1108 public SQLWarning getWarnings() throws SQLException {
1109 // TODO Auto-generated method stub
1114 public void insertRow() throws SQLException {
1115 // TODO Auto-generated method stub
1120 public boolean isAfterLast() throws SQLException {
1121 // TODO Auto-generated method stub
1126 public boolean isBeforeFirst() throws SQLException {
1127 // TODO Auto-generated method stub
1132 public boolean isClosed() throws SQLException {
1133 // TODO Auto-generated method stub
1138 public boolean isFirst() throws SQLException {
1139 // TODO Auto-generated method stub
1144 public boolean isLast() throws SQLException {
1145 // TODO Auto-generated method stub
1150 public boolean last() throws SQLException {
1151 // TODO Auto-generated method stub
1156 public void moveToCurrentRow() throws SQLException {
1157 // TODO Auto-generated method stub
1162 public void moveToInsertRow() throws SQLException {
1163 // TODO Auto-generated method stub
1168 public boolean previous() throws SQLException {
1169 // TODO Auto-generated method stub
1174 public void refreshRow() throws SQLException {
1175 // TODO Auto-generated method stub
1180 public boolean relative(int rows) throws SQLException {
1181 // TODO Auto-generated method stub
1186 public boolean rowDeleted() throws SQLException {
1187 // TODO Auto-generated method stub
1192 public boolean rowInserted() throws SQLException {
1193 // TODO Auto-generated method stub
1198 public boolean rowUpdated() throws SQLException {
1199 // TODO Auto-generated method stub
1204 public void setFetchDirection(int direction) throws SQLException {
1205 // TODO Auto-generated method stub
1210 public void setFetchSize(int rows) throws SQLException {
1211 // TODO Auto-generated method stub
1216 public void updateArray(int columnIndex, Array x) throws SQLException {
1217 // TODO Auto-generated method stub
1222 public void updateArray(String columnLabel, Array x) throws SQLException {
1223 // TODO Auto-generated method stub
1228 public void updateAsciiStream(int columnIndex, InputStream x, int length)
1229 throws SQLException {
1230 // TODO Auto-generated method stub
1235 public void updateAsciiStream(int columnIndex, InputStream x, long length)
1236 throws SQLException {
1237 // TODO Auto-generated method stub
1242 public void updateAsciiStream(int columnIndex, InputStream x)
1243 throws SQLException {
1244 // TODO Auto-generated method stub
1249 public void updateAsciiStream(String columnLabel, InputStream x, int length)
1250 throws SQLException {
1251 // TODO Auto-generated method stub
1256 public void updateAsciiStream(String columnLabel, InputStream x, long length)
1257 throws SQLException {
1258 // TODO Auto-generated method stub
1263 public void updateAsciiStream(String columnLabel, InputStream x)
1264 throws SQLException {
1265 // TODO Auto-generated method stub
1270 public void updateBigDecimal(int columnIndex, BigDecimal x)
1271 throws SQLException {
1272 // TODO Auto-generated method stub
1277 public void updateBigDecimal(String columnLabel, BigDecimal x)
1278 throws SQLException {
1279 // TODO Auto-generated method stub
1284 public void updateBinaryStream(int columnIndex, InputStream x, int length)
1285 throws SQLException {
1286 // TODO Auto-generated method stub
1291 public void updateBinaryStream(int columnIndex, InputStream x, long length)
1292 throws SQLException {
1293 // TODO Auto-generated method stub
1298 public void updateBinaryStream(int columnIndex, InputStream x)
1299 throws SQLException {
1300 // TODO Auto-generated method stub
1305 public void updateBinaryStream(String columnLabel, InputStream x, int length)
1306 throws SQLException {
1307 // TODO Auto-generated method stub
1312 public void updateBinaryStream(String columnLabel, InputStream x,
1313 long length) throws SQLException {
1314 // TODO Auto-generated method stub
1319 public void updateBinaryStream(String columnLabel, InputStream x)
1320 throws SQLException {
1321 // TODO Auto-generated method stub
1326 public void updateBlob(int columnIndex, Blob x) throws SQLException {
1327 // TODO Auto-generated method stub
1332 public void updateBlob(int columnIndex, InputStream inputStream, long length)
1333 throws SQLException {
1334 // TODO Auto-generated method stub
1339 public void updateBlob(int columnIndex, InputStream inputStream)
1340 throws SQLException {
1341 // TODO Auto-generated method stub
1346 public void updateBlob(String columnLabel, Blob x) throws SQLException {
1347 // TODO Auto-generated method stub
1352 public void updateBlob(String columnLabel, InputStream inputStream,
1353 long length) throws SQLException {
1354 // TODO Auto-generated method stub
1359 public void updateBlob(String columnLabel, InputStream inputStream)
1360 throws SQLException {
1361 // TODO Auto-generated method stub
1366 public void updateBoolean(int columnIndex, boolean x) throws SQLException {
1367 // TODO Auto-generated method stub
1372 public void updateBoolean(String columnLabel, boolean x)
1373 throws SQLException {
1374 // TODO Auto-generated method stub
1379 public void updateByte(int columnIndex, byte x) throws SQLException {
1380 // TODO Auto-generated method stub
1385 public void updateByte(String columnLabel, byte x) throws SQLException {
1386 // TODO Auto-generated method stub
1391 public void updateBytes(int columnIndex, byte[] x) throws SQLException {
1392 // TODO Auto-generated method stub
1397 public void updateBytes(String columnLabel, byte[] x) throws SQLException {
1398 // TODO Auto-generated method stub
1403 public void updateCharacterStream(int columnIndex, Reader x, int length)
1404 throws SQLException {
1405 // TODO Auto-generated method stub
1410 public void updateCharacterStream(int columnIndex, Reader x, long length)
1411 throws SQLException {
1412 // TODO Auto-generated method stub
1417 public void updateCharacterStream(int columnIndex, Reader x)
1418 throws SQLException {
1419 // TODO Auto-generated method stub
1424 public void updateCharacterStream(String columnLabel, Reader reader,
1425 int length) throws SQLException {
1426 // TODO Auto-generated method stub
1431 public void updateCharacterStream(String columnLabel, Reader reader,
1432 long length) throws SQLException {
1433 // TODO Auto-generated method stub
1438 public void updateCharacterStream(String columnLabel, Reader reader)
1439 throws SQLException {
1440 // TODO Auto-generated method stub
1445 public void updateClob(int columnIndex, Clob x) throws SQLException {
1446 // TODO Auto-generated method stub
1451 public void updateClob(int columnIndex, Reader reader, long length)
1452 throws SQLException {
1453 // TODO Auto-generated method stub
1458 public void updateClob(int columnIndex, Reader reader) throws SQLException {
1459 // TODO Auto-generated method stub
1464 public void updateClob(String columnLabel, Clob x) throws SQLException {
1465 // TODO Auto-generated method stub
1470 public void updateClob(String columnLabel, Reader reader, long length)
1471 throws SQLException {
1472 // TODO Auto-generated method stub
1477 public void updateClob(String columnLabel, Reader reader)
1478 throws SQLException {
1479 // TODO Auto-generated method stub
1484 public void updateDate(int columnIndex, Date x) throws SQLException {
1485 // TODO Auto-generated method stub
1490 public void updateDate(String columnLabel, Date x) throws SQLException {
1491 // TODO Auto-generated method stub
1496 public void updateDouble(int columnIndex, double x) throws SQLException {
1497 // TODO Auto-generated method stub
1502 public void updateDouble(String columnLabel, double x) throws SQLException {
1503 // TODO Auto-generated method stub
1508 public void updateFloat(int columnIndex, float x) throws SQLException {
1509 // TODO Auto-generated method stub
1514 public void updateFloat(String columnLabel, float x) throws SQLException {
1515 // TODO Auto-generated method stub
1520 public void updateInt(int columnIndex, int x) throws SQLException {
1521 // TODO Auto-generated method stub
1526 public void updateInt(String columnLabel, int x) throws SQLException {
1527 // TODO Auto-generated method stub
1532 public void updateLong(int columnIndex, long x) throws SQLException {
1533 // TODO Auto-generated method stub
1538 public void updateLong(String columnLabel, long x) throws SQLException {
1539 // TODO Auto-generated method stub
1544 public void updateNCharacterStream(int columnIndex, Reader x, long length)
1545 throws SQLException {
1546 // TODO Auto-generated method stub
1551 public void updateNCharacterStream(int columnIndex, Reader x)
1552 throws SQLException {
1553 // TODO Auto-generated method stub
1558 public void updateNCharacterStream(String columnLabel, Reader reader,
1559 long length) throws SQLException {
1560 // TODO Auto-generated method stub
1565 public void updateNCharacterStream(String columnLabel, Reader reader)
1566 throws SQLException {
1567 // TODO Auto-generated method stub
1572 public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
1573 // TODO Auto-generated method stub
1578 public void updateNClob(int columnIndex, Reader reader, long length)
1579 throws SQLException {
1580 // TODO Auto-generated method stub
1585 public void updateNClob(int columnIndex, Reader reader) throws SQLException {
1586 // TODO Auto-generated method stub
1591 public void updateNClob(String columnLabel, NClob nClob)
1592 throws SQLException {
1593 // TODO Auto-generated method stub
1598 public void updateNClob(String columnLabel, Reader reader, long length)
1599 throws SQLException {
1600 // TODO Auto-generated method stub
1605 public void updateNClob(String columnLabel, Reader reader)
1606 throws SQLException {
1607 // TODO Auto-generated method stub
1612 public void updateNString(int columnIndex, String nString)
1613 throws SQLException {
1614 // TODO Auto-generated method stub
1619 public void updateNString(String columnLabel, String nString)
1620 throws SQLException {
1621 // TODO Auto-generated method stub
1626 public void updateNull(int columnIndex) throws SQLException {
1627 // TODO Auto-generated method stub
1632 public void updateNull(String columnLabel) throws SQLException {
1633 // TODO Auto-generated method stub
1638 public void updateObject(int columnIndex, Object x, int scaleOrLength)
1639 throws SQLException {
1640 // TODO Auto-generated method stub
1645 public void updateObject(int columnIndex, Object x) throws SQLException {
1646 // TODO Auto-generated method stub
1651 public void updateObject(String columnLabel, Object x, int scaleOrLength)
1652 throws SQLException {
1653 // TODO Auto-generated method stub
1658 public void updateObject(String columnLabel, Object x) throws SQLException {
1659 // TODO Auto-generated method stub
1664 public void updateRef(int columnIndex, Ref x) throws SQLException {
1665 // TODO Auto-generated method stub
1670 public void updateRef(String columnLabel, Ref x) throws SQLException {
1671 // TODO Auto-generated method stub
1676 public void updateRow() throws SQLException {
1677 // TODO Auto-generated method stub
1682 public void updateRowId(int columnIndex, RowId x) throws SQLException {
1683 // TODO Auto-generated method stub
1688 public void updateRowId(String columnLabel, RowId x) throws SQLException {
1689 // TODO Auto-generated method stub
1694 public void updateSQLXML(int columnIndex, SQLXML xmlObject)
1695 throws SQLException {
1696 // TODO Auto-generated method stub
1701 public void updateSQLXML(String columnLabel, SQLXML xmlObject)
1702 throws SQLException {
1703 // TODO Auto-generated method stub
1708 public void updateShort(int columnIndex, short x) throws SQLException {
1709 // TODO Auto-generated method stub
1714 public void updateShort(String columnLabel, short x) throws SQLException {
1715 // TODO Auto-generated method stub
1720 public void updateString(int columnIndex, String x) throws SQLException {
1721 // TODO Auto-generated method stub
1726 public void updateString(String columnLabel, String x) throws SQLException {
1727 // TODO Auto-generated method stub
1732 public void updateTime(int columnIndex, Time x) throws SQLException {
1733 // TODO Auto-generated method stub
1738 public void updateTime(String columnLabel, Time x) throws SQLException {
1739 // TODO Auto-generated method stub
1744 public void updateTimestamp(int columnIndex, Timestamp x)
1745 throws SQLException {
1746 // TODO Auto-generated method stub
1751 public void updateTimestamp(String columnLabel, Timestamp x)
1752 throws SQLException {
1753 // TODO Auto-generated method stub
1758 public boolean wasNull() throws SQLException {
1759 // TODO Auto-generated method stub
1764 public String getCatalogName(int column) throws SQLException {
1765 // TODO Auto-generated method stub
1770 public String getColumnClassName(int column) throws SQLException {
1771 // TODO Auto-generated method stub
1776 public int getColumnCount() throws SQLException {
1777 return fieldsInQuery.size();
1781 public int getColumnDisplaySize(int column) throws SQLException {
1782 // TODO Auto-generated method stub
1787 public String getColumnLabel(int column) throws SQLException {
1788 return this.fieldsInQuery.get(column - 1).toString();
1792 public String getColumnName(int column) throws SQLException {
1793 // TODO Auto-generated method stub
1798 public int getColumnType(int column) throws SQLException {
1803 public String getColumnTypeName(int column) throws SQLException {
1804 // TODO Auto-generated method stub
1809 public int getPrecision(int column) throws SQLException {
1810 // TODO Auto-generated method stub
1815 public int getScale(int column) throws SQLException {
1816 // TODO Auto-generated method stub
1821 public String getSchemaName(int column) throws SQLException {
1822 // TODO Auto-generated method stub
1827 public String getTableName(int column) throws SQLException {
1828 // TODO Auto-generated method stub
1833 public boolean isAutoIncrement(int column) throws SQLException {
1834 // TODO Auto-generated method stub
1839 public boolean isCaseSensitive(int column) throws SQLException {
1840 // TODO Auto-generated method stub
1845 public boolean isCurrency(int column) throws SQLException {
1846 // TODO Auto-generated method stub
1851 public boolean isDefinitelyWritable(int column) throws SQLException {
1852 // TODO Auto-generated method stub
1857 public int isNullable(int column) throws SQLException {
1858 // TODO Auto-generated method stub
1863 public boolean isReadOnly(int column) throws SQLException {
1864 // TODO Auto-generated method stub
1869 public boolean isSearchable(int column) throws SQLException {
1870 // TODO Auto-generated method stub
1875 public boolean isSigned(int column) throws SQLException {
1876 // TODO Auto-generated method stub
1881 public boolean isWritable(int column) throws SQLException {
1882 // TODO Auto-generated method stub
1887 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
1888 // TODO Auto-generated method stub
1893 public <T> T getObject(String columnLabel, Class<T> type)
1894 throws SQLException {
1895 // TODO Auto-generated method stub