|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mysql.jdbc.MysqlIO
This class is used by Connection for communicating with the MySQL server.
Connection
Field Summary | |
(package private) static int |
COMP_HEADER_LENGTH
|
(package private) static int |
HEADER_LENGTH
|
(package private) static int |
MIN_COMPRESS_LEN
|
(package private) static int |
NULL_LENGTH
|
protected int |
serverCharsetIndex
|
Constructor Summary | |
protected |
MysqlIO(java.lang.String host,
int port,
java.lang.String socketFactoryClassName,
java.util.Properties props,
Connection conn,
int socketTimeout)
Constructor: Connect to the MySQL server and setup a stream connection. |
Method Summary | |
protected void |
changeUser(java.lang.String userName,
java.lang.String password,
java.lang.String database)
Re-authenticates as the given user and password |
protected void |
checkForCharsetMismatch()
Determines if the database charset is the same as the platform charset |
(package private) void |
closeStreamer(RowData streamer)
|
(package private) void |
doHandshake(java.lang.String user,
java.lang.String password,
java.lang.String database)
Initialize communications with the MySQL server. |
protected void |
forceClose()
Forcibly closes the underlying socket to MySQL. |
(package private) java.lang.String |
getHost()
Returns the host this IO is connected to |
(package private) static int |
getMaxBuf()
|
protected ResultSet |
getResultSet(long columnCount,
int maxRows,
int resultSetType,
boolean streamResults,
java.lang.String catalog)
Build a result set. |
(package private) int |
getServerMajorVersion()
Get the major version of the MySQL server we are talking to. |
(package private) int |
getServerMinorVersion()
Get the minor version of the MySQL server we are talking to. |
(package private) int |
getServerSubMinorVersion()
Get the sub-minor version of the MySQL server we are talking to. |
(package private) java.lang.String |
getServerVersion()
Get the version string of the server we are talking to |
(package private) Buffer |
getSharedSendPacket()
Returns the packet used for sending data (used by PreparedStatement) Guarded by external synchronization on a mutex. |
protected boolean |
hasLongColumnInfo()
Does the server send back extra column info? |
(package private) byte[][] |
nextRow(int columnCount)
Retrieve one row from the MySQL server. |
(package private) void |
quit()
Log-off of the MySQL server and close the socket. |
(package private) void |
resetMaxBuf()
Sets the buffer size to max-buf |
(package private) Buffer |
sendCommand(int command,
java.lang.String extraData,
Buffer queryPacket)
Send a command to the MySQL server If data is to be sent with command, it should be put in ExtraData Raw packets can be sent by setting QueryPacket to something other than null. |
protected void |
setProfileSql(boolean flag)
Should the driver generate SQL statement profiles? |
(package private) ResultSet |
sqlQuery(java.lang.String query,
int maxRows,
java.lang.String characterEncoding,
Connection conn,
int resultSetType,
boolean streamResults,
java.lang.String catalog)
Send a query specified in the String "Query" to the MySQL server. |
(package private) ResultSet |
sqlQueryDirect(Buffer queryPacket,
int maxRows,
Connection conn,
int resultSetType,
boolean streamResults,
java.lang.String catalog)
Send a query stored in a packet directly to the server. |
protected Field |
unpackField(Buffer packet,
boolean extractDefaultValues)
Unpacks the Field information from the given packet. |
(package private) boolean |
versionMeetsMinimum(int major,
int minor,
int subminor)
Does the version of the MySQL server we are connected to meet the given minimums? |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final int NULL_LENGTH
static final int COMP_HEADER_LENGTH
static final int MIN_COMPRESS_LEN
static final int HEADER_LENGTH
protected int serverCharsetIndex
Constructor Detail |
protected MysqlIO(java.lang.String host, int port, java.lang.String socketFactoryClassName, java.util.Properties props, Connection conn, int socketTimeout) throws java.io.IOException, java.sql.SQLException
host
- the hostname to connect toport
- the port number that the server is listening onsocketFactoryClassName
- the socket factory to useprops
- the Properties from DriverManager.getConnection()conn
- the Connection that is creating ussocketTimeout
- the timeout to set for the socket (0 means no
timeout)
java.io.IOException
- if an IOException occurs during connect.
java.sql.SQLException
- if a database access error occurs.Method Detail |
protected void setProfileSql(boolean flag)
flag
- should the driver enable profiling?protected ResultSet getResultSet(long columnCount, int maxRows, int resultSetType, boolean streamResults, java.lang.String catalog) throws java.lang.Exception
columnCount
- the number of columns in the result setmaxRows
- the maximum number of rows to read (-1 means all rows)resultSetType
- the type of result set (CONCUR_UPDATABLE or
READ_ONLY)streamResults
- should the result set be read all at once, or
streamed?catalog
- the database name in use when the result set was created
java.lang.Exception
- if a database access error occursprotected final void forceClose()
protected void changeUser(java.lang.String userName, java.lang.String password, java.lang.String database) throws java.sql.SQLException
userName
- DOCUMENT ME!password
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!protected boolean hasLongColumnInfo()
protected final Field unpackField(Buffer packet, boolean extractDefaultValues) throws java.sql.SQLException
packet
- the packet containing the field informationextractDefaultValues
- should default values be extracted?
java.sql.SQLException
protected void checkForCharsetMismatch()
static int getMaxBuf()
final int getServerMajorVersion()
final int getServerMinorVersion()
final int getServerSubMinorVersion()
java.lang.String getServerVersion()
void doHandshake(java.lang.String user, java.lang.String password, java.lang.String database) throws java.sql.SQLException
user
- DOCUMENT ME!password
- DOCUMENT ME!database
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!final byte[][] nextRow(int columnCount) throws java.lang.Exception
columnCount
- DOCUMENT ME!
java.lang.Exception
- DOCUMENT ME!final void quit() throws java.sql.SQLException
java.sql.SQLException
- DOCUMENT ME!Buffer getSharedSendPacket()
void closeStreamer(RowData streamer) throws java.sql.SQLException
java.sql.SQLException
void resetMaxBuf()
final Buffer sendCommand(int command, java.lang.String extraData, Buffer queryPacket) throws java.lang.Exception
command
- DOCUMENT ME!extraData
- DOCUMENT ME!queryPacket
- DOCUMENT ME!
java.lang.Exception
- DOCUMENT ME!
java.sql.SQLException
- DOCUMENT ME!final ResultSet sqlQuery(java.lang.String query, int maxRows, java.lang.String characterEncoding, Connection conn, int resultSetType, boolean streamResults, java.lang.String catalog) throws java.lang.Exception
query
- DOCUMENT ME!maxRows
- DOCUMENT ME!characterEncoding
- DOCUMENT ME!conn
- DOCUMENT ME!resultSetType
- DOCUMENT ME!streamResults
- DOCUMENT ME!catalog
- DOCUMENT ME!
java.lang.Exception
- DOCUMENT ME!final ResultSet sqlQueryDirect(Buffer queryPacket, int maxRows, Connection conn, int resultSetType, boolean streamResults, java.lang.String catalog) throws java.lang.Exception
queryPacket
- DOCUMENT ME!maxRows
- DOCUMENT ME!conn
- DOCUMENT ME!resultSetType
- DOCUMENT ME!streamResults
- DOCUMENT ME!catalog
- DOCUMENT ME!
java.lang.Exception
- DOCUMENT ME!java.lang.String getHost()
boolean versionMeetsMinimum(int major, int minor, int subminor)
major
- DOCUMENT ME!minor
- DOCUMENT ME!subminor
- DOCUMENT ME!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |