From: Jeff M. <je...@mk...> - 2002-07-08 09:37:37
|
Scott could you do me a favor and change this to use the MockObject notImplemented() method rather than UnsupportedOperationException then I'll happily commit this. On Tue, 2002-07-02 at 17:22, Scott Lamb wrote: > First, thanks Jeff for adding the SQL stuff for JDK 1.4. I know I said I > would look at that...argh. Thanks. > > The attached patch adds a MockDatabaseMetaData class and setup in > CommonMockConnection to attach it. I'm testing some code that determines > what SQL to give to the database based on the driver name. That's the > only method implemented in the class so far. > > -- > Scott Lamb > ---- > > diff -Nru --exclude=CVS mockobjects-java.clean/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java > --- mockobjects-java.clean/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java Fri Jun 28 12:35:39 2002 > +++ mockobjects-java/src/jdk/common/com/mockobjects/sql/CommonMockConnection.java Tue Jul 2 01:22:25 2002 > @@ -17,6 +17,7 @@ > private ExpectationCounter myCreateStatementCalls = new ExpectationCounter("CommonMockConnection.createStatement"); > private ExpectationValue myAutoCommit = new ExpectationValue("CommonMockConnection.setAutoCommit"); > private Statement myStatement; > + private DatabaseMetaData myMetaData; > > private boolean myIsClosed; > private SQLException myIsClosedException; > @@ -54,6 +55,10 @@ > myStatementException = exception; > } > > + public void setupMetaData(DatabaseMetaData metaData) { > + myMetaData = metaData; > + } > + > public void clearWarnings() throws SQLException { > notImplemented(); > } > @@ -99,8 +104,7 @@ > > public DatabaseMetaData getMetaData() > throws SQLException { > - notImplemented(); > - return null; > + return myMetaData; > } > > public int getTransactionIsolation() throws SQLException { > @@ -207,4 +211,4 @@ > throw myStatementException; > } > } > -} > \ No newline at end of file > +} > diff -Nru --exclude=CVS mockobjects-java.clean/src/jdk/common/com/mockobjects/sql/MockDatabaseMetaData.java mockobjects-java/src/jdk/common/com/mockobjects/sql/MockDatabaseMetaData.java > --- mockobjects-java.clean/src/jdk/common/com/mockobjects/sql/MockDatabaseMetaData.java Wed Dec 31 18:00:00 1969 > +++ mockobjects-java/src/jdk/common/com/mockobjects/sql/MockDatabaseMetaData.java Tue Jul 2 01:28:51 2002 > @@ -0,0 +1,701 @@ > +package com.mockobjects.sql; > + > +import java.sql.Connection; > +import java.sql.DatabaseMetaData; > +import java.sql.ResultSet; > +import java.sql.SQLException; > + > +public class MockDatabaseMetaData implements DatabaseMetaData { > + > + private String myDriverName; > + > + public void setupDriverName(String driverName) { > + myDriverName = driverName; > + } > + > + public boolean supportsANSI92FullSQL() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsANSI92EntryLevelSQL() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsStatementPooling() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsMixedCaseQuotedIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSubqueriesInComparisons() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsMultipleOpenResults() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getProcedures(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getSystemFunctions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsUnionAll() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getDatabaseMinorVersion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsResultSetConcurrency(int a0, int a1) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getCatalogs() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean usesLocalFilePerTable() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsResultSetHoldability(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getIndexInfo(String a0, String a1, String a2, boolean a3, > + boolean a4) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsExpressionsInOrderBy() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getDatabaseProductName() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsIntegrityEnhancementFacility() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxBinaryLiteralLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsLimitedOuterJoins() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean storesUpperCaseQuotedIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsMultipleResultSets() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsFullOuterJoins() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean ownDeletesAreVisible(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getPrimaryKeys(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxColumnsInIndex() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getExportedKeys(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean locatorsUpdateCopy() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getTables(String a0, String a1, String a2, String[] a3) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxColumnsInTable() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getDriverVersion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsBatchUpdates() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxTablesInSelect() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public Connection getConnection() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsNonNullableColumns() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxColumnsInOrderBy() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsOrderByUnrelated() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCatalogsInIndexDefinitions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getJDBCMajorVersion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getExtraNameCharacters() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean nullsAreSortedLow() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getAttributes(String a0, String a1, String a2, String a3) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean updatesAreDetected(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsDataManipulationTransactionsOnly() > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxConnections() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsOpenCursorsAcrossCommit() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getUDTs(String a0, String a1, String a2, int[] a3) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getTableTypes() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getResultSetHoldability() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean insertsAreDetected(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getSchemas() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxCatalogNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getDefaultTransactionIsolation() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getURL() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean usesLocalFiles() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsExtendedSQLGrammar() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSchemasInProcedureCalls() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getSuperTypes(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxStatements() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxCharLiteralLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsTransactionIsolationLevel(int a0) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsTableCorrelationNames() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getSearchStringEscape() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean deletesAreDetected(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsColumnAliasing() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean isReadOnly() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsLikeEscapeClause() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean storesLowerCaseIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean storesMixedCaseQuotedIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsMultipleTransactions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getProcedureTerm() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxStatementLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean nullPlusNonNullIsNull() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsGroupByBeyondSelect() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getDriverMajorVersion() { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCoreSQLGrammar() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsPositionedUpdate() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCatalogsInPrivilegeDefinitions() > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsGetGeneratedKeys() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getImportedKeys(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getIdentifierQuoteString() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getSuperTables(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean nullsAreSortedHigh() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getNumericFunctions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSchemasInIndexDefinitions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsGroupByUnrelated() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getTypeInfo() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsTransactions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsPositionedDelete() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxProcedureNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsOuterJoins() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsOpenCursorsAcrossRollback() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean storesMixedCaseIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getDatabaseMajorVersion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxColumnsInSelect() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean dataDefinitionIgnoredInTransactions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getCatalogTerm() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxRowSize() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getUserName() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean allProceduresAreCallable() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean nullsAreSortedAtStart() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean storesUpperCaseIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCatalogsInDataManipulation() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getBestRowIdentifier(String a0, String a1, String a2, > + int a3, boolean a4) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean storesLowerCaseQuotedIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean nullsAreSortedAtEnd() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getSQLKeywords() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getCrossReference(String a0, String a1, String a2, > + String a3, String a4, String a5) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean isCatalogAtStart() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsNamedParameters() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSubqueriesInIns() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getVersionColumns(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean othersInsertsAreVisible(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsANSI92IntermediateSQL() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCatalogsInTableDefinitions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getJDBCMinorVersion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getStringFunctions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsDataDefinitionAndDataManipulationTransactions() > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getColumnPrivileges(String a0, String a1, String a2, > + String a3) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean dataDefinitionCausesTransactionCommit() > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSubqueriesInExists() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxUserNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxIndexLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getDriverName() throws SQLException { > + return myDriverName; > + } > + > + public boolean othersUpdatesAreVisible(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSavepoints() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsMixedCaseIdentifiers() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getCatalogSeparator() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSchemasInPrivilegeDefinitions() > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxColumnsInGroupBy() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsDifferentTableCorrelationNames() > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSubqueriesInQuantifieds() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsResultSetType(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getDatabaseProductVersion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getSQLStateType() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSelectForUpdate() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxTableNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsUnion() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsOpenStatementsAcrossCommit() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getColumns(String a0, String a1, String a2, String a3) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsAlterTableWithDropColumn() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsStoredProcedures() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean othersDeletesAreVisible(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getSchemaTerm() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getDriverMinorVersion() { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxSchemaNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean doesMaxRowSizeIncludeBlobs() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getTablePrivileges(String a0, String a1, String a2) > + throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSchemasInDataManipulation() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxCursorNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsAlterTableWithAddColumn() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsOpenStatementsAcrossRollback() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public int getMaxColumnNameLength() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean ownInsertsAreVisible(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsGroupBy() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsConvert(int a0, int a1) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsConvert() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCorrelatedSubqueries() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public String getTimeDateFunctions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsSchemasInTableDefinitions() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsCatalogsInProcedureCalls() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean allTablesAreSelectable() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean supportsMinimumSQLGrammar() throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public boolean ownUpdatesAreVisible(int a0) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > + public ResultSet getProcedureColumns(String a0, String a1, String a2, > + String a3) throws SQLException { > + throw new UnsupportedOperationException(); > + } > + > +} -- jeff martin information technologist mkodo limited mobile: 44 (0) 78 5547 8331 phone: 44 (0) 20 2226 4545 email: je...@mk... www.mkodo.com |