public class SQLUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
FOREIGN_KEY_VIOLATED_STATE |
static String |
UNIQUE_KEY_VIOLATED_STATE |
| Constructor and Description |
|---|
SQLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
beginTransaction(Connection conn) |
static boolean |
checkIfTableExists(Connection conn,
String tableName) |
static void |
close(Connection conn) |
static void |
close(ResultSet rset,
Statement stmt) |
static void |
close(ResultSet rset,
Statement stmt,
Connection conn) |
static void |
close(Statement stmt) |
static void |
close(Statement stmt,
Connection conn) |
static void |
commitTransaction(Connection conn) |
static void |
executeScript(Connection conn,
String file,
String charset) |
static int |
fillStatement(PreparedStatement stmt,
Object... params)
Fill the given
PreparedStatement object with the specified parameters.Note that this method uses the setObject method which depends
of a specified JDBC driver implementation to work properly. |
static int |
fillStatementIndx(PreparedStatement stmt,
int indx,
Object... params)
Fill the given
PreparedStatement object with the specified parameters
starting at indx position.Note that this method uses the setObject method which depends
of a specified JDBC driver implementation to work properly. |
static Limit |
lim(int x) |
static OrderBy |
orderByAsc(Object field) |
static OrderBy |
orderByDesc(Object field) |
static PreparedStatement |
prepare(Connection conn,
String query,
Object... params)
Prepare a statement (PreparedStatement) with the query and set the parameters.
|
static void |
rollbackTransaction(Connection conn) |
public static final String UNIQUE_KEY_VIOLATED_STATE
public static final String FOREIGN_KEY_VIOLATED_STATE
public static void executeScript(Connection conn, String file, String charset)
public static boolean checkIfTableExists(Connection conn, String tableName)
public static void close(Statement stmt)
public static void close(Statement stmt, Connection conn)
public static void close(Connection conn)
public static void close(ResultSet rset, Statement stmt, Connection conn)
public static int fillStatement(PreparedStatement stmt, Object... params)
PreparedStatement object with the specified parameters.setObject method which depends
of a specified JDBC driver implementation to work properly.stmt - - The PreparedStatement objectparams - - Values that will be added in statementfillStatementIndx(PreparedStatement, int, Object...),
PreparedStatement.setObject(int, Object)public static int fillStatementIndx(PreparedStatement stmt, int indx, Object... params)
PreparedStatement object with the specified parameters
starting at indx position.setObject method which depends
of a specified JDBC driver implementation to work properly.stmt - - The PreparedStatement objectindx - - Initial index for setting attributes in statementparams - - Values that will be added in statementfillStatement(PreparedStatement, Object...),
PreparedStatement.setObject(int, Object)public static PreparedStatement prepare(Connection conn, String query, Object... params) throws SQLException
conn - the connectionquery - the query to prepareparams - the parameters to set in the querySQLExceptionpublic static Limit lim(int x)
public static void beginTransaction(Connection conn)
public static void commitTransaction(Connection conn)
public static void rollbackTransaction(Connection conn)
Copyright © 2016. All Rights Reserved.