protected TimeZone getServerTimeZone() throws SQLException { return this.driverConnection.getServerConnection().getLogonResult().getTimeZone(); }
protected TimeZone getServerTimeZone() throws SQLException { return this.driverConnection.getServerConnection().getLogonResult().getTimeZone(); }
/** * <p>MMPreparedStatement constructor. * @param Driver's connection object. * @param String object representing the prepared statement */ PreparedStatementImpl(ConnectionImpl connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException { super(connection, resultSetType, resultSetConcurrency); if (sql == null) { throw new TeiidSQLException(JDBCPlugin.Util.getString("MMPreparedStatement.Err_prep_sql")); //$NON-NLS-1$ } this.prepareSql = sql; TimeZone timezone = connection.getServerConnection().getLogonResult().getTimeZone(); if (timezone != null && !timezone.hasSameRules(getDefaultCalendar().getTimeZone())) { this.serverCalendar = Calendar.getInstance(timezone); } }
/** * <p>MMPreparedStatement constructor. * @param Driver's connection object. * @param String object representing the prepared statement */ PreparedStatementImpl(ConnectionImpl connection, String sql, int resultSetType, int resultSetConcurrency) throws SQLException { super(connection, resultSetType, resultSetConcurrency); if (sql == null) { throw new TeiidSQLException(JDBCPlugin.Util.getString("MMPreparedStatement.Err_prep_sql")); //$NON-NLS-1$ } this.prepareSql = sql; TimeZone timezone = connection.getServerConnection().getLogonResult().getTimeZone(); if (timezone != null && !timezone.hasSameRules(getDefaultCalendar().getTimeZone())) { this.serverCalendar = Calendar.getInstance(timezone); } }
/** * A helper method to get an <code>MMPreparedStatement</code> that can be * used for simple test cases. * <p> * The returned value is an instance of <code>TestableMMPreparedStatement</code> * <p> * This method invokes <code>getMMPreparedStatement(final MMConnection conn, * final String sql)</code> with a fake connection object constructed by * <code>Mockito</code>. * * @param sql the query for the prepared statement * @return an instance of TestableMMPreparedStatement * @throws SQLException */ protected PreparedStatementImpl getMMPreparedStatement(final String sql) throws SQLException { ConnectionImpl conn = Mockito.mock(ConnectionImpl.class); ServerConnection serverConn = Mockito.mock(ServerConnection.class); LogonResult logonResult = Mockito.mock(LogonResult.class); Mockito.stub(conn.getServerConnection()).toReturn(serverConn); Mockito.stub(serverConn.getLogonResult()).toReturn(logonResult); Mockito.stub(logonResult.getTimeZone()).toReturn(TimeZone.getDefault()); return getMMPreparedStatement(conn, sql); }
Mockito.stub(logonResult.getTimeZone()).toReturn(TimeZone.getDefault());