use of java.sql.ParameterMetaData in project phoenix by apache.
the class QueryMetaDataTest method testNonEqualityRowValueConstructorBindParamMetaDataWithBindArgsOnRHSAndLiteralExprOnLHS.
@Test
public void testNonEqualityRowValueConstructorBindParamMetaDataWithBindArgsOnRHSAndLiteralExprOnLHS() throws Exception {
String query = "SELECT a_integer, x_integer FROM aTable WHERE 7 >= (?, ?)";
Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES));
PreparedStatement statement = conn.prepareStatement(query);
ParameterMetaData pmd = statement.getParameterMetaData();
assertEquals(2, pmd.getParameterCount());
assertEquals(Integer.class.getName(), pmd.getParameterClassName(1));
assertEquals(null, pmd.getParameterClassName(2));
}
use of java.sql.ParameterMetaData in project phoenix by apache.
the class QueryMetaDataTest method testUpsertParameterMetaData.
@Test
public void testUpsertParameterMetaData() throws Exception {
String query = "UPSERT INTO atable VALUES (?, ?, ?, ?, ?)";
Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES));
PreparedStatement statement = conn.prepareStatement(query);
ParameterMetaData pmd = statement.getParameterMetaData();
assertEquals(5, pmd.getParameterCount());
assertEquals(String.class.getName(), pmd.getParameterClassName(1));
assertEquals(String.class.getName(), pmd.getParameterClassName(2));
assertEquals(String.class.getName(), pmd.getParameterClassName(3));
assertEquals(String.class.getName(), pmd.getParameterClassName(4));
assertEquals(Integer.class.getName(), pmd.getParameterClassName(5));
}
use of java.sql.ParameterMetaData in project phoenix by apache.
the class QueryMetaDataTest method testRowValueConstructorBindParamMetaDataWithBindArgsAtSamePlacesOnLHSRHS.
@Test
public void testRowValueConstructorBindParamMetaDataWithBindArgsAtSamePlacesOnLHSRHS() throws Exception {
String query = "SELECT a_integer, x_integer FROM aTable WHERE (a_integer, ?) = (a_integer, ?)";
Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES));
PreparedStatement statement = conn.prepareStatement(query);
ParameterMetaData pmd = statement.getParameterMetaData();
assertEquals(2, pmd.getParameterCount());
assertEquals(null, pmd.getParameterClassName(1));
assertEquals(null, pmd.getParameterClassName(2));
}
use of java.sql.ParameterMetaData in project phoenix by apache.
the class QueryMetaDataTest method testNoParameterMetaData.
@Test
public void testNoParameterMetaData() throws Exception {
String query = "SELECT a_string, b_string FROM atable WHERE organization_id='000000000000000'";
Connection conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES));
PreparedStatement statement = conn.prepareStatement(query);
ParameterMetaData pmd = statement.getParameterMetaData();
assertEquals(0, pmd.getParameterCount());
}
use of java.sql.ParameterMetaData in project phoenix by apache.
the class QueryMetaDataTest method testBindParamMetaDataForNestedRVC.
@Test
public void testBindParamMetaDataForNestedRVC() throws Exception {
String query = "SELECT organization_id, entity_id, a_string FROM aTable WHERE (organization_id, (entity_id, a_string)) >= (?, (?, ?))";
Connection conn = DriverManager.getConnection(PHOENIX_JDBC_URL, PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES));
PreparedStatement statement = conn.prepareStatement(query);
ParameterMetaData pmd = statement.getParameterMetaData();
assertEquals(3, pmd.getParameterCount());
assertEquals(String.class.getName(), pmd.getParameterClassName(1));
assertEquals(String.class.getName(), pmd.getParameterClassName(2));
assertEquals(String.class.getName(), pmd.getParameterClassName(3));
}
Aggregations