当前位置: 首页>>代码示例>>Java>>正文


Java DatabaseMetaData.getFunctionColumns方法代码示例

本文整理汇总了Java中java.sql.DatabaseMetaData.getFunctionColumns方法的典型用法代码示例。如果您正苦于以下问题:Java DatabaseMetaData.getFunctionColumns方法的具体用法?Java DatabaseMetaData.getFunctionColumns怎么用?Java DatabaseMetaData.getFunctionColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.DatabaseMetaData的用法示例。


在下文中一共展示了DatabaseMetaData.getFunctionColumns方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkFunctionColumnTypeForBug68307

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
private void checkFunctionColumnTypeForBug68307(String testAgainst, DatabaseMetaData testDbMetaData) throws Exception {
    rs = testDbMetaData.getFunctionColumns(null, null, "testBug68307_%", "%");

    while (rs.next()) {
        String message = testAgainst + ", function <" + rs.getString("FUNCTION_NAME") + "." + rs.getString("COLUMN_NAME") + ">";
        if (rs.getString("COLUMN_NAME") == null || rs.getString("COLUMN_NAME").length() == 0) {
            assertEquals(message, DatabaseMetaData.functionReturn, rs.getShort("COLUMN_TYPE"));
        } else if (rs.getString("COLUMN_NAME").endsWith("_in")) {
            assertEquals(message, DatabaseMetaData.functionColumnIn, rs.getShort("COLUMN_TYPE"));
        } else if (rs.getString("COLUMN_NAME").endsWith("_inout")) {
            assertEquals(message, DatabaseMetaData.functionColumnInOut, rs.getShort("COLUMN_TYPE"));
        } else if (rs.getString("COLUMN_NAME").endsWith("_out")) {
            assertEquals(message, DatabaseMetaData.functionColumnOut, rs.getShort("COLUMN_TYPE"));
        } else {
            fail("Column '" + rs.getString("FUNCTION_NAME") + "." + rs.getString("COLUMN_NAME") + "' not expected within test case.");
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:19,代码来源:MetaDataRegressionTest.java

示例2: testGetFunctionColumns

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
@Test public void testGetFunctionColumns() throws SQLException {
  DatabaseMetaData metadata = getDatabaseMetadata();
  try (ResultSet rs = metadata.getFunctionColumns(null, null, null, null)) {
    ResultSetMetaData rsMeta = rs.getMetaData();

    assertEquals(17, rsMeta.getColumnCount());
    assertColumn(rsMeta, 1, "FUNCTION_CAT", Types.VARCHAR, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 2, "FUNCTION_SCHEM", Types.VARCHAR, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 3, "FUNCTION_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 4, "COLUMN_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 5, "COLUMN_TYPE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 6, "DATA_TYPE", Types.INTEGER, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 7, "TYPE_NAME", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 8, "PRECISION", Types.INTEGER, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 9, "LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 10, "SCALE", Types.SMALLINT, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 11, "RADIX", Types.SMALLINT, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 12, "NULLABLE", Types.SMALLINT, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 13, "REMARKS", Types.VARCHAR, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 14, "CHAR_OCTET_LENGTH", Types.INTEGER, DatabaseMetaData.columnNullable);
    assertColumn(rsMeta, 15, "ORDINAL_POSITION", Types.INTEGER, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 16, "IS_NULLABLE", Types.VARCHAR, DatabaseMetaData.columnNoNulls);
    assertColumn(rsMeta, 17, "SPECIFIC_NAME", Types.VARCHAR, DatabaseMetaData.columnNullable);
  }
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:26,代码来源:MetaResultSetTest.java

示例3: testTwo

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
/**
 * Basic test of DatabaseMetaData functions that access system tables
 */
public void testTwo() throws Exception {

    Connection conn = newConnection();
    int        updateCount;

    try {
        TestUtil.testScript(conn, "testrun/hsqldb/TestSelf.txt");

        DatabaseMetaData dbmeta = conn.getMetaData();

        dbmeta.allProceduresAreCallable();
        dbmeta.getBestRowIdentifier(null, null, "T_1",
                                    DatabaseMetaData.bestRowTransaction,
                                    true);
        dbmeta.getCatalogs();
        dbmeta.getColumnPrivileges(null, "PUBLIC", "T_1", "%");
        dbmeta.getColumns("PUBLIC", "PUBLIC", "T_1", "%");
        dbmeta.getCrossReference(null, null, "T_1", null, null, "T_1");
        dbmeta.getExportedKeys(null, null, "T_1");
        dbmeta.getFunctionColumns(null, "%", "%", "%");
        dbmeta.getFunctions(null, "%", "%");
        dbmeta.getImportedKeys("PUBLIC", "PUBLIC", "T_1");
        dbmeta.getIndexInfo("PUBLIC", "PUBLIC", "T1", true, true);
        dbmeta.getPrimaryKeys("PUBLIC", "PUBLIC", "T_1");
        dbmeta.getProcedureColumns(null, null, "%", "%");
        dbmeta.getProcedures("PUBLIC", "%", "%");
        dbmeta.getSchemas(null, "#");
        dbmeta.getTablePrivileges(null, "%", "%");
        dbmeta.getUDTs(null, "%", "%", new int[]{ Types.DISTINCT });
    } catch (Exception e) {
        assertTrue("unable to prepare or execute DDL", false);
    } finally {
        conn.close();
    }
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:39,代码来源:TestDatabaseMetaData.java

示例4: fetchProcedureColumns

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
public static ResultSet fetchProcedureColumns(final DatabaseMetaData meta, final String catalog,
    final String schema, final String procedureName) throws SQLException {
    if (meta.getDatabaseProductName().equalsIgnoreCase(DatabaseProduct.POSTGRESQL.name())) {
        return meta.getFunctionColumns(catalog, schema, procedureName, null);
    }

    return meta.getProcedureColumns(catalog, schema, procedureName, null);
}
 
开发者ID:syndesisio,项目名称:syndesis,代码行数:9,代码来源:DatabaseMetaDataHelper.java

示例5: fetchProcedureColumns

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
static ResultSet fetchProcedureColumns(final DatabaseMetaData meta, final String catalog,
    final String schema, final String procedureName) throws SQLException {
    if (meta.getDatabaseProductName().equalsIgnoreCase(DatabaseProduct.POSTGRESQL.name())) {
        return meta.getFunctionColumns(catalog, schema, procedureName, null);
    }

    return meta.getProcedureColumns(catalog, schema, procedureName, null);
}
 
开发者ID:syndesisio,项目名称:connectors,代码行数:9,代码来源:SqlStoredConnectorMetaDataExtension.java

示例6: runOtherMetaDataTests

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
private void runOtherMetaDataTests() throws SQLException
{
	DatabaseMetaData metadata = connection.getMetaData();
	try (ResultSet rs = metadata.getCatalogs())
	{
	}
	try (ResultSet rs = metadata.getAttributes("", "", null, null))
	{
	}
	try (ResultSet rs = metadata.getClientInfoProperties())
	{
	}
	try (ResultSet rs = metadata.getFunctionColumns("", "", null, null))
	{
	}
	try (ResultSet rs = metadata.getFunctions("", "", null))
	{
	}
	try (ResultSet rs = metadata.getProcedureColumns("", "", null, null))
	{
	}
	try (ResultSet rs = metadata.getProcedures("", "", null))
	{
	}
	try (ResultSet rs = metadata.getSchemas())
	{
	}
	try (ResultSet rs = metadata.getSchemas("", null))
	{
	}
	try (ResultSet rs = metadata.getSuperTypes("", "", null))
	{
	}
	try (ResultSet rs = metadata.getTableTypes())
	{
	}
	try (ResultSet rs = metadata.getTypeInfo())
	{
	}
	try (ResultSet rs = metadata.getUDTs(null, null, null, null))
	{
	}
	for (String table : TABLES)
	{
		try (ResultSet rs = metadata.getExportedKeys("", "", table))
		{
		}
		try (ResultSet rs = metadata.getImportedKeys("", "", table))
		{
		}
		try (ResultSet rs = metadata.getBestRowIdentifier("", "", table, DatabaseMetaData.bestRowTransaction,
				false))
		{
		}
		try (ResultSet rs = metadata.getColumnPrivileges("", "", table, null))
		{
		}
		try (ResultSet rs = metadata.getPrimaryKeys("", "", table))
		{
		}
		try (ResultSet rs = metadata.getPseudoColumns("", "", table, null))
		{
		}
		try (ResultSet rs = metadata.getSuperTables("", "", table))
		{
		}
		try (ResultSet rs = metadata.getTablePrivileges("", "", table))
		{
		}
		try (ResultSet rs = metadata.getVersionColumns("", "", table))
		{
		}
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:75,代码来源:MetaDataTester.java

示例7: testBug20727196

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
/**
 * Tests fix for BUG#20727196 - GETPROCEDURECOLUMNS() RETURNS EXCEPTION FOR FUNCTION WHICH RETURNS ENUM/SET TYPE.
 * 
 * Test duplicated in testsuite.regression.MetaDataRegressionTest.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20727196() throws Exception {
    createFunction("testBug20727196_f1", "(p ENUM ('Yes', 'No')) RETURNS VARCHAR(10) DETERMINISTIC BEGIN RETURN IF(p='Yes', 'Yay!', if(p='No', 'Ney!', 'What?')); END");
    createFunction("testBug20727196_f2", "(p CHAR(1)) RETURNS ENUM ('Yes', 'No') DETERMINISTIC BEGIN RETURN IF(p='y', 'Yes', if(p='n', 'No', '?')); END");
    createFunction("testBug20727196_f3", "(p ENUM ('Yes', 'No')) RETURNS ENUM ('Yes', 'No') DETERMINISTIC BEGIN RETURN IF(p='Yes', 'Yes', if(p='No', 'No', '?')); END");
    createProcedure("testBug20727196_p1", "(p ENUM ('Yes', 'No')) BEGIN SELECT IF(p='Yes', 'Yay!', if(p='No', 'Ney!', 'What?')); END");

    for (String connProps : new String[] { "getProceduresReturnsFunctions=false,useInformationSchema=false",
            "getProceduresReturnsFunctions=false,useInformationSchema=true" }) {

        Connection testConn = null;
        try {
            testConn = getConnectionWithProps(connProps);
            DatabaseMetaData dbmd = testConn.getMetaData();

            this.rs = dbmd.getFunctionColumns(null, null, "testBug20727196_%", "%");

            // testBug20727196_f1 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f1", this.rs.getString(3));
            assertEquals("", this.rs.getString(4));
            assertEquals("VARCHAR", this.rs.getString(7));
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f1", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));

            // testBug20727196_f2 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f2", this.rs.getString(3));
            assertEquals("", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f2", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("CHAR", this.rs.getString(7));

            // testBug20727196_f3 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f3", this.rs.getString(3));
            assertEquals("", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f3", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));

            assertFalse(this.rs.next());

            this.rs = dbmd.getProcedureColumns(null, null, "testBug20727196_%", "%");

            // testBug20727196_p1 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_p1", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));

            assertFalse(this.rs.next());
        } finally {
            if (testConn != null) {
                testConn.close();
            }
        }
    }
}
 
开发者ID:rafallis,项目名称:BibliotecaPS,代码行数:73,代码来源:MetaDataRegressionTest.java

示例8: testBug20727196

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
/**
 * Tests fix for BUG#20727196 - GETPROCEDURECOLUMNS() RETURNS EXCEPTION FOR FUNCTION WHICH RETURNS ENUM/SET TYPE.
 * 
 * Test duplicated in testsuite.regression.MetaDataRegressionTest.
 * 
 * @throws Exception
 *             if the test fails.
 */
public void testBug20727196() throws Exception {
    createFunction("testBug20727196_f1", "(p ENUM ('Yes', 'No')) RETURNS VARCHAR(10) BEGIN RETURN IF(p='Yes', 'Yay!', if(p='No', 'Ney!', 'What?')); END");
    createFunction("testBug20727196_f2", "(p CHAR(1)) RETURNS ENUM ('Yes', 'No') BEGIN RETURN IF(p='y', 'Yes', if(p='n', 'No', '?')); END");
    createFunction("testBug20727196_f3", "(p ENUM ('Yes', 'No')) RETURNS ENUM ('Yes', 'No') BEGIN RETURN IF(p='Yes', 'Yes', if(p='No', 'No', '?')); END");
    createProcedure("testBug20727196_p1", "(p ENUM ('Yes', 'No')) BEGIN SELECT IF(p='Yes', 'Yay!', if(p='No', 'Ney!', 'What?')); END");

    for (String connProps : new String[] { "getProceduresReturnsFunctions=false,useInformationSchema=false",
            "getProceduresReturnsFunctions=false,useInformationSchema=true" }) {

        Connection testConn = null;
        try {
            testConn = getConnectionWithProps(connProps);
            DatabaseMetaData dbmd = testConn.getMetaData();

            this.rs = dbmd.getFunctionColumns(null, null, "testBug20727196_%", "%");

            // testBug20727196_f1 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f1", this.rs.getString(3));
            assertEquals("", this.rs.getString(4));
            assertEquals("VARCHAR", this.rs.getString(7));
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f1", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));

            // testBug20727196_f2 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f2", this.rs.getString(3));
            assertEquals("", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f2", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("CHAR", this.rs.getString(7));

            // testBug20727196_f3 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f3", this.rs.getString(3));
            assertEquals("", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_f3", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));

            assertFalse(this.rs.next());

            this.rs = dbmd.getProcedureColumns(null, null, "testBug20727196_%", "%");

            // testBug20727196_p1 columns:
            assertTrue(this.rs.next());
            assertEquals("testBug20727196_p1", this.rs.getString(3));
            assertEquals("p", this.rs.getString(4));
            assertEquals("ENUM", this.rs.getString(7));

            assertFalse(this.rs.next());
        } finally {
            if (testConn != null) {
                testConn.close();
            }
        }
    }
}
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:73,代码来源:MetaDataRegressionTest.java

示例9: checkGetFunctionColumnsForBug69298

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
private void checkGetFunctionColumnsForBug69298(String stepDescription, Connection testConn) throws Exception {
    DatabaseMetaData testDbMetaData = testConn.getMetaData();
    ResultSet funcColsMD = testDbMetaData.getFunctionColumns(null, null, "testBug69298_%", "%");
    String sd = stepDescription + " getFunctionColumns() ";

    assertTrue(sd + "1st of 2 rows expected.", funcColsMD.next());

    // function column: testBug69298_func return
    assertEquals(sd + "-> FUNCTION_CAT", testConn.getCatalog(), funcColsMD.getString("FUNCTION_CAT"));
    assertEquals(sd + "-> FUNCTION_SCHEM", null, funcColsMD.getString("FUNCTION_SCHEM"));
    assertEquals(sd + "-> FUNCTION_NAME", "testBug69298_func", funcColsMD.getString("FUNCTION_NAME"));
    assertEquals(sd + "-> COLUMN_NAME", "", funcColsMD.getString("COLUMN_NAME"));
    assertEquals(sd + "-> COLUMN_TYPE", DatabaseMetaData.functionReturn, funcColsMD.getShort("COLUMN_TYPE"));
    assertEquals(sd + "-> DATA_TYPE", Types.INTEGER, funcColsMD.getInt("DATA_TYPE"));
    assertEquals(sd + "-> TYPE_NAME", "INT", funcColsMD.getString("TYPE_NAME"));
    assertEquals(sd + "-> PRECISION", 10, funcColsMD.getInt("PRECISION"));
    assertEquals(sd + "-> LENGTH", 10, funcColsMD.getInt("LENGTH"));
    assertEquals(sd + "-> SCALE", 0, funcColsMD.getShort("SCALE"));
    assertEquals(sd + "-> RADIX", 10, funcColsMD.getShort("RADIX"));
    assertEquals(sd + "-> NULLABLE", DatabaseMetaData.functionNullable, funcColsMD.getShort("NULLABLE"));
    assertEquals(sd + "-> REMARKS", null, funcColsMD.getString("REMARKS"));
    assertEquals(sd + "-> CHAR_OCTET_LENGTH", 0, funcColsMD.getInt("CHAR_OCTET_LENGTH"));
    assertEquals(sd + "-> ORDINAL_POSITION", 0, funcColsMD.getInt("ORDINAL_POSITION"));
    assertEquals(sd + "-> IS_NULLABLE", "YES", funcColsMD.getString("IS_NULLABLE"));
    assertEquals(sd + "-> SPECIFIC_NAME", "testBug69298_func", funcColsMD.getString("SPECIFIC_NAME"));

    assertTrue(sd + "2nd of 2 rows expected.", funcColsMD.next());

    // function column: testBug69298_func.param_func
    assertEquals(sd + "-> FUNCTION_CAT", testConn.getCatalog(), funcColsMD.getString("FUNCTION_CAT"));
    assertEquals(sd + "-> FUNCTION_SCHEM", null, funcColsMD.getString("FUNCTION_SCHEM"));
    assertEquals(sd + "-> FUNCTION_NAME", "testBug69298_func", funcColsMD.getString("FUNCTION_NAME"));
    assertEquals(sd + "-> COLUMN_NAME", "param_func", funcColsMD.getString("COLUMN_NAME"));
    assertEquals(sd + "-> COLUMN_TYPE", DatabaseMetaData.functionColumnIn, funcColsMD.getShort("COLUMN_TYPE"));
    assertEquals(sd + "-> DATA_TYPE", Types.INTEGER, funcColsMD.getInt("DATA_TYPE"));
    assertEquals(sd + "-> TYPE_NAME", "INT", funcColsMD.getString("TYPE_NAME"));
    assertEquals(sd + "-> PRECISION", 10, funcColsMD.getInt("PRECISION"));
    assertEquals(sd + "-> LENGTH", 10, funcColsMD.getInt("LENGTH"));
    assertEquals(sd + "-> SCALE", 0, funcColsMD.getShort("SCALE"));
    assertEquals(sd + "-> RADIX", 10, funcColsMD.getShort("RADIX"));
    assertEquals(sd + "-> NULLABLE", DatabaseMetaData.functionNullable, funcColsMD.getShort("NULLABLE"));
    assertEquals(sd + "-> REMARKS", null, funcColsMD.getString("REMARKS"));
    assertEquals(sd + "-> CHAR_OCTET_LENGTH", 0, funcColsMD.getInt("CHAR_OCTET_LENGTH"));
    assertEquals(sd + "-> ORDINAL_POSITION", 1, funcColsMD.getInt("ORDINAL_POSITION"));
    assertEquals(sd + "-> IS_NULLABLE", "YES", funcColsMD.getString("IS_NULLABLE"));
    assertEquals(sd + "-> SPECIFIC_NAME", "testBug69298_func", funcColsMD.getString("SPECIFIC_NAME"));

    assertFalse(sd + "no more rows expected.", funcColsMD.next());
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:50,代码来源:MetaDataRegressionTest.java

示例10: checkMetaDataInfoForBug17248345

import java.sql.DatabaseMetaData; //导入方法依赖的package包/类
private void checkMetaDataInfoForBug17248345(Connection testConn) throws Exception {
    DatabaseMetaData testDbMetaData = testConn.getMetaData();
    ResultSet rsMD;
    boolean useInfoSchema = ((ConnectionProperties) testConn).getUseInformationSchema();
    boolean getProcRetFunc = ((ConnectionProperties) testConn).getGetProceduresReturnsFunctions();
    String stepDescription = "Prop. useInfoSchema(" + (useInfoSchema ? 1 : 0) + ") + getProcRetFunc(" + (getProcRetFunc ? 1 : 0) + "):";
    String sd;

    // getFunctions() must return 1 record.
    sd = stepDescription + " getFunctions() ";
    rsMD = testDbMetaData.getFunctions(null, null, "testBug17248345");
    assertTrue(sd + "one row expected.", rsMD.next());
    assertEquals(sd + " -> FUNCTION_NAME", "testBug17248345", rsMD.getString("FUNCTION_NAME"));
    assertFalse(sd + "no more rows expected.", rsMD.next());

    // getFunctionColumns() must return 2 records (func return + func param).
    sd = stepDescription + " getFunctionColumns() ";
    rsMD = testDbMetaData.getFunctionColumns(null, null, "testBug17248345", "%");
    assertTrue(sd + "1st of 2 rows expected.", rsMD.next());
    assertEquals(sd + " -> FUNCTION_NAME", "testBug17248345", rsMD.getString("FUNCTION_NAME"));
    assertEquals(sd + " -> COLUMN_NAME", "", rsMD.getString("COLUMN_NAME"));
    assertTrue(sd + "2nd of 2 rows expected.", rsMD.next());
    assertEquals(sd + " -> FUNCTION_NAME", "testBug17248345", rsMD.getString("FUNCTION_NAME"));
    assertEquals(sd + " -> COLUMN_NAME", "funccol", rsMD.getString("COLUMN_NAME"));
    assertFalse(sd + "no more rows expected.", rsMD.next());

    // getProcedures() must return 1 or 2 records, depending on if getProceduresReturnsFunctions is false or true
    // respectively. When exists a procedure and a function with same name, function is returned first.
    sd = stepDescription + " getProcedures() ";
    rsMD = testDbMetaData.getProcedures(null, null, "testBug17248345");
    if (getProcRetFunc) {
        assertTrue(sd + "1st of 2 rows expected.", rsMD.next());
        assertEquals(sd + " -> PROCEDURE_NAME", "testBug17248345", rsMD.getString("PROCEDURE_NAME"));
        assertTrue(sd + "2nd of 2 rows expected.", rsMD.next());
    } else {
        assertTrue(sd + "one row expected.", rsMD.next());
    }
    assertEquals(sd + " -> PROCEDURE_NAME", "testBug17248345", rsMD.getString("PROCEDURE_NAME"));
    assertFalse(sd + "no more rows expected.", rsMD.next());

    // getProcedureColumns() must return 1 or 3 records, depending on if getProceduresReturnsFunctions is false or
    // true respectively. When exists a procedure and a function with same name, function is returned first.
    sd = stepDescription + " getProcedureColumns() ";
    rsMD = testDbMetaData.getProcedureColumns(null, null, "testBug17248345", "%");
    if (getProcRetFunc) {
        assertTrue(sd + "1st of 3 rows expected.", rsMD.next());
        assertEquals(sd + " -> PROCEDURE_NAME", "testBug17248345", rsMD.getString("PROCEDURE_NAME"));
        assertEquals(sd + " -> COLUMN_NAME", "", rsMD.getString("COLUMN_NAME"));
        assertTrue(sd + "2nd of 3 rows expected.", rsMD.next());
        assertEquals(sd + " -> PROCEDURE_NAME", "testBug17248345", rsMD.getString("PROCEDURE_NAME"));
        assertEquals(sd + " -> COLUMN_NAME", "funccol", rsMD.getString("COLUMN_NAME"));
        assertTrue(sd + "3rd of 3 rows expected.", rsMD.next());
    } else {
        assertTrue(sd + "one row expected.", rsMD.next());
    }
    assertEquals(sd + " -> PROCEDURE_NAME", "testBug17248345", rsMD.getString("PROCEDURE_NAME"));
    assertEquals(sd + " -> COLUMN_NAME", "proccol", rsMD.getString("COLUMN_NAME"));
    assertFalse(sd + "no more rows expected.", rsMD.next());
}
 
开发者ID:Jugendhackt,项目名称:OpenVertretung,代码行数:60,代码来源:MetaDataRegressionTest.java


注:本文中的java.sql.DatabaseMetaData.getFunctionColumns方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。