Refactor tabular output for eventual re-use printing table metadata.
[squelch.git] / src / test / java / net / jaekl / squelch / sql / PreparedStatementMock.java
diff --git a/src/test/java/net/jaekl/squelch/sql/PreparedStatementMock.java b/src/test/java/net/jaekl/squelch/sql/PreparedStatementMock.java
new file mode 100644 (file)
index 0000000..c4c33a2
--- /dev/null
@@ -0,0 +1,656 @@
+package net.jaekl.squelch.sql;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.ParameterMetaData;
+import java.sql.PreparedStatement;
+import java.sql.Ref;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+
+public class PreparedStatementMock implements PreparedStatement {
+       private ArrayList<Object> m_args;
+       private boolean m_closed;
+       private ConnectionMock m_conn;
+       private String m_sql;
+       
+       public PreparedStatementMock(ConnectionMock conn, String sql) 
+       {
+               m_args = new ArrayList<Object>();
+               m_closed = false;
+               m_conn = conn;
+               m_sql = sql;
+       }
+       
+       @Override
+       public String toString()
+       {
+               StringBuilder sb = new StringBuilder(m_sql);
+               
+               for (Object arg : m_args) {
+                       sb.append("[" + arg + "]");
+               }
+               
+               return sb.toString();
+       }
+
+       @Override
+       public void addBatch(String arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void cancel() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void clearBatch() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void clearWarnings() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void close() throws SQLException {
+               m_closed = true;
+       }
+
+       @Override
+       public void closeOnCompletion() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public boolean execute(String arg0) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public boolean execute(String arg0, int arg1) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public boolean execute(String arg0, int[] arg1) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public boolean execute(String arg0, String[] arg1) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public int[] executeBatch() throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public ResultSet executeQuery(String arg0) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");         
+       }
+
+       @Override
+       public int executeUpdate(String arg0) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");         
+       }
+
+       @Override
+       public int executeUpdate(String arg0, int arg1) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public int executeUpdate(String arg0, int[] arg1) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");
+       }
+
+       @Override
+       public int executeUpdate(String arg0, String[] arg1) throws SQLException {
+               assert(! m_closed);
+               throw new UnsupportedOperationException("Not yet implemented");         
+       }
+
+       @Override
+       public Connection getConnection() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getFetchDirection() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getFetchSize() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public ResultSet getGeneratedKeys() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getMaxFieldSize() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getMaxRows() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public boolean getMoreResults() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public boolean getMoreResults(int arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getQueryTimeout() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public ResultSet getResultSet() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getResultSetConcurrency() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getResultSetHoldability() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getResultSetType() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public int getUpdateCount() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public SQLWarning getWarnings() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public boolean isCloseOnCompletion() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public boolean isClosed() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public boolean isPoolable() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public void setCursorName(String arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setEscapeProcessing(boolean arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setFetchDirection(int arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setFetchSize(int arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setMaxFieldSize(int arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setMaxRows(int arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setPoolable(boolean arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setQueryTimeout(int arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public <T> T unwrap(Class<T> arg0) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public void addBatch() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void clearParameters() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public boolean execute() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public ResultSet executeQuery() throws SQLException {
+               assert(! m_closed);
+               return m_conn.mock_executeQuery(this);
+       }
+
+       @Override
+       public int executeUpdate() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public ResultSetMetaData getMetaData() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public ParameterMetaData getParameterMetaData() throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+               
+       }
+
+       @Override
+       public void setArray(int arg0, Array arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setAsciiStream(int arg0, InputStream arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setAsciiStream(int arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setAsciiStream(int arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBigDecimal(int arg0, BigDecimal arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBinaryStream(int arg0, InputStream arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBinaryStream(int arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBinaryStream(int arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBlob(int arg0, Blob arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBlob(int arg0, InputStream arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBlob(int arg0, InputStream arg1, long arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBoolean(int arg0, boolean arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setByte(int arg0, byte arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setBytes(int arg0, byte[] arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setCharacterStream(int arg0, Reader arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setCharacterStream(int arg0, Reader arg1, int arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setCharacterStream(int arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setClob(int arg0, Clob arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setClob(int arg0, Reader arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setClob(int arg0, Reader arg1, long arg2) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setDate(int arg0, Date arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setDate(int arg0, Date arg1, Calendar arg2) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setDouble(int arg0, double arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setFloat(int arg0, float arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setInt(int arg0, int arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setLong(int arg0, long arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNCharacterStream(int arg0, Reader arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNCharacterStream(int arg0, Reader arg1, long arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNClob(int arg0, NClob arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNClob(int arg0, Reader arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNClob(int arg0, Reader arg1, long arg2) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNString(int arg0, String arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNull(int arg0, int arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setNull(int arg0, int arg1, String arg2) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setObject(int arg0, Object arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setObject(int arg0, Object arg1, int arg2) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setObject(int arg0, Object arg1, int arg2, int arg3)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setRef(int arg0, Ref arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setRowId(int arg0, RowId arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setSQLXML(int arg0, SQLXML arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setShort(int arg0, short arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setString(int arg0, String arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setTime(int arg0, Time arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setTime(int arg0, Time arg1, Calendar arg2) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setTimestamp(int arg0, Timestamp arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setTimestamp(int arg0, Timestamp arg1, Calendar arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setURL(int arg0, URL arg1) throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+       @Override
+       public void setUnicodeStream(int arg0, InputStream arg1, int arg2)
+                       throws SQLException {
+               throw new UnsupportedOperationException("Not yet implemented");
+
+       }
+
+}