⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectionproperties.java

📁 mysql的jdbc驱动
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		}		void setValue(int valueFlag) {			this.valueAsObject = new Integer(valueFlag);		}	}	class MemorySizeConnectionProperty extends IntegerConnectionProperty {		MemorySizeConnectionProperty(String propertyNameToSet,				int defaultValueToSet, int lowerBoundToSet,				int upperBoundToSet, String descriptionToSet,				String sinceVersionToSet, String category, int orderInCategory) {			super(propertyNameToSet, defaultValueToSet, lowerBoundToSet,					upperBoundToSet, descriptionToSet, sinceVersionToSet,					category, orderInCategory);			// TODO Auto-generated constructor stub		}		void initializeFrom(String extractedValue) throws SQLException {			if (extractedValue != null) {				if (extractedValue.endsWith("k")						|| extractedValue.endsWith("K")						|| extractedValue.endsWith("kb")						|| extractedValue.endsWith("Kb")						|| extractedValue.endsWith("kB")) {					multiplier = 1024;					int indexOfK = StringUtils.indexOfIgnoreCase(							extractedValue, "k");					extractedValue = extractedValue.substring(0, indexOfK);				} else if (extractedValue.endsWith("m")						|| extractedValue.endsWith("M")						|| extractedValue.endsWith("G")						|| extractedValue.endsWith("mb")						|| extractedValue.endsWith("Mb")						|| extractedValue.endsWith("mB")) {					multiplier = 1024 * 1024;					int indexOfM = StringUtils.indexOfIgnoreCase(							extractedValue, "m");					extractedValue = extractedValue.substring(0, indexOfM);				} else if (extractedValue.endsWith("g")						|| extractedValue.endsWith("G")						|| extractedValue.endsWith("gb")						|| extractedValue.endsWith("Gb")						|| extractedValue.endsWith("gB")) {					multiplier = 1024 * 1024 * 1024;					int indexOfG = StringUtils.indexOfIgnoreCase(							extractedValue, "g");					extractedValue = extractedValue.substring(0, indexOfG);				}			}			super.initializeFrom(extractedValue);		}		void setValue(String value) throws SQLException {			initializeFrom(value);		}	}	class StringConnectionProperty extends ConnectionProperty {		StringConnectionProperty(String propertyNameToSet,				String defaultValueToSet, String descriptionToSet,				String sinceVersionToSet, String category, int orderInCategory) {			this(propertyNameToSet, defaultValueToSet, null, descriptionToSet,					sinceVersionToSet, category, orderInCategory);		}		/**		 * DOCUMENT ME!		 * 		 * @param propertyNameToSet		 * @param defaultValueToSet		 * @param allowableValuesToSet		 * @param descriptionToSet		 * @param sinceVersionToSet		 *            DOCUMENT ME!		 */		StringConnectionProperty(String propertyNameToSet,				String defaultValueToSet, String[] allowableValuesToSet,				String descriptionToSet, String sinceVersionToSet,				String category, int orderInCategory) {			super(propertyNameToSet, defaultValueToSet, allowableValuesToSet,					0, 0, descriptionToSet, sinceVersionToSet, category,					orderInCategory);		}		String getValueAsString() {			return (String) this.valueAsObject;		}		/**		 * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#hasValueConstraints()		 */		boolean hasValueConstraints() {			return (this.allowableValues != null)					&& (this.allowableValues.length > 0);		}		/**		 * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#initializeFrom(java.util.Properties)		 */		void initializeFrom(String extractedValue) throws SQLException {			if (extractedValue != null) {				validateStringValues(extractedValue);				this.valueAsObject = extractedValue;			} else {				this.valueAsObject = this.defaultValue;			}		}		/**		 * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#isRangeBased()		 */		boolean isRangeBased() {			return false;		}		void setValue(String valueFlag) {			this.valueAsObject = valueFlag;		}	}	private static final String CONNECTION_AND_AUTH_CATEGORY = "Connection/Authentication";	private static final String DEBUGING_PROFILING_CATEGORY = "Debuging/Profiling";	private static final String HA_CATEGORY = "High Availability and Clustering";	private static final String MISC_CATEGORY = "Miscellaneous";	private static final String PERFORMANCE_CATEGORY = "Performance Extensions";	private static final String SECURITY_CATEGORY = "Security";	private static final String[] PROPERTY_CATEGORIES = new String[] {			CONNECTION_AND_AUTH_CATEGORY, HA_CATEGORY, SECURITY_CATEGORY,			PERFORMANCE_CATEGORY, DEBUGING_PROFILING_CATEGORY, MISC_CATEGORY };	private static final ArrayList PROPERTY_LIST = new ArrayList();	private static final String STANDARD_LOGGER_NAME = StandardLogger.class			.getName();	protected static final String ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL = "convertToNull";	protected static final String ZERO_DATETIME_BEHAVIOR_EXCEPTION = "exception";	protected static final String ZERO_DATETIME_BEHAVIOR_ROUND = "round";	static {		try {			java.lang.reflect.Field[] declaredFields = ConnectionProperties.class					.getDeclaredFields();			for (int i = 0; i < declaredFields.length; i++) {				if (ConnectionProperties.ConnectionProperty.class						.isAssignableFrom(declaredFields[i].getType())) {					PROPERTY_LIST.add(declaredFields[i]);				}			}		} catch (Exception ex) {			throw new RuntimeException(ex.toString());		}	}	/**	 * Exposes all ConnectionPropertyInfo instances as DriverPropertyInfo	 * 	 * @param info	 *            the properties to load into these ConnectionPropertyInfo	 *            instances	 * @param slotsToReserve	 *            the number of DPI slots to reserve for 'standard' DPI	 *            properties (user, host, password, etc)	 * @return a list of all ConnectionPropertyInfo instances, as	 *         DriverPropertyInfo	 * @throws SQLException	 *             if an error occurs	 */	protected static DriverPropertyInfo[] exposeAsDriverPropertyInfo(			Properties info, int slotsToReserve) throws SQLException {		return (new ConnectionProperties() {		}).exposeAsDriverPropertyInfoInternal(info, slotsToReserve);	}	private BooleanConnectionProperty allowLoadLocalInfile = new BooleanConnectionProperty(			"allowLoadLocalInfile",			true,			"Should the driver allow use of 'LOAD DATA LOCAL INFILE...' (defaults to 'true').",			"3.0.3", SECURITY_CATEGORY, Integer.MAX_VALUE);	private BooleanConnectionProperty allowMultiQueries = new BooleanConnectionProperty(			"allowMultiQueries",			false,			"Allow the use of ';' to delimit multiple queries during one statement (true/false, defaults to 'false'",			"3.1.1", SECURITY_CATEGORY, 1);	private BooleanConnectionProperty allowNanAndInf = new BooleanConnectionProperty(			"allowNanAndInf",			false,			"Should the driver allow NaN or +/- INF values in PreparedStatement.setDouble()?",			"3.1.5", MISC_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty allowUrlInLocalInfile = new BooleanConnectionProperty(			"allowUrlInLocalInfile",			false,			"Should the driver allow URLs in 'LOAD DATA LOCAL INFILE' statements?",			"3.1.4", SECURITY_CATEGORY, Integer.MAX_VALUE);	private BooleanConnectionProperty alwaysSendSetIsolation = new BooleanConnectionProperty(			"alwaysSendSetIsolation",			true,			"Should the driver always communicate with the database when "					+ " Connection.setTransactionIsolation() is called? "					+ "If set to false, the driver will only communicate with the "					+ "database when the requested transaction isolation is different "					+ "than the whichever is newer, the last value that was set via "					+ "Connection.setTransactionIsolation(), or the value that was read from "					+ "the server when the connection was established.",			"3.1.7", PERFORMANCE_CATEGORY, Integer.MAX_VALUE);	private BooleanConnectionProperty autoDeserialize = new BooleanConnectionProperty(			"autoDeserialize",			false,			"Should the driver automatically detect and de-serialize objects stored in BLOB fields?",			"3.1.5", MISC_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty autoGenerateTestcaseScript = new BooleanConnectionProperty(			"autoGenerateTestcaseScript", false,			"Should the driver dump the SQL it is executing, including server-side "					+ "prepared statements to STDERR?", "3.1.9",			DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE);	private boolean autoGenerateTestcaseScriptAsBoolean = false;	private BooleanConnectionProperty autoReconnect = new BooleanConnectionProperty(			"autoReconnect",			false,			"Should the driver try to re-establish stale and/or dead connections? "					+ "  If enabled the driver will throw an exception for a queries issued on a stale or dead connection, "					+ " which belong to the current transaction, but will attempt reconnect before the next query issued on the "					+ "connection in a new transaction. The use of this feature "					+ "is not recommended, because it has side effects related to session state and data consistency when applications don't"					+ "handle SQLExceptions properly, and is only designed to be used "					+ "when you are unable to configure your application to handle SQLExceptions resulting from dead and"					+ "stale connections properly. Alternatively, investigate setting the MySQL server variable \"wait_timeout\""					+ "to some high value rather than the default of 8 hours.",			"1.1", HA_CATEGORY, 0);	private BooleanConnectionProperty autoReconnectForPools = new BooleanConnectionProperty(			"autoReconnectForPools",			false,			"Use a reconnection strategy appropriate for connection pools (defaults to 'false')",			"3.1.3", HA_CATEGORY, 1);	private boolean autoReconnectForPoolsAsBoolean = false;	private MemorySizeConnectionProperty blobSendChunkSize = new MemorySizeConnectionProperty(			"blobSendChunkSize",			1024 * 1024,			1,			Integer.MAX_VALUE,			"Chunk to use when sending BLOB/CLOBs via ServerPreparedStatements",			"3.1.9", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty cacheCallableStatements = new BooleanConnectionProperty(			"cacheCallableStmts", false,			"Should the driver cache the parsing stage of CallableStatements",			"3.1.2", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty cachePreparedStatements = new BooleanConnectionProperty(			"cachePrepStmts",			false,			"Should the driver cache the parsing stage of PreparedStatements of client-side "					+ "prepared statements, the \"check\" for suitability of server-side prepared "					+ " and server-side prepared statements themselves?",			"3.0.10", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty cacheResultSetMetadata = new BooleanConnectionProperty(			"cacheResultSetMetadata",			false,			"Should the driver cache ResultSetMetaData for Statements and PreparedStatements? (Req. JDK-1.4+, true/false, default 'false')",			"3.1.1", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private boolean cacheResultSetMetaDataAsBoolean;	private BooleanConnectionProperty cacheServerConfiguration = new BooleanConnectionProperty(			"cacheServerConfiguration",			false,			"Should the driver cache the results of "					+ "'SHOW VARIABLES' and 'SHOW COLLATION' on a per-URL basis?",			"3.1.5", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private IntegerConnectionProperty callableStatementCacheSize = new IntegerConnectionProperty(			"callableStmtCacheSize",			100,			0,			Integer.MAX_VALUE,			"If 'cacheCallableStmts' is enabled, how many callable statements should be cached?",			"3.1.2", PERFORMANCE_CATEGORY, 5);	private BooleanConnectionProperty capitalizeTypeNames = new BooleanConnectionProperty(			"capitalizeTypeNames",			false,			"Capitalize type names in DatabaseMetaData? (usually only useful when using WebObjects, true/false, defaults to 'false')",			"2.0.7", MISC_CATEGORY, Integer.MIN_VALUE);	private StringConnectionProperty characterEncoding = new StringConnectionProperty(			"characterEncoding",			null,			"If 'useUnicode' is set to true, what character encoding should the driver use when dealing with strings? (defaults is to 'autodetect')",			"1.1g", MISC_CATEGORY, 5);	private String characterEncodingAsString = null;	private StringConnectionProperty characterSetResults = new StringConnectionProperty(			"characterSetResults", null,			"Character set to tell the server to return results as.", "3.0.13",			MISC_CATEGORY, 6);	private BooleanConnectionProperty clobberStreamingResults = new BooleanConnectionProperty(			"clobberStreamingResults",			false,			"This will cause a 'streaming' ResultSet to be automatically closed, "					+ "and any outstanding data still streaming from the server to be discarded if another query is executed "					+ "before all the data has been read from the server.",			"3.0.9", MISC_CATEGORY, Integer.MIN_VALUE);	private StringConnectionProperty connectionCollation = new StringConnectionProperty(			"connectionCollation",			null,			"If set, tells the server to use this collation via 'set collation_connection'",			"3.0.13", MISC_CATEGORY, 7);	private IntegerConnectionProperty connectTimeout = new IntegerConnectionProperty(			"connectTimeout", 0, 0, Integer.MAX_VALUE,			"Timeout for socket connect (in milliseconds), with 0 being no timeout. "					+ "Only works on JDK-1.4 or newer. Defaults to '0'.",			"3.0.1", CONNECTION_AND_AUTH_CATEGORY, 9);	private BooleanConnectionProperty continueBatchOnError = new BooleanConnectionProperty(			"continueBatchOnError",			true,			"Should the driver continue processing batch commands if "					+ "one statement fails. The JDBC spec allows either way (defaults to 'true').",			"3.0.3", MISC_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty createDatabaseIfNotExist = new BooleanConnectionProperty(			"createDatabaseIfNotExist",			false,			"Creates the database given in the URL if it doesn't yet exist. Assumes "					+ " the configured user has permissions to create databases.",			"3.1.9", MISC_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty detectServerPreparedStmts = new BooleanConnectionProperty(			"useServerPrepStmts",			true,			"Use server-side prepared statements if the server supports them? (defaults to 'true').",			"3.1.0", MISC_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty dontTrackOpenResources = new BooleanConnectionProperty(			"dontTrackOpenResources",			false,			"The JDBC specification requires the driver to automatically track and close resources, "					+ "however if your application doesn't do a good job of "					+ "explicitly calling close() on statements or result sets, "					+ "this can cause memory leakage. Setting this property to true "					+ "relaxes this constraint, and can be more memory efficient for "					+ "some applications.", "3.1.7", PERFORMANCE_CATEGORY,			Integer.MIN_VALUE);	private BooleanConnectionProperty dumpQueriesOnException = new BooleanConnectionProperty(			"dumpQueriesOnException",			false,			"Should the driver dump the contents of the query sent to the server in the message for SQLExceptions?",			"3.1.3", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty dynamicCalendars = new BooleanConnectionProperty(			"dynamicCalendars",			false,			"Should the driver retrieve the default"					+ " calendar when required, or cache it per connection/session?",			"3.1.5", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty elideSetAutoCommits = new BooleanConnectionProperty(			"elideSetAutoCommits",			false,			"If using MySQL-4.1 or newer, should the driver only issue 'set autocommit=n' queries when the server's state doesn't match the requested state by Connection.setAutoCommit(boolean)?",			"3.1.3", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty emptyStringsConvertToZero = new BooleanConnectionProperty(			"emptyStringsConvertToZero", true,			"Should the driver allow conversions from empty string "					+ "fields to numeric values of '0'?", "3.1.8",			MISC_CATEGORY, Integer.MIN_VALUE);	private BooleanConnectionProperty emulateLocators = new BooleanConnectionProperty(			"emulateLocators", false, "N/A", "3.1.0", MISC_CATEGORY,			Integer.MIN_VALUE);	private BooleanConnectionProperty emulateUnsupportedPstmts = new BooleanConnectionProperty(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -