List:Commits« Previous MessageNext Message »
From:mmatthews Date:April 15 2008 2:23am
Subject:Connector/J commit: r6770 - in branches/branch_5_1: . src/com/mysql/jdbc src/testsuite/regression
View as plain text  
Modified:
   branches/branch_5_1/CHANGES
   branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java
   branches/branch_5_1/src/com/mysql/jdbc/TimeUtil.java
   branches/branch_5_1/src/testsuite/regression/ResultSetRegressionTest.java
Log:
Fixed BUG#36051 - ResultSet.getTime() won't accept value of '24' for hours component of
	  a java.sql.Time.

Modified: branches/branch_5_1/CHANGES
===================================================================
--- branches/branch_5_1/CHANGES	2008-04-03 20:28:35 UTC (rev 6769)
+++ branches/branch_5_1/CHANGES	2008-04-15 00:23:33 UTC (rev 6770)
@@ -30,6 +30,9 @@
 	  did not take effect in certain circumstances. This also fixes related bugs BUG#13261
and
 	  BUG#35753.
 	  
+	- Fixed BUG#36051 - ResultSet.getTime() won't accept value of '24' for hours component
of
+	  a java.sql.Time.
+	  
 03-06-08 - Version 5.1.6
 
     - JDBC-4.0-ized XAConnections and datasources.

Modified: branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java	2008-04-03 20:28:35 UTC (rev
6769)
+++ branches/branch_5_1/src/com/mysql/jdbc/ResultSetImpl.java	2008-04-15 00:23:33 UTC (rev
6770)
@@ -431,7 +431,7 @@
 	public ResultSetImpl(String catalog, Field[] fields, RowData tuples,
 			ConnectionImpl conn, StatementImpl creatorStmt) throws SQLException {
 		this.connection = conn;
-
+		
 		this.retainOwningStatement = false;
 		
 		if (this.connection != null) {
@@ -481,6 +481,8 @@
 			initializeWithMetadata();
 		} // else called by Connection.initializeResultsMetadataFromCache() when cached
 		useLegacyDatetimeCode = this.connection.getUseLegacyDatetimeCode();
+		
+		setRowPositionValidity();
 	}
 
 	public void initializeWithMetadata() throws SQLException {
@@ -5900,6 +5902,8 @@
 	private Time getTimeInternal(int columnIndex, Calendar targetCalendar,
 			TimeZone tz,
 			boolean rollForward) throws java.sql.SQLException {
+		checkRowPos();
+		
 		if (this.isBinaryEncoded) {
 			return getNativeTime(columnIndex, targetCalendar, tz, rollForward);
 		}

Modified: branches/branch_5_1/src/com/mysql/jdbc/TimeUtil.java
===================================================================
--- branches/branch_5_1/src/com/mysql/jdbc/TimeUtil.java	2008-04-03 20:28:35 UTC (rev
6769)
+++ branches/branch_5_1/src/com/mysql/jdbc/TimeUtil.java	2008-04-15 00:23:33 UTC (rev
6770)
@@ -1019,7 +1019,7 @@
 
 	final static Time fastTimeCreate(Calendar cal, int hour, int minute,
 			int second) throws SQLException {
-		if (hour < 0 || hour > 23) {
+		if (hour < 0 || hour > 24) {
 			throw SQLError.createSQLException("Illegal hour value '" + hour + "' for java.sql.Time
type in value '"
 					+ timeFormattedString(hour, minute, second) + ".", 
 					SQLError.SQL_STATE_ILLEGAL_ARGUMENT);

Modified: branches/branch_5_1/src/testsuite/regression/ResultSetRegressionTest.java
===================================================================
--- branches/branch_5_1/src/testsuite/regression/ResultSetRegressionTest.java	2008-04-03
20:28:35 UTC (rev 6769)
+++ branches/branch_5_1/src/testsuite/regression/ResultSetRegressionTest.java	2008-04-15
00:23:33 UTC (rev 6770)
@@ -4671,4 +4671,14 @@
 			closeMemberJDBCResources();
 		}
 	}
+	
+	public void testBug36051() throws Exception {
+		try {
+			this.rs = this.stmt.executeQuery("SELECT '24:00:00'");
+			this.rs.next();
+			this.rs.getTime(1);
+		} finally {
+			closeMemberJDBCResources();
+		}
+	}
 }

Thread
Connector/J commit: r6770 - in branches/branch_5_1: . src/com/mysql/jdbc src/testsuite/regressionmmatthews15 Apr