Connection.java
上传用户:tanyanyong
上传日期:2013-06-23
资源大小:1355k
文件大小:130k
- *
- * @return DOCUMENT ME!
- */
- int getNetBufferLength() {
- return this.netBufferLength;
- }
- boolean isPedantic() {
- return this.pedantic;
- }
- void setReadInfoMsgEnabled(boolean flag) {
- this.readInfoMsg = flag;
- }
- boolean isReadInfoMsgEnabled() {
- return this.readInfoMsg;
- }
- int getServerMajorVersion() {
- return this.io.getServerMajorVersion();
- }
- int getServerMinorVersion() {
- return this.io.getServerMinorVersion();
- }
- int getServerSubMinorVersion() {
- return this.io.getServerSubMinorVersion();
- }
- String getServerVersion() {
- return this.io.getServerVersion();
- }
- String getURL() {
- return this.myURL;
- }
- /**
- * Set whether or not this connection should use SSL
- *
- * @param flag DOCUMENT ME!
- */
- void setUseSSL(boolean flag) {
- this.useSSL = flag;
- }
- String getUser() {
- return this.user;
- }
- boolean alwaysClearStream() {
- return this.alwaysClearStream;
- }
- boolean continueBatchOnError() {
- return this.continueBatchOnError;
- }
- /**
- * Send a query to the server. Returns one of the ResultSet objects. This
- * is synchronized, so Statement's queries will be serialized.
- *
- * @param sql the SQL statement to be executed
- * @param maxRowsToRetreive DOCUMENT ME!
- * @param catalog DOCUMENT ME!
- *
- * @return a ResultSet holding the results
- *
- * @exception java.sql.SQLException if a database error occurs
- */
- ResultSet execSQL(String sql, int maxRowsToRetreive, String catalog)
- throws java.sql.SQLException {
- if (Driver.TRACE) {
- Object[] args = { sql, new Integer(maxRowsToRetreive) };
- Debug.methodCall(this, "execSQL", args);
- }
- return execSQL(sql, maxRowsToRetreive, null,
- java.sql.ResultSet.CONCUR_READ_ONLY, catalog);
- }
- ResultSet execSQL(String sql, int maxRows, int resultSetType,
- boolean streamResults, boolean queryIsSelectOnly, String catalog)
- throws SQLException {
- return execSQL(sql, maxRows, null, resultSetType, streamResults,
- queryIsSelectOnly, catalog);
- }
- ResultSet execSQL(String sql, int maxRows, Buffer packet, String catalog)
- throws java.sql.SQLException {
- return execSQL(sql, maxRows, packet,
- java.sql.ResultSet.CONCUR_READ_ONLY, catalog);
- }
- ResultSet execSQL(String sql, int maxRows, Buffer packet,
- int resultSetType, String catalog) throws java.sql.SQLException {
- return execSQL(sql, maxRows, packet, resultSetType, true, false, catalog);
- }
- ResultSet execSQL(String sql, int maxRows, Buffer packet,
- int resultSetType, boolean streamResults, boolean queryIsSelectOnly,
- String catalog) throws java.sql.SQLException {
- if (Driver.TRACE) {
- Object[] args = { sql, new Integer(maxRows), packet };
- Debug.methodCall(this, "execSQL", args);
- }
- if ((sql == null) || (sql.length() == 0)) {
- if (packet == null) {
- throw new SQLException("Query can not be null or empty",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- }
- //
- // Fall-back if the master is back online if we've
- // issued queriesBeforeRetryMaster queries since
- // we failed over
- //
- synchronized (this.mutex) {
- this.lastQueryFinishedTime = 0; // we're busy!
- pingAndReconnect(false);
- try {
- int realMaxRows = (maxRows == -1) ? MysqlDefs.MAX_ROWS : maxRows;
- if (packet == null) {
- String encoding = null;
- if (useUnicode()) {
- encoding = getEncoding();
- }
- return this.io.sqlQuery(sql, realMaxRows, encoding, this,
- resultSetType, streamResults, catalog);
- } else {
- return this.io.sqlQueryDirect(packet, realMaxRows, this,
- resultSetType, streamResults, catalog);
- }
- } catch (java.sql.SQLException sqlE) {
- // don't clobber SQL exceptions
- String sqlState = sqlE.getSQLState();
- if ((sqlState != null)
- && sqlState.equals(
- SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE)) {
- cleanup(sqlE);
- }
- throw sqlE;
- } catch (Exception ex) {
- if (ex instanceof IOException) {
- cleanup(ex);
- }
- String exceptionType = ex.getClass().getName();
- String exceptionMessage = ex.getMessage();
- if (!this.useParanoidErrorMessages()) {
- exceptionMessage += "nnNested Stack Trace:n";
- exceptionMessage += Util.stackTraceToString(ex);
- }
- throw new java.sql.SQLException(
- "Error during query: Unexpected Exception: "
- + exceptionType + " message given: " + exceptionMessage,
- SQLError.SQL_STATE_GENERAL_ERROR);
- } finally {
- this.lastQueryFinishedTime = System.currentTimeMillis();
- }
- }
- }
- /**
- * Has the maxRows value changed?
- *
- * @param stmt DOCUMENT ME!
- */
- void maxRowsChanged(Statement stmt) {
- synchronized (this.mutex) {
- if (this.statementsUsingMaxRows == null) {
- this.statementsUsingMaxRows = new HashMap();
- }
- this.statementsUsingMaxRows.put(stmt, stmt);
- this.maxRowsChanged = true;
- }
- }
- /**
- * Called by statements on their .close() to let the connection know when
- * it is safe to set the connection back to 'default' row limits.
- *
- * @param stmt the statement releasing it's max-rows requirement
- *
- * @throws SQLException if a database error occurs issuing the statement
- * that sets the limit default.
- */
- void unsetMaxRows(Statement stmt) throws SQLException {
- synchronized (this.mutex) {
- if (this.statementsUsingMaxRows != null) {
- Object found = this.statementsUsingMaxRows.remove(stmt);
- if ((found != null)
- && (this.statementsUsingMaxRows.size() == 0)) {
- execSQL("SET OPTION SQL_SELECT_LIMIT=DEFAULT", -1,
- this.database);
- this.maxRowsChanged = false;
- }
- }
- }
- }
- boolean useAnsiQuotedIdentifiers() {
- return this.useAnsiQuotes;
- }
- boolean useHostsInPrivileges() {
- return this.useHostsInPrivileges;
- }
- /**
- * Has maxRows() been set?
- *
- * @return DOCUMENT ME!
- */
- boolean useMaxRows() {
- synchronized (this.mutex) {
- return this.maxRowsChanged;
- }
- }
- boolean useStreamLengthsInPrepStmts() {
- return this.useStreamLengthsInPrepStmts;
- }
- /**
- * Sets state for a failed-over connection
- *
- * @throws SQLException DOCUMENT ME!
- */
- private void setFailedOverState() throws SQLException {
- // FIXME: User Selectable?
- setReadOnly(true);
- this.queriesIssuedFailedOver = 0;
- this.failedOver = true;
- this.masterFailTimeMillis = System.currentTimeMillis();
- }
- private void checkClosed() throws SQLException {
- if (this.isClosed) {
- StringBuffer exceptionMessage = new StringBuffer();
- exceptionMessage.append(
- "No operations allowed after connection closed.");
- if (!this.paranoid) {
- if (this.forcedCloseReason != null) {
- exceptionMessage.append(
- "nnConnection was closed due to the following exception:");
- exceptionMessage.append(Util.stackTraceToString(
- this.forcedCloseReason));
- } else if (this.explicitCloseLocation != null) {
- exceptionMessage.append(
- "nnConnection was closed explicitly by the application at the following location:");
- exceptionMessage.append(Util.stackTraceToString(
- this.explicitCloseLocation));
- }
- }
- throw new SQLException(exceptionMessage.toString(), "08003");
- }
- }
- /**
- * If useUnicode flag is set and explicit client character encoding isn't
- * specified then assign encoding from server if any.
- *
- * @throws SQLException DOCUMENT ME!
- */
- private void checkServerEncoding() throws SQLException {
- if (this.doUnicode && (this.encoding != null)) {
- // spec'd by client, don't map, but check
- // for character encoding 'overlaps' when using
- // pre-4.1 servers
- if (!this.io.versionMeetsMinimum(4, 1, 0)) {
- if ("ISO8859_2".equals("this.encoding")) {
- throw new SQLException(
- "Character encoding 'ISO8859_2' specified in JDBC URL which maps to multiple MySQL character encodings:"
- + "nn" + "* 'latin2'n" + "* 'czech'n"
- + "* 'hungarian'n" + "* 'croat'n"
- + "nSpecify one of the above encodings using the 'mysqlEncoding' connection property.",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- } else if ("ISO8859_13".equals("this.encoding")) {
- throw new SQLException(
- "Character encoding 'ISO8859_13' specified in JDBC URL which maps to multiple MySQL character encodings:"
- + "nn" + "* 'latvian'n" + "* 'latvian1'n"
- + "* 'estonia'n"
- + "nSpecify one of the above encodings using the 'mysqlEncoding' connection property.",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- return;
- }
- this.mysqlEncodingName = (String) this.serverVariables.get(
- "character_set");
- if (this.mysqlEncodingName == null) {
- // must be 4.1.1 or newer?
- this.mysqlEncodingName = (String) this.serverVariables.get(
- "character_set_client");
- }
- String javaEncodingName = null;
- if (this.mysqlEncodingName != null) {
- javaEncodingName = (String) charsetMap.get(this.mysqlEncodingName
- .toUpperCase());
- }
- //
- // First check if we can do the encoding ourselves
- //
- if (!this.doUnicode && (javaEncodingName != null)) {
- SingleByteCharsetConverter converter = getCharsetConverter(javaEncodingName);
- if (converter != null) { // we know how to convert this ourselves
- this.doUnicode = true; // force the issue
- this.encoding = javaEncodingName;
- return;
- }
- }
- //
- // Now, try and find a Java I/O converter that can do
- // the encoding for us
- //
- if (this.mysqlEncodingName != null) {
- if (javaEncodingName == null) {
- // We don't have a mapping for it, so try
- // and canonicalize the name....
- if (Character.isLowerCase(this.mysqlEncodingName.charAt(0))) {
- char[] ach = this.mysqlEncodingName.toCharArray();
- ach[0] = Character.toUpperCase(this.mysqlEncodingName
- .charAt(0));
- this.encoding = new String(ach);
- }
- }
- //
- // Attempt to use the encoding, and bail out if it
- // can't be used
- //
- try {
- "abc".getBytes(javaEncodingName);
- this.encoding = javaEncodingName;
- this.doUnicode = true;
- } catch (UnsupportedEncodingException UE) {
- throw new SQLException(
- "The driver can not map the character encoding '"
- + this.encoding + "' that your server is using "
- + "to a character encoding your JVM understands. You "
- + "can specify this mapping manually by adding "useUnicode=true" "
- + "as well as "characterEncoding=[an_encoding_your_jvm_understands]" "
- + "to your JDBC URL.",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- }
- /**
- * Set transaction isolation level to the value received from server if
- * any. Is called by connectionInit(...)
- *
- * @throws SQLException DOCUMENT ME!
- */
- private void checkTransactionIsolationLevel() throws SQLException {
- String txIsolationName = null;
- if (this.io.versionMeetsMinimum(4, 0, 3)) {
- txIsolationName = "tx_isolation";
- } else {
- txIsolationName = "transaction_isolation";
- }
- String s = (String) this.serverVariables.get(txIsolationName);
- if (s != null) {
- Integer intTI = (Integer) mapTransIsolationName2Value.get(s);
- if (intTI != null) {
- isolationLevel = intTI.intValue();
- }
- }
- }
- /**
- * Destroys this connection and any underlying resources
- *
- * @param cleanupReason DOCUMENT ME!
- */
- private void cleanup(Throwable cleanupReason) {
- try {
- if ((this.io != null) && !isClosed()) {
- realClose(false, false);
- } else if (this.io != null) {
- this.io.forceClose();
- }
- } catch (SQLException sqlEx) {
- // ignore, we're going away.
- }
- this.isClosed = true;
- this.forcedCloseReason = cleanupReason;
- }
- private void detectFloatingPointStyle() throws SQLException {
- java.sql.Statement stmt = null;
- java.sql.ResultSet rs = null;
- try {
- stmt = createStatement();
- if (stmt.getMaxRows() != 0) {
- stmt.setMaxRows(0);
- }
- rs = stmt.executeQuery(
- "select round('inf'), round('-inf'), round('nan')");
- if (rs.next()) {
- String posInf = rs.getString(1);
- if ("inf".equalsIgnoreCase(posInf)) {
- this.positiveInfinityRep = "'inf'";
- this.positiveInfinityRepIsClipped = false;
- }
- String negInf = rs.getString(2);
- if ("-inf".equalsIgnoreCase(negInf)) {
- this.negativeInfinityRep = "'-inf'";
- this.negativeInfinityRepIsClipped = false;
- }
- String nan = rs.getString(3);
- if ("nan".equalsIgnoreCase(nan)) {
- this.notANumberRep = "'nan'";
- this.notANumberRepIsClipped = false;
- }
- }
- rs.close();
- rs = null;
- stmt.close();
- stmt = null;
- } catch (SQLException sqlEx) {
- ; // ignore here, we default to lowest-common denominator
- } finally {
- if (rs != null) {
- try {
- rs.close();
- } catch (SQLException sqlEx) {
- ; // ignore
- }
- rs = null;
- }
- if (stmt != null) {
- try {
- stmt.close();
- } catch (SQLException sqlEx) {
- ; // ignore
- }
- stmt = null;
- }
- }
- }
- /**
- * Initializes driver properties that come from URL or properties passed to
- * the driver manager.
- *
- * @param info DOCUMENT ME!
- *
- * @throws SQLException DOCUMENT ME!
- */
- private void initializeDriverProperties(Properties info)
- throws SQLException {
- this.socketFactoryClassName = info.getProperty("socketFactory",
- DEFAULT_SOCKET_FACTORY);
- this.useUnbufferedInput = "TRUE".equalsIgnoreCase(info.getProperty(
- "useUnbufferedInput"));
- if (info.getProperty("cachePrepStmts") != null) {
- this.cachePreparedStatements = info.getProperty("cachePrepStmts")
- .equalsIgnoreCase("TRUE");
- if (this.cachePreparedStatements) {
- if (info.getProperty("prepStmtCacheSize") != null) {
- try {
- this.preparedStatementCacheSize = Integer.parseInt(info
- .getProperty("prepStmtCacheSize"));
- if (this.preparedStatementCacheSize < 0) {
- throw new SQLException("Connection property 'prepStmtCacheSize' must be a non-negative integer value.",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- } catch (NumberFormatException nfe) {
- throw new SQLException("Connection property 'prepStmtCacheSize' must be a non-negative integer value.",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- }
- if (info.getProperty("prepStmtCacheSqlLimit") != null) {
- try {
- this.preparedStatementCacheMaxSqlSize = Integer
- .parseInt(info.getProperty("prepStmtCacheSqlLimit"));
- if (this.preparedStatementCacheMaxSqlSize < 0) {
- throw new SQLException("Connection property 'prepStmtCacheSqlLimit' must be a non-negative integer value.",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- } catch (NumberFormatException nfe) {
- throw new SQLException("Connection property 'prepStmtCacheSqlLimit' must be a non-negative integer value.",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- }
- this.cachedPreparedStatementParams = new HashMap(this.preparedStatementCacheSize);
- }
- }
- if (info.getProperty("alwaysClearStream") != null) {
- this.alwaysClearStream = info.getProperty("alwaysClearStream")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("reconnectAtTxEnd") != null) {
- this.reconnectAtTxEnd = info.getProperty("reconnectAtTxEnd")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("clobberStreamingResults") != null) {
- this.clobberStreamingResults = info.getProperty(
- "clobberStreamingResults").equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("strictUpdates") != null) {
- this.strictUpdates = info.getProperty("strictUpdates")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("ignoreNonTxTables") != null) {
- this.ignoreNonTxTables = info.getProperty("ignoreNonTxTables")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("secondsBeforeRetryMaster") != null) {
- String secondsBeforeRetryStr = info.getProperty(
- "secondsBeforeRetryMaster");
- try {
- int seconds = Integer.parseInt(secondsBeforeRetryStr);
- if (seconds < 1) {
- throw new SQLException("Illegal (< 1) value '"
- + secondsBeforeRetryStr
- + "' for 'secondsBeforeRetryMaster'",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- this.secondsBeforeRetryMaster = seconds;
- } catch (NumberFormatException nfe) {
- throw new SQLException("Illegal non-numeric value '"
- + secondsBeforeRetryStr
- + "' for 'secondsBeforeRetryMaster'",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- }
- if (info.getProperty("queriesBeforeRetryMaster") != null) {
- String queriesBeforeRetryStr = info.getProperty(
- "queriesBeforeRetryMaster");
- try {
- this.queriesBeforeRetryMaster = Integer.parseInt(queriesBeforeRetryStr);
- } catch (NumberFormatException nfe) {
- throw new SQLException("Illegal non-numeric value '"
- + queriesBeforeRetryStr
- + "' for 'queriesBeforeRetryMaster'",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- }
- if (info.getProperty("allowLoadLocalInfile") != null) {
- this.allowLoadLocalInfile = info.getProperty("allowLoadLocalInfile")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("continueBatchOnError") != null) {
- this.continueBatchOnError = info.getProperty("continueBatchOnError")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("pedantic") != null) {
- this.pedantic = info.getProperty("pedantic").equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("useStreamLengthsInPrepStmts") != null) {
- this.useStreamLengthsInPrepStmts = info.getProperty(
- "useStreamLengthsInPrepStmts").equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("useTimezone") != null) {
- this.useTimezone = info.getProperty("useTimezone").equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("relaxAutoCommit") != null) {
- this.relaxAutoCommit = info.getProperty("relaxAutoCommit")
- .equalsIgnoreCase("TRUE");
- } else if (info.getProperty("relaxAutocommit") != null) {
- this.relaxAutoCommit = info.getProperty("relaxAutocommit")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("paranoid") != null) {
- this.paranoid = info.getProperty("paranoid").equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("autoReconnect") != null) {
- this.highAvailability = info.getProperty("autoReconnect")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("capitalizeTypeNames") != null) {
- this.capitalizeDBMDTypes = info.getProperty("capitalizeTypeNames")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("ultraDevHack") != null) {
- this.useUltraDevWorkAround = info.getProperty("ultraDevHack")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("strictFloatingPoint") != null) {
- this.strictFloatingPoint = info.getProperty("strictFloatingPoint")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("useSSL") != null) {
- this.useSSL = info.getProperty("useSSL").equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("useCompression") != null) {
- this.useCompression = info.getProperty("useCompression")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("socketTimeout") != null) {
- try {
- int n = Integer.parseInt(info.getProperty("socketTimeout"));
- if (n < 0) {
- throw new SQLException("socketTimeout can not " + "be < 0",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- this.socketTimeout = n;
- } catch (NumberFormatException NFE) {
- throw new SQLException("Illegal parameter '"
- + info.getProperty("socketTimeout") + "' for socketTimeout",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- if (this.highAvailability) {
- if (info.getProperty("maxReconnects") != null) {
- try {
- int n = Integer.parseInt(info.getProperty("maxReconnects"));
- this.maxReconnects = n;
- } catch (NumberFormatException NFE) {
- throw new SQLException("Illegal parameter '"
- + info.getProperty("maxReconnects")
- + "' for maxReconnects",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- if (info.getProperty("initialTimeout") != null) {
- try {
- double n = Integer.parseInt(info.getProperty(
- "initialTimeout"));
- this.initialTimeout = n;
- } catch (NumberFormatException NFE) {
- throw new SQLException("Illegal parameter '"
- + info.getProperty("initialTimeout")
- + "' for initialTimeout",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- }
- if (info.getProperty("maxRows") != null) {
- try {
- int n = Integer.parseInt(info.getProperty("maxRows"));
- if (n == 0) {
- n = -1;
- }
- // adjust so that it will become MysqlDefs.MAX_ROWS
- // in execSQL()
- this.maxRows = n;
- this.maxRowsChanged = true;
- } catch (NumberFormatException NFE) {
- throw new SQLException("Illegal parameter '"
- + info.getProperty("maxRows") + "' for maxRows",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- if (info.getProperty("useHostsInPrivileges") != null) {
- this.useHostsInPrivileges = info.getProperty("useHostsInPrivileges")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("interactiveClient") != null) {
- this.isInteractiveClient = info.getProperty("interactiveClient")
- .equalsIgnoreCase("TRUE");
- }
- if (info.getProperty("useUnicode") != null) {
- this.doUnicode = info.getProperty("useUnicode").equalsIgnoreCase("TRUE");
- }
- if (this.doUnicode) {
- if (info.getProperty("mysqlEncoding") != null) {
- this.mysqlEncodingName = info.getProperty("mysqlEncoding");
- }
- if (info.getProperty("characterEncoding") != null) {
- this.encoding = info.getProperty("characterEncoding");
- // Attempt to use the encoding, and bail out if it
- // can't be used
- try {
- String testString = "abc";
- testString.getBytes(this.encoding);
- } catch (UnsupportedEncodingException UE) {
- throw new SQLException("Unsupported character "
- + "encoding '" + this.encoding + "'.",
- SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
- }
- }
- }
- }
- /**
- * Sets varying properties that depend on server information. Called once
- * we have connected to the server.
- *
- * @param info DOCUMENT ME!
- *
- * @throws SQLException DOCUMENT ME!
- */
- private void initializePropsFromServer(Properties info)
- throws SQLException {
- if (this.io.versionMeetsMinimum(3, 22, 1)) {
- this.useFastPing = true;
- }
- detectFloatingPointStyle();
- this.serverVariables.clear();
- //
- // If version is greater than 3.21.22 get the server
- // variables.
- if (this.io.versionMeetsMinimum(3, 21, 22)) {
- com.mysql.jdbc.Statement stmt = null;
- com.mysql.jdbc.ResultSet results = null;
- try {
- stmt = (com.mysql.jdbc.Statement) createStatement();
- if (stmt.getMaxRows() != 0) {
- stmt.setMaxRows(0);
- }
- results = (com.mysql.jdbc.ResultSet) stmt.executeQuery(
- "SHOW VARIABLES");
- while (results.next()) {
- this.serverVariables.put(results.getString(1),
- results.getString(2));
- }
- } catch (java.sql.SQLException e) {
- throw e;
- } finally {
- if (results != null) {
- try {
- results.close();
- } catch (java.sql.SQLException sqlE) {
- ;
- }
- }
- if (stmt != null) {
- try {
- stmt.close();
- } catch (java.sql.SQLException sqlE) {
- ;
- }
- }
- }
- String lowerCaseTables = (String) serverVariables.get(
- "lower_case_table_names");
- this.lowerCaseTableNames = "on".equalsIgnoreCase(lowerCaseTables)
- || "1".equalsIgnoreCase(lowerCaseTables)
- || "2".equalsIgnoreCase(lowerCaseTables);
- if (this.useTimezone
- && this.serverVariables.containsKey("timezone")) {
- // user can specify/override as property
- String canoncicalTimezone = this.props.getProperty(
- "serverTimezone");
- if ((canoncicalTimezone == null)
- || (canoncicalTimezone.length() == 0)) {
- String serverTimezoneStr = (String) this.serverVariables
- .get("timezone");
- try {
- canoncicalTimezone = TimeUtil.getCanoncialTimezone(serverTimezoneStr);
- if (canoncicalTimezone == null) {
- throw new SQLException("Can't map timezone '"
- + serverTimezoneStr + "' to "
- + " canonical timezone.",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- } catch (IllegalArgumentException iae) {
- throw new SQLException(iae.getMessage(),
- SQLError.SQL_STATE_GENERAL_ERROR);
- }
- }
- serverTimezone = TimeZone.getTimeZone(canoncicalTimezone);
- //
- // The Calendar class has the behavior of mapping
- // unknown timezones to 'GMT' instead of throwing an
- // exception, so we must check for this...
- //
- if (!canoncicalTimezone.equalsIgnoreCase("GMT")
- && serverTimezone.getID().equals("GMT")) {
- throw new SQLException("No timezone mapping entry for '"
- + canoncicalTimezone + "'",
- SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
- }
- }
- if (this.serverVariables.containsKey("max_allowed_packet")) {
- this.maxAllowedPacket = Integer.parseInt((String) this.serverVariables
- .get("max_allowed_packet"));
- }
- if (this.serverVariables.containsKey("net_buffer_length")) {
- this.netBufferLength = Integer.parseInt((String) this.serverVariables
- .get("net_buffer_length"));
- }
- checkTransactionIsolationLevel();
- checkServerEncoding();
- this.io.checkForCharsetMismatch();
- }
- if (this.io.versionMeetsMinimum(3, 23, 15)) {
- this.transactionsSupported = true;
- setAutoCommit(true); // to override anything
- // the server is set to...reqd
- // by JDBC spec.
- } else {
- this.transactionsSupported = false;
- }
- if (this.io.versionMeetsMinimum(3, 23, 36)) {
- this.hasIsolationLevels = true;
- } else {
- this.hasIsolationLevels = false;
- }
- // Start logging perf/profile data if the user has requested it.
- String profileSql = info.getProperty("profileSql");
- if ((profileSql != null) && profileSql.trim().equalsIgnoreCase("true")) {
- this.io.setProfileSql(true);
- } else {
- this.io.setProfileSql(false);
- }
- this.hasQuotedIdentifiers = this.io.versionMeetsMinimum(3, 23, 6);
- if (this.serverVariables.containsKey("sql_mode")) {
- int sqlMode = 0;
- try {
- sqlMode = Integer.parseInt((String) this.serverVariables.get(
- "sql_mode"));
- } catch (NumberFormatException nfe) {
- sqlMode = 0;
- }
- if ((sqlMode & 4) > 0) {
- this.useAnsiQuotes = true;
- } else {
- this.useAnsiQuotes = false;
- }
- }
- //
- // Setup client character set for MySQL-4.1 and newer
- //
- if (this.io.versionMeetsMinimum(4, 1, 0) && useUnicode()
- && (getEncoding() != null)) {
- if (getEncoding().equalsIgnoreCase("UTF-8")
- || getEncoding().equalsIgnoreCase("UTF8")) {
- // charset names are case-sensitive
- execSQL("SET NAMES utf8", -1, this.database);
- } else {
- String namesEncoding = this.mysqlEncodingName;
- if ("koi8_ru".equals(this.mysqlEncodingName)) {
- // This has a _different_ name in 4.1...
- namesEncoding = "ko18r";
- }
- if (namesEncoding != null) {
- execSQL("SET NAMES " + namesEncoding, -1, this.database);
- }
- }
- }
- this.io.resetMaxBuf();
- }
- /**
- * Loads the mapping between MySQL character sets and Java character sets
- */
- private static void loadCharacterSetMapping() {
- multibyteCharsetsMap = new HashMap();
- Iterator multibyteCharsets = CharsetMapping.MULTIBYTE_CHARSETS.keySet()
- .iterator();
- while (multibyteCharsets.hasNext()) {
- String charset = ((String) multibyteCharsets.next()).toUpperCase();
- multibyteCharsetsMap.put(charset, charset);
- }
- //
- // Now change all server encodings to upper-case to "future-proof"
- // this mapping
- //
- Iterator keys = CharsetMapping.CHARSETMAP.keySet().iterator();
- charsetMap = new HashMap();
- while (keys.hasNext()) {
- String mysqlCharsetName = ((String) keys.next()).trim();
- String javaCharsetName = CharsetMapping.CHARSETMAP.get(mysqlCharsetName)
- .toString().trim();
- charsetMap.put(mysqlCharsetName.toUpperCase(), javaCharsetName);
- charsetMap.put(mysqlCharsetName, javaCharsetName);
- }
- }
- private boolean getUseUltraDevWorkAround() {
- return useUltraDevWorkAround;
- }
- // *********************************************************************
- //
- // END OF PUBLIC INTERFACE
- //
- // *********************************************************************
- /**
- * Detect if the connection is still good
- *
- * @throws Exception DOCUMENT ME!
- */
- private void ping() throws Exception {
- if (this.useFastPing) {
- this.io.sendCommand(MysqlDefs.PING, null, null);
- } else {
- this.io.sqlQuery(PING_COMMAND, MysqlDefs.MAX_ROWS, this.encoding,
- this, java.sql.ResultSet.CONCUR_READ_ONLY, false, this.database);
- }
- }
- private void pingAndReconnect(boolean ignoreAutoCommitSetting)
- throws SQLException {
- boolean localAutoCommit = this.autoCommit;
- // We use this to catch the 'edge' case
- // of autoReconnect going from true->false
- //
- if (ignoreAutoCommitSetting) {
- localAutoCommit = true;
- }
- if (this.failedOver && localAutoCommit) {
- this.queriesIssuedFailedOver++;
- if (shouldFallBack()) {
- createNewIO(true);
- String connectedHost = this.io.getHost();
- if ((connectedHost != null)
- && this.hostList.get(0).equals(connectedHost)) {
- this.failedOver = false;
- this.queriesIssuedFailedOver = 0;
- setReadOnly(false);
- }
- }
- }
- if ((this.highAvailability || this.failedOver) && localAutoCommit) {
- try {
- ping();
- } catch (Exception Ex) {
- createNewIO(true);
- }
- }
- }
- private void rollbackNoChecks() throws SQLException {
- execSQL("rollback", -1, null);
- }
- /**
- * Should we try to connect back to the master? We try when we've been
- * failed over >= this.secondsBeforeRetryMaster _or_ we've issued >
- * this.queriesIssuedFailedOver
- *
- * @return DOCUMENT ME!
- */
- private boolean shouldFallBack() {
- long secondsSinceFailedOver = (System.currentTimeMillis()
- - this.masterFailTimeMillis) / 1000;
- return ((secondsSinceFailedOver >= this.secondsBeforeRetryMaster)
- || ((this.queriesIssuedFailedOver % this.queriesBeforeRetryMaster) == 0));
- }
- /**
- * Wrapper class for UltraDev CallableStatements that are really
- * PreparedStatments. Nice going, UltraDev developers.
- */
- class UltraDevWorkAround implements java.sql.CallableStatement {
- private java.sql.PreparedStatement delegate = null;
- UltraDevWorkAround(java.sql.PreparedStatement pstmt) {
- delegate = pstmt;
- }
- public void setArray(int p1, final java.sql.Array p2)
- throws java.sql.SQLException {
- delegate.setArray(p1, p2);
- }
- public java.sql.Array getArray(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getArray(String)
- */
- public java.sql.Array getArray(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setAsciiStream(int p1, final java.io.InputStream p2, int p3)
- throws java.sql.SQLException {
- delegate.setAsciiStream(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setAsciiStream(String, InputStream, int)
- */
- public void setAsciiStream(String arg0, InputStream arg1, int arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- public void setBigDecimal(int p1, final java.math.BigDecimal p2)
- throws java.sql.SQLException {
- delegate.setBigDecimal(p1, p2);
- }
- /**
- * @see CallableStatement#setBigDecimal(String, BigDecimal)
- */
- public void setBigDecimal(String arg0, BigDecimal arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public java.math.BigDecimal getBigDecimal(int p1)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public java.math.BigDecimal getBigDecimal(int p1, int p2)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getBigDecimal(String)
- */
- public BigDecimal getBigDecimal(String arg0) throws SQLException {
- return null;
- }
- public void setBinaryStream(int p1, final java.io.InputStream p2, int p3)
- throws java.sql.SQLException {
- delegate.setBinaryStream(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setBinaryStream(String, InputStream, int)
- */
- public void setBinaryStream(String arg0, InputStream arg1, int arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- public void setBlob(int p1, final java.sql.Blob p2)
- throws java.sql.SQLException {
- delegate.setBlob(p1, p2);
- }
- public java.sql.Blob getBlob(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getBlob(String)
- */
- public java.sql.Blob getBlob(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setBoolean(int p1, boolean p2) throws java.sql.SQLException {
- delegate.setBoolean(p1, p2);
- }
- /**
- * @see CallableStatement#setBoolean(String, boolean)
- */
- public void setBoolean(String arg0, boolean arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public boolean getBoolean(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getBoolean(String)
- */
- public boolean getBoolean(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setByte(int p1, byte p2) throws java.sql.SQLException {
- delegate.setByte(p1, p2);
- }
- /**
- * @see CallableStatement#setByte(String, byte)
- */
- public void setByte(String arg0, byte arg1) throws SQLException {
- throw new NotImplemented();
- }
- public byte getByte(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getByte(String)
- */
- public byte getByte(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setBytes(int p1, byte[] p2) throws java.sql.SQLException {
- delegate.setBytes(p1, p2);
- }
- /**
- * @see CallableStatement#setBytes(String, byte[])
- */
- public void setBytes(String arg0, byte[] arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public byte[] getBytes(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getBytes(String)
- */
- public byte[] getBytes(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setCharacterStream(int p1, final java.io.Reader p2, int p3)
- throws java.sql.SQLException {
- delegate.setCharacterStream(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setCharacterStream(String, Reader, int)
- */
- public void setCharacterStream(String arg0, Reader arg1, int arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- public void setClob(int p1, final java.sql.Clob p2)
- throws java.sql.SQLException {
- delegate.setClob(p1, p2);
- }
- public java.sql.Clob getClob(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getClob(String)
- */
- public Clob getClob(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public java.sql.Connection getConnection() throws java.sql.SQLException {
- return delegate.getConnection();
- }
- public void setCursorName(java.lang.String p1)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public void setDate(int p1, final java.sql.Date p2)
- throws java.sql.SQLException {
- delegate.setDate(p1, p2);
- }
- public void setDate(int p1, final java.sql.Date p2,
- final java.util.Calendar p3) throws java.sql.SQLException {
- delegate.setDate(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setDate(String, Date, Calendar)
- */
- public void setDate(String arg0, Date arg1, Calendar arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setDate(String, Date)
- */
- public void setDate(String arg0, Date arg1) throws SQLException {
- throw new NotImplemented();
- }
- public java.sql.Date getDate(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public java.sql.Date getDate(int p1, final java.util.Calendar p2)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getDate(String, Calendar)
- */
- public Date getDate(String arg0, Calendar arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#getDate(String)
- */
- public Date getDate(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setDouble(int p1, double p2) throws java.sql.SQLException {
- delegate.setDouble(p1, p2);
- }
- /**
- * @see CallableStatement#setDouble(String, double)
- */
- public void setDouble(String arg0, double arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public double getDouble(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getDouble(String)
- */
- public double getDouble(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setEscapeProcessing(boolean p1)
- throws java.sql.SQLException {
- delegate.setEscapeProcessing(p1);
- }
- public void setFetchDirection(int p1) throws java.sql.SQLException {
- delegate.setFetchDirection(p1);
- }
- public int getFetchDirection() throws java.sql.SQLException {
- return delegate.getFetchDirection();
- }
- public void setFetchSize(int p1) throws java.sql.SQLException {
- delegate.setFetchSize(p1);
- }
- public int getFetchSize() throws java.sql.SQLException {
- return delegate.getFetchSize();
- }
- public void setFloat(int p1, float p2) throws java.sql.SQLException {
- delegate.setFloat(p1, p2);
- }
- /**
- * @see CallableStatement#setFloat(String, float)
- */
- public void setFloat(String arg0, float arg1) throws SQLException {
- throw new NotImplemented();
- }
- public float getFloat(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getFloat(String)
- */
- public float getFloat(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see Statement#getGeneratedKeys()
- */
- public java.sql.ResultSet getGeneratedKeys() throws SQLException {
- return delegate.getGeneratedKeys();
- }
- public void setInt(int p1, int p2) throws java.sql.SQLException {
- delegate.setInt(p1, p2);
- }
- /**
- * @see CallableStatement#setInt(String, int)
- */
- public void setInt(String arg0, int arg1) throws SQLException {
- throw new NotImplemented();
- }
- public int getInt(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getInt(String)
- */
- public int getInt(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setLong(int p1, long p2) throws java.sql.SQLException {
- delegate.setLong(p1, p2);
- }
- /**
- * @see CallableStatement#setLong(String, long)
- */
- public void setLong(String arg0, long arg1) throws SQLException {
- throw new NotImplemented();
- }
- public long getLong(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getLong(String)
- */
- public long getLong(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setMaxFieldSize(int p1) throws java.sql.SQLException {
- delegate.setMaxFieldSize(p1);
- }
- public int getMaxFieldSize() throws java.sql.SQLException {
- return delegate.getMaxFieldSize();
- }
- public void setMaxRows(int p1) throws java.sql.SQLException {
- delegate.setMaxRows(p1);
- }
- public int getMaxRows() throws java.sql.SQLException {
- return delegate.getMaxRows();
- }
- public java.sql.ResultSetMetaData getMetaData()
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public boolean getMoreResults() throws java.sql.SQLException {
- return delegate.getMoreResults();
- }
- /**
- * @see Statement#getMoreResults(int)
- */
- public boolean getMoreResults(int arg0) throws SQLException {
- return delegate.getMoreResults();
- }
- public void setNull(int p1, int p2) throws java.sql.SQLException {
- delegate.setNull(p1, p2);
- }
- public void setNull(int p1, int p2, java.lang.String p3)
- throws java.sql.SQLException {
- delegate.setNull(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setNull(String, int, String)
- */
- public void setNull(String arg0, int arg1, String arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setNull(String, int)
- */
- public void setNull(String arg0, int arg1) throws SQLException {
- throw new NotImplemented();
- }
- public void setObject(int p1, final java.lang.Object p2)
- throws java.sql.SQLException {
- delegate.setObject(p1, p2);
- }
- public void setObject(int p1, final java.lang.Object p2, int p3)
- throws java.sql.SQLException {
- delegate.setObject(p1, p2, p3);
- }
- public void setObject(int p1, final java.lang.Object p2, int p3, int p4)
- throws java.sql.SQLException {
- delegate.setObject(p1, p2, p3, p4);
- }
- /**
- * @see CallableStatement#setObject(String, Object, int, int)
- */
- public void setObject(String arg0, Object arg1, int arg2, int arg3)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setObject(String, Object, int)
- */
- public void setObject(String arg0, Object arg1, int arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setObject(String, Object)
- */
- public void setObject(String arg0, Object arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public java.lang.Object getObject(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public java.lang.Object getObject(int p1, final java.util.Map p2)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getObject(String, Map)
- */
- public Object getObject(String arg0, Map arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#getObject(String)
- */
- public Object getObject(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see PreparedStatement#getParameterMetaData()
- */
- public ParameterMetaData getParameterMetaData()
- throws SQLException {
- return delegate.getParameterMetaData();
- }
- public void setQueryTimeout(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public int getQueryTimeout() throws java.sql.SQLException {
- return delegate.getQueryTimeout();
- }
- public void setRef(int p1, final java.sql.Ref p2)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public java.sql.Ref getRef(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getRef(String)
- */
- public Ref getRef(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public java.sql.ResultSet getResultSet() throws java.sql.SQLException {
- return delegate.getResultSet();
- }
- public int getResultSetConcurrency() throws java.sql.SQLException {
- return delegate.getResultSetConcurrency();
- }
- /**
- * @see Statement#getResultSetHoldability()
- */
- public int getResultSetHoldability() throws SQLException {
- return delegate.getResultSetHoldability();
- }
- public int getResultSetType() throws java.sql.SQLException {
- return delegate.getResultSetType();
- }
- public void setShort(int p1, short p2) throws java.sql.SQLException {
- delegate.setShort(p1, p2);
- }
- /**
- * @see CallableStatement#setShort(String, short)
- */
- public void setShort(String arg0, short arg1) throws SQLException {
- throw new NotImplemented();
- }
- public short getShort(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getShort(String)
- */
- public short getShort(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setString(int p1, java.lang.String p2)
- throws java.sql.SQLException {
- delegate.setString(p1, p2);
- }
- /**
- * @see CallableStatement#setString(String, String)
- */
- public void setString(String arg0, String arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public java.lang.String getString(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getString(String)
- */
- public String getString(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setTime(int p1, final java.sql.Time p2)
- throws java.sql.SQLException {
- delegate.setTime(p1, p2);
- }
- public void setTime(int p1, final java.sql.Time p2,
- final java.util.Calendar p3) throws java.sql.SQLException {
- delegate.setTime(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setTime(String, Time, Calendar)
- */
- public void setTime(String arg0, Time arg1, Calendar arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setTime(String, Time)
- */
- public void setTime(String arg0, Time arg1) throws SQLException {
- throw new NotImplemented();
- }
- public java.sql.Time getTime(int p1) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public java.sql.Time getTime(int p1, final java.util.Calendar p2)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getTime(String, Calendar)
- */
- public Time getTime(String arg0, Calendar arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#getTime(String)
- */
- public Time getTime(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setTimestamp(int p1, final java.sql.Timestamp p2)
- throws java.sql.SQLException {
- delegate.setTimestamp(p1, p2);
- }
- public void setTimestamp(int p1, final java.sql.Timestamp p2,
- final java.util.Calendar p3) throws java.sql.SQLException {
- delegate.setTimestamp(p1, p2, p3);
- }
- /**
- * @see CallableStatement#setTimestamp(String, Timestamp, Calendar)
- */
- public void setTimestamp(String arg0, Timestamp arg1, Calendar arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setTimestamp(String, Timestamp)
- */
- public void setTimestamp(String arg0, Timestamp arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public java.sql.Timestamp getTimestamp(int p1)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public java.sql.Timestamp getTimestamp(int p1,
- final java.util.Calendar p2) throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#getTimestamp(String, Calendar)
- */
- public Timestamp getTimestamp(String arg0, Calendar arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#getTimestamp(String)
- */
- public Timestamp getTimestamp(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#setURL(String, URL)
- */
- public void setURL(String arg0, URL arg1) throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see PreparedStatement#setURL(int, URL)
- */
- public void setURL(int arg0, URL arg1) throws SQLException {
- delegate.setURL(arg0, arg1);
- }
- /**
- * @see CallableStatement#getURL(int)
- */
- public URL getURL(int arg0) throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#getURL(String)
- */
- public URL getURL(String arg0) throws SQLException {
- throw new NotImplemented();
- }
- public void setUnicodeStream(int p1, final java.io.InputStream p2,
- int p3) throws java.sql.SQLException {
- delegate.setUnicodeStream(p1, p2, p3);
- }
- public int getUpdateCount() throws java.sql.SQLException {
- return delegate.getUpdateCount();
- }
- public java.sql.SQLWarning getWarnings() throws java.sql.SQLException {
- return delegate.getWarnings();
- }
- public void addBatch() throws java.sql.SQLException {
- delegate.addBatch();
- }
- public void addBatch(java.lang.String p1) throws java.sql.SQLException {
- delegate.addBatch(p1);
- }
- public void cancel() throws java.sql.SQLException {
- delegate.cancel();
- }
- public void clearBatch() throws java.sql.SQLException {
- delegate.clearBatch();
- }
- public void clearParameters() throws java.sql.SQLException {
- delegate.clearParameters();
- }
- public void clearWarnings() throws java.sql.SQLException {
- delegate.clearWarnings();
- }
- public void close() throws java.sql.SQLException {
- delegate.close();
- }
- public boolean execute() throws java.sql.SQLException {
- return delegate.execute();
- }
- public boolean execute(java.lang.String p1)
- throws java.sql.SQLException {
- return delegate.execute(p1);
- }
- /**
- * @see Statement#execute(String, int)
- */
- public boolean execute(String arg0, int arg1) throws SQLException {
- return delegate.execute(arg0, arg1);
- }
- /**
- * @see Statement#execute(String, int[])
- */
- public boolean execute(String arg0, int[] arg1)
- throws SQLException {
- return delegate.execute(arg0, arg1);
- }
- /**
- * @see Statement#execute(String, String[])
- */
- public boolean execute(String arg0, String[] arg1)
- throws SQLException {
- return delegate.execute(arg0, arg1);
- }
- public int[] executeBatch() throws java.sql.SQLException {
- return delegate.executeBatch();
- }
- public java.sql.ResultSet executeQuery() throws java.sql.SQLException {
- return delegate.executeQuery();
- }
- public java.sql.ResultSet executeQuery(java.lang.String p1)
- throws java.sql.SQLException {
- return delegate.executeQuery(p1);
- }
- public int executeUpdate() throws java.sql.SQLException {
- return delegate.executeUpdate();
- }
- public int executeUpdate(java.lang.String p1)
- throws java.sql.SQLException {
- return delegate.executeUpdate(p1);
- }
- /**
- * @see Statement#executeUpdate(String, int)
- */
- public int executeUpdate(String arg0, int arg1)
- throws SQLException {
- return delegate.executeUpdate(arg0, arg1);
- }
- /**
- * @see Statement#executeUpdate(String, int[])
- */
- public int executeUpdate(String arg0, int[] arg1)
- throws SQLException {
- return delegate.executeUpdate(arg0, arg1);
- }
- /**
- * @see Statement#executeUpdate(String, String[])
- */
- public int executeUpdate(String arg0, String[] arg1)
- throws SQLException {
- return delegate.executeUpdate(arg0, arg1);
- }
- public void registerOutParameter(int p1, int p2)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public void registerOutParameter(int p1, int p2, int p3)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- public void registerOutParameter(int p1, int p2, java.lang.String p3)
- throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- /**
- * @see CallableStatement#registerOutParameter(String, int, int)
- */
- public void registerOutParameter(String arg0, int arg1, int arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#registerOutParameter(String, int, String)
- */
- public void registerOutParameter(String arg0, int arg1, String arg2)
- throws SQLException {
- throw new NotImplemented();
- }
- /**
- * @see CallableStatement#registerOutParameter(String, int)
- */
- public void registerOutParameter(String arg0, int arg1)
- throws SQLException {
- throw new NotImplemented();
- }
- public boolean wasNull() throws java.sql.SQLException {
- throw new SQLException("Not supported");
- }
- }
- }