]> jaekl.net Git - squelch.git/blob - src/test/java/net/jaekl/squelch/stmt/TabularMock.java
Fix and fine-tune suppress_nulls.
[squelch.git] / src / test / java / net / jaekl / squelch / stmt / TabularMock.java
1 package net.jaekl.squelch.stmt;
2
3 import java.sql.SQLException;
4 import java.util.ArrayList;
5
6 import net.jaekl.squelch.sql.Column;
7 import net.jaekl.squelch.sql.Row;
8
9 public class TabularMock extends Tabular {
10         private Column[] m_cols;
11         private ArrayList<Row> m_rows;
12         private int m_rowIdx;
13         
14         public TabularMock() {
15                 m_cols = new Column[0];
16                 m_rows = new ArrayList<Row>();
17                 m_rowIdx = (-1);
18         }
19         
20         @Override
21         Column[] getCols() throws SQLException {
22                 return m_cols.clone();
23         }
24
25         @Override
26         Row getNext() {
27                 if (m_rowIdx >= (m_rows.size() - 1)) {
28                         return null;
29                 }
30                 m_rowIdx++;
31                 return m_rows.get(m_rowIdx);
32         }
33         
34         public void mock_setCols(Column[] cols) {
35                 m_cols = cols.clone();
36         }
37         
38         public void mock_addRow(Row row) {
39                 m_rows.add(row);
40         }
41 }