Search in sources :

Example 1 with TrinoConnection

use of io.trino.jdbc.TrinoConnection in project trino by trinodb.

the class TestJdbc method shouldSetLocale.

@Test(groups = JDBC)
public void shouldSetLocale() throws SQLException {
    // TODO uew new connection rather than modifying a shared one
    ((TrinoConnection) 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("一月"));
    }
}
Also used : QueryResult(io.trino.tempto.query.QueryResult) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) TrinoConnection(io.trino.jdbc.TrinoConnection) Test(org.testng.annotations.Test) ProductTest(io.trino.tempto.ProductTest)

Example 2 with TrinoConnection

use of io.trino.jdbc.TrinoConnection in project trino by trinodb.

the class JdbcDriverUtils method setSessionProperty.

public static void setSessionProperty(Connection connection, String key, String value) throws SQLException {
    @SuppressWarnings("resource") TrinoConnection trinoConnection = connection.unwrap(TrinoConnection.class);
    trinoConnection.setSessionProperty(key, value);
}
Also used : TrinoConnection(io.trino.jdbc.TrinoConnection)

Aggregations

TrinoConnection (io.trino.jdbc.TrinoConnection)2 ProductTest (io.trino.tempto.ProductTest)1 QueryResult (io.trino.tempto.query.QueryResult)1 PreparedStatement (java.sql.PreparedStatement)1 Statement (java.sql.Statement)1 Test (org.testng.annotations.Test)1