QueryOptions Class
Contains an immutable configuration for the SOQL SET OPTIONS clause.
Pass a Database.QueryOptions instance as a bind variable to the SOQL SET OPTIONS clause. Construct Database.QueryOptions instances by calling Database.QueryOptions.builder(), and then build() on the returned Database.QueryOptionsBuilder instance.
Use Database.QueryOptions with dynamic SOQL methods that support binds, including Database.query, Database.queryWithBinds, Database.countQuery, Database.countQueryWithBinds, Database.getQueryLocator, and Database.getQueryLocatorWithBinds.
Keep these considerations in mind.
- After
build(), the object is immutable. Use theget*methods to read values set on the builder. - Unset properties return
nullfrom their getters. - Only the query options that you explicitly set are applied. If not set, the platform performs the default query behavior.
This example builds a Database.QueryOptions object and binds the object in a query.
The following are methods for QueryOptions.
-
Returns a new
Database.QueryOptionsBuilderwith no options set. -
Returns the dataspace name set on the builder, or
nullif unset. -
Returns whether explicit namespace resolution is enabled, or
nullif unset. -
Returns whether empty-string filter values are honored, or
nullif unset.
Returns a new Database.QueryOptionsBuilder with no options set.
public static Database.QueryOptionsBuilder builder()
Type: Database.QueryOptionsBuilder
A new Database.QueryOptionsBuilder with no options set.
Returns the dataspace name set on the builder, or null if unset.
public String getDataspace()
Type: String
The dataspace name, or null if unset. Never returns an empty string. Use when querying Data 360 Data Lake Objects (DLOs). For more information, see SOQL SET OPTIONS in the SOQL and SOSL Reference.
Returns whether explicit namespace resolution is enabled, or null if unset.
public Boolean getExplicitNamespace()
Type: Boolean
true if explicit namespace resolution is enabled, false if it is disabled, or null if unset.
Returns whether empty-string filter values are honored, or null if unset.
public Boolean getHonorEmptyStrings()
Type: Boolean
true if empty-string filter values are honored, false if they aren’t, or null if unset. For more information, see SOQL SET OPTIONS in the SOQL and SOSL Reference .