Exemple #1
0
 @Test(groups = JDBC)
 public void shouldSetLocale() throws SQLException {
   connection.setLocale(CHINESE);
   try (Statement statement = connection.createStatement()) {
     QueryResult result =
         queryResult(statement, "SELECT date_format(TIMESTAMP '2001-01-09 09:04', '%M')");
     assertThat(result).contains(row("一月"));
   }
 }
Exemple #2
0
 @Test(groups = JDBC)
 public void shouldSetTimezone() throws SQLException {
   String timeZoneId = "Indian/Kerguelen";
   connection.setTimeZoneId(timeZoneId);
   try (Statement statement = connection.createStatement()) {
     QueryResult result = queryResult(statement, "select current_timezone()");
     assertThat(result).contains(row(timeZoneId));
   }
 }
Exemple #3
0
 @Test(groups = JDBC)
 @Requires(ImmutableNationTable.class)
 public void shouldExecuteQueryWithSelectedCatalogAndSchema() throws SQLException {
   connection.setCatalog("hive");
   connection.setSchema("default");
   try (Statement statement = connection.createStatement()) {
     QueryResult result = queryResult(statement, "select * from nation");
     assertThat(result).matches(PRESTO_NATION_RESULT);
   }
 }
Exemple #4
0
 @Test(groups = JDBC)
 @Requires(ImmutableNationTable.class)
 public void shouldExecuteQuery() throws SQLException {
   try (Statement statement = connection.createStatement()) {
     QueryResult result = queryResult(statement, "select * from hive.default.nation");
     assertThat(result).matches(PRESTO_NATION_RESULT);
   }
 }
Exemple #5
0
  @Test(groups = {JDBC, QUARANTINE})
  @Requires(ImmutableAndMutableNationTable.class)
  public void shouldInsertSelectQuery() throws SQLException {
    String tableNameInDatabase = mutableTablesState().get(TABLE_NAME).getNameInDatabase();
    assertThat(query("SELECT * FROM " + tableNameInDatabase)).hasNoRows();

    try (Statement statement = connection.createStatement()) {
      // TODO: fix, should return proper number of inserted rows
      assertThat(
              statement.executeUpdate(
                  "insert into " + tableNameInDatabase + " select * from nation"))
          .isEqualTo(25);
    }

    assertThat(query("SELECT * FROM " + tableNameInDatabase)).matches(PRESTO_NATION_RESULT);
  }
Exemple #6
0
 private PrestoDatabaseMetaData metaData() throws SQLException {
   return (PrestoDatabaseMetaData) connection.getMetaData();
 }