下面列出了android.database.sqlite.SQLiteQueryBuilder#appendWhereEscapeString ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Return a Cursor contains all RegisteredActionParameter records which matches the parameters.
*
* @param parameterName
* is the parameter name, or null to fetch any parameterName.
* @param actionID
* is the action id, or null to fetch any actionID.
* @param dataTypeID
* is the dataType id, or null to fetch any dataTypeID.
* @return a Cursor contains all RegisteredActionParameter records which matches the parameters.
*/
public Cursor fetchAll(String parameterName, Long actionID, Long dataTypeID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (parameterName != null) {
qb.appendWhere(" AND " + KEY_ACTIONPARAMETERNAME + " = ");
qb.appendWhereEscapeString(parameterName);
}
if (actionID != null) {
qb.appendWhere(" AND " + KEY_ACTIONID + " = " + actionID);
}
if (dataTypeID != null) {
qb.appendWhere(" AND " + KEY_DATATYPEID + " = " + dataTypeID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all DataFilter records which matches the parameters.
*
* @param dataFilterName
* is the filter name or null to fetch any filter name.
*
* @param dataFilterDisplayName
* is the filter display name or null to fetch any filter name.
*
* @param filterOnDataTypeID
* is the id of data type it filters on, or null to fetch any.
*
* @param compareWithDataTypeID
* is the id of data type it compares to, or null to fetch any.
*
* @return a Cursor that contains all DataFilter records which matches the parameters.
*/
public Cursor fetchAll(String dataFilterName, String dataFilterDisplayName,
Long filterOnDataTypeID, Long compareWithDataTypeID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (dataFilterName != null) {
qb.appendWhere(" AND " + KEY_DATAFILTERNAME + " = ");
qb.appendWhereEscapeString(dataFilterName);
}
if (dataFilterDisplayName != null) {
qb.appendWhere(" AND " + KEY_DATAFILTERDISPLAYNAME + " = ");
qb.appendWhereEscapeString(dataFilterDisplayName);
}
if (filterOnDataTypeID != null) {
qb.appendWhere(" AND " + KEY_FILTERONDATATYPEID + " = " + filterOnDataTypeID);
}
if (compareWithDataTypeID != null) {
qb.appendWhere(" AND " + KEY_COMPAREWITHDATATYPEID + " = " + compareWithDataTypeID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all RegisteredApp records which matches the parameters.
*
* @param appName
* is the application name or null to fetch any appName.
* @param pkgName
* is the package name or null to fetch any pkgName.
* @param enabled
* is whether the application is activated or null to fetch any enabled status.
* @return a Cursor that contains all RegisteredApp records which matches the parameters.
*/
public Cursor fetchAll(String appName, String pkgName, Boolean enabled) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (appName != null) {
qb.appendWhere(" AND " + KEY_APPNAME + " = ");
qb.appendWhereEscapeString(appName);
}
if (pkgName != null) {
qb.appendWhere(" AND " + KEY_PKGNAME + " = ");
qb.appendWhereEscapeString(pkgName);
}
if (enabled != null) {
qb.appendWhere(" AND " + KEY_ENABLED + " = " + (enabled ? 1 : 0));
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor contains all RegisteredEventAttribute records which matches the parameters.
*
* @param attributeName
* is the attribute name, or null to fetch any attributeName
* @param eventID
* is the event id, or null to fetch any eventID
* @param dataTypeID
* is the dataType id, or null to fetch any dataTypeID
* @return a Cursor contains all RegisteredEventAttribute records which matches the parameters.
*/
public Cursor fetchAll(String attributeName, Long eventID, Long dataTypeID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (attributeName != null) {
qb.appendWhere(" AND " + KEY_EVENTATTRIBUTENAME + " = ");
qb.appendWhereEscapeString(attributeName);
}
if (eventID != null) {
qb.appendWhere(" AND " + KEY_EVENTID + " = " + eventID);
}
if (dataTypeID != null) {
qb.appendWhere(" AND " + KEY_DATATYPEID + " = " + dataTypeID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all DataType records which matches the parameters.
*
* @param dataTypeName
* is the data type name or null to fetch any dataTypeName.
* @param dataTypeClassName
* is the name of the data type class.
* @return a Cursor that contains all DataType records which matches the parameters.
*/
public Cursor fetchAll(String dataTypeName, String dataTypeClassName) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (dataTypeName != null) {
qb.appendWhere(" AND " + KEY_DATATYPENAME + " = ");
qb.appendWhereEscapeString(dataTypeName);
}
if (dataTypeClassName != null) {
qb.appendWhere(" AND " + KEY_DATATYPECLASSNAME + " = ");
qb.appendWhereEscapeString(dataTypeClassName);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all RuleActionParameter records which matches the parameters.
*
* @param ruleActionID
* is id of rule action it belongs to, or null to fetch any
* @param actionParameterID
* is id of its action parameter type, or null to fetch any
* @param ruleActionParameterData
* is the data associated with this parameter, or null to fetch any
* @return a Cursor that contains all RuleActionParameter records which matches the parameters.
*/
public Cursor fetchAll(Long ruleActionID, Long actionParameterID, String ruleActionParameterData) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (ruleActionID != null) {
qb.appendWhere(" AND " + KEY_RULEACTIONID + " = " + ruleActionID);
}
if (actionParameterID != null) {
qb.appendWhere(" AND " + KEY_ACTIONPARAMETERID + " = " + actionParameterID);
}
if (ruleActionParameterData != null) {
qb.appendWhere(" AND " + KEY_RULEACTIONPARAMETERDATA + " = ");
qb.appendWhereEscapeString(ruleActionParameterData);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all Rule records which matches the parameters.
*
* @param eventID
* is the event id, or null to fetch any eventID
* @param ruleName
* is name of rule, or null to fetch any ruleName
* @param ruleDesc
* is description of rule, or null to fetch any description
* @param enabled
* is whether the rule is activated or null to fetch any enabled status
* @param orderBy
* is the ',' delimited order by columns, or null if no specific order
* @return a Cursor that contains all Rule records which matches the parameters.
* @throws SQLiteException
* if orderBy is not compiled correctly
*/
public Cursor fetchAll(Long eventID, String ruleName, String ruleDesc, Boolean enabled,
String orderBy) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (eventID != null) {
qb.appendWhere(" AND " + KEY_EVENTID + " = " + eventID);
}
if (ruleName != null) {
qb.appendWhere(" AND " + KEY_RULENAME + " = ");
qb.appendWhereEscapeString(ruleName);
}
if (ruleDesc != null) {
qb.appendWhere(" AND " + KEY_RULEDESC + " = ");
qb.appendWhereEscapeString(ruleDesc);
}
if (enabled != null) {
qb.appendWhere(" AND " + KEY_ENABLED + " = " + (enabled ? 1 : 0));
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, orderBy);
}
/**
* Return a Cursor that contains all ExternalAttribute records which matches the parameters
*
* @param attributeName
* is the attribute name, or null to fetch any actionName
* @param appID
* is the application id, or null to fetch any appID
* @param dataTypeID
* is the dataType id, or null to fetch any dataTypeID
* @return a Cursor that contains all RegisteredAction records which matches the parameters.
*/
public Cursor fetchAll(String attributeName, Long appID, Long dataTypeID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (attributeName != null) {
qb.appendWhere(" AND " + KEY_EXTERNALATTRIBUTENAME + " = ");
qb.appendWhereEscapeString(attributeName);
}
if (appID != null) {
qb.appendWhere(" AND " + KEY_APPID + " = " + appID);
}
if (dataTypeID != null) {
qb.appendWhere(" AND " + KEY_DATATYPEID + " = " + dataTypeID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all FailedActionParameter records which matches the parameters.
*
* @param failedActionID
* is id of failed action it belongs to, or null to fetch any
* @param actionParameterName
* name of action parameter, or null to fetch any
* @param failedActionParameterData
* is the data associated with this parameter, or null to fetch any
* @return a Cursor that contains all FailedActionParameter records which matches the parameters.
*/
public Cursor fetchAll(Long failedActionID, String actionParameterName,
String failedActionParameterData) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (failedActionID != null) {
qb.appendWhere(" AND " + KEY_FAILEDACTIONID + " = " + failedActionID);
}
if (actionParameterName != null) {
qb.appendWhere(" AND " + KEY_ACTIONPARAMETERNAME + " = " + actionParameterName);
}
if (failedActionParameterData != null) {
qb.appendWhere(" AND " + KEY_FAILEDACTIONPARAMETERDATA + " = ");
qb.appendWhereEscapeString(failedActionParameterData);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Append the selection of the account specified in <code>uri</code> to the an {@link SQLiteQueryBuilder}.
*
* @param sqlBuilder
* A {@link SQLiteQueryBuilder} that the selection is appended to.
* @param uri
* A {@link Uri} that specifies an account.
*/
protected void selectAccount(SQLiteQueryBuilder sqlBuilder, Uri uri)
{
String accountName = getAccountName(uri);
String accountType = getAccountType(uri);
if (accountName != null)
{
sqlBuilder.appendWhere(" AND ");
sqlBuilder.appendWhere(TaskListSyncColumns.ACCOUNT_NAME);
sqlBuilder.appendWhere("=");
sqlBuilder.appendWhereEscapeString(accountName);
}
if (accountType != null)
{
sqlBuilder.appendWhere(" AND ");
sqlBuilder.appendWhere(TaskListSyncColumns.ACCOUNT_TYPE);
sqlBuilder.appendWhere("=");
sqlBuilder.appendWhereEscapeString(accountType);
}
}
/**
* Append the selection of the account specified in <code>uri</code> to the an {@link SQLiteQueryBuilder}.
*
* @param sqlBuilder
* A {@link SQLiteQueryBuilder} that the selection is appended to.
* @param uri
* A {@link Uri} that specifies an account.
*/
protected void selectAccount(SQLiteQueryBuilder sqlBuilder, Uri uri)
{
String accountName = getAccountName(uri);
String accountType = getAccountType(uri);
if (accountName != null)
{
sqlBuilder.appendWhere(" AND ");
sqlBuilder.appendWhere(TaskListSyncColumns.ACCOUNT_NAME);
sqlBuilder.appendWhere("=");
sqlBuilder.appendWhereEscapeString(accountName);
}
if (accountType != null)
{
sqlBuilder.appendWhere(" AND ");
sqlBuilder.appendWhere(TaskListSyncColumns.ACCOUNT_TYPE);
sqlBuilder.appendWhere("=");
sqlBuilder.appendWhereEscapeString(accountType);
}
}
/**
* Return a Cursor that contains all RegisteredApp records which matches the parameters.
*
* @param appName
* is the application name or null to fetch any appName.
* @param pkgName
* is the package name or null to fetch any pkgName.
* @param enabled
* is whether the application is activated or null to fetch any enabled status.
* @param loginEabled
* is whether the application needs username and password information.
* @param username
* is the username for the application.
* @param password
* is the password the application.
* @return a Cursor that contains all RegisteredApp records which matches the parameters.
*/
public Cursor fetchAll(String appName, String pkgName, Boolean enabled, Boolean loginEnabled,
String username, String password) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (appName != null) {
qb.appendWhere(" AND " + KEY_APPNAME + " = ");
qb.appendWhereEscapeString(appName);
}
if (pkgName != null) {
qb.appendWhere(" AND " + KEY_PKGNAME + " = ");
qb.appendWhereEscapeString(pkgName);
}
if (enabled != null) {
qb.appendWhere(" AND " + KEY_ENABLED + " = " + (enabled ? 1 : 0));
}
if (loginEnabled != null) {
qb.appendWhere(" AND " + KEY_LOGIN + " = " + (loginEnabled ? 1 : 0));
}
if (username != null) {
qb.appendWhere(" AND " + KEY_USERNAME + " = ");
qb.appendWhereEscapeString(username);
}
if (password != null) {
qb.appendWhere(" AND " + KEY_PASSWORD + " = ");
qb.appendWhereEscapeString(password);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all RuleFilter records which matches the parameters.
*
* @param ruleID
* is the id of rule the filter belongs to, or null to fetch any.
* @param eventAttributeID
* is id of the event attribute, or null to fetch any.
* @param externalAttributeID
* is id of the external attribute, or null to fetch any.
* @param dataFilterID
* is id of the data filter, or null to fetch any.
* @param parentRuleFilterID
* is id of its parent ruleFiler, or null to fetch any.
* @param ruleFilterData
* is the data associated with this ruleFilter, or null to fetch any.
* @return a Cursor that contains all RuleFilter records which matches the parameters.
*/
public Cursor fetchAll(Long ruleID, Long eventAttributeID, Long externalAttributeID,
Long dataFilterID, Long parentRuleFilterID, String ruleFilterData) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (ruleID != null) {
qb.appendWhere(" AND " + KEY_RULEID + " = " + ruleID);
}
if (eventAttributeID != null) {
qb.appendWhere(" AND " + KEY_EVENTATTRIBUTEID + " = " + eventAttributeID);
}
if (externalAttributeID != null) {
qb.appendWhere(" AND " + KEY_EXTERNALATTRIBUTEID + " = " + externalAttributeID);
}
if (dataFilterID != null) {
qb.appendWhere(" AND " + KEY_DATAFILTERID + " = " + dataFilterID);
}
if (parentRuleFilterID != null) {
qb.appendWhere(" AND " + KEY_PARENTRULEFILTERID + " = " + parentRuleFilterID);
}
if (ruleFilterData != null) {
qb.appendWhere(" AND " + KEY_RULEFILTERDATA + " = ");
qb.appendWhereEscapeString(ruleFilterData);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all RegisteredAction records which matches the parameters
*
* @param actionName
* is the actionName, or null to fetch any actionName
* @param appID
* is the application id, or null to fetch any appID
* @return a Cursor that contains all RegisteredAction records which matches the parameters.
*/
public Cursor fetchAll(String actionName, Long appID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (actionName != null) {
qb.appendWhere(" AND " + KEY_ACTIONNAME + " = ");
qb.appendWhereEscapeString(actionName);
}
if (appID != null) {
qb.appendWhere(" AND " + KEY_APPID + " = " + appID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}
/**
* Return a Cursor that contains all RegisteredEvent records which matches the parameters.
*
* @param eventName
* is the event name, or null to fetch any eventName
* @param appID
* is the application id, or null to fetch any appID
* @return a Cursor that contains all RegisteredEvent records which matches the parameters.
*/
public Cursor fetchAll(String eventName, Long appID) {
SQLiteQueryBuilder qb = new SQLiteQueryBuilder();
qb.setTables(DATABASE_TABLE);
qb.appendWhere("1=1");
if (eventName != null) {
qb.appendWhere(" AND " + KEY_EVENTNAME + " = ");
qb.appendWhereEscapeString(eventName);
}
if (appID != null) {
qb.appendWhere(" AND " + KEY_APPID + " = " + appID);
}
// Not using additional selections, selectionArgs, groupBy, having, orderBy, set them to null.
return qb.query(database, KEYS, null, null, null, null, null);
}