Merge "BUG-190 Simplify reconnect logic in protocol-framework."
[controller.git] / opendaylight / md-sal / sal-dom-xsql / src / main / java / org / opendaylight / controller / md / sal / dom / xsql / jdbc / JDBCResultSet.java
1 package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
2
3 import java.io.InputStream;
4 import java.io.Reader;
5 import java.io.Serializable;
6 import java.lang.reflect.Method;
7 import java.math.BigDecimal;
8 import java.net.URL;
9 import java.sql.Array;
10 import java.sql.Blob;
11 import java.sql.Clob;
12 import java.sql.Date;
13 import java.sql.NClob;
14 import java.sql.Ref;
15 import java.sql.ResultSet;
16 import java.sql.ResultSetMetaData;
17 import java.sql.RowId;
18 import java.sql.SQLException;
19 import java.sql.SQLWarning;
20 import java.sql.SQLXML;
21 import java.sql.Statement;
22 import java.sql.Time;
23 import java.sql.Timestamp;
24 import java.util.ArrayList;
25 import java.util.Calendar;
26 import java.util.HashMap;
27 import java.util.HashSet;
28 import java.util.LinkedList;
29 import java.util.List;
30 import java.util.Map;
31 import java.util.Set;
32 import java.util.concurrent.ConcurrentHashMap;
33
34 import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrint;
35 import org.opendaylight.controller.md.sal.dom.xsql.XSQLBluePrintNode;
36 import org.opendaylight.controller.md.sal.dom.xsql.XSQLColumn;
37 import org.opendaylight.controller.md.sal.dom.xsql.XSQLCriteria;
38 import org.opendaylight.controller.md.sal.dom.xsql.XSQLODLUtils;
39
40 public class JDBCResultSet
41     implements Serializable, ResultSet, ResultSetMetaData {
42     private static final long serialVersionUID = -7450200738431047057L;
43
44     private String sql = null;
45     private List<XSQLBluePrintNode> tablesInQuery =
46         new ArrayList<XSQLBluePrintNode>();
47     private Map<String, XSQLBluePrintNode> tablesInQueryMap =
48         new ConcurrentHashMap<String, XSQLBluePrintNode>();
49     private List<XSQLColumn> fieldsInQuery = new ArrayList<XSQLColumn>();
50     private transient LinkedList<Map> records = new LinkedList<Map>();
51     private transient Map currentRecord = null;
52     private boolean finished = false;
53     private int id = 0;
54     private static Integer nextID = new Integer(0);
55     public int numberOfTasks = 0;
56     private Map<String, Map<XSQLColumn, List<XSQLCriteria>>> criteria =
57         new ConcurrentHashMap<String, Map<XSQLColumn, List<XSQLCriteria>>>();
58     private Exception err = null;
59     private List<Record> EMPTY_RESULT = new LinkedList<Record>();
60
61     public JDBCResultSet(String _sql) {
62         synchronized (JDBCResultSet.class) {
63             nextID++;
64             id = nextID;
65         }
66         this.sql = _sql;
67     }
68
69     public String getSQL() {
70         return this.sql;
71     }
72
73     public void setError(Exception _err) {
74         this.err = _err;
75     }
76
77     public Exception getError() {
78         return this.err;
79     }
80
81     public void updateData(JDBCResultSet rs) {
82         synchronized (this) {
83             this.tablesInQuery = rs.tablesInQuery;
84             this.tablesInQueryMap = rs.tablesInQueryMap;
85             this.fieldsInQuery = rs.fieldsInQuery;
86             this.notifyAll();
87         }
88     }
89
90     public int isObjectFitCriteria(Map objValues, String tableName) {
91         Map<XSQLColumn, List<XSQLCriteria>> tblCriteria = criteria.get(tableName);
92         if (tblCriteria == null) {
93             return 1;
94         }
95         for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
96             .entrySet()) {
97             for (XSQLCriteria c : cc.getValue()) {
98                 Object value = objValues.get(cc.getKey().toString());
99                 int result = c.checkValue(value);
100                 if (result == 0) {
101                     return 0;
102                 }
103             }
104         }
105         return 1;
106     }
107
108     public int isObjectFitCriteria(Object element, Class cls) {
109         Map<XSQLColumn, List<XSQLCriteria>> tblCriteria =
110             criteria.get(cls.getName());
111         if (tblCriteria == null) {
112             return 1;
113         }
114         for (Map.Entry<XSQLColumn, List<XSQLCriteria>> cc : tblCriteria
115             .entrySet()) {
116             for (XSQLCriteria c : cc.getValue()) {
117                 int result =
118                     c.isObjectFitCriteria(element, cc.getKey().getName());
119                 if (result == 0) {
120                     return 0;
121                 }
122             }
123         }
124         return 1;
125     }
126
127     public Map<String, Map<XSQLColumn, List<XSQLCriteria>>> getCriteria() {
128         return this.criteria;
129     }
130
131     public int getID() {
132         return this.id;
133     }
134
135     public List<XSQLBluePrintNode> getTables() {
136         return tablesInQuery;
137     }
138
139     public void addTableToQuery(XSQLBluePrintNode node) {
140         if (this.tablesInQueryMap.containsKey(node.getBluePrintNodeName())) {
141             return;
142         }
143         this.tablesInQuery.add(node);
144         this.tablesInQueryMap.put(node.getBluePrintNodeName(), node);
145     }
146
147     public List<XSQLColumn> getFields() {
148         return this.fieldsInQuery;
149     }
150
151     public XSQLBluePrintNode getMainTable() {
152         if (tablesInQuery.size() == 1) {
153             return tablesInQuery.get(0);
154         }
155         XSQLBluePrintNode result = null;
156         for (XSQLBluePrintNode node : tablesInQuery) {
157             if (result == null) {
158                 result = node;
159             } else if (result.getLevel() < node.getLevel()) {
160                 result = node;
161             }
162         }
163         return result;
164     }
165
166     public boolean isFinished() {
167         return finished;
168     }
169
170     public void setFinished(boolean b) {
171         this.finished = b;
172     }
173
174     public int size() {
175         return this.records.size();
176     }
177
178     public void addRecord(Map r) {
179         synchronized (this) {
180             if (records == null) {
181                 records = new LinkedList<Map>();
182             }
183             records.add(r);
184             this.notifyAll();
185         }
186     }
187
188
189     public void addRecord(ArrayList hierarchy) {
190         Map rec = new HashMap();
191         for (int i = hierarchy.size() - 1; i >= 0; i--) {
192             Object element = hierarchy.get(i);
193             for (XSQLColumn c : fieldsInQuery) {
194                 if (c.getTableName()
195                     .equals(element.getClass().getSimpleName())) {
196                     try {
197                         Method m = element.getClass().getMethod(c.getName(), null);
198                         Object value = m.invoke(element, null);
199                         rec.put(c.getName(), value);
200                     } catch (Exception err) {
201                         err.printStackTrace();
202                     }
203                 }
204             }
205         }
206         this.records.add(rec);
207     }
208
209     public boolean next() {
210         this.currentRecord = null;
211         if (records == null) {
212             records = new LinkedList<Map>();
213         }
214         while (!finished || records.size() > 0) {
215             synchronized (this) {
216                 if (records.size() == 0) {
217                     try {
218                         this.wait(1000);
219                     } catch (Exception err) {
220                     }
221                     if (records.size() > 0) {
222                         try {
223                             currentRecord = records.removeFirst();
224                             return true;
225                         } finally {
226                             this.notifyAll();
227                         }
228                     }
229                 } else {
230                     try {
231                         currentRecord = records.removeFirst();
232                         return true;
233                     } finally {
234                         this.notifyAll();
235                     }
236                 }
237             }
238         }
239         return false;
240     }
241
242     public Map getCurrent() {
243         return this.currentRecord;
244     }
245
246     private void createRecord(Object data, XSQLBluePrintNode node) {
247         Map rec = new HashMap();
248         for (XSQLColumn c : this.fieldsInQuery) {
249             if (c.getTableName().equals(node.getBluePrintNodeName())) {
250                 try {
251                     Method m = node.getInterface().getMethod(c.getName(), null);
252                     Object value = m.invoke(data, null);
253                     if (value != null) {
254                         rec.put(c.getName(), value);
255                     } else {
256                         rec.put(c.getName(), "");
257                     }
258                 } catch (Exception err) {
259                     err.printStackTrace();
260                 }
261
262             }
263         }
264     }
265
266     public static class Record {
267         public Map data = new HashMap();
268         public Object element = null;
269
270         public Map getRecord() {
271             return this.data;
272         }
273     }
274
275     private Map collectColumnValues(Object node, XSQLBluePrintNode bpn) {
276         Map subChildren = XSQLODLUtils.getChildren(node);
277         Map result = new HashMap();
278         for (Object stc : subChildren.values()) {
279             if (stc.getClass().getName()
280                 .endsWith("ImmutableAugmentationNode")) {
281                 Map values = XSQLODLUtils.getChildren(stc);
282                 for (Object key : values.keySet()) {
283                     Object val = values.get(key);
284                     if (val.getClass().getName()
285                         .endsWith("ImmutableLeafNode")) {
286                         Object value = XSQLODLUtils.getValue(val);
287                         String k = XSQLODLUtils.getNodeName(val);
288                         if (value != null) {
289                             result.put(bpn.getBluePrintNodeName() + "." + k,
290                                 value.toString());
291                         }
292                     }
293                 }
294             } else if (stc.getClass().getName().endsWith("ImmutableLeafNode")) {
295                 String k = XSQLODLUtils.getNodeName(stc);
296                 Object value = XSQLODLUtils.getValue(stc);
297                 if (value != null) {
298                     result.put(bpn.getBluePrintNodeName() + "." + k, value.toString());
299                 }
300             }
301         }
302         return result;
303     }
304
305     private void addToData(Record rec, XSQLBluePrintNode bpn, XSQLBluePrint bluePrint, Map fullRecord) {
306         XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(XSQLODLUtils.getNodeIdentiofier(rec.element));
307         if (bpn != null) {
308             for (XSQLColumn c : fieldsInQuery) {
309                 for(XSQLBluePrintNode eNode:eNodes){
310                     if (((XSQLBluePrintNode) c.getBluePrintNode()).getBluePrintNodeName().equals(eNode.getBluePrintNodeName())) {
311                         //Object value = Criteria.getValue(rec.element, c.getName());
312                         String columnName = c.toString();
313                         Object value = fullRecord.get(columnName);
314                         if (value != null) {
315                             try {
316                                 Object rsValue = c.getResultSetValue(value);
317                                 c.setCharWidth(rsValue.toString().length());
318                                 rec.data.put(columnName, rsValue);
319                             } catch (Exception err) {
320                             }
321                         }
322                     }
323                 }
324             }
325         }
326     }
327
328     private boolean beenHere(Set<String> beenHereElement, Object element) {
329         if (beenHereElement == null) {
330             beenHereElement = new HashSet<String>();
331         }
332
333         String elementKey = null;
334
335         try {
336             elementKey = element.toString();
337         } catch (Exception err) {
338             elementKey = "Unknown";
339         }
340
341         if (beenHereElement.contains(elementKey)) {
342             return true;
343         }
344
345         beenHereElement.add(elementKey);
346         return false;
347     }
348
349     public List<Object> getChildren(Object node, String tableName,XSQLBluePrint bluePrint) {
350
351         List<Object> children = XSQLODLUtils.getMChildren(node);
352         List<Object> result = new LinkedList<Object>();
353
354         for (Object child : children) {
355
356             String odlNodeName = XSQLODLUtils.getNodeIdentiofier(child);
357             if(odlNodeName==null) continue;
358
359             XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(odlNodeName);
360             if(eNodes==null) continue;
361
362             boolean match = false;
363             for(XSQLBluePrintNode enode:eNodes){
364                 if(tableName.startsWith(enode.toString())){
365                     match = true;
366                     break;
367                 }
368             }
369
370             if(!match) continue;
371
372             if (child.getClass().getName().endsWith("ImmutableContainerNode")) {
373                 result.add(child);
374             }else
375             if (child.getClass().getName().endsWith("ImmutableAugmentationNode")) {
376                 List<Object> _children = XSQLODLUtils.getMChildren(child);
377                 for (Object c : _children) {
378                     if (c.getClass().getName().endsWith("ImmutableContainerNode")) {
379                         result.add(c);
380                     }
381                 }
382             } else if (child.getClass().getName().endsWith("ImmutableMapNode")) {
383                 result.addAll(XSQLODLUtils.getMChildren(child));
384             }
385         }
386         return result;
387     }
388
389     public List<Record> addRecords(Object element, XSQLBluePrintNode node,boolean root, String tableName,XSQLBluePrint bluePrint) {
390
391         List<Record> result = new LinkedList<Record>();
392         String nodeID = XSQLODLUtils.getNodeIdentiofier(element);
393         if (node.getODLTableName().equals(nodeID)) {
394             XSQLBluePrintNode bluePrintNode = bluePrint.getBluePrintNodeByODLTableName(nodeID)[0];
395             Record rec = new Record();
396             rec.element = element;
397             XSQLBluePrintNode bpn = this.tablesInQueryMap.get(bluePrintNode.getBluePrintNodeName());
398             if (this.criteria.containsKey(bluePrintNode.getBluePrintNodeName()) || bpn != null) {
399                 Map<?, ?> allKeyValues = collectColumnValues(element, bpn);
400                 if (!(isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) {
401                     return EMPTY_RESULT;
402                 }
403                 addToData(rec, bpn, bluePrint,allKeyValues);
404             }
405             if (root) {
406                 addRecord(rec.data);
407             } else {
408                 result.add(rec);
409             }
410             return result;
411         }
412
413         XSQLBluePrintNode parent = node.getParent();
414         List<Record> subRecords = addRecords(element, parent, false, tableName,bluePrint);
415         for (Record subRec : subRecords) {
416             List<Object> subO = getChildren(subRec.element, tableName,bluePrint);
417             if (subO != null) {
418                 for (Object subData : subO) {
419                     Record rec = new Record();
420                     rec.element = subData;
421                     rec.data.putAll(subRec.data);
422
423                     String recID = XSQLODLUtils.getNodeIdentiofier(rec.element);
424                     XSQLBluePrintNode eNodes[] = bluePrint.getBluePrintNodeByODLTableName(recID);
425                     XSQLBluePrintNode bpn = null;
426                     for(XSQLBluePrintNode eNode:eNodes){
427                         bpn = this.tablesInQueryMap.get(eNode.getBluePrintNodeName());
428                         if(bpn!=null)
429                             break;
430                     }
431                     boolean isObjectInCriteria = true;
432                     if (bpn != null) {
433                         Map allKeyValues = collectColumnValues(rec.element, bpn);
434                         if ((isObjectFitCriteria(allKeyValues, bpn.getBluePrintNodeName()) == 1)) {
435                             addToData(rec, bpn,bluePrint,allKeyValues);
436                         } else {
437                             isObjectInCriteria = false;
438                         }
439                     }
440
441                     if (isObjectInCriteria) {
442                         if (root) {
443                             if(!rec.data.isEmpty())
444                                 addRecord(rec.data);
445                         } else {
446                             result.add(rec);
447                         }
448                     }
449                 }
450             }
451         }
452
453         return result;
454     }
455
456     @Override
457     public boolean isWrapperFor(Class<?> iface) throws SQLException {
458         // TODO Auto-generated method stub
459         return false;
460     }
461
462     @Override
463     public <T> T unwrap(Class<T> iface) throws SQLException {
464         // TODO Auto-generated method stub
465         return null;
466     }
467
468     @Override
469     public boolean absolute(int row) throws SQLException {
470         // TODO Auto-generated method stub
471         return false;
472     }
473
474     @Override
475     public void afterLast() throws SQLException {
476         // TODO Auto-generated method stub
477
478     }
479
480     @Override
481     public void beforeFirst() throws SQLException {
482         // TODO Auto-generated method stub
483
484     }
485
486     @Override
487     public void cancelRowUpdates() throws SQLException {
488         // TODO Auto-generated method stub
489
490     }
491
492     @Override
493     public void clearWarnings() throws SQLException {
494         // TODO Auto-generated method stub
495
496     }
497
498     @Override
499     public void close() throws SQLException {
500         // TODO Auto-generated method stub
501
502     }
503
504     @Override
505     public void deleteRow() throws SQLException {
506         // TODO Auto-generated method stub
507
508     }
509
510     @Override
511     public int findColumn(String columnLabel) throws SQLException {
512         // TODO Auto-generated method stub
513         return 0;
514     }
515
516     @Override
517     public boolean first() throws SQLException {
518         // TODO Auto-generated method stub
519         return false;
520     }
521
522     @Override
523     public Array getArray(int columnIndex) throws SQLException {
524         // TODO Auto-generated method stub
525         return null;
526     }
527
528     @Override
529     public Array getArray(String columnLabel) throws SQLException {
530         // TODO Auto-generated method stub
531         return null;
532     }
533
534     @Override
535     public InputStream getAsciiStream(int columnIndex) throws SQLException {
536         // TODO Auto-generated method stub
537         return null;
538     }
539
540     @Override
541     public InputStream getAsciiStream(String columnLabel) throws SQLException {
542         // TODO Auto-generated method stub
543         return null;
544     }
545
546     @Override
547     public BigDecimal getBigDecimal(int columnIndex, int scale)
548         throws SQLException {
549         // TODO Auto-generated method stub
550         return null;
551     }
552
553     @Override
554     public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
555         // TODO Auto-generated method stub
556         return null;
557     }
558
559     @Override
560     public BigDecimal getBigDecimal(String columnLabel, int scale)
561         throws SQLException {
562         // TODO Auto-generated method stub
563         return null;
564     }
565
566     @Override
567     public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
568         // TODO Auto-generated method stub
569         return null;
570     }
571
572     @Override
573     public InputStream getBinaryStream(int columnIndex) throws SQLException {
574         // TODO Auto-generated method stub
575         return null;
576     }
577
578     @Override
579     public InputStream getBinaryStream(String columnLabel) throws SQLException {
580         // TODO Auto-generated method stub
581         return null;
582     }
583
584     @Override
585     public Blob getBlob(int columnIndex) throws SQLException {
586         // TODO Auto-generated method stub
587         return null;
588     }
589
590     @Override
591     public Blob getBlob(String columnLabel) throws SQLException {
592         // TODO Auto-generated method stub
593         return null;
594     }
595
596     @Override
597     public boolean getBoolean(int columnIndex) throws SQLException {
598         // TODO Auto-generated method stub
599         return false;
600     }
601
602     @Override
603     public boolean getBoolean(String columnLabel) throws SQLException {
604         // TODO Auto-generated method stub
605         return false;
606     }
607
608     @Override
609     public byte getByte(int columnIndex) throws SQLException {
610         // TODO Auto-generated method stub
611         return 0;
612     }
613
614     @Override
615     public byte getByte(String columnLabel) throws SQLException {
616         // TODO Auto-generated method stub
617         return 0;
618     }
619
620     @Override
621     public byte[] getBytes(int columnIndex) throws SQLException {
622         // TODO Auto-generated method stub
623         return null;
624     }
625
626     @Override
627     public byte[] getBytes(String columnLabel) throws SQLException {
628         // TODO Auto-generated method stub
629         return null;
630     }
631
632     @Override
633     public Reader getCharacterStream(int columnIndex) throws SQLException {
634         // TODO Auto-generated method stub
635         return null;
636     }
637
638     @Override
639     public Reader getCharacterStream(String columnLabel) throws SQLException {
640         // TODO Auto-generated method stub
641         return null;
642     }
643
644     @Override
645     public Clob getClob(int columnIndex) throws SQLException {
646         // TODO Auto-generated method stub
647         return null;
648     }
649
650     @Override
651     public Clob getClob(String columnLabel) throws SQLException {
652         // TODO Auto-generated method stub
653         return null;
654     }
655
656     @Override
657     public int getConcurrency() throws SQLException {
658         // TODO Auto-generated method stub
659         return 0;
660     }
661
662     @Override
663     public String getCursorName() throws SQLException {
664         // TODO Auto-generated method stub
665         return null;
666     }
667
668     @Override
669     public Date getDate(int columnIndex, Calendar cal) throws SQLException {
670         // TODO Auto-generated method stub
671         return null;
672     }
673
674     @Override
675     public Date getDate(int columnIndex) throws SQLException {
676         // TODO Auto-generated method stub
677         return null;
678     }
679
680     @Override
681     public Date getDate(String columnLabel, Calendar cal) throws SQLException {
682         // TODO Auto-generated method stub
683         return null;
684     }
685
686     @Override
687     public Date getDate(String columnLabel) throws SQLException {
688         // TODO Auto-generated method stub
689         return null;
690     }
691
692     @Override
693     public double getDouble(int columnIndex) throws SQLException {
694         // TODO Auto-generated method stub
695         return 0;
696     }
697
698     @Override
699     public double getDouble(String columnLabel) throws SQLException {
700         // TODO Auto-generated method stub
701         return 0;
702     }
703
704     @Override
705     public int getFetchDirection() throws SQLException {
706         // TODO Auto-generated method stub
707         return 0;
708     }
709
710     @Override
711     public int getFetchSize() throws SQLException {
712         // TODO Auto-generated method stub
713         return 0;
714     }
715
716     @Override
717     public float getFloat(int columnIndex) throws SQLException {
718         // TODO Auto-generated method stub
719         return 0;
720     }
721
722     @Override
723     public float getFloat(String columnLabel) throws SQLException {
724         // TODO Auto-generated method stub
725         return 0;
726     }
727
728     @Override
729     public int getHoldability() throws SQLException {
730         // TODO Auto-generated method stub
731         return 0;
732     }
733
734     @Override
735     public int getInt(int columnIndex) throws SQLException {
736         // TODO Auto-generated method stub
737         return 0;
738     }
739
740     @Override
741     public int getInt(String columnLabel) throws SQLException {
742         // TODO Auto-generated method stub
743         return 0;
744     }
745
746     @Override
747     public long getLong(int columnIndex) throws SQLException {
748         // TODO Auto-generated method stub
749         return 0;
750     }
751
752     @Override
753     public long getLong(String columnLabel) throws SQLException {
754         // TODO Auto-generated method stub
755         return 0;
756     }
757
758     @Override
759     public ResultSetMetaData getMetaData() throws SQLException {
760         return this;
761     }
762
763     @Override
764     public Reader getNCharacterStream(int columnIndex) throws SQLException {
765         // TODO Auto-generated method stub
766         return null;
767     }
768
769     @Override
770     public Reader getNCharacterStream(String columnLabel) throws SQLException {
771         // TODO Auto-generated method stub
772         return null;
773     }
774
775     @Override
776     public NClob getNClob(int columnIndex) throws SQLException {
777         // TODO Auto-generated method stub
778         return null;
779     }
780
781     @Override
782     public NClob getNClob(String columnLabel) throws SQLException {
783         // TODO Auto-generated method stub
784         return null;
785     }
786
787     @Override
788     public String getNString(int columnIndex) throws SQLException {
789         // TODO Auto-generated method stub
790         return null;
791     }
792
793     @Override
794     public String getNString(String columnLabel) throws SQLException {
795         // TODO Auto-generated method stub
796         return null;
797     }
798
799     @Override
800     public Object getObject(int columnIndex, Map<String, Class<?>> map)
801         throws SQLException {
802         // TODO Auto-generated method stub
803         return null;
804     }
805
806     @Override
807     public Object getObject(int columnIndex) throws SQLException {
808         return currentRecord
809             .get(this.fieldsInQuery.get(columnIndex - 1).toString());
810     }
811
812     @Override
813     public Object getObject(String columnLabel, Map<String, Class<?>> map)
814         throws SQLException {
815         // TODO Auto-generated method stub
816         return null;
817     }
818
819     @Override
820     public Object getObject(String columnLabel) throws SQLException {
821         return currentRecord.get(columnLabel);
822     }
823
824     @Override
825     public Ref getRef(int columnIndex) throws SQLException {
826         // TODO Auto-generated method stub
827         return null;
828     }
829
830     @Override
831     public Ref getRef(String columnLabel) throws SQLException {
832         // TODO Auto-generated method stub
833         return null;
834     }
835
836     @Override
837     public int getRow() throws SQLException {
838         // TODO Auto-generated method stub
839         return 0;
840     }
841
842     @Override
843     public RowId getRowId(int columnIndex) throws SQLException {
844         // TODO Auto-generated method stub
845         return null;
846     }
847
848     @Override
849     public RowId getRowId(String columnLabel) throws SQLException {
850         // TODO Auto-generated method stub
851         return null;
852     }
853
854     @Override
855     public SQLXML getSQLXML(int columnIndex) throws SQLException {
856         // TODO Auto-generated method stub
857         return null;
858     }
859
860     @Override
861     public SQLXML getSQLXML(String columnLabel) throws SQLException {
862         // TODO Auto-generated method stub
863         return null;
864     }
865
866     @Override
867     public short getShort(int columnIndex) throws SQLException {
868         // TODO Auto-generated method stub
869         return 0;
870     }
871
872     @Override
873     public short getShort(String columnLabel) throws SQLException {
874         // TODO Auto-generated method stub
875         return 0;
876     }
877
878     @Override
879     public Statement getStatement() throws SQLException {
880         // TODO Auto-generated method stub
881         return null;
882     }
883
884     @Override
885     public String getString(int columnIndex) throws SQLException {
886         // TODO Auto-generated method stub
887         return null;
888     }
889
890     @Override
891     public String getString(String columnLabel) throws SQLException {
892         // TODO Auto-generated method stub
893         return null;
894     }
895
896     @Override
897     public Time getTime(int columnIndex, Calendar cal) throws SQLException {
898         // TODO Auto-generated method stub
899         return null;
900     }
901
902     @Override
903     public Time getTime(int columnIndex) throws SQLException {
904         // TODO Auto-generated method stub
905         return null;
906     }
907
908     @Override
909     public Time getTime(String columnLabel, Calendar cal) throws SQLException {
910         // TODO Auto-generated method stub
911         return null;
912     }
913
914     @Override
915     public Time getTime(String columnLabel) throws SQLException {
916         // TODO Auto-generated method stub
917         return null;
918     }
919
920     @Override
921     public Timestamp getTimestamp(int columnIndex, Calendar cal)
922         throws SQLException {
923         // TODO Auto-generated method stub
924         return null;
925     }
926
927     @Override
928     public Timestamp getTimestamp(int columnIndex) throws SQLException {
929         // TODO Auto-generated method stub
930         return null;
931     }
932
933     @Override
934     public Timestamp getTimestamp(String columnLabel, Calendar cal)
935         throws SQLException {
936         // TODO Auto-generated method stub
937         return null;
938     }
939
940     @Override
941     public Timestamp getTimestamp(String columnLabel) throws SQLException {
942         // TODO Auto-generated method stub
943         return null;
944     }
945
946     @Override
947     public int getType() throws SQLException {
948         // TODO Auto-generated method stub
949         return 0;
950     }
951
952     @Override
953     public URL getURL(int columnIndex) throws SQLException {
954         // TODO Auto-generated method stub
955         return null;
956     }
957
958     @Override
959     public URL getURL(String columnLabel) throws SQLException {
960         // TODO Auto-generated method stub
961         return null;
962     }
963
964     @Override
965     public InputStream getUnicodeStream(int columnIndex) throws SQLException {
966         // TODO Auto-generated method stub
967         return null;
968     }
969
970     @Override
971     public InputStream getUnicodeStream(String columnLabel)
972         throws SQLException {
973         // TODO Auto-generated method stub
974         return null;
975     }
976
977     @Override
978     public SQLWarning getWarnings() throws SQLException {
979         // TODO Auto-generated method stub
980         return null;
981     }
982
983     @Override
984     public void insertRow() throws SQLException {
985         // TODO Auto-generated method stub
986
987     }
988
989     @Override
990     public boolean isAfterLast() throws SQLException {
991         // TODO Auto-generated method stub
992         return false;
993     }
994
995     @Override
996     public boolean isBeforeFirst() throws SQLException {
997         // TODO Auto-generated method stub
998         return false;
999     }
1000
1001     @Override
1002     public boolean isClosed() throws SQLException {
1003         // TODO Auto-generated method stub
1004         return false;
1005     }
1006
1007     @Override
1008     public boolean isFirst() throws SQLException {
1009         // TODO Auto-generated method stub
1010         return false;
1011     }
1012
1013     @Override
1014     public boolean isLast() throws SQLException {
1015         // TODO Auto-generated method stub
1016         return false;
1017     }
1018
1019     @Override
1020     public boolean last() throws SQLException {
1021         // TODO Auto-generated method stub
1022         return false;
1023     }
1024
1025     @Override
1026     public void moveToCurrentRow() throws SQLException {
1027         // TODO Auto-generated method stub
1028
1029     }
1030
1031     @Override
1032     public void moveToInsertRow() throws SQLException {
1033         // TODO Auto-generated method stub
1034
1035     }
1036
1037     @Override
1038     public boolean previous() throws SQLException {
1039         // TODO Auto-generated method stub
1040         return false;
1041     }
1042
1043     @Override
1044     public void refreshRow() throws SQLException {
1045         // TODO Auto-generated method stub
1046
1047     }
1048
1049     @Override
1050     public boolean relative(int rows) throws SQLException {
1051         // TODO Auto-generated method stub
1052         return false;
1053     }
1054
1055     @Override
1056     public boolean rowDeleted() throws SQLException {
1057         // TODO Auto-generated method stub
1058         return false;
1059     }
1060
1061     @Override
1062     public boolean rowInserted() throws SQLException {
1063         // TODO Auto-generated method stub
1064         return false;
1065     }
1066
1067     @Override
1068     public boolean rowUpdated() throws SQLException {
1069         // TODO Auto-generated method stub
1070         return false;
1071     }
1072
1073     @Override
1074     public void setFetchDirection(int direction) throws SQLException {
1075         // TODO Auto-generated method stub
1076
1077     }
1078
1079     @Override
1080     public void setFetchSize(int rows) throws SQLException {
1081         // TODO Auto-generated method stub
1082
1083     }
1084
1085     @Override
1086     public void updateArray(int columnIndex, Array x) throws SQLException {
1087         // TODO Auto-generated method stub
1088
1089     }
1090
1091     @Override
1092     public void updateArray(String columnLabel, Array x) throws SQLException {
1093         // TODO Auto-generated method stub
1094
1095     }
1096
1097     @Override
1098     public void updateAsciiStream(int columnIndex, InputStream x, int length)
1099         throws SQLException {
1100         // TODO Auto-generated method stub
1101
1102     }
1103
1104     @Override
1105     public void updateAsciiStream(int columnIndex, InputStream x, long length)
1106         throws SQLException {
1107         // TODO Auto-generated method stub
1108
1109     }
1110
1111     @Override
1112     public void updateAsciiStream(int columnIndex, InputStream x)
1113         throws SQLException {
1114         // TODO Auto-generated method stub
1115
1116     }
1117
1118     @Override
1119     public void updateAsciiStream(String columnLabel, InputStream x, int length)
1120         throws SQLException {
1121         // TODO Auto-generated method stub
1122
1123     }
1124
1125     @Override
1126     public void updateAsciiStream(String columnLabel, InputStream x,
1127         long length)
1128         throws SQLException {
1129         // TODO Auto-generated method stub
1130
1131     }
1132
1133     @Override
1134     public void updateAsciiStream(String columnLabel, InputStream x)
1135         throws SQLException {
1136         // TODO Auto-generated method stub
1137
1138     }
1139
1140     @Override
1141     public void updateBigDecimal(int columnIndex, BigDecimal x)
1142         throws SQLException {
1143         // TODO Auto-generated method stub
1144
1145     }
1146
1147     @Override
1148     public void updateBigDecimal(String columnLabel, BigDecimal x)
1149         throws SQLException {
1150         // TODO Auto-generated method stub
1151
1152     }
1153
1154     @Override
1155     public void updateBinaryStream(int columnIndex, InputStream x, int length)
1156         throws SQLException {
1157         // TODO Auto-generated method stub
1158
1159     }
1160
1161     @Override
1162     public void updateBinaryStream(int columnIndex, InputStream x, long length)
1163         throws SQLException {
1164         // TODO Auto-generated method stub
1165
1166     }
1167
1168     @Override
1169     public void updateBinaryStream(int columnIndex, InputStream x)
1170         throws SQLException {
1171         // TODO Auto-generated method stub
1172
1173     }
1174
1175     @Override
1176     public void updateBinaryStream(String columnLabel, InputStream x,
1177         int length)
1178         throws SQLException {
1179         // TODO Auto-generated method stub
1180
1181     }
1182
1183     @Override
1184     public void updateBinaryStream(String columnLabel, InputStream x,
1185         long length) throws SQLException {
1186         // TODO Auto-generated method stub
1187
1188     }
1189
1190     @Override
1191     public void updateBinaryStream(String columnLabel, InputStream x)
1192         throws SQLException {
1193         // TODO Auto-generated method stub
1194
1195     }
1196
1197     @Override
1198     public void updateBlob(int columnIndex, Blob x) throws SQLException {
1199         // TODO Auto-generated method stub
1200
1201     }
1202
1203     @Override
1204     public void updateBlob(int columnIndex, InputStream inputStream,
1205         long length)
1206         throws SQLException {
1207         // TODO Auto-generated method stub
1208
1209     }
1210
1211     @Override
1212     public void updateBlob(int columnIndex, InputStream inputStream)
1213         throws SQLException {
1214         // TODO Auto-generated method stub
1215
1216     }
1217
1218     @Override
1219     public void updateBlob(String columnLabel, Blob x) throws SQLException {
1220         // TODO Auto-generated method stub
1221
1222     }
1223
1224     @Override
1225     public void updateBlob(String columnLabel, InputStream inputStream,
1226         long length) throws SQLException {
1227         // TODO Auto-generated method stub
1228
1229     }
1230
1231     @Override
1232     public void updateBlob(String columnLabel, InputStream inputStream)
1233         throws SQLException {
1234         // TODO Auto-generated method stub
1235
1236     }
1237
1238     @Override
1239     public void updateBoolean(int columnIndex, boolean x) throws SQLException {
1240         // TODO Auto-generated method stub
1241
1242     }
1243
1244     @Override
1245     public void updateBoolean(String columnLabel, boolean x)
1246         throws SQLException {
1247         // TODO Auto-generated method stub
1248
1249     }
1250
1251     @Override
1252     public void updateByte(int columnIndex, byte x) throws SQLException {
1253         // TODO Auto-generated method stub
1254
1255     }
1256
1257     @Override
1258     public void updateByte(String columnLabel, byte x) throws SQLException {
1259         // TODO Auto-generated method stub
1260
1261     }
1262
1263     @Override
1264     public void updateBytes(int columnIndex, byte[] x) throws SQLException {
1265         // TODO Auto-generated method stub
1266
1267     }
1268
1269     @Override
1270     public void updateBytes(String columnLabel, byte[] x) throws SQLException {
1271         // TODO Auto-generated method stub
1272
1273     }
1274
1275     @Override
1276     public void updateCharacterStream(int columnIndex, Reader x, int length)
1277         throws SQLException {
1278         // TODO Auto-generated method stub
1279
1280     }
1281
1282     @Override
1283     public void updateCharacterStream(int columnIndex, Reader x, long length)
1284         throws SQLException {
1285         // TODO Auto-generated method stub
1286
1287     }
1288
1289     @Override
1290     public void updateCharacterStream(int columnIndex, Reader x)
1291         throws SQLException {
1292         // TODO Auto-generated method stub
1293
1294     }
1295
1296     @Override
1297     public void updateCharacterStream(String columnLabel, Reader reader,
1298         int length) throws SQLException {
1299         // TODO Auto-generated method stub
1300
1301     }
1302
1303     @Override
1304     public void updateCharacterStream(String columnLabel, Reader reader,
1305         long length) throws SQLException {
1306         // TODO Auto-generated method stub
1307
1308     }
1309
1310     @Override
1311     public void updateCharacterStream(String columnLabel, Reader reader)
1312         throws SQLException {
1313         // TODO Auto-generated method stub
1314
1315     }
1316
1317     @Override
1318     public void updateClob(int columnIndex, Clob x) throws SQLException {
1319         // TODO Auto-generated method stub
1320
1321     }
1322
1323     @Override
1324     public void updateClob(int columnIndex, Reader reader, long length)
1325         throws SQLException {
1326         // TODO Auto-generated method stub
1327
1328     }
1329
1330     @Override
1331     public void updateClob(int columnIndex, Reader reader) throws SQLException {
1332         // TODO Auto-generated method stub
1333
1334     }
1335
1336     @Override
1337     public void updateClob(String columnLabel, Clob x) throws SQLException {
1338         // TODO Auto-generated method stub
1339
1340     }
1341
1342     @Override
1343     public void updateClob(String columnLabel, Reader reader, long length)
1344         throws SQLException {
1345         // TODO Auto-generated method stub
1346
1347     }
1348
1349     @Override
1350     public void updateClob(String columnLabel, Reader reader)
1351         throws SQLException {
1352         // TODO Auto-generated method stub
1353
1354     }
1355
1356     @Override
1357     public void updateDate(int columnIndex, Date x) throws SQLException {
1358         // TODO Auto-generated method stub
1359
1360     }
1361
1362     @Override
1363     public void updateDate(String columnLabel, Date x) throws SQLException {
1364         // TODO Auto-generated method stub
1365
1366     }
1367
1368     @Override
1369     public void updateDouble(int columnIndex, double x) throws SQLException {
1370         // TODO Auto-generated method stub
1371
1372     }
1373
1374     @Override
1375     public void updateDouble(String columnLabel, double x) throws SQLException {
1376         // TODO Auto-generated method stub
1377
1378     }
1379
1380     @Override
1381     public void updateFloat(int columnIndex, float x) throws SQLException {
1382         // TODO Auto-generated method stub
1383
1384     }
1385
1386     @Override
1387     public void updateFloat(String columnLabel, float x) throws SQLException {
1388         // TODO Auto-generated method stub
1389
1390     }
1391
1392     @Override
1393     public void updateInt(int columnIndex, int x) throws SQLException {
1394         // TODO Auto-generated method stub
1395
1396     }
1397
1398     @Override
1399     public void updateInt(String columnLabel, int x) throws SQLException {
1400         // TODO Auto-generated method stub
1401
1402     }
1403
1404     @Override
1405     public void updateLong(int columnIndex, long x) throws SQLException {
1406         // TODO Auto-generated method stub
1407
1408     }
1409
1410     @Override
1411     public void updateLong(String columnLabel, long x) throws SQLException {
1412         // TODO Auto-generated method stub
1413
1414     }
1415
1416     @Override
1417     public void updateNCharacterStream(int columnIndex, Reader x, long length)
1418         throws SQLException {
1419         // TODO Auto-generated method stub
1420
1421     }
1422
1423     @Override
1424     public void updateNCharacterStream(int columnIndex, Reader x)
1425         throws SQLException {
1426         // TODO Auto-generated method stub
1427
1428     }
1429
1430     @Override
1431     public void updateNCharacterStream(String columnLabel, Reader reader,
1432         long length) throws SQLException {
1433         // TODO Auto-generated method stub
1434
1435     }
1436
1437     @Override
1438     public void updateNCharacterStream(String columnLabel, Reader reader)
1439         throws SQLException {
1440         // TODO Auto-generated method stub
1441
1442     }
1443
1444     @Override
1445     public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
1446         // TODO Auto-generated method stub
1447
1448     }
1449
1450     @Override
1451     public void updateNClob(int columnIndex, Reader reader, long length)
1452         throws SQLException {
1453         // TODO Auto-generated method stub
1454
1455     }
1456
1457     @Override
1458     public void updateNClob(int columnIndex, Reader reader)
1459         throws SQLException {
1460         // TODO Auto-generated method stub
1461
1462     }
1463
1464     @Override
1465     public void updateNClob(String columnLabel, NClob nClob)
1466         throws SQLException {
1467         // TODO Auto-generated method stub
1468
1469     }
1470
1471     @Override
1472     public void updateNClob(String columnLabel, Reader reader, long length)
1473         throws SQLException {
1474         // TODO Auto-generated method stub
1475
1476     }
1477
1478     @Override
1479     public void updateNClob(String columnLabel, Reader reader)
1480         throws SQLException {
1481         // TODO Auto-generated method stub
1482
1483     }
1484
1485     @Override
1486     public void updateNString(int columnIndex, String nString)
1487         throws SQLException {
1488         // TODO Auto-generated method stub
1489
1490     }
1491
1492     @Override
1493     public void updateNString(String columnLabel, String nString)
1494         throws SQLException {
1495         // TODO Auto-generated method stub
1496
1497     }
1498
1499     @Override
1500     public void updateNull(int columnIndex) throws SQLException {
1501         // TODO Auto-generated method stub
1502
1503     }
1504
1505     @Override
1506     public void updateNull(String columnLabel) throws SQLException {
1507         // TODO Auto-generated method stub
1508
1509     }
1510
1511     @Override
1512     public void updateObject(int columnIndex, Object x, int scaleOrLength)
1513         throws SQLException {
1514         // TODO Auto-generated method stub
1515
1516     }
1517
1518     @Override
1519     public void updateObject(int columnIndex, Object x) throws SQLException {
1520         // TODO Auto-generated method stub
1521
1522     }
1523
1524     @Override
1525     public void updateObject(String columnLabel, Object x, int scaleOrLength)
1526         throws SQLException {
1527         // TODO Auto-generated method stub
1528
1529     }
1530
1531     @Override
1532     public void updateObject(String columnLabel, Object x) throws SQLException {
1533         // TODO Auto-generated method stub
1534
1535     }
1536
1537     @Override
1538     public void updateRef(int columnIndex, Ref x) throws SQLException {
1539         // TODO Auto-generated method stub
1540
1541     }
1542
1543     @Override
1544     public void updateRef(String columnLabel, Ref x) throws SQLException {
1545         // TODO Auto-generated method stub
1546
1547     }
1548
1549     @Override
1550     public void updateRow() throws SQLException {
1551         // TODO Auto-generated method stub
1552
1553     }
1554
1555     @Override
1556     public void updateRowId(int columnIndex, RowId x) throws SQLException {
1557         // TODO Auto-generated method stub
1558
1559     }
1560
1561     @Override
1562     public void updateRowId(String columnLabel, RowId x) throws SQLException {
1563         // TODO Auto-generated method stub
1564
1565     }
1566
1567     @Override
1568     public void updateSQLXML(int columnIndex, SQLXML xmlObject)
1569         throws SQLException {
1570         // TODO Auto-generated method stub
1571
1572     }
1573
1574     @Override
1575     public void updateSQLXML(String columnLabel, SQLXML xmlObject)
1576         throws SQLException {
1577         // TODO Auto-generated method stub
1578
1579     }
1580
1581     @Override
1582     public void updateShort(int columnIndex, short x) throws SQLException {
1583         // TODO Auto-generated method stub
1584
1585     }
1586
1587     @Override
1588     public void updateShort(String columnLabel, short x) throws SQLException {
1589         // TODO Auto-generated method stub
1590
1591     }
1592
1593     @Override
1594     public void updateString(int columnIndex, String x) throws SQLException {
1595         // TODO Auto-generated method stub
1596
1597     }
1598
1599     @Override
1600     public void updateString(String columnLabel, String x) throws SQLException {
1601         // TODO Auto-generated method stub
1602
1603     }
1604
1605     @Override
1606     public void updateTime(int columnIndex, Time x) throws SQLException {
1607         // TODO Auto-generated method stub
1608
1609     }
1610
1611     @Override
1612     public void updateTime(String columnLabel, Time x) throws SQLException {
1613         // TODO Auto-generated method stub
1614
1615     }
1616
1617     @Override
1618     public void updateTimestamp(int columnIndex, Timestamp x)
1619         throws SQLException {
1620         // TODO Auto-generated method stub
1621
1622     }
1623
1624     @Override
1625     public void updateTimestamp(String columnLabel, Timestamp x)
1626         throws SQLException {
1627         // TODO Auto-generated method stub
1628
1629     }
1630
1631     @Override
1632     public boolean wasNull() throws SQLException {
1633         // TODO Auto-generated method stub
1634         return false;
1635     }
1636
1637     @Override
1638     public String getCatalogName(int column) throws SQLException {
1639         // TODO Auto-generated method stub
1640         return null;
1641     }
1642
1643     @Override
1644     public String getColumnClassName(int column) throws SQLException {
1645         // TODO Auto-generated method stub
1646         return null;
1647     }
1648
1649     @Override
1650     public int getColumnCount() throws SQLException {
1651         return fieldsInQuery.size();
1652     }
1653
1654     @Override
1655     public int getColumnDisplaySize(int column) throws SQLException {
1656         // TODO Auto-generated method stub
1657         return 0;
1658     }
1659
1660     @Override
1661     public String getColumnLabel(int column) throws SQLException {
1662         return this.fieldsInQuery.get(column - 1).toString();
1663     }
1664
1665     @Override
1666     public String getColumnName(int column) throws SQLException {
1667         // TODO Auto-generated method stub
1668         return null;
1669     }
1670
1671     @Override
1672     public int getColumnType(int column) throws SQLException {
1673         // TODO Auto-generated method stub
1674         return 0;
1675     }
1676
1677     @Override
1678     public String getColumnTypeName(int column) throws SQLException {
1679         // TODO Auto-generated method stub
1680         return null;
1681     }
1682
1683     @Override
1684     public int getPrecision(int column) throws SQLException {
1685         // TODO Auto-generated method stub
1686         return 0;
1687     }
1688
1689     @Override
1690     public int getScale(int column) throws SQLException {
1691         // TODO Auto-generated method stub
1692         return 0;
1693     }
1694
1695     @Override
1696     public String getSchemaName(int column) throws SQLException {
1697         // TODO Auto-generated method stub
1698         return null;
1699     }
1700
1701     @Override
1702     public String getTableName(int column) throws SQLException {
1703         // TODO Auto-generated method stub
1704         return null;
1705     }
1706
1707     @Override
1708     public boolean isAutoIncrement(int column) throws SQLException {
1709         // TODO Auto-generated method stub
1710         return false;
1711     }
1712
1713     @Override
1714     public boolean isCaseSensitive(int column) throws SQLException {
1715         // TODO Auto-generated method stub
1716         return false;
1717     }
1718
1719     @Override
1720     public boolean isCurrency(int column) throws SQLException {
1721         // TODO Auto-generated method stub
1722         return false;
1723     }
1724
1725     @Override
1726     public boolean isDefinitelyWritable(int column) throws SQLException {
1727         // TODO Auto-generated method stub
1728         return false;
1729     }
1730
1731     @Override
1732     public int isNullable(int column) throws SQLException {
1733         // TODO Auto-generated method stub
1734         return 0;
1735     }
1736
1737     @Override
1738     public boolean isReadOnly(int column) throws SQLException {
1739         // TODO Auto-generated method stub
1740         return false;
1741     }
1742
1743     @Override
1744     public boolean isSearchable(int column) throws SQLException {
1745         // TODO Auto-generated method stub
1746         return false;
1747     }
1748
1749     @Override
1750     public boolean isSigned(int column) throws SQLException {
1751         // TODO Auto-generated method stub
1752         return false;
1753     }
1754
1755     @Override
1756     public boolean isWritable(int column) throws SQLException {
1757         // TODO Auto-generated method stub
1758         return false;
1759     }
1760
1761     @Override
1762     public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
1763         // TODO Auto-generated method stub
1764         return null;
1765     }
1766
1767     @Override
1768     public <T> T getObject(String columnLabel, Class<T> type)
1769         throws SQLException {
1770         // TODO Auto-generated method stub
1771         return null;
1772     }
1773
1774
1775
1776     ////Metadata
1777
1778
1779
1780 }