本文整理汇总了Java中com.mysql.jdbc.Util.isJdbc4方法的典型用法代码示例。如果您正苦于以下问题:Java Util.isJdbc4方法的具体用法?Java Util.isJdbc4怎么用?Java Util.isJdbc4使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mysql.jdbc.Util
的用法示例。
在下文中一共展示了Util.isJdbc4方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
protected static ConnectionWrapper getInstance(MysqlPooledConnection mysqlPooledConnection, Connection mysqlConnection, boolean forXa) throws SQLException {
if (!Util.isJdbc4()) {
return new ConnectionWrapper(mysqlPooledConnection, mysqlConnection, forXa);
}
return (ConnectionWrapper) Util.handleNewInstance(JDBC_4_CONNECTION_WRAPPER_CTOR,
new Object[] { mysqlPooledConnection, mysqlConnection, Boolean.valueOf(forXa) }, mysqlPooledConnection.getExceptionInterceptor());
}
示例2: testReservedWords
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
public void testReservedWords() throws Exception {
if (Util.isJdbc4()) {
// there is a specific JCDB4 test for this
return;
}
final String mysqlKeywords = "ACCESSIBLE,ANALYZE,ASENSITIVE,BEFORE,BIGINT,BINARY,BLOB,CALL,CHANGE,CONDITION,DATABASE,DATABASES,DAY_HOUR,"
+ "DAY_MICROSECOND,DAY_MINUTE,DAY_SECOND,DELAYED,DETERMINISTIC,DISTINCTROW,DIV,DUAL,EACH,ELSEIF,ENCLOSED,ESCAPED,EXIT,EXPLAIN,FLOAT4,FLOAT8,"
+ "FORCE,FULLTEXT,GENERATED,HIGH_PRIORITY,HOUR_MICROSECOND,HOUR_MINUTE,HOUR_SECOND,IF,IGNORE,INDEX,INFILE,INOUT,INT1,INT2,INT3,INT4,INT8,"
+ "IO_AFTER_GTIDS,IO_BEFORE_GTIDS,ITERATE,KEYS,KILL,LEAVE,LIMIT,LINEAR,LINES,LOAD,LOCALTIME,LOCALTIMESTAMP,LOCK,LONG,LONGBLOB,LONGTEXT,LOOP,"
+ "LOW_PRIORITY,MASTER_BIND,MASTER_SSL_VERIFY_SERVER_CERT,MAXVALUE,MEDIUMBLOB,MEDIUMINT,MEDIUMTEXT,MIDDLEINT,MINUTE_MICROSECOND,MINUTE_SECOND,"
+ "MOD,MODIFIES,NO_WRITE_TO_BINLOG,OPTIMIZE,OPTIMIZER_COSTS,OPTIONALLY,OUT,OUTFILE,PARTITION,PURGE,RANGE,READS,READ_WRITE,REGEXP,RELEASE,"
+ "RENAME,REPEAT,REPLACE,REQUIRE,RESIGNAL,RETURN,RLIKE,SCHEMAS,SECOND_MICROSECOND,SENSITIVE,SEPARATOR,SHOW,SIGNAL,SPATIAL,SPECIFIC,"
+ "SQLEXCEPTION,SQLWARNING,SQL_BIG_RESULT,SQL_CALC_FOUND_ROWS,SQL_SMALL_RESULT,SSL,STARTING,STORED,STRAIGHT_JOIN,TERMINATED,TINYBLOB,TINYINT,"
+ "TINYTEXT,TRIGGER,UNDO,UNLOCK,UNSIGNED,USE,UTC_DATE,UTC_TIME,UTC_TIMESTAMP,VARBINARY,VARCHARACTER,VIRTUAL,WHILE,XOR,YEAR_MONTH,ZEROFILL";
assertEquals("MySQL keywords don't match expected.", mysqlKeywords, this.conn.getMetaData().getSQLKeywords());
}
示例3: testBug16634180
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Tests fix for Bug#16634180 - LOCK WAIT TIMEOUT EXCEEDED CAUSES SQLEXCEPTION, SHOULD CAUSE SQLTRANSIENTEXCEPTION
*
* @throws Exception
* if the test fails.
*/
public void testBug16634180() throws Exception {
if (Util.isJdbc4()) {
// relevant JDBC4+ test is testsuite.regression.jdbc4.ConnectionRegressionTest.testBug16634180()
return;
}
createTable("testBug16634180", "(pk integer primary key, val integer)", "InnoDB");
this.stmt.executeUpdate("insert into testBug16634180 values(0,0)");
Connection c1 = null;
Connection c2 = null;
try {
c1 = getConnectionWithProps(new Properties());
c1.setAutoCommit(false);
Statement s1 = c1.createStatement();
s1.executeUpdate("update testBug16634180 set val=val+1 where pk=0");
c2 = getConnectionWithProps(new Properties());
c2.setAutoCommit(false);
Statement s2 = c2.createStatement();
try {
s2.executeUpdate("update testBug16634180 set val=val+1 where pk=0");
fail("ER_LOCK_WAIT_TIMEOUT should be thrown.");
} catch (MySQLTransientException ex) {
assertEquals(MysqlErrorNumbers.ER_LOCK_WAIT_TIMEOUT, ex.getErrorCode());
assertEquals(SQLError.SQL_STATE_ROLLBACK_SERIALIZATION_FAILURE, ex.getSQLState());
assertEquals("Lock wait timeout exceeded; try restarting transaction", ex.getMessage());
}
} finally {
if (c1 != null) {
c1.close();
}
if (c2 != null) {
c2.close();
}
}
}
示例4: getInstance
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
protected static MysqlPooledConnection getInstance(com.mysql.jdbc.Connection connection) throws SQLException {
if (!Util.isJdbc4()) {
return new MysqlPooledConnection(connection);
}
return (MysqlPooledConnection) Util.handleNewInstance(JDBC_4_POOLED_CONNECTION_WRAPPER_CTOR, new Object[] { connection },
connection.getExceptionInterceptor());
}
示例5: getInstance
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
protected static MysqlXAConnection getInstance(com.mysql.jdbc.Connection mysqlConnection, boolean logXaCommands) throws SQLException {
if (!Util.isJdbc4()) {
return new MysqlXAConnection(mysqlConnection, logXaCommands);
}
return (MysqlXAConnection) Util.handleNewInstance(JDBC_4_XA_CONNECTION_WRAPPER_CTOR, new Object[] { mysqlConnection, Boolean.valueOf(logXaCommands) },
mysqlConnection.getExceptionInterceptor());
}
示例6: testCouplingOfCursorFetch
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Checks if setting useCursorFetch to "true" automatically enables
* server-side prepared statements.
*/
public void testCouplingOfCursorFetch() throws Exception {
if (!versionMeetsMinimum(5, 0)) {
return;
}
Connection fetchConn = null;
try {
Properties props = new Properties();
props.setProperty("useServerPrepStmts", "false"); // force the issue
props.setProperty("useCursorFetch", "true");
fetchConn = getConnectionWithProps(props);
String classname = "com.mysql.jdbc.ServerPreparedStatement";
if (Util.isJdbc42()) {
classname = "com.mysql.jdbc.JDBC42ServerPreparedStatement";
} else if (Util.isJdbc4()) {
classname = "com.mysql.jdbc.JDBC4ServerPreparedStatement";
}
assertEquals(classname, fetchConn.prepareStatement("SELECT 1").getClass().getName());
} finally {
if (fetchConn != null) {
fetchConn.close();
}
}
}
示例7: getInstance
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
protected static PreparedStatementWrapper getInstance(ConnectionWrapper c, MysqlPooledConnection conn, PreparedStatement toWrap) throws SQLException {
if (!Util.isJdbc4()) {
return new PreparedStatementWrapper(c, conn, toWrap);
}
return (PreparedStatementWrapper) Util.handleNewInstance(JDBC_4_PREPARED_STATEMENT_WRAPPER_CTOR, new Object[] { c, conn, toWrap },
conn.getExceptionInterceptor());
}
示例8: testBug73163
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Tests fix for BUG#73163 - IndexOutOfBoundsException thrown preparing statement.
*
* This bug occurs only if running with Java6+. Duplicated in testsuite.regression.StatementRegressionTest.jdbc4.testBug73163().
*
* @throws Exception
* if the test fails.
*/
public void testBug73163() throws Exception {
try {
this.stmt = this.conn.prepareStatement("LOAD DATA INFILE ? INTO TABLE testBug73163");
} catch (SQLException e) {
if (e.getCause() instanceof IndexOutOfBoundsException && Util.isJdbc4()) {
fail("IOOBE thrown in Java6+ while preparing a LOAD DATA statement with placeholders.");
} else {
throw e;
}
}
}
示例9: testBug73163
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Tests fix for BUG#73163 - IndexOutOfBoundsException thrown preparing statement.
*
* This bug occurs only if running with Java6+. Duplicated in testsuite.regression.StatementRegressionTest.testBug73163().
*
* @throws Exception
* if the test fails.
*/
public void testBug73163() throws Exception {
try {
stmt = conn.prepareStatement("LOAD DATA INFILE ? INTO TABLE testBug73163");
} catch (SQLException e) {
if (e.getCause() instanceof IndexOutOfBoundsException && Util.isJdbc4()) {
fail("IOOBE thrown in Java6+ while preparing a LOAD DATA statement with placeholders.");
} else {
throw e;
}
}
}
示例10: getInstance
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
protected static CallableStatementWrapper getInstance(ConnectionWrapper c, MysqlPooledConnection conn, CallableStatement toWrap) throws SQLException {
if (!Util.isJdbc4()) {
return new CallableStatementWrapper(c, conn, toWrap);
}
return (CallableStatementWrapper) Util.handleNewInstance(JDBC_4_CALLABLE_STATEMENT_WRAPPER_CTOR, new Object[] { c, conn, toWrap },
conn.getExceptionInterceptor());
}
示例11: testBug69298
import com.mysql.jdbc.Util; //导入方法依赖的package包/类
/**
* Tests fix for BUG#69298 - Different outcome from DatabaseMetaData.getFunctions() when using I__S.
*
* @throws Exception
* if the test fails.
*/
public void testBug69298() throws Exception {
if (Util.isJdbc4()) {
return;
}
Connection testConn;
createFunction("testBug69298_func", "(param_func INT) RETURNS INT COMMENT 'testBug69298_func comment' DETERMINISTIC RETURN 1");
createProcedure("testBug69298_proc", "(IN param_proc INT) COMMENT 'testBug69298_proc comment' SELECT 1");
// test with standard connection
assertFalse("Property useInformationSchema should be false", ((ConnectionProperties) this.conn).getUseInformationSchema());
assertTrue("Property getProceduresReturnsFunctions should be true", ((ConnectionProperties) this.conn).getGetProceduresReturnsFunctions());
checkGetProceduresForBug69298("Std. Connection MetaData", this.conn);
checkGetProcedureColumnsForBug69298("Std. Connection MetaData", this.conn);
// test with property useInformationSchema=true
testConn = getConnectionWithProps("useInformationSchema=true");
assertTrue("Property useInformationSchema should be true", ((ConnectionProperties) testConn).getUseInformationSchema());
assertTrue("Property getProceduresReturnsFunctions should be true", ((ConnectionProperties) testConn).getGetProceduresReturnsFunctions());
checkGetProceduresForBug69298("Prop. useInfoSchema(1) MetaData", testConn);
checkGetProcedureColumnsForBug69298("Prop. useInfoSchema(1) MetaData", testConn);
testConn.close();
// test with property getProceduresReturnsFunctions=false
testConn = getConnectionWithProps("getProceduresReturnsFunctions=false");
assertFalse("Property useInformationSchema should be false", ((ConnectionProperties) testConn).getUseInformationSchema());
assertFalse("Property getProceduresReturnsFunctions should be false", ((ConnectionProperties) testConn).getGetProceduresReturnsFunctions());
checkGetProceduresForBug69298("Prop. getProcRetFunc(0) MetaData", testConn);
checkGetProcedureColumnsForBug69298("Prop. getProcRetFunc(0) MetaData", testConn);
testConn.close();
// test with property useInformationSchema=true & getProceduresReturnsFunctions=false
testConn = getConnectionWithProps("useInformationSchema=true,getProceduresReturnsFunctions=false");
assertTrue("Property useInformationSchema should be true", ((ConnectionProperties) testConn).getUseInformationSchema());
assertFalse("Property getProceduresReturnsFunctions should be false", ((ConnectionProperties) testConn).getGetProceduresReturnsFunctions());
checkGetProceduresForBug69298("Prop. useInfoSchema(1) + getProcRetFunc(0) MetaData", testConn);
checkGetProcedureColumnsForBug69298("Prop. useInfoSchema(1) + getProcRetFunc(0) MetaData", testConn);
testConn.close();
}