File size: 12,732 Bytes
2795186 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
/*
Copyright 2007 MySQL AB, 2008 Sun Microsystems
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 java.sql.SQLException;
import java.util.TimeZone;
import com.mysql.jdbc.log.Log;
/**
* This interface contains methods that are considered the "vendor extension"
* to the JDBC API for MySQL's implementation of java.sql.Connection.
*
* For those looking further into the driver implementation, it is not
* an API that is used for plugability of implementations inside our driver
* (which is why there are still references to ConnectionImpl throughout the
* code).
*
* @version $Id: $
*
*/
public interface Connection extends java.sql.Connection, ConnectionProperties {
/**
* Changes the user on this connection by performing a re-authentication. If
* authentication fails, the connection will remain under the context of the
* current user.
*
* @param userName
* the username to authenticate with
* @param newPassword
* the password to authenticate with
* @throws SQLException
* if authentication fails, or some other error occurs while
* performing the command.
*/
public abstract void changeUser(String userName, String newPassword)
throws SQLException;
public abstract void clearHasTriedMaster();
/**
* Prepares a statement on the client, using client-side emulation
* (irregardless of the configuration property 'useServerPrepStmts')
* with the same semantics as the java.sql.Connection.prepareStatement()
* method with the same argument types.
*
* @see java.sql.Connection#prepareStatement(String)
*/
public abstract java.sql.PreparedStatement clientPrepareStatement(String sql)
throws SQLException;
/**
* Prepares a statement on the client, using client-side emulation
* (irregardless of the configuration property 'useServerPrepStmts')
* with the same semantics as the java.sql.Connection.prepareStatement()
* method with the same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int)
*/
public abstract java.sql.PreparedStatement clientPrepareStatement(String sql,
int autoGenKeyIndex) throws SQLException;
/**
* Prepares a statement on the client, using client-side emulation
* (irregardless of the configuration property 'useServerPrepStmts')
* with the same semantics as the java.sql.Connection.prepareStatement()
* method with the same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int, int)
*/
public abstract java.sql.PreparedStatement clientPrepareStatement(String sql,
int resultSetType, int resultSetConcurrency) throws SQLException;
/**
* Prepares a statement on the client, using client-side emulation
* (irregardless of the configuration property 'useServerPrepStmts')
* with the same semantics as the java.sql.Connection.prepareStatement()
* method with the same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int[])
*/
public abstract java.sql.PreparedStatement clientPrepareStatement(String sql,
int[] autoGenKeyIndexes) throws SQLException;
/**
* Prepares a statement on the client, using client-side emulation
* (irregardless of the configuration property 'useServerPrepStmts')
* with the same semantics as the java.sql.Connection.prepareStatement()
* method with the same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int, int, int)
*/
public abstract java.sql.PreparedStatement clientPrepareStatement(String sql,
int resultSetType, int resultSetConcurrency,
int resultSetHoldability) throws SQLException;
/**
* Prepares a statement on the client, using client-side emulation
* (irregardless of the configuration property 'useServerPrepStmts')
* with the same semantics as the java.sql.Connection.prepareStatement()
* method with the same argument types.
*
* @see java.sql.Connection#prepareStatement(String, String[])
*/
public abstract java.sql.PreparedStatement clientPrepareStatement(String sql,
String[] autoGenKeyColNames) throws SQLException;
/**
* Returns the number of statements active on this connection, which
* haven't been .close()d.
*/
public abstract int getActiveStatementCount();
/**
* Reports how long this connection has been idle.
* This time (reported in milliseconds) is updated once a query has
* completed.
*
* @return number of ms that this connection has been idle, 0 if the driver
* is busy retrieving results.
*/
public abstract long getIdleFor();
/**
* Returns the log mechanism that should be used to log information from/for
* this Connection.
*
* @return the Log instance to use for logging messages.
* @throws SQLException
* if an error occurs
*/
public abstract Log getLog() throws SQLException;
/**
* Returns the server's character set
*
* @return the server's character set.
*/
public abstract String getServerCharacterEncoding();
/**
* Returns the TimeZone that represents the configured
* timezone for the server.
*/
public abstract TimeZone getServerTimezoneTZ();
/**
* Returns the comment that will be prepended to all statements
* sent to the server.
*
* @return the comment that will be prepended to all statements
* sent to the server.
*/
public abstract String getStatementComment();
/**
* Has this connection tried to execute a query on the "master"
* server (first host in a multiple host list).
*/
public abstract boolean hasTriedMaster();
/**
* Is this connection currently a participant in an XA transaction?
*/
public abstract boolean isInGlobalTx();
/**
* Set the state of being in a global (XA) transaction.
* @param flag
*/
public void setInGlobalTx(boolean flag);
/**
* Is this connection connected to the first host in the list if
* there is a list of servers in the URL?
*
* @return true if this connection is connected to the first in
* the list.
*/
public abstract boolean isMasterConnection();
/**
* Is the server in a sql_mode that doesn't allow us to use \\ to escape
* things?
*
* @return Returns the noBackslashEscapes.
*/
public abstract boolean isNoBackslashEscapesSet();
/**
* Does this connection have the same resource name as the given
* connection (for XA)?
*
* @param c
* @return
*/
public abstract boolean isSameResource(Connection c);
/**
* Is the server configured to use lower-case table names only?
*
* @return true if lower_case_table_names is 'on'
*/
public abstract boolean lowerCaseTableNames();
/**
* Does the server this connection is connected to
* support unicode?
*/
public abstract boolean parserKnowsUnicode();
/**
* Detect if the connection is still good by sending a ping command
* to the server.
*
* @throws SQLException
* if the ping fails
*/
public abstract void ping() throws SQLException;
/**
* Resets the server-side state of this connection. Doesn't work for MySQL
* versions older than 4.0.6 or if isParanoid() is set (it will become a
* no-op in these cases). Usually only used from connection pooling code.
*
* @throws SQLException
* if the operation fails while resetting server state.
*/
public abstract void resetServerState() throws SQLException;
/**
* Prepares a statement on the server (irregardless of the
* configuration property 'useServerPrepStmts') with the same semantics
* as the java.sql.Connection.prepareStatement() method with the
* same argument types.
*
* @see java.sql.Connection#prepareStatement(String)
*/
public abstract java.sql.PreparedStatement serverPrepareStatement(String sql)
throws SQLException;
/**
* Prepares a statement on the server (irregardless of the
* configuration property 'useServerPrepStmts') with the same semantics
* as the java.sql.Connection.prepareStatement() method with the
* same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int)
*/
public abstract java.sql.PreparedStatement serverPrepareStatement(String sql,
int autoGenKeyIndex) throws SQLException;
/**
* Prepares a statement on the server (irregardless of the
* configuration property 'useServerPrepStmts') with the same semantics
* as the java.sql.Connection.prepareStatement() method with the
* same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int, int)
*/
public abstract java.sql.PreparedStatement serverPrepareStatement(String sql,
int resultSetType, int resultSetConcurrency) throws SQLException;
/**
* Prepares a statement on the server (irregardless of the
* configuration property 'useServerPrepStmts') with the same semantics
* as the java.sql.Connection.prepareStatement() method with the
* same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int, int, int)
*/
public abstract java.sql.PreparedStatement serverPrepareStatement(String sql,
int resultSetType, int resultSetConcurrency,
int resultSetHoldability) throws SQLException;
/**
* Prepares a statement on the server (irregardless of the
* configuration property 'useServerPrepStmts') with the same semantics
* as the java.sql.Connection.prepareStatement() method with the
* same argument types.
*
* @see java.sql.Connection#prepareStatement(String, int[])
*/
public abstract java.sql.PreparedStatement serverPrepareStatement(String sql,
int[] autoGenKeyIndexes) throws SQLException;
/**
* Prepares a statement on the server (irregardless of the
* configuration property 'useServerPrepStmts') with the same semantics
* as the java.sql.Connection.prepareStatement() method with the
* same argument types.
*
* @see java.sql.Connection#prepareStatement(String, String[])
*/
public abstract java.sql.PreparedStatement serverPrepareStatement(String sql,
String[] autoGenKeyColNames) throws SQLException;
/**
* @param failedOver
* The failedOver to set.
*/
public abstract void setFailedOver(boolean flag);
/**
* @param preferSlaveDuringFailover
* The preferSlaveDuringFailover to set.
*/
public abstract void setPreferSlaveDuringFailover(boolean flag);
/**
* Sets the comment that will be prepended to all statements
* sent to the server. Do not use slash-star or star-slash tokens
* in the comment as these will be added by the driver itself.
*
* @param comment the comment that will be prepended to all statements
* sent to the server.
*/
public abstract void setStatementComment(String comment);
/**
* Used by MiniAdmin to shutdown a MySQL server
*
* @throws SQLException
* if the command can not be issued.
*/
public abstract void shutdownServer() throws SQLException;
/**
* Does the server this connection is connected to
* support quoted isolation levels?
*/
public abstract boolean supportsIsolationLevel();
/**
* Does the server this connection is connected to
* support quoted identifiers?
*/
public abstract boolean supportsQuotedIdentifiers();
/**
* Does the server this connection is connected to
* support quoted identifiers?
*/
public abstract boolean supportsTransactions();
/**
* Does the server this connection is connected to
* meet or exceed the given version?
*/
public abstract boolean versionMeetsMinimum(int major, int minor,
int subminor) throws SQLException;
public abstract void reportQueryTime(long millisOrNanos);
public abstract boolean isAbonormallyLongQuery(long millisOrNanos);
public abstract void initializeExtension(Extension ex) throws SQLException;
/** Returns the -session- value of 'auto_increment_increment' from the server if it exists,
* or '1' if not.
*/
public abstract int getAutoIncrementIncrement();
}
|