Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
public class PrestoDatabaseMetaData
implements DatabaseMetaData
{
private static final String JDBC_URL_START = "jdbc:";
private static final String SEARCH_STRING_ESCAPE = "\\";

private final PrestoConnection connection;
Expand Down Expand Up @@ -60,7 +61,7 @@ public boolean allTablesAreSelectable()
public String getURL()
throws SQLException
{
return connection.getURI().toString();
return JDBC_URL_START + connection.getURI().toString();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ public void testGetClientInfoProperties()
}
}

@Test
public void testGetUrl()
throws Exception
{
DatabaseMetaData metaData = connection.getMetaData();
assertEquals(metaData.getURL(), "jdbc:presto://" + server.getAddress());
}

private static void assertColumnSpec(ResultSet rs, int dataType, Long precision, Long numPrecRadix, String typeName)
throws SQLException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,17 @@ public void testDeallocate()
}
}

@Test(groups = JDBC)
@Requires(ImmutableNationTable.class)
public void testMetaDataGetURL()
throws SQLException
{
DatabaseMetaData metaData = metaData();
String url = metaData.getURL();
assertThat(url).startsWith("jdbc:presto://");
assertThat(url).isEqualTo(prestoJdbcURL);
}

private QueryResult queryResult(Statement statement, String query)
throws SQLException
{
Expand Down