?? connection.java
字號:
/* Copyright (C) 2002-2007 MySQL AB This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. There are special exceptions to the terms and conditions of the GPL as it is applied to this software. View the full text of the exception in file EXCEPTIONS-CONNECTOR-J in the directory of this software distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package com.mysql.jdbc;import com.mysql.jdbc.log.Log;import com.mysql.jdbc.log.LogFactory;import com.mysql.jdbc.log.NullLogger;import com.mysql.jdbc.profiler.ProfileEventSink;import com.mysql.jdbc.profiler.ProfilerEvent;import com.mysql.jdbc.util.LRUCache;import java.io.IOException;import java.io.InputStream;import java.io.Reader;import java.io.UnsupportedEncodingException;import java.lang.reflect.Array;import java.lang.reflect.Constructor;import java.lang.reflect.Method;import java.math.BigDecimal;import java.net.URL;import java.sql.Blob;import java.sql.Clob;import java.sql.Date;import java.sql.ParameterMetaData;import java.sql.Ref;import java.sql.SQLException;import java.sql.SQLWarning;import java.sql.Savepoint;import java.sql.Time;import java.sql.Timestamp;import java.util.ArrayList;import java.util.Calendar;import java.util.GregorianCalendar;import java.util.HashMap;import java.util.Hashtable;import java.util.Iterator;import java.util.List;import java.util.Locale;import java.util.Map;import java.util.Properties;import java.util.Stack;import java.util.StringTokenizer;import java.util.TimeZone;import java.util.Timer;import java.util.TreeMap;/** * A Connection represents a session with a specific database. Within the * context of a Connection, SQL statements are executed and results are * returned. * <P> * A Connection's database is able to provide information describing its tables, * its supported SQL grammar, its stored procedures, the capabilities of this * connection, etc. This information is obtained with the getMetaData method. * </p> * * @author Mark Matthews * @version $Id: Connection.java 6599 2007-10-02 22:34:20Z mmatthews $ * @see java.sql.Connection */public class Connection extends ConnectionProperties implements java.sql.Connection { private static final String JDBC_LOCAL_CHARACTER_SET_RESULTS = "jdbc.local.character_set_results"; /** * Used as a key for caching callable statements which (may) depend on * current catalog...In 5.0.x, they don't (currently), but stored procedure * names soon will, so current catalog is a (hidden) component of the name. */ class CompoundCacheKey { String componentOne; String componentTwo; int hashCode; CompoundCacheKey(String partOne, String partTwo) { this.componentOne = partOne; this.componentTwo = partTwo; // Handle first component (in most cases, currentCatalog) // being NULL.... this.hashCode = (((this.componentOne != null) ? this.componentOne : "") + this.componentTwo).hashCode(); } /* * (non-Javadoc) * * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals(Object obj) { if (obj instanceof CompoundCacheKey) { CompoundCacheKey another = (CompoundCacheKey) obj; boolean firstPartEqual = false; if (this.componentOne == null) { firstPartEqual = (another.componentOne == null); } else { firstPartEqual = this.componentOne .equals(another.componentOne); } return (firstPartEqual && this.componentTwo .equals(another.componentTwo)); } return false; } /* * (non-Javadoc) * * @see java.lang.Object#hashCode() */ public int hashCode() { return this.hashCode; } } /** * 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) { this.delegate = pstmt; } public void addBatch() throws SQLException { this.delegate.addBatch(); } public void addBatch(java.lang.String p1) throws SQLException { this.delegate.addBatch(p1); } public void cancel() throws SQLException { this.delegate.cancel(); } public void clearBatch() throws SQLException { this.delegate.clearBatch(); } public void clearParameters() throws SQLException { this.delegate.clearParameters(); } public void clearWarnings() throws SQLException { this.delegate.clearWarnings(); } public void close() throws SQLException { this.delegate.close(); } public boolean execute() throws SQLException { return this.delegate.execute(); } public boolean execute(java.lang.String p1) throws SQLException { return this.delegate.execute(p1); } /** * @see Statement#execute(String, int) */ public boolean execute(String arg0, int arg1) throws SQLException { return this.delegate.execute(arg0, arg1); } /** * @see Statement#execute(String, int[]) */ public boolean execute(String arg0, int[] arg1) throws SQLException { return this.delegate.execute(arg0, arg1); } /** * @see Statement#execute(String, String[]) */ public boolean execute(String arg0, String[] arg1) throws SQLException { return this.delegate.execute(arg0, arg1); } public int[] executeBatch() throws SQLException { return this.delegate.executeBatch(); } public java.sql.ResultSet executeQuery() throws SQLException { return this.delegate.executeQuery(); } public java.sql.ResultSet executeQuery(java.lang.String p1) throws SQLException { return this.delegate.executeQuery(p1); } public int executeUpdate() throws SQLException { return this.delegate.executeUpdate(); } public int executeUpdate(java.lang.String p1) throws SQLException { return this.delegate.executeUpdate(p1); } /** * @see Statement#executeUpdate(String, int) */ public int executeUpdate(String arg0, int arg1) throws SQLException { return this.delegate.executeUpdate(arg0, arg1); } /** * @see Statement#executeUpdate(String, int[]) */ public int executeUpdate(String arg0, int[] arg1) throws SQLException { return this.delegate.executeUpdate(arg0, arg1); } /** * @see Statement#executeUpdate(String, String[]) */ public int executeUpdate(String arg0, String[] arg1) throws SQLException { return this.delegate.executeUpdate(arg0, arg1); } public java.sql.Array getArray(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getArray(String) */ public java.sql.Array getArray(String arg0) throws SQLException { throw new NotImplemented(); } public java.math.BigDecimal getBigDecimal(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * DOCUMENT ME! * * @param p1 * DOCUMENT ME! * @param p2 * DOCUMENT ME! * @return DOCUMENT ME! * @throws SQLException * DOCUMENT ME! * @deprecated */ public java.math.BigDecimal getBigDecimal(int p1, int p2) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getBigDecimal(String) */ public BigDecimal getBigDecimal(String arg0) throws SQLException { return null; } public java.sql.Blob getBlob(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getBlob(String) */ public java.sql.Blob getBlob(String arg0) throws SQLException { throw new NotImplemented(); } public boolean getBoolean(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getBoolean(String) */ public boolean getBoolean(String arg0) throws SQLException { throw new NotImplemented(); } public byte getByte(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getByte(String) */ public byte getByte(String arg0) throws SQLException { throw new NotImplemented(); } public byte[] getBytes(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getBytes(String) */ public byte[] getBytes(String arg0) throws SQLException { throw new NotImplemented(); } public java.sql.Clob getClob(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getClob(String) */ public Clob getClob(String arg0) throws SQLException { throw new NotImplemented(); } public java.sql.Connection getConnection() throws SQLException { return this.delegate.getConnection(); } public java.sql.Date getDate(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } public java.sql.Date getDate(int p1, final Calendar p2) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getDate(String) */ public Date getDate(String arg0) throws SQLException { throw new NotImplemented(); } /** * @see CallableStatement#getDate(String, Calendar) */ public Date getDate(String arg0, Calendar arg1) throws SQLException { throw new NotImplemented(); } public double getDouble(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getDouble(String) */ public double getDouble(String arg0) throws SQLException { throw new NotImplemented(); } public int getFetchDirection() throws SQLException { return this.delegate.getFetchDirection(); } public int getFetchSize() throws java.sql.SQLException { return this.delegate.getFetchSize(); } public float getFloat(int p1) throws SQLException { throw SQLError.createSQLException("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 this.delegate.getGeneratedKeys(); } public int getInt(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getInt(String) */ public int getInt(String arg0) throws SQLException { throw new NotImplemented(); } public long getLong(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getLong(String) */ public long getLong(String arg0) throws SQLException { throw new NotImplemented(); } public int getMaxFieldSize() throws SQLException { return this.delegate.getMaxFieldSize(); } public int getMaxRows() throws SQLException { return this.delegate.getMaxRows(); } public java.sql.ResultSetMetaData getMetaData() throws SQLException { throw SQLError.createSQLException("Not supported"); } public boolean getMoreResults() throws SQLException { return this.delegate.getMoreResults(); } /** * @see Statement#getMoreResults(int) */ public boolean getMoreResults(int arg0) throws SQLException { return this.delegate.getMoreResults(); } public java.lang.Object getObject(int p1) throws SQLException { throw SQLError.createSQLException("Not supported"); } public java.lang.Object getObject(int p1, final java.util.Map p2) throws SQLException { throw SQLError.createSQLException("Not supported"); } /** * @see CallableStatement#getObject(String) */ public Object getObject(String arg0) throws SQLException { throw new NotImplemented(); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -