public abstract class SQLUtils extends Object
| Constructor and Description |
|---|
SQLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
buildInsertSQL(String tableName,
String... columnNames)
Create insert-preparedStatement-String for specific table and column names
|
static PreparedStatement |
buildInsertStatement(Connection con,
String tableName,
Map<String,Object> columns)
Create insert-preparedStatement by connection with table and columns
|
static String |
buildUpdateSQL(String tableName,
String... columnNames)
Create update-preparedStatement-String with table name, column names and where-clause
|
static String |
buildUpdateSQL(String tableName,
String[] columnNames,
String where)
Create update-preparedStatement-String with table name, column names and where-clause.
|
static PreparedStatement |
buildUpdateStatement(Connection con,
String tableName,
Map<String,Object> columns,
String where,
Object... whereValues)
Create update-preparedStatement by connection with table, columns, and where clause
|
static Map<String,Integer> |
getColumnInfo(Connection con,
String tableName) |
static int |
getSQLType(Class<?> type) |
static boolean |
tableExists(Connection con,
String tableName)
Check if table exists in connection
|
public static String buildInsertSQL(String tableName, String... columnNames)
columnNames - column names as String Arraypublic static PreparedStatement buildInsertStatement(Connection con, String tableName, Map<String,Object> columns) throws SQLException
con - Connection required for creating prepared Statementcolumns - map with column name as key and the column value as valueSQLExceptionpublic static String buildUpdateSQL(String tableName, String... columnNames)
tableName - table name for statementpublic static String buildUpdateSQL(String tableName, String[] columnNames, String where)
public static PreparedStatement buildUpdateStatement(Connection con, String tableName, Map<String,Object> columns, String where, Object... whereValues) throws SQLException
con - Connection required for creating prepared Statementcolumns - columns map for name and valuewhereValues - values for where clauseSQLExceptionpublic static Map<String,Integer> getColumnInfo(Connection con, String tableName) throws SQLException
SQLExceptionpublic static int getSQLType(Class<?> type)
public static boolean tableExists(Connection con, String tableName) throws SQLException
TRUE if table exists, FALSE if table does not existsSQLExceptionCopyright © 2010–2021 Vegard IT GmbH, Germany. All rights reserved.