Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.derbyTesting.functionTests.tests.jdbcapi
Class odbc_metadata  view odbc_metadata download odbc_metadata.java

java.lang.Object
  extended byorg.apache.derbyTesting.functionTests.tests.jdbcapi.metadata_test
      extended byorg.apache.derbyTesting.functionTests.tests.jdbcapi.odbc_metadata

public class odbc_metadata
extends metadata_test

Test of database metadata for ODBC clients. This test does everything that is done in "metadata.java" (which this class extends), except that it makes the metadata calls in such a way as to retrieve ODBC-compliant result sets. Unlike metadata.java, this test also does a (simple) check of the metadata result sets to see if they comply with the standards--in this case, with the ODBC 3.0 standard as defined at this URL: http://msdn.microsoft.com/library/default.asp?url=/library/ en-us/odbc/htm/odbcsqlprocedurecolumns.asp The ODBC standards verification involves checking the following for each column in each of the relevant metadata result sets: 1. Does the column name match what the spec says? 2. Does the column type match what the spec says? 3. Does the column nullability match what the spec says? If compliance failures occur in any of these ways, an ODBC non- compliance failure will be reported as part of the test output. Under no circumstances should a master file for this test contain an ODBC non-compliance message and still be considered as "passing".


Field Summary
private static java.lang.String[][] odbcComplianceTargets
           
 
Fields inherited from class org.apache.derbyTesting.functionTests.tests.jdbcapi.metadata_test
con, GET_BEST_ROW_IDENTIFIER, GET_COLUMN_PRIVILEGES, GET_COLUMNS, GET_CROSS_REFERENCE, GET_EXPORTED_KEYS, GET_IMPORTED_KEYS, GET_INDEX_INFO, GET_PRIMARY_KEYS, GET_PROCEDURE_COLUMNS, GET_PROCEDURES, GET_TABLE_PRIVILEGES, GET_TABLES, GET_TYPE_INFO, GET_VERSION_COLUMNS, IGNORE_PROC_ID, s
 
Constructor Summary
odbc_metadata(java.lang.String[] args)
          Constructor: Intializes the Connection and Statement fields to be used through the test, and then does the first-level check of ODBC compliance.
 
Method Summary
private static java.lang.String addQuotes(java.lang.String str)
           
protected  boolean badNullability(int odbcProc, java.lang.String colName, int colNum, boolean wasNull)
          Takes result set metadata and sees if the nullability of its columns match what ODBC 3.0 dictates.
protected  void checkODBCNamesAndTypes(java.sql.ResultSet rs, int procId)
          Takes result set metadata and sees if the names and types of its columns match what ODBC 3.0 dictates.
protected  void dumpRS(int procId, java.sql.ResultSet s)
          Dumps a result to output and, if procId is not -1, checks to see if the nullability of the result set values conforms to the ODBC 3.0 specification.
protected  java.sql.ResultSet getMetaDataRS(java.sql.DatabaseMetaData dmd, int procId, java.lang.String[] sArgs, java.lang.String[] argArray, int[] iArgs, boolean[] bArgs)
          This method is responsible for executing a metadata query and returning a result set that complies with the ODBC 3.0 specification.
protected  void loadODBCTargets()
          This is where we load the metadata result set schema that is specified in the ODBC 3.0 spec.
static void main(java.lang.String[] args)
          Makes a call to the "runTest" method in metadata_test.java, which will in turn call back here for implementations of the abstract methods.
protected  void verifyODBC3Compliance()
          This method tests to see if the result sets returned for ODBC clients do in fact comply with the ODBC 3.0 spec.
 
Methods inherited from class org.apache.derbyTesting.functionTests.tests.jdbcapi.metadata_test
createConnection, dumpRS, dumpSQLExceptions, runTest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

odbcComplianceTargets

private static java.lang.String[][] odbcComplianceTargets
Constructor Detail

odbc_metadata

public odbc_metadata(java.lang.String[] args)
Constructor: Intializes the Connection and Statement fields to be used through the test, and then does the first-level check of ODBC compliance.

Method Detail

main

public static void main(java.lang.String[] args)
Makes a call to the "runTest" method in metadata_test.java, which will in turn call back here for implementations of the abstract methods.


getMetaDataRS

protected java.sql.ResultSet getMetaDataRS(java.sql.DatabaseMetaData dmd,
                                           int procId,
                                           java.lang.String[] sArgs,
                                           java.lang.String[] argArray,
                                           int[] iArgs,
                                           boolean[] bArgs)
                                    throws java.sql.SQLException
This method is responsible for executing a metadata query and returning a result set that complies with the ODBC 3.0 specification.

Specified by:
getMetaDataRS in class metadata_test

dumpRS

protected void dumpRS(int procId,
                      java.sql.ResultSet s)
               throws java.sql.SQLException
Dumps a result to output and, if procId is not -1, checks to see if the nullability of the result set values conforms to the ODBC 3.0 specification.

Specified by:
dumpRS in class metadata_test

verifyODBC3Compliance

protected void verifyODBC3Compliance()
                              throws java.lang.Exception
This method tests to see if the result sets returned for ODBC clients do in fact comply with the ODBC 3.0 spec. That specification can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/ en-us/odbc/htm/odbcsqlprocedurecolumns.asp NOTE: This method only verifies the names and types of the columns. The nullability of the values is checked as part of the dumpRS() method.


loadODBCTargets

protected void loadODBCTargets()
This is where we load the metadata result set schema that is specified in the ODBC 3.0 spec. When we do validation of the ODBC result set, we will compare the actual results with the target values that we load here. Target lists consist of three strings for each column in the result set. The first string is the expected (ODBC 3.0) column name. The second string is the expected column type. The third string is the expected column nullability (null means that the column is nullable; any non-null String means that the column is NOT NULLABLE). The target values in this method come from the following URL: http://msdn.microsoft.com/library/default.asp?url=/library/ en-us/odbc/htm/odbcsqlprocedurecolumns.asp


checkODBCNamesAndTypes

protected void checkODBCNamesAndTypes(java.sql.ResultSet rs,
                                      int procId)
                               throws java.sql.SQLException
Takes result set metadata and sees if the names and types of its columns match what ODBC 3.0 dictates.


badNullability

protected boolean badNullability(int odbcProc,
                                 java.lang.String colName,
                                 int colNum,
                                 boolean wasNull)
Takes result set metadata and sees if the nullability of its columns match what ODBC 3.0 dictates.


addQuotes

private static java.lang.String addQuotes(java.lang.String str)