public class SqlUtils
extends java.lang.Object
| Constructor and Description |
|---|
SqlUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
checkEditPermission(java.lang.String tableName)
Checks if user has the permission to edit a specified table.
|
static void |
commit()
Commits the current database transaction.
|
static java.util.List<com.archibus.datasource.data.DataRecord> |
executeQuery(java.lang.String tableName,
java.lang.String[] fieldNames,
java.lang.String sql)
Executes SQL query and returns all records (no record limit).
|
static void |
executeUpdate(java.lang.String tableName,
java.lang.String sql)
Executes SQL update query without checking user's permission to edit specified table.
|
static void |
executeUpdate(java.lang.String tableName,
java.lang.String sql,
boolean checkTableEditPermission)
Executes SQL update query with the option to check user's permission to edit specified table.
|
static void |
executeUpdateRequired(java.lang.String tableName,
java.lang.String sql)
Executes SQL update query.
|
static java.lang.String |
formatSqlReplace0WithHuge(java.lang.String value)
Replaces any expression that returns a 0 result with a very large number (9999999999)
|
static java.lang.String |
formatValueForSql(java.lang.Object value)
Formats field value for SQL.
|
static boolean |
isOracle()
Returns true if the current database is Oracle.
|
static boolean |
isSqlServer()
Returns true if the current database is SQL Server.
|
static boolean |
isSybase()
Returns true if the current database is Sybase.
|
static java.lang.String |
makeLiteralOrBlank(java.lang.String value)
Returns literalized version of specified string, or an empty string if specified string is
null.
|
static java.lang.Object |
normalizeValueForSql(java.lang.Object value)
Converts value to type that is accepted by the SQL layer:
java.util.Date --> java.sql.Date
|
static void |
normalizeValuesForSql(java.util.Map<java.lang.String,java.lang.Object> values)
Converts values to types that are accepted by the SQL layer.
|
static void |
rollback()
Rolls back the current database transaction.
|
public static void executeUpdate(java.lang.String tableName,
java.lang.String sql)
tableName - - String table Name.sql - - String sql statement.public static void executeUpdate(java.lang.String tableName,
java.lang.String sql,
boolean checkTableEditPermission)
tableName - - String table Name.sql - - String sql statement.checkTableEditPermission - - boolean.public static void executeUpdateRequired(java.lang.String tableName,
java.lang.String sql)
This is a replacement for EventHandlerBase.executeDbSql(EventHandlerContext context, String tableName, String sql, boolean updatedRecordsRequired).
tableName - - String table Name.sql - - String sql statement.public static java.util.List<com.archibus.datasource.data.DataRecord> executeQuery(java.lang.String tableName,
java.lang.String[] fieldNames,
java.lang.String sql)
tableName - Table name.fieldNames - Names of fields which will be retrieved.sql - Custom SQL query.public static void commit()
public static void rollback()
public static boolean isOracle()
public static boolean isSqlServer()
public static boolean isSybase()
public static java.lang.String formatValueForSql(java.lang.Object value)
value - public static java.lang.String makeLiteralOrBlank(java.lang.String value)
value - public static java.lang.String formatSqlReplace0WithHuge(java.lang.String value)
value - public static java.lang.Object normalizeValueForSql(java.lang.Object value)
value - public static void normalizeValuesForSql(java.util.Map<java.lang.String,java.lang.Object> values)
values - - Mappublic static void checkEditPermission(java.lang.String tableName)
tableName - - String table name.