public class RdbUtils extends Object
SystemCapability.Data#DATA_APPDATAMGR| 限定符和类型 | 类 | 说明 |
|---|---|---|
static class |
RdbUtils.OperationType |
Describes the database operation type.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static void |
appendStringToSqlAndEscapeQuote(StringBuilder sqlbuilder,
String escapeVar) |
Appends an
escapeVar to an sqlbuilder. |
static String |
escapeQuote(String sqlString) |
Escapes the single quotation marks in a string.
|
static void |
verifyPredicates(RdbStore rdbStore,
RdbUtils.OperationType type,
AbsRdbPredicates absRdbPredicates) |
Verifies the specified instance object of
AbsRdbPredicates. |
static void |
verifySql(RdbStore rdbStore,
String sql) |
Verifies the specified SQL statement.
|
public static void appendStringToSqlAndEscapeQuote(StringBuilder sqlbuilder, String escapeVar)
escapeVar to an sqlbuilder.
Single quotation marks contained in the escapeVar will be escaped. If escapeVar
is null, it will not be appended, and sqlbuilder will be returned.
sqlbuilder - Indicates the sqlbuilder to which the sqlString will be appended.escapeVar - Indicates the escapeVar to be appended.public static String escapeQuote(String sqlString)
If the input string is null, null will be returned. If the input string is empty,
two single quotation marks will be returned.
sqlString - Indicates the string that contains the single quotation marks to be escaped.public static void verifySql(RdbStore rdbStore, String sql)
rdbStore - Indicates the database on which to execute the SQL statement.sql - Indicates the SQL statement to verify.RdbException - Throws this exception if the SQL statement is invalid.IllegalArgumentException - Throws this exception if either parameter is null.public static void verifyPredicates(RdbStore rdbStore, RdbUtils.OperationType type, AbsRdbPredicates absRdbPredicates)
AbsRdbPredicates.
This method applies to the update, delete, and count operations on the database.
rdbStore - Indicates the database for which to set the AbsRdbPredicates.type - Indicates the operation type, as enumerated in OperationType.absRdbPredicates - Indicates the instance object of AbsRdbPredicates to verify.RdbException - Throws this exception if the instance of AbsRdbPredicates is invalid for the
specified operation type.IllegalArgumentException - Throws this exception if any parameter is null.