MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:mmatthews Date:April 3 2006 3:37pm
Subject:Connector/J commit: r5122 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_3_1/connector-j/src/testsuite/regress...
View as plain text  
Modified:
   branches/branch_3_1/connector-j/CHANGES
   branches/branch_3_1/connector-j/src/com/mysql/jdbc/SQLError.java
   branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
   branches/branch_5_0/connector-j/CHANGES
   branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java
   branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
   branches/branch_5_1/connector-j/CHANGES
   branches/branch_5_1/connector-j/src/com/mysql/jdbc/SQLError.java
   branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
Log:
Fixed BUG#18740 - Data truncation and getWarnings() only returns last 
	  warning in set.

Modified: branches/branch_3_1/connector-j/CHANGES
===================================================================
--- branches/branch_3_1/connector-j/CHANGES	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_3_1/connector-j/CHANGES	2006-04-03 15:37:11 UTC (rev 5122)
@@ -78,6 +78,9 @@
 	
 	- Added additional accessor and mutator methods on ConnectionProperties
 	  so that DataSource users can use same naming as regular URL properties.
+	  
+	- Fixed BUG#18740 - Data truncation and getWarnings() only returns last 
+	  warning in set.
     
 11-30-05 - Version 3.1.12
 

Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/SQLError.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/SQLError.java	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/SQLError.java	2006-04-03 15:37:11 UTC (rev 5122)
@@ -713,7 +713,6 @@
 							currentWarning = newTruncation;
 						} else {
 							currentWarning.setNextWarning(newTruncation);
-							currentWarning = newTruncation;
 						}
 					}
 				} else {
@@ -728,7 +727,6 @@
 						currentWarning = newWarning;
 					} else {
 						currentWarning.setNextWarning(newWarning);
-						currentWarning = newWarning;
 					}
 				}
 			}

Modified: branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_3_1/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-04-03 15:37:11 UTC (rev 5122)
@@ -3084,4 +3084,32 @@
 			}
 		}
 	}
+	
+	/**
+	 * Tests fix for BUG#18740 - Data truncation and getWarnings()
+	 * only returns last warning in set.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug18740() throws Exception {
+		createTable("testWarnings", "(field1 smallint(6),"
+				+ "field2 varchar(6),"
+				+ "UNIQUE KEY field1(field1))");
+
+		try {
+			this.stmt.executeUpdate("INSERT INTO testWarnings VALUES "
+				+ "(10001, 'data1'),"
+				+ "(10002, 'data2 foo'),"
+				+ "(10003, 'data3'),"
+				+ "(10004999, 'data4'),"
+				+ "(10005, 'data5')");
+		} catch (SQLException sqlEx) {
+			assertEquals("01004", sqlEx.getSQLState());
+			assertEquals("01004", sqlEx.getNextException().getSQLState());
+			
+			SQLWarning sqlWarn = this.stmt.getWarnings();
+			assertEquals("01000", sqlWarn.getSQLState());
+			assertEquals("01000", sqlWarn.getNextWarning().getSQLState());
+		}
+	}
 }

Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_5_0/connector-j/CHANGES	2006-04-03 15:37:11 UTC (rev 5122)
@@ -181,6 +181,9 @@
 	
 	- Added additional accessor and mutator methods on ConnectionProperties
 	  so that DataSource users can use same naming as regular URL properties.
+	  
+	- Fixed BUG#18740 - Data truncation and getWarnings() only returns last 
+	  warning in set.
 	
 11-30-05 - Version 3.1.12
 

Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java	2006-04-03 15:37:11 UTC (rev 5122)
@@ -721,7 +721,6 @@
 							currentWarning = newTruncation;
 						} else {
 							currentWarning.setNextWarning(newTruncation);
-							currentWarning = newTruncation;
 						}
 					}
 				} else {
@@ -736,7 +735,6 @@
 						currentWarning = newWarning;
 					} else {
 						currentWarning.setNextWarning(newWarning);
-						currentWarning = newWarning;
 					}
 				}
 			}

Modified: branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_5_0/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-04-03 15:37:11 UTC (rev 5122)
@@ -3112,4 +3112,32 @@
 			}
 		}
 	}
+
+	/**
+	 * Tests fix for BUG#18740 - Data truncation and getWarnings()
+	 * only returns last warning in set.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug18740() throws Exception {
+		createTable("testWarnings", "(field1 smallint(6),"
+				+ "field2 varchar(6),"
+				+ "UNIQUE KEY field1(field1))");
+	
+		try {
+			this.stmt.executeUpdate("INSERT INTO testWarnings VALUES "
+				+ "(10001, 'data1'),"
+				+ "(10002, 'data2 foo'),"
+				+ "(10003, 'data3'),"
+				+ "(10004999, 'data4'),"
+				+ "(10005, 'data5')");
+		} catch (SQLException sqlEx) {
+			assertEquals("01004", sqlEx.getSQLState());
+			assertEquals("01004", sqlEx.getNextException().getSQLState());
+			
+			SQLWarning sqlWarn = this.stmt.getWarnings();
+			assertEquals("01000", sqlWarn.getSQLState());
+			assertEquals("01000", sqlWarn.getNextWarning().getSQLState());
+		}
+	}
 }

Modified: branches/branch_5_1/connector-j/CHANGES
===================================================================
--- branches/branch_5_1/connector-j/CHANGES	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_5_1/connector-j/CHANGES	2006-04-03 15:37:11 UTC (rev 5122)
@@ -184,6 +184,9 @@
     - Added additional accessor and mutator methods on ConnectionProperties
 	  so that DataSource users can use same naming as regular URL properties.
 	  
+	- Fixed BUG#18740 - Data truncation and getWarnings() only returns last 
+	  warning in set.
+	  
 11-30-05 - Version 3.1.12
 
     - Fixed client-side prepared statement bug with embedded ? inside

Modified: branches/branch_5_1/connector-j/src/com/mysql/jdbc/SQLError.java
===================================================================
--- branches/branch_5_1/connector-j/src/com/mysql/jdbc/SQLError.java	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_5_1/connector-j/src/com/mysql/jdbc/SQLError.java	2006-04-03 15:37:11 UTC (rev 5122)
@@ -721,7 +721,6 @@
 							currentWarning = newTruncation;
 						} else {
 							currentWarning.setNextWarning(newTruncation);
-							currentWarning = newTruncation;
 						}
 					}
 				} else {
@@ -736,7 +735,6 @@
 						currentWarning = newWarning;
 					} else {
 						currentWarning.setNextWarning(newWarning);
-						currentWarning = newWarning;
 					}
 				}
 			}

Modified: branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java
===================================================================
--- branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-04-03 15:16:16 UTC (rev 5121)
+++ branches/branch_5_1/connector-j/src/testsuite/regression/StatementRegressionTest.java	2006-04-03 15:37:11 UTC (rev 5122)
@@ -3113,4 +3113,32 @@
 		}
 	}
 
+	/**
+	 * Tests fix for BUG#18740 - Data truncation and getWarnings()
+	 * only returns last warning in set.
+	 * 
+	 * @throws Exception if the test fails.
+	 */
+	public void testBug18740() throws Exception {
+		createTable("testWarnings", "(field1 smallint(6),"
+				+ "field2 varchar(6),"
+				+ "UNIQUE KEY field1(field1))");
+	
+		try {
+			this.stmt.executeUpdate("INSERT INTO testWarnings VALUES "
+				+ "(10001, 'data1'),"
+				+ "(10002, 'data2 foo'),"
+				+ "(10003, 'data3'),"
+				+ "(10004999, 'data4'),"
+				+ "(10005, 'data5')");
+		} catch (SQLException sqlEx) {
+			assertEquals("01004", sqlEx.getSQLState());
+			assertEquals("01004", sqlEx.getNextException().getSQLState());
+			
+			SQLWarning sqlWarn = this.stmt.getWarnings();
+			assertEquals("01000", sqlWarn.getSQLState());
+			assertEquals("01000", sqlWarn.getNextWarning().getSQLState());
+		}
+	}
+
 }

Thread
Connector/J commit: r5122 - in branches: branch_3_1/connector-j branch_3_1/connector-j/src/com/mysql/jdbc branch_3_1/connector-j/src/testsuite/regress...mmatthews3 Apr