~maria-captains/mariadb-java-client/trunk

« back to all changes in this revision

Viewing changes to src/test/java/org/mariadb/jdbc/DateTest.java

  • Committer: Massimo Siani
  • Date: 2014-12-09 11:01:52 UTC
  • mfrom: (513 mariadb-java-client)
  • mto: This revision was merged to the branch mainline in revision 548.
  • Revision ID: massimo.siani@skysql.com-20141209110152-05d5r3apend9l0ew
Fix for CONJ-79: ResultSet from previos query after "Read timed out" socket exception

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
import java.sql.Timestamp;
15
15
import java.sql.Types;
16
16
import java.util.Calendar;
 
17
import java.util.GregorianCalendar;
17
18
import java.util.TimeZone;
18
19
import java.util.logging.Level;
19
20
import java.util.logging.Logger;
169
170
        rs.next();
170
171
        /* Check that time is correct, up to seconds precision */
171
172
        assertEquals(d.getTime()/1000,rs.getTimestamp(1).getTime()/1000);
172
 
 
 
173
    }
 
174
    
 
175
    @Test
 
176
    public void nullTimestampTest() throws SQLException {
 
177
        PreparedStatement ps = connection.prepareStatement("insert into dtest values(null)");
 
178
        ps.executeUpdate();
 
179
        ResultSet rs = connection.createStatement().executeQuery("select * from dtest where d is null");
 
180
        rs.next();
 
181
        Calendar cal = new GregorianCalendar();
 
182
        assertEquals(null, rs.getTimestamp(1, cal));
173
183
    }
174
184
 
175
185
    @SuppressWarnings( "deprecation" )