Modified:
branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
Log:
Push truncation checks on writes to server if possible (works only for MySQL-5.0, but more performant).
Modified: branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
--- branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-05-30 19:18:23 UTC (rev 5320)
+++ branches/branch_3_1/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2006-05-30 19:29:25 UTC (rev 5321)
@@ -895,9 +895,14 @@
true,
"Should the driver throw java.sql.DataTruncation"
+ " exceptions when data is truncated as is required by the JDBC specification when connected to a server that supports warnings"
- + "(MySQL 4.1.0 and newer)?", "3.1.2", MISC_CATEGORY,
+ + "(MySQL 4.1.0 and newer)? When connected to MySQL 5.0.2 or newer, the driver will "
+ + "alter the sql_mode on the server to include STRICT_TRANS_TABLES instead of checking "
+ + "for warnings on writes to the database, which is more efficient.", "3.1.2", MISC_CATEGORY,
Integer.MIN_VALUE);
+ private boolean jdbcCompliantTruncationForReads =
+ this.jdbcCompliantTruncation.getValueAsBoolean();
+
private MemorySizeConnectionProperty locatorFetchBufferSize = new MemorySizeConnectionProperty(
"locatorFetchBufferSize",
1024 * 1024,
@@ -2540,6 +2545,7 @@
.getValueAsBoolean();
this.maintainTimeStatsAsBoolean = this.maintainTimeStats
.getValueAsBoolean();
+ this.jdbcCompliantTruncationForReads = getJdbcCompliantTruncation();
}
/**
@@ -2938,6 +2944,7 @@
*/
public void setJdbcCompliantTruncation(boolean flag) {
this.jdbcCompliantTruncation.setValue(flag);
+ setJdbcCompliantTruncationForReads(flag);
}
/**
@@ -3579,4 +3586,13 @@
public int getPrepStmtCacheSqlLimit() {
return getPreparedStatementCacheSqlLimit();
}
+
+ protected boolean getJdbcCompliantTruncationForReads() {
+ return this.jdbcCompliantTruncationForReads;
+ }
+
+ protected void setJdbcCompliantTruncationForReads(
+ boolean jdbcCompliantTruncationForReads) {
+ this.jdbcCompliantTruncationForReads = jdbcCompliantTruncationForReads;
+ }
}
| Thread |
|---|
| • Connector/J commit: r5321 - branches/branch_3_1/connector-j/src/com/mysql/jdbc | mmatthews | 30 May |