From: Chris Jaekl Date: Sun, 12 Jun 2016 11:01:17 +0000 (+0900) Subject: Refactor tabular output for eventual re-use printing table metadata. X-Git-Url: https://jaekl.net/gitweb/?a=commitdiff_plain;h=dad47827334a0732966cc197dfe1e3ac303fb694;p=squelch.git Refactor tabular output for eventual re-use printing table metadata. Note that this is not yet complete; tabular output is currently broken. --- diff --git a/src/main/java/net/jaekl/squelch/sql/Row.java b/src/main/java/net/jaekl/squelch/sql/Row.java new file mode 100644 index 0000000..0496d23 --- /dev/null +++ b/src/main/java/net/jaekl/squelch/sql/Row.java @@ -0,0 +1,17 @@ +package net.jaekl.squelch.sql; + +public class Row { + private Object[] m_args; + + public Row(int numCols) { + m_args = new Object[numCols]; + } + + public void setValue(int idx, Object value) { + m_args[idx - 1] = value; + } + + public Object getValue(int idx) { + return m_args[idx-1]; + } +} diff --git a/src/main/java/net/jaekl/squelch/stmt/Select.java b/src/main/java/net/jaekl/squelch/stmt/Select.java index 088181a..afad262 100644 --- a/src/main/java/net/jaekl/squelch/stmt/Select.java +++ b/src/main/java/net/jaekl/squelch/stmt/Select.java @@ -5,12 +5,9 @@ import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.Locale; -import net.jaekl.squelch.sql.Column; - public class Select extends Query { @Override @@ -38,57 +35,13 @@ public class Select extends Query { } return rowCount; } - - private Column[] getColumns(ResultSetMetaData metaData) - throws SQLException, ClassNotFoundException - { - int colCount = metaData.getColumnCount(); - - Column cols[] = new Column[colCount]; - for (int idx = 1; idx <= colCount; ++idx) { - String label = metaData.getColumnLabel(idx); - Class clazz = Class.forName(metaData.getColumnTypeName(idx)); - int width = metaData.getColumnDisplaySize(idx); - cols[idx] = new Column(label, clazz, width); - } - - return cols; - } - + private int printFormatted(PrintWriter pw, ResultSet rs) throws IOException, SQLException { - try { - ResultSetMetaData metaData = rs.getMetaData(); - int rowCount = 0; - Column[] cols = getColumns(metaData); - StringBuilder sb = new StringBuilder(); - sb.append("----------------------------------\n"); - for (int idx = 1; idx <= cols.length; ++idx) { - sb.append("|" + cols[idx - 1].getLabel()); - } - sb.append("|\n"); - String header = sb.toString(); - - while (rs.next()) { - if (null != header) { - pw.print(header); - header = null; - } - - for (int idx = 1; idx <= cols.length; ++idx) { - pw.print("|" + rs.getObject(idx)); - } - pw.println("|"); - } - if (rowCount > 0) { - pw.println("----------------------------------"); - } - pw.println("" + rowCount + " row(s) returned."); - - return rowCount; - } - catch (ClassNotFoundException exc) { - throw new SQLException(exc); - } + TabularResultSet trs = new TabularResultSet(rs); + int rowCount = trs.printTable(pw); + pw.flush(); + + return rowCount; } } diff --git a/src/main/java/net/jaekl/squelch/stmt/Tabular.java b/src/main/java/net/jaekl/squelch/stmt/Tabular.java new file mode 100644 index 0000000..03c403e --- /dev/null +++ b/src/main/java/net/jaekl/squelch/stmt/Tabular.java @@ -0,0 +1,246 @@ +package net.jaekl.squelch.stmt; + +import java.io.PrintWriter; +import java.sql.SQLException; +import java.sql.Types; + +import net.jaekl.squelch.sql.Column; +import net.jaekl.squelch.sql.Row; + +// Copyright (C) 2016 by Chris Jaekl +// +// Tabular: wrapper around a set of tabular data (such as a ResultSet or table's MetaData). +// Includes routines to output the data as a human-friendly table, or as CSV. + +abstract public class Tabular { + private static class RowBuffer { + private final int ROW_BUF_SIZE = 50; + + private Row[] m_rowBuf; + private int m_pending; + + public RowBuffer() { + m_rowBuf = new Row[ROW_BUF_SIZE]; + m_pending = 0; + } + + public void addRow(Row row) { + assert (m_pending < m_rowBuf.length); + m_rowBuf[m_pending] = row; + m_pending++; + } + public int getPending() { return m_pending; } + public Row getRow(int idx) { + assert (idx >= 0 && idx < m_pending); + return m_rowBuf[idx]; + } + public boolean isFull() { return m_pending >= m_rowBuf.length; } + } + + abstract Column[] getCols() throws SQLException; + abstract Row getNext(); + + // Returns the number of (data) rows that were output + public int printTable(PrintWriter pw) throws SQLException { + int rowCount = 0; + Column[] cols = getCols(); + RowBuffer rowBuf; + + // Initialize colWidths to the widths of the column names + int[] colWidths = initColWidthsFromColNames(cols); + + // Examine and buffer up to ROW_BUF_SIZE rows, adjusting (widening) colWidths where needed + rowBuf = bufferRows(colWidths); + + int pending = rowBuf.getPending(); + if (pending > 0) { + writeHeader(pw, cols, colWidths); + writeRowBuffer(pw, rowBuf, colWidths); + rowCount = rowBuf.getPending(); + } + + while (pending > 0) { + rowBuf = bufferRows(colWidths); + writeRowBuffer(pw, rowBuf, colWidths); + pending = rowBuf.getPending(); + rowCount += pending; + } + + // TODO: Implement a String table for i18n + pw.println("" + rowCount + " row(s) returned."); + pw.flush(); + + return rowCount; + } + + // Returns the number of (data) rows that were output + public int printCsv(PrintWriter pw) throws SQLException { + int rowCount = 0; + Column[] cols = getCols(); + Row row = null; + + StringBuilder sb = new StringBuilder(); + boolean firstCol = true; + for (int idx = 1; idx <= cols.length; ++idx) { + if (firstCol) { + firstCol = false; + } + else { + sb.append(","); + } + sb.append("" + cols[idx - 1].getLabel()); + } + sb.append("\n"); + String header = sb.toString(); + + while (null != (row = getNext())) { + if (null != header) { + pw.print(header); + header = null; + } + + firstCol = true; + for (int idx = 1; idx <= cols.length; ++idx) { + if (firstCol) { + firstCol = false; + } + else { + pw.print(","); + } + pw.print("" + row.getValue(idx)); + } + pw.println(""); + rowCount++; + } + pw.flush(); + + return rowCount; + } + + // Examine and buffer up to rowBuf.length rows. + // Returns the number of actual rows that were buffered (zero if no more rows are available). + RowBuffer bufferRows(int[] colWidths) + { + RowBuffer rowBuf = new RowBuffer(); + + while (!rowBuf.isFull()) { + Row row = getNext(); + if (null == row) { + // No more rows available + return rowBuf; + } + rowBuf.addRow(row); + + // Check whether all values in this row will fit in the current column widths + for (int colIdx = 0; colIdx < colWidths.length; ++colIdx) { + int width = ("" + row.getValue(colIdx + 1)).length(); + if (width > colWidths[colIdx]) { + // Widen the column to fit this value + colWidths[colIdx] = width; + } + } + } + + return rowBuf; + } + + String centrePad(String value, int desiredWidth) + { + if (null == value) { + return centrePad("NULL", desiredWidth); + } + if (value.length() >= desiredWidth) { + return value; + } + int left = (desiredWidth - value.length()) / 2; + int right = desiredWidth - value.length() - left; + return repChar(' ', left) + value + repChar(' ', right); + } + + int[] initColWidthsFromColNames(Column[] cols) + { + int[] widths = new int[cols.length]; + + for (int idx = 0; idx < cols.length; ++idx) { + widths[idx] = cols[idx].getLabel().length(); + } + + return widths; + } + + Class classForSqlType(int sqlType) + { + switch(sqlType) + { + case Types.BOOLEAN: + return Boolean.class; + case Types.CHAR: + return Character.class; + case Types.DATE: + case Types.TIME: + case Types.TIMESTAMP: + return java.util.Date.class; + case Types.DECIMAL: + case Types.DOUBLE: + case Types.FLOAT: + case Types.NUMERIC: + case Types.REAL: + return Double.class; + case Types.INTEGER: + return Long.class; + case Types.ROWID: + case Types.SMALLINT: + return Integer.class; + case Types.TINYINT: + return Short.class; + case Types.LONGNVARCHAR: + case Types.LONGVARCHAR: + case Types.NCHAR: + case Types.NVARCHAR: + case Types.VARCHAR: + return String.class; + } + return Object.class; + } + + String repChar(char chr, int times) + { + StringBuffer sb = new StringBuffer(); + for (int idx = 0; idx < times; ++idx) { + sb.append(chr); + } + return sb.toString(); + } + + void writeDivider(PrintWriter pw, int[] colWidths) { + for (int idx = 0; idx < colWidths.length; ++idx) { + pw.print("+" + repChar('-', colWidths[idx])); + } + pw.println("+"); + } + + void writeHeader(PrintWriter pw, Column[] cols, int[] colWidths) { + writeDivider(pw, colWidths); + + for (int idx = 1; idx <= cols.length; ++idx) { + Column col = cols[idx]; + pw.print("|" + centrePad(col.getLabel(), colWidths[idx])); + } + pw.println("|"); + + writeDivider(pw, colWidths); + } + + void writeRowBuffer(PrintWriter pw, RowBuffer rowBuf, int[] colWidths) { + + for (int rowIdx = 0; rowIdx < rowBuf.getPending(); ++rowIdx) { + Row row = rowBuf.getRow(rowIdx); + for (int colIdx = 0; colIdx < colWidths.length; ++colIdx) { + String value = "" + row.getValue(colIdx); + String padding = repChar(' ', colWidths[colIdx] - value.length()); + pw.print("|" + value + padding); + } + pw.println("|"); + } + } +} diff --git a/src/main/java/net/jaekl/squelch/stmt/TabularResultSet.java b/src/main/java/net/jaekl/squelch/stmt/TabularResultSet.java new file mode 100644 index 0000000..92da23d --- /dev/null +++ b/src/main/java/net/jaekl/squelch/stmt/TabularResultSet.java @@ -0,0 +1,38 @@ +package net.jaekl.squelch.stmt; + +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; + +import net.jaekl.squelch.sql.Column; +import net.jaekl.squelch.sql.Row; + +public class TabularResultSet extends Tabular { + private ResultSet m_resultSet; + + public TabularResultSet(ResultSet resultSet) { + m_resultSet = resultSet; + } + + @Override + Column[] getCols() throws SQLException { + ResultSetMetaData metaData = m_resultSet.getMetaData(); + int colCount = metaData.getColumnCount(); + + Column cols[] = new Column[colCount]; + for (int idx = 1; idx <= colCount; ++idx) { + String label = metaData.getColumnLabel(idx); + Class clazz = classForSqlType(metaData.getColumnType(idx)); + int width = metaData.getColumnDisplaySize(idx); + cols[idx - 1] = new Column(label, clazz, width); + } + + return cols; + } + + @Override + Row getNext() { + // TODO Auto-generated method stub + return null; + } +} diff --git a/src/test/java/net/jaekl/squelch/SquelchTest.java b/src/test/java/net/jaekl/squelch/SquelchTest.java index fc12402..be533d8 100644 --- a/src/test/java/net/jaekl/squelch/SquelchTest.java +++ b/src/test/java/net/jaekl/squelch/SquelchTest.java @@ -13,12 +13,12 @@ import java.nio.charset.StandardCharsets; import java.sql.Connection; import java.sql.SQLException; -import net.jaekl.squelch.db.ConnectionMock; import net.jaekl.squelch.db.DbDriver; import net.jaekl.squelch.db.MsSqlDriver; import net.jaekl.squelch.db.MySqlDriver; import net.jaekl.squelch.db.OracleDriver; import net.jaekl.squelch.db.PostgresqlDriver; +import net.jaekl.squelch.sql.ConnectionMock; import net.jaekl.squelch.util.ConsoleInputMock; import org.junit.Test; diff --git a/src/test/java/net/jaekl/squelch/db/ConnectionMock.java b/src/test/java/net/jaekl/squelch/db/ConnectionMock.java deleted file mode 100644 index e242e00..0000000 --- a/src/test/java/net/jaekl/squelch/db/ConnectionMock.java +++ /dev/null @@ -1,383 +0,0 @@ -package net.jaekl.squelch.db; - -import java.sql.Array; -import java.sql.Blob; -import java.sql.CallableStatement; -import java.sql.Clob; -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.NClob; -import java.sql.PreparedStatement; -import java.sql.SQLClientInfoException; -import java.sql.SQLException; -import java.sql.SQLWarning; -import java.sql.SQLXML; -import java.sql.Savepoint; -import java.sql.Statement; -import java.sql.Struct; -import java.util.ArrayList; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Executor; - -public class ConnectionMock implements Connection { - private ArrayList m_executedQueries; - - public ConnectionMock() { - m_executedQueries = new ArrayList(); - } - - public ResultSetMock mock_executeQuery(PreparedStatementMock psm) - { - m_executedQueries.add(psm.toString()); - return new ResultSetMock(); - } - - public boolean mock_queryWasExecuted(String sql) { - // There's an assumption here that we don't try a large number of queries in a single test. - // If that assumption is false, then we should change this to be more efficient. - return m_executedQueries.contains(sql); - } - - @Override - public boolean isWrapperFor(Class arg0) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T unwrap(Class arg0) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void abort(Executor executor) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void clearWarnings() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void close() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void commit() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public Array createArrayOf(String typeName, Object[] elements) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Blob createBlob() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Clob createClob() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public NClob createNClob() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLXML createSQLXML() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Statement createStatement() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Statement createStatement(int resultSetType, int resultSetConcurrency) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Statement createStatement(int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Struct createStruct(String typeName, Object[] attributes) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean getAutoCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String getCatalog() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Properties getClientInfo() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getClientInfo(String name) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public DatabaseMetaData getMetaData() throws SQLException { - DatabaseMetaData result = new DatabaseMetaDataMock(); - return result; - } - - @Override - public int getNetworkTimeout() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getSchema() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getTransactionIsolation() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public Map> getTypeMap() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public SQLWarning getWarnings() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean isClosed() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isReadOnly() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isValid(int timeout) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public String nativeSQL(String sql) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public CallableStatement prepareCall(String sql) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public CallableStatement prepareCall(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public PreparedStatement prepareStatement(String sql) throws SQLException { - return new PreparedStatementMock(this, sql); - } - - @Override - public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public PreparedStatement prepareStatement(String sql, int[] columnIndexes) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public PreparedStatement prepareStatement(String sql, String[] columnNames) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public PreparedStatement prepareStatement(String sql, int resultSetType, - int resultSetConcurrency, int resultSetHoldability) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void releaseSavepoint(Savepoint savepoint) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void rollback() throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void rollback(Savepoint savepoint) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setAutoCommit(boolean autoCommit) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setCatalog(String catalog) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setClientInfo(Properties properties) - throws SQLClientInfoException { - // TODO Auto-generated method stub - - } - - @Override - public void setClientInfo(String name, String value) - throws SQLClientInfoException { - // TODO Auto-generated method stub - - } - - @Override - public void setHoldability(int holdability) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setNetworkTimeout(Executor executor, int milliseconds) - throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setReadOnly(boolean readOnly) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public Savepoint setSavepoint() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Savepoint setSavepoint(String name) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public void setSchema(String schema) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTransactionIsolation(int level) throws SQLException { - // TODO Auto-generated method stub - - } - - @Override - public void setTypeMap(Map> map) throws SQLException { - // TODO Auto-generated method stub - - } - -} - diff --git a/src/test/java/net/jaekl/squelch/db/DatabaseMetaDataMock.java b/src/test/java/net/jaekl/squelch/db/DatabaseMetaDataMock.java deleted file mode 100644 index 8f9abcd..0000000 --- a/src/test/java/net/jaekl/squelch/db/DatabaseMetaDataMock.java +++ /dev/null @@ -1,1103 +0,0 @@ -package net.jaekl.squelch.db; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.ResultSet; -import java.sql.RowIdLifetime; -import java.sql.SQLException; - -import net.jaekl.squelch.db.ResultSetMock; - -public class DatabaseMetaDataMock implements DatabaseMetaData { - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public T unwrap(Class iface) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean allProceduresAreCallable() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean allTablesAreSelectable() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean autoCommitFailureClosesAllResultSets() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean dataDefinitionCausesTransactionCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean dataDefinitionIgnoredInTransactions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean deletesAreDetected(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean generatedKeyAlwaysReturned() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public ResultSet getAttributes(String catalog, String schemaPattern, - String typeNamePattern, String attributeNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getBestRowIdentifier(String catalog, String schema, - String table, int scope, boolean nullable) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getCatalogSeparator() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getCatalogTerm() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getCatalogs() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getClientInfoProperties() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getColumnPrivileges(String catalog, String schema, - String table, String columnNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public Connection getConnection() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getCrossReference(String parentCatalog, - String parentSchema, String parentTable, String foreignCatalog, - String foreignSchema, String foreignTable) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getDatabaseMajorVersion() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getDatabaseMinorVersion() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getDatabaseProductName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDatabaseProductVersion() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getDefaultTransactionIsolation() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getDriverMajorVersion() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getDriverMinorVersion() { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getDriverName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getDriverVersion() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getExportedKeys(String catalog, String schema, String table) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getExtraNameCharacters() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getFunctionColumns(String catalog, String schemaPattern, - String functionNamePattern, String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getFunctions(String catalog, String schemaPattern, - String functionNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getIdentifierQuoteString() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getImportedKeys(String catalog, String schema, String table) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getIndexInfo(String catalog, String schema, String table, - boolean unique, boolean approximate) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getJDBCMajorVersion() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getJDBCMinorVersion() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxBinaryLiteralLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxCatalogNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxCharLiteralLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInGroupBy() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInIndex() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInOrderBy() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInSelect() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxColumnsInTable() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxConnections() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxCursorNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxIndexLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxProcedureNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxRowSize() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxSchemaNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxStatementLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxStatements() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxTableNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxTablesInSelect() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public int getMaxUserNameLength() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getNumericFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getPrimaryKeys(String catalog, String schema, String table) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getProcedureColumns(String catalog, String schemaPattern, - String procedureNamePattern, String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getProcedureTerm() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getProcedures(String catalog, String schemaPattern, - String procedureNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getPseudoColumns(String catalog, String schemaPattern, - String tableNamePattern, String columnNamePattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getResultSetHoldability() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public RowIdLifetime getRowIdLifetime() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSQLKeywords() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public int getSQLStateType() throws SQLException { - // TODO Auto-generated method stub - return 0; - } - - @Override - public String getSchemaTerm() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSchemas() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSchemas(String catalog, String schemaPattern) - throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSearchStringEscape() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getStringFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSuperTables(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getSuperTypes(String catalog, String schemaPattern, - String typeNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getSystemFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTablePrivileges(String catalog, String schemaPattern, - String tableNamePattern) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTableTypes() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) - throws SQLException - { - ResultSetMock result = new ResultSetMock(); - return result; - } - - @Override - public String getTimeDateFunctions() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getTypeInfo() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getUDTs(String catalog, String schemaPattern, - String typeNamePattern, int[] types) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getURL() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public String getUserName() throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public ResultSet getVersionColumns(String catalog, String schema, - String table) throws SQLException { - // TODO Auto-generated method stub - return null; - } - - @Override - public boolean insertsAreDetected(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isCatalogAtStart() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean isReadOnly() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean locatorsUpdateCopy() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullPlusNonNullIsNull() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedAtEnd() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedAtStart() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedHigh() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean nullsAreSortedLow() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean othersDeletesAreVisible(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean othersInsertsAreVisible(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean othersUpdatesAreVisible(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean ownDeletesAreVisible(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean ownInsertsAreVisible(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean ownUpdatesAreVisible(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesLowerCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesMixedCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesUpperCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsANSI92EntryLevelSQL() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsANSI92FullSQL() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsANSI92IntermediateSQL() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsAlterTableWithAddColumn() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsAlterTableWithDropColumn() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsBatchUpdates() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInDataManipulation() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInIndexDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInProcedureCalls() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCatalogsInTableDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsColumnAliasing() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsConvert() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsConvert(int fromType, int toType) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCoreSQLGrammar() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsCorrelatedSubqueries() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsDataDefinitionAndDataManipulationTransactions() - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsDataManipulationTransactionsOnly() - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsDifferentTableCorrelationNames() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsExpressionsInOrderBy() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsExtendedSQLGrammar() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsFullOuterJoins() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGetGeneratedKeys() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGroupBy() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGroupByBeyondSelect() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsGroupByUnrelated() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsIntegrityEnhancementFacility() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsLikeEscapeClause() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsLimitedOuterJoins() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMinimumSQLGrammar() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMixedCaseIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMultipleOpenResults() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMultipleResultSets() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsMultipleTransactions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsNamedParameters() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsNonNullableColumns() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenCursorsAcrossCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenCursorsAcrossRollback() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenStatementsAcrossCommit() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOpenStatementsAcrossRollback() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOrderByUnrelated() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsOuterJoins() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsPositionedDelete() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsPositionedUpdate() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsResultSetConcurrency(int type, int concurrency) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsResultSetHoldability(int holdability) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsResultSetType(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSavepoints() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInDataManipulation() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInIndexDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInProcedureCalls() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSchemasInTableDefinitions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSelectForUpdate() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsStatementPooling() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsStoredProcedures() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInComparisons() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInExists() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInIns() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsSubqueriesInQuantifieds() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsTableCorrelationNames() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsTransactionIsolationLevel(int level) - throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsTransactions() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsUnion() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean supportsUnionAll() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean updatesAreDetected(int type) throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean usesLocalFilePerTable() throws SQLException { - // TODO Auto-generated method stub - return false; - } - - @Override - public boolean usesLocalFiles() throws SQLException { - // TODO Auto-generated method stub - return false; - } - -} diff --git a/src/test/java/net/jaekl/squelch/db/PreparedStatementMock.java b/src/test/java/net/jaekl/squelch/db/PreparedStatementMock.java deleted file mode 100644 index 9967728..0000000 --- a/src/test/java/net/jaekl/squelch/db/PreparedStatementMock.java +++ /dev/null @@ -1,656 +0,0 @@ -package net.jaekl.squelch.db; - -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 m_args; - private boolean m_closed; - private ConnectionMock m_conn; - private String m_sql; - - public PreparedStatementMock(ConnectionMock conn, String sql) - { - m_args = new ArrayList(); - 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 unwrap(Class 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"); - - } - -} diff --git a/src/test/java/net/jaekl/squelch/db/ResultSetMetaDataMock.java b/src/test/java/net/jaekl/squelch/db/ResultSetMetaDataMock.java deleted file mode 100644 index f1969ec..0000000 --- a/src/test/java/net/jaekl/squelch/db/ResultSetMetaDataMock.java +++ /dev/null @@ -1,153 +0,0 @@ -package net.jaekl.squelch.db; - -import java.sql.ResultSetMetaData; -import java.sql.SQLException; - -import net.jaekl.squelch.sql.Column; - -public class ResultSetMetaDataMock implements ResultSetMetaData { - private Column[] m_cols; - - public ResultSetMetaDataMock() - { - m_cols = new Column[0]; - } - - @Override - public boolean isWrapperFor(Class arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public T unwrap(Class arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getCatalogName(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getColumnClassName(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getColumnCount() throws SQLException { - return m_cols.length; - } - - @Override - public int getColumnDisplaySize(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getColumnLabel(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getColumnName(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getColumnType(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getColumnTypeName(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getPrecision(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getScale(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getSchemaName(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getTableName(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isAutoIncrement(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isCaseSensitive(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isCurrency(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isDefinitelyWritable(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int isNullable(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isReadOnly(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isSearchable(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isSigned(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isWritable(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - -} diff --git a/src/test/java/net/jaekl/squelch/db/ResultSetMock.java b/src/test/java/net/jaekl/squelch/db/ResultSetMock.java deleted file mode 100644 index 5c7be5d..0000000 --- a/src/test/java/net/jaekl/squelch/db/ResultSetMock.java +++ /dev/null @@ -1,1214 +0,0 @@ -package net.jaekl.squelch.db; - -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.Date; -import java.sql.NClob; -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.Statement; -import java.sql.Time; -import java.sql.Timestamp; -import java.util.Calendar; -import java.util.Map; - -public class ResultSetMock implements ResultSet { - private ResultSetMetaDataMock m_metaDataMock; - - public ResultSetMock() { - m_metaDataMock = new ResultSetMetaDataMock(); - } - - @Override - public boolean isWrapperFor(Class iface) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public T unwrap(Class iface) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean absolute(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void afterLast() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void beforeFirst() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void cancelRowUpdates() 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 { - // no-op - } - - @Override - public void deleteRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int findColumn(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean first() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Array getArray(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Array getArray(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public InputStream getAsciiStream(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public InputStream getAsciiStream(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public BigDecimal getBigDecimal(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public BigDecimal getBigDecimal(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Deprecated - @Override - public BigDecimal getBigDecimal(int arg0, int arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Deprecated - @Override - public BigDecimal getBigDecimal(String arg0, int arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public InputStream getBinaryStream(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public InputStream getBinaryStream(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Blob getBlob(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Blob getBlob(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean getBoolean(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean getBoolean(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public byte getByte(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public byte getByte(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public byte[] getBytes(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public byte[] getBytes(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Reader getCharacterStream(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Reader getCharacterStream(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Clob getClob(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Clob getClob(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getConcurrency() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getCursorName() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Date getDate(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Date getDate(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Date getDate(int arg0, Calendar arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Date getDate(String arg0, Calendar arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public double getDouble(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public double getDouble(String arg0) 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 float getFloat(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public float getFloat(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getHoldability() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getInt(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getInt(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public long getLong(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public long getLong(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public ResultSetMetaData getMetaData() throws SQLException { - return m_metaDataMock; - } - - @Override - public Reader getNCharacterStream(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Reader getNCharacterStream(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public NClob getNClob(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public NClob getNClob(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getNString(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getNString(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Object getObject(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Object getObject(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Object getObject(int arg0, Map> arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Object getObject(String arg0, Map> arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public T getObject(int arg0, Class arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public T getObject(String arg0, Class arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Ref getRef(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Ref getRef(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public RowId getRowId(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public RowId getRowId(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public SQLXML getSQLXML(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public SQLXML getSQLXML(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public short getShort(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public short getShort(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Statement getStatement() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getString(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public String getString(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Time getTime(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Time getTime(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Time getTime(int arg0, Calendar arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Time getTime(String arg0, Calendar arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Timestamp getTimestamp(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Timestamp getTimestamp(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Timestamp getTimestamp(int arg0, Calendar arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public Timestamp getTimestamp(String arg0, Calendar arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public int getType() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public URL getURL(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public URL getURL(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Deprecated - @Override - public InputStream getUnicodeStream(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Deprecated - @Override - public InputStream getUnicodeStream(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public SQLWarning getWarnings() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void insertRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isAfterLast() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isBeforeFirst() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isClosed() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isFirst() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean isLast() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean last() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void moveToCurrentRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void moveToInsertRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean next() throws SQLException { - return false; - } - - @Override - public boolean previous() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void refreshRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean relative(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean rowDeleted() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean rowInserted() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean rowUpdated() 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 updateArray(int arg0, Array arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateArray(String arg0, Array arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateAsciiStream(int arg0, InputStream arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateAsciiStream(String arg0, InputStream arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateAsciiStream(int arg0, InputStream arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateAsciiStream(String arg0, InputStream arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateAsciiStream(int arg0, InputStream arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateAsciiStream(String arg0, InputStream arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBigDecimal(int arg0, BigDecimal arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBigDecimal(String arg0, BigDecimal arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBinaryStream(int arg0, InputStream arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBinaryStream(String arg0, InputStream arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBinaryStream(int arg0, InputStream arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBinaryStream(String arg0, InputStream arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBinaryStream(int arg0, InputStream arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBinaryStream(String arg0, InputStream arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBlob(int arg0, Blob arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBlob(String arg0, Blob arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBlob(int arg0, InputStream arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBlob(String arg0, InputStream arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBlob(int arg0, InputStream arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBlob(String arg0, InputStream arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBoolean(int arg0, boolean arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBoolean(String arg0, boolean arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateByte(int arg0, byte arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateByte(String arg0, byte arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBytes(int arg0, byte[] arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateBytes(String arg0, byte[] arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateCharacterStream(int arg0, Reader arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateCharacterStream(String arg0, Reader arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateCharacterStream(int arg0, Reader arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateCharacterStream(String arg0, Reader arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateCharacterStream(int arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateCharacterStream(String arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateClob(int arg0, Clob arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateClob(String arg0, Clob arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateClob(int arg0, Reader arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateClob(String arg0, Reader arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateClob(int arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateClob(String arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateDate(int arg0, Date arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateDate(String arg0, Date arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateDouble(int arg0, double arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateDouble(String arg0, double arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateFloat(int arg0, float arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateFloat(String arg0, float arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateInt(int arg0, int arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateInt(String arg0, int arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateLong(int arg0, long arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateLong(String arg0, long arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNCharacterStream(int arg0, Reader arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNCharacterStream(String arg0, Reader arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNCharacterStream(int arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNCharacterStream(String arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNClob(int arg0, NClob arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNClob(String arg0, NClob arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNClob(int arg0, Reader arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNClob(String arg0, Reader arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNClob(int arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNClob(String arg0, Reader arg1, long arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNString(int arg0, String arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNString(String arg0, String arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNull(int arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateNull(String arg0) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateObject(int arg0, Object arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateObject(String arg0, Object arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateObject(int arg0, Object arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateObject(String arg0, Object arg1, int arg2) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateRef(int arg0, Ref arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateRef(String arg0, Ref arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateRow() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateRowId(int arg0, RowId arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateRowId(String arg0, RowId arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateShort(int arg0, short arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateShort(String arg0, short arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateString(int arg0, String arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateString(String arg0, String arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateTime(int arg0, Time arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateTime(String arg0, Time arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateTimestamp(int arg0, Timestamp arg1) throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public void updateTimestamp(String arg0, Timestamp arg1) - throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - - @Override - public boolean wasNull() throws SQLException { - throw new UnsupportedOperationException("Not yet implemented."); - - } - -} diff --git a/src/test/java/net/jaekl/squelch/sql/ConnectionMock.java b/src/test/java/net/jaekl/squelch/sql/ConnectionMock.java new file mode 100644 index 0000000..22b686f --- /dev/null +++ b/src/test/java/net/jaekl/squelch/sql/ConnectionMock.java @@ -0,0 +1,384 @@ +package net.jaekl.squelch.sql; + +import java.sql.Array; +import java.sql.Blob; +import java.sql.CallableStatement; +import java.sql.Clob; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.NClob; +import java.sql.PreparedStatement; +import java.sql.SQLClientInfoException; +import java.sql.SQLException; +import java.sql.SQLWarning; +import java.sql.SQLXML; +import java.sql.Savepoint; +import java.sql.Statement; +import java.sql.Struct; +import java.util.ArrayList; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Executor; + + +public class ConnectionMock implements Connection { + private ArrayList m_executedQueries; + + public ConnectionMock() { + m_executedQueries = new ArrayList(); + } + + public ResultSetMock mock_executeQuery(PreparedStatementMock psm) + { + m_executedQueries.add(psm.toString()); + return new ResultSetMock(); + } + + public boolean mock_queryWasExecuted(String sql) { + // There's an assumption here that we don't try a large number of queries in a single test. + // If that assumption is false, then we should change this to be more efficient. + return m_executedQueries.contains(sql); + } + + @Override + public boolean isWrapperFor(Class arg0) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public T unwrap(Class arg0) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void abort(Executor executor) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void clearWarnings() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void close() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void commit() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public Array createArrayOf(String typeName, Object[] elements) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Blob createBlob() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Clob createClob() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public NClob createNClob() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public SQLXML createSQLXML() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Statement createStatement() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Statement createStatement(int resultSetType, int resultSetConcurrency) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Statement createStatement(int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Struct createStruct(String typeName, Object[] attributes) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean getAutoCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getCatalog() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Properties getClientInfo() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getClientInfo(String name) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getHoldability() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public DatabaseMetaData getMetaData() throws SQLException { + DatabaseMetaData result = new DatabaseMetaDataMock(); + return result; + } + + @Override + public int getNetworkTimeout() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getSchema() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getTransactionIsolation() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Map> getTypeMap() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public SQLWarning getWarnings() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isClosed() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isReadOnly() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isValid(int timeout) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public String nativeSQL(String sql) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallableStatement prepareCall(String sql) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public CallableStatement prepareCall(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql) throws SQLException { + return new PreparedStatementMock(this, sql); + } + + @Override + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, String[] columnNames) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public PreparedStatement prepareStatement(String sql, int resultSetType, + int resultSetConcurrency, int resultSetHoldability) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void releaseSavepoint(Savepoint savepoint) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void rollback() throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void rollback(Savepoint savepoint) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setAutoCommit(boolean autoCommit) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setCatalog(String catalog) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setClientInfo(Properties properties) + throws SQLClientInfoException { + // TODO Auto-generated method stub + + } + + @Override + public void setClientInfo(String name, String value) + throws SQLClientInfoException { + // TODO Auto-generated method stub + + } + + @Override + public void setHoldability(int holdability) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setNetworkTimeout(Executor executor, int milliseconds) + throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setReadOnly(boolean readOnly) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public Savepoint setSavepoint() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Savepoint setSavepoint(String name) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setSchema(String schema) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTransactionIsolation(int level) throws SQLException { + // TODO Auto-generated method stub + + } + + @Override + public void setTypeMap(Map> map) throws SQLException { + // TODO Auto-generated method stub + + } + +} + diff --git a/src/test/java/net/jaekl/squelch/sql/DatabaseMetaDataMock.java b/src/test/java/net/jaekl/squelch/sql/DatabaseMetaDataMock.java new file mode 100644 index 0000000..b8ecded --- /dev/null +++ b/src/test/java/net/jaekl/squelch/sql/DatabaseMetaDataMock.java @@ -0,0 +1,1102 @@ +package net.jaekl.squelch.sql; + +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.RowIdLifetime; +import java.sql.SQLException; + + +public class DatabaseMetaDataMock implements DatabaseMetaData { + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public T unwrap(Class iface) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean allProceduresAreCallable() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean allTablesAreSelectable() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean autoCommitFailureClosesAllResultSets() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean dataDefinitionCausesTransactionCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean dataDefinitionIgnoredInTransactions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deletesAreDetected(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean generatedKeyAlwaysReturned() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public ResultSet getAttributes(String catalog, String schemaPattern, + String typeNamePattern, String attributeNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getBestRowIdentifier(String catalog, String schema, + String table, int scope, boolean nullable) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCatalogSeparator() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCatalogTerm() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getCatalogs() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getClientInfoProperties() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getColumnPrivileges(String catalog, String schema, + String table, String columnNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getColumns(String catalog, String schemaPattern, + String tableNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Connection getConnection() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getCrossReference(String parentCatalog, + String parentSchema, String parentTable, String foreignCatalog, + String foreignSchema, String foreignTable) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getDatabaseMajorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDatabaseMinorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getDatabaseProductName() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDatabaseProductVersion() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getDefaultTransactionIsolation() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDriverMajorVersion() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getDriverMinorVersion() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getDriverName() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDriverVersion() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getExportedKeys(String catalog, String schema, String table) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getExtraNameCharacters() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getFunctionColumns(String catalog, String schemaPattern, + String functionNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getFunctions(String catalog, String schemaPattern, + String functionNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getIdentifierQuoteString() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getImportedKeys(String catalog, String schema, String table) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getIndexInfo(String catalog, String schema, String table, + boolean unique, boolean approximate) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getJDBCMajorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getJDBCMinorVersion() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxBinaryLiteralLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxCatalogNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxCharLiteralLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInGroupBy() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInIndex() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInOrderBy() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInSelect() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxColumnsInTable() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxConnections() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxCursorNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxIndexLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxProcedureNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxRowSize() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxSchemaNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxStatementLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxStatements() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxTableNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxTablesInSelect() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getMaxUserNameLength() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getNumericFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getPrimaryKeys(String catalog, String schema, String table) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getProcedureColumns(String catalog, String schemaPattern, + String procedureNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getProcedureTerm() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getProcedures(String catalog, String schemaPattern, + String procedureNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getPseudoColumns(String catalog, String schemaPattern, + String tableNamePattern, String columnNamePattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getResultSetHoldability() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public RowIdLifetime getRowIdLifetime() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getSQLKeywords() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getSQLStateType() throws SQLException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getSchemaTerm() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSchemas() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSchemas(String catalog, String schemaPattern) + throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getSearchStringEscape() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getStringFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSuperTables(String catalog, String schemaPattern, + String tableNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getSuperTypes(String catalog, String schemaPattern, + String typeNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getSystemFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTablePrivileges(String catalog, String schemaPattern, + String tableNamePattern) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTableTypes() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) + throws SQLException + { + ResultSetMock result = new ResultSetMock(); + return result; + } + + @Override + public String getTimeDateFunctions() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getTypeInfo() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getUDTs(String catalog, String schemaPattern, + String typeNamePattern, int[] types) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getURL() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getUserName() throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public ResultSet getVersionColumns(String catalog, String schema, + String table) throws SQLException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean insertsAreDetected(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isCatalogAtStart() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isReadOnly() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean locatorsUpdateCopy() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullPlusNonNullIsNull() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedAtEnd() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedAtStart() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedHigh() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean nullsAreSortedLow() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean othersDeletesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean othersInsertsAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean othersUpdatesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean ownDeletesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean ownInsertsAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean ownUpdatesAreVisible(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesLowerCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesMixedCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesUpperCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsANSI92EntryLevelSQL() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsANSI92FullSQL() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsANSI92IntermediateSQL() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsAlterTableWithAddColumn() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsAlterTableWithDropColumn() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsBatchUpdates() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInDataManipulation() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInIndexDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInPrivilegeDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInProcedureCalls() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCatalogsInTableDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsColumnAliasing() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsConvert() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsConvert(int fromType, int toType) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCoreSQLGrammar() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsCorrelatedSubqueries() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsDataDefinitionAndDataManipulationTransactions() + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsDataManipulationTransactionsOnly() + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsDifferentTableCorrelationNames() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsExpressionsInOrderBy() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsExtendedSQLGrammar() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsFullOuterJoins() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGetGeneratedKeys() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGroupBy() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGroupByBeyondSelect() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsGroupByUnrelated() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsIntegrityEnhancementFacility() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsLikeEscapeClause() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsLimitedOuterJoins() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMinimumSQLGrammar() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMixedCaseIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMultipleOpenResults() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMultipleResultSets() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsMultipleTransactions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsNamedParameters() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsNonNullableColumns() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenCursorsAcrossCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenCursorsAcrossRollback() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenStatementsAcrossCommit() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOpenStatementsAcrossRollback() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOrderByUnrelated() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsOuterJoins() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsPositionedDelete() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsPositionedUpdate() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsResultSetConcurrency(int type, int concurrency) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsResultSetHoldability(int holdability) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsResultSetType(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSavepoints() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInDataManipulation() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInIndexDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInPrivilegeDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInProcedureCalls() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSchemasInTableDefinitions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSelectForUpdate() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsStatementPooling() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsStoredFunctionsUsingCallSyntax() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsStoredProcedures() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInComparisons() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInExists() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInIns() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsSubqueriesInQuantifieds() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsTableCorrelationNames() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsTransactionIsolationLevel(int level) + throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsTransactions() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsUnion() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean supportsUnionAll() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean updatesAreDetected(int type) throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean usesLocalFilePerTable() throws SQLException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean usesLocalFiles() throws SQLException { + // TODO Auto-generated method stub + return false; + } + +} 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 index 0000000..c4c33a2 --- /dev/null +++ b/src/test/java/net/jaekl/squelch/sql/PreparedStatementMock.java @@ -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 m_args; + private boolean m_closed; + private ConnectionMock m_conn; + private String m_sql; + + public PreparedStatementMock(ConnectionMock conn, String sql) + { + m_args = new ArrayList(); + 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 unwrap(Class 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"); + + } + +} diff --git a/src/test/java/net/jaekl/squelch/sql/ResultSetMetaDataMock.java b/src/test/java/net/jaekl/squelch/sql/ResultSetMetaDataMock.java new file mode 100644 index 0000000..402aabb --- /dev/null +++ b/src/test/java/net/jaekl/squelch/sql/ResultSetMetaDataMock.java @@ -0,0 +1,153 @@ +package net.jaekl.squelch.sql; + +import java.sql.ResultSetMetaData; +import java.sql.SQLException; + +import net.jaekl.squelch.sql.Column; + +public class ResultSetMetaDataMock implements ResultSetMetaData { + private Column[] m_cols; + + public ResultSetMetaDataMock() + { + m_cols = new Column[0]; + } + + @Override + public boolean isWrapperFor(Class arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T unwrap(Class arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getCatalogName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnClassName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getColumnCount() throws SQLException { + return m_cols.length; + } + + @Override + public int getColumnDisplaySize(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnLabel(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getColumnType(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getColumnTypeName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getPrecision(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getScale(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getSchemaName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getTableName(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isAutoIncrement(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isCaseSensitive(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isCurrency(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isDefinitelyWritable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int isNullable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isReadOnly(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isSearchable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isSigned(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isWritable(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + +} diff --git a/src/test/java/net/jaekl/squelch/sql/ResultSetMock.java b/src/test/java/net/jaekl/squelch/sql/ResultSetMock.java new file mode 100644 index 0000000..b398e24 --- /dev/null +++ b/src/test/java/net/jaekl/squelch/sql/ResultSetMock.java @@ -0,0 +1,1224 @@ +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.Date; +import java.sql.NClob; +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.Statement; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Map; + + +public class ResultSetMock implements ResultSet { + private ResultSetMetaDataMock m_metaDataMock; + private ArrayList m_rows; + private int m_rowNum; + + public ResultSetMock() { + m_metaDataMock = new ResultSetMetaDataMock(); + m_rows = new ArrayList(); + m_rowNum = -1; + } + + public void mock_addRow(Row row) { + m_rows.add(row); + } + + @Override + public boolean isWrapperFor(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T unwrap(Class iface) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean absolute(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void afterLast() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void beforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void cancelRowUpdates() 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 { + // no-op + } + + @Override + public void deleteRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int findColumn(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean first() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Array getArray(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Array getArray(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getAsciiStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getAsciiStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public BigDecimal getBigDecimal(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public BigDecimal getBigDecimal(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public BigDecimal getBigDecimal(int arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public BigDecimal getBigDecimal(String arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getBinaryStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public InputStream getBinaryStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Blob getBlob(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Blob getBlob(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean getBoolean(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean getBoolean(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte getByte(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte getByte(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte[] getBytes(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public byte[] getBytes(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Reader getCharacterStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Reader getCharacterStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Clob getClob(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Clob getClob(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getConcurrency() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getCursorName() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(int arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Date getDate(String arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public double getDouble(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public double getDouble(String arg0) 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 float getFloat(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public float getFloat(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getHoldability() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getInt(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getInt(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public long getLong(int idx) throws SQLException { + Row row = m_rows.get(m_rowNum); + return (Long)(row.getValue(idx)); + } + + @Override + public long getLong(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public ResultSetMetaData getMetaData() throws SQLException { + return m_metaDataMock; + } + + @Override + public Reader getNCharacterStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Reader getNCharacterStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public NClob getNClob(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public NClob getNClob(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getNString(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getNString(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(int idx) throws SQLException { + Row row = m_rows.get(m_rowNum); + return row.getValue(idx); + } + + @Override + public Object getObject(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(int arg0, Map> arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Object getObject(String arg0, Map> arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T getObject(int arg0, Class arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public T getObject(String arg0, Class arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Ref getRef(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Ref getRef(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public RowId getRowId(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public RowId getRowId(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public SQLXML getSQLXML(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public SQLXML getSQLXML(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public short getShort(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public short getShort(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Statement getStatement() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public String getString(int idx) throws SQLException { + Row row = m_rows.get(m_rowNum); + return (String)(row.getValue(idx)); + } + + @Override + public String getString(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(int idx) throws SQLException { + Row row = m_rows.get(m_rowNum); + return new Time(((java.util.Date)row.getValue(idx)).getTime()); + } + + @Override + public Time getTime(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(int arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Time getTime(String arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(int arg0, Calendar arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public Timestamp getTimestamp(String arg0, Calendar arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public int getType() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public URL getURL(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public URL getURL(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public InputStream getUnicodeStream(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Deprecated + @Override + public InputStream getUnicodeStream(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public SQLWarning getWarnings() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void insertRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isAfterLast() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isBeforeFirst() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isClosed() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isFirst() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean isLast() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean last() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void moveToCurrentRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void moveToInsertRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean next() throws SQLException { + return false; + } + + @Override + public boolean previous() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void refreshRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean relative(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean rowDeleted() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean rowInserted() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean rowUpdated() 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 updateArray(int arg0, Array arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateArray(String arg0, Array arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(int arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(String arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(String arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateAsciiStream(String arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBigDecimal(int arg0, BigDecimal arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBigDecimal(String arg0, BigDecimal arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(int arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(String arg0, InputStream arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(int arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(String arg0, InputStream arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBinaryStream(String arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(int arg0, Blob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(String arg0, Blob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(int arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(String arg0, InputStream arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(int arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBlob(String arg0, InputStream arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBoolean(int arg0, boolean arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBoolean(String arg0, boolean arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateByte(int arg0, byte arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateByte(String arg0, byte arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBytes(int arg0, byte[] arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateBytes(String arg0, byte[] arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(int arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(String arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(int arg0, Reader arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(String arg0, Reader arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateCharacterStream(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(int arg0, Clob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(String arg0, Clob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(String arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateClob(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDate(int arg0, Date arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDate(String arg0, Date arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDouble(int arg0, double arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateDouble(String arg0, double arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateFloat(int arg0, float arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateFloat(String arg0, float arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateInt(int arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateInt(String arg0, int arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateLong(int arg0, long arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateLong(String arg0, long arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(int arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(String arg0, Reader arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNCharacterStream(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(int arg0, NClob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(String arg0, NClob arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(int arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(String arg0, Reader arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(int arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNClob(String arg0, Reader arg1, long arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNString(int arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNString(String arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNull(int arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateNull(String arg0) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(int arg0, Object arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(String arg0, Object arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(int arg0, Object arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateObject(String arg0, Object arg1, int arg2) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRef(int arg0, Ref arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRef(String arg0, Ref arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRow() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRowId(int arg0, RowId arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateRowId(String arg0, RowId arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateShort(int arg0, short arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateShort(String arg0, short arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateString(int arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateString(String arg0, String arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTime(int arg0, Time arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTime(String arg0, Time arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTimestamp(int arg0, Timestamp arg1) throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public void updateTimestamp(String arg0, Timestamp arg1) + throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + + @Override + public boolean wasNull() throws SQLException { + throw new UnsupportedOperationException("Not yet implemented."); + + } + +} diff --git a/src/test/java/net/jaekl/squelch/stmt/TabularTest.java b/src/test/java/net/jaekl/squelch/stmt/TabularTest.java new file mode 100644 index 0000000..6b5462d --- /dev/null +++ b/src/test/java/net/jaekl/squelch/stmt/TabularTest.java @@ -0,0 +1,94 @@ +package net.jaekl.squelch.stmt; + +import static org.junit.Assert.*; + +import java.sql.SQLException; +import java.sql.Types; + +import net.jaekl.squelch.sql.Column; +import net.jaekl.squelch.sql.Row; + +import org.junit.Test; + +public class TabularTest { + private static class TabularMock extends Tabular { + @Override + Column[] getCols() throws SQLException { + return null; + } + + @Override + Row getNext() { + return null; + } + } + + @Test + public void test_classForSqlType() { + Object[][] data = { + { Types.ARRAY, Object.class }, + { Types.BIGINT, Object.class }, + { Types.BINARY, Object.class }, + { Types.BIT, Object.class }, + { Types.BLOB, Object.class }, + { Types.BOOLEAN, Boolean.class }, + { Types.CHAR, Character.class }, + { Types.CLOB, Object.class }, + { Types.DATALINK, Object.class }, + { Types.DATE, java.util.Date.class }, + { Types.DECIMAL, Double.class }, + { Types.DISTINCT, Object.class }, + { Types.DOUBLE, Double.class }, + { Types.FLOAT, Double.class }, + { Types.INTEGER, Long.class }, + { Types.JAVA_OBJECT, Object.class }, + { Types.LONGNVARCHAR, String.class }, + { Types.LONGVARBINARY, Object.class }, + { Types.NCHAR, String.class }, + { Types.NCLOB, Object.class }, + { Types.NULL, Object.class }, + { Types.NUMERIC, Double.class }, + { Types.NVARCHAR, String.class }, + { Types.OTHER, Object.class }, + { Types.REAL, Double.class }, + { Types.REF, Object.class }, + { Types.ROWID, Integer.class }, + { Types.SMALLINT, Integer.class }, + { Types.SQLXML, Object.class }, + { Types.STRUCT, Object.class }, + { Types.TIME, java.util.Date.class }, + { Types.TIMESTAMP, java.util.Date.class }, + { Types.TINYINT, Short.class }, + { Types.VARBINARY, Object.class }, + { Types.VARCHAR, String.class } + }; + Tabular tabular = new TabularMock(); + + for (Object[] datum : data) { + Class expected = (Class)datum[1]; + Class actual = tabular.classForSqlType((int) datum[0]); + assertEquals(expected, actual); + } + } + + @Test + public void test_repChar() { + Tabular tabular = new TabularMock(); + + assertEquals("", tabular.repChar(' ', 0)); + assertEquals(" ", tabular.repChar(' ', 4)); + assertEquals("###", tabular.repChar('#', 3)); + assertEquals("------", tabular.repChar('-', 6)); + } + + @Test + public void test_centrePad() { + Tabular tabular = new TabularMock(); + + assertEquals("Vestibule", tabular.centrePad("Vestibule", 2)); + assertEquals(" Fred ", tabular.centrePad("Fred", 8)); + assertEquals("NULL", tabular.centrePad(null, 0)); + assertEquals(" NULL ", tabular.centrePad(null, 8)); + assertEquals(" Wilma ", tabular.centrePad("Wilma", 12)); + } +}