|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.sql.ConnectionHelper
com.antelmann.sql.MySQLHelper
@ThirdParty(value="MySQL JDBC driver: com.mysql.jdbc") public class MySQLHelper
provides added functionality for MySQL database
Mysqldump,
MySQLLog| Constructor Summary | |
|---|---|
MySQLHelper(Connection con)
|
|
| Method Summary | |
|---|---|
static Logger |
configureAndGetLogger(Connector c)
|
static Connector |
configureLogger(Connector c,
Class<? extends com.mysql.jdbc.log.Log> logClass)
allows to configure the given Connector so that all calls are traced by the given loggerClass |
static Connector |
configureProfiler(Connector c,
Class<? extends com.mysql.jdbc.profiler.ProfilerEventHandler> loggerClass)
allows to configure the given Connector so that all calls are traced by the given loggerClass |
static Connector |
configureSlowQueries(Connector c,
long millis)
|
void |
copyTable(String source,
String newTable)
|
void |
export(String table,
File file)
|
com.mysql.jdbc.Connection |
getConnection()
|
static com.mysql.jdbc.profiler.ProfilerEventHandler |
getProfileEventHandler(Connection con)
|
String |
getSessionVariable(String variable)
|
HashMap<String,String> |
getSessionVariables()
|
String |
getSqlForView(String viewName)
|
boolean |
isMySQL()
|
void |
lockTable(boolean exclusive,
String... tables)
useful for early requiring locks to avoid deadlocks |
void |
setSessionVariable(String variable,
String value)
|
void |
setStreamResults(boolean flag)
setting this flag to true will set the fetch size to Integer.MIN_VALUE. |
void |
setWaitTimeout(int timeout)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MySQLHelper(Connection con)
| Method Detail |
|---|
public boolean isMySQL()
isMySQL in class ConnectionHelperpublic com.mysql.jdbc.Connection getConnection()
getConnection in class ConnectionHelper
public void setWaitTimeout(int timeout)
throws SQLException
timeout - number of seconds
SQLException
@Todo(value="still problems w/ intrusiveness & transactions")
public void lockTable(boolean exclusive,
String... tables)
throws SQLException
ConnectionHelper
lockTable in class ConnectionHelperSQLExceptionpublic void setStreamResults(boolean flag)
Integer.MIN_VALUE.
This is the only value other than 0 that will make MySQL react so that it will
stream the results instead of loading the entire ResultSet; if the flag is false,
0 will be set.
Note that if this is set to true, no other query can be done on the connection
until the underlying statement of a streamed ResultSet is closed again!
@Warning(value="be aware of SQL-Injection here as PreparedStatement parameters won\'t work")
public void setSessionVariable(String variable,
String value)
throws SQLException
SQLException
public String getSessionVariable(String variable)
throws SQLException
SQLException
public HashMap<String,String> getSessionVariables()
throws SQLException
SQLException
public void copyTable(String source,
String newTable)
throws SQLException
SQLException
public void export(String table,
File file)
throws SQLException
SQLException
public String getSqlForView(String viewName)
throws SQLException
SQLException
public static Connector configureSlowQueries(Connector c,
long millis)
public static com.mysql.jdbc.profiler.ProfilerEventHandler getProfileEventHandler(Connection con)
public static Connector configureProfiler(Connector c,
Class<? extends com.mysql.jdbc.profiler.ProfilerEventHandler> loggerClass)
getProfileEventHandler(Connection),
MySQLLog
public static Connector configureLogger(Connector c,
Class<? extends com.mysql.jdbc.log.Log> logClass)
Connection.getLog(),
MySQLLogpublic static Logger configureAndGetLogger(Connector c)
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||