[+/-]
A Query instance represents a specific query with bound
parameters. The instance is created by the method
com.mysql.clusterj.Session.createQuery.
public interface com.mysql.clusterj.Query<E> {
// Public Static Fieldspublic static final java.lang.String INDEX_USED = "IndexUsed";public static final java.lang.String SCAN_TYPE = "ScanType";public static final java.lang.String SCAN_TYPE_INDEX_SCAN = "INDEX_SCAN";public static final java.lang.String SCAN_TYPE_PRIMARY_KEY = "PRIMARY_KEY";public static final java.lang.String SCAN_TYPE_TABLE_SCAN = "TABLE_SCAN";public static final java.lang.String SCAN_TYPE_UNIQUE_KEY = "UNIQUE_KEY";
// Public Methodspublic com.mysql.clusterj.Results<E> execute(java.lang.Object parameter);public com.mysql.clusterj.Results<E> execute(java.lang.Object[] parameters);public com.mysql.clusterj.Results<E> execute(java.util.Map<java.lang.String, ?> parameters);public java.util.Map<java.lang.String, java.lang.Object> explain();public java.util.List<E> getResultList();public void setParameter(java.lang.String parameterName,
java.lang.Object value);
}

public static final java.lang.String SCAN_TYPE_INDEX_SCAN = "INDEX_SCAN";The query explain scan type value for index scan
public static final java.lang.String SCAN_TYPE_PRIMARY_KEY = "PRIMARY_KEY";The query explain scan type value for primary key
public static final java.lang.String SCAN_TYPE_TABLE_SCAN = "TABLE_SCAN";The query explain scan type value for table scan
public static final java.lang.String SCAN_TYPE_UNIQUE_KEY = "UNIQUE_KEY";The query explain scan type value for unique key
public com.mysql.clusterj.Results<E> execute(java.util.Map<java.lang.String, ?> parameters);Execute the query with one or more named parameters. Parameters are resolved by name.
Parameters | |
parameters |
the parameters |
return |
the result |
public com.mysql.clusterj.Results<E> execute(java.lang.Object[] parameters);Execute the query with one or more parameters. Parameters are resolved in the order they were declared in the query.
Parameters | |
parameters |
the parameters |
return |
the result |
public com.mysql.clusterj.Results<E> execute(java.lang.Object parameter);Execute the query with exactly one parameter.
Parameters | |
parameter |
the parameter |
return |
the result |
public java.util.Map<java.lang.String, java.lang.Object> explain();Explain how this query will be or was executed. If called before binding all parameters, throws ClusterJUserException. Return a map of key:value pairs that explain how the query will be or was executed. Details can be obtained by calling toString on the value. The following keys are returned:
ScanType: the type of scan, with values:
PRIMARY_KEY: the query used key lookup with the primary key
UNIQUE_KEY: the query used key lookup with a unique key
INDEX_SCAN: the query used a range scan with a non-unique key
TABLE_SCAN: the query used a table scan
IndexUsed: the name of the index used, if any
Parameters | |
return |
the data about the execution of this query |
Exceptions
ClusterJUserException
if not all parameters are bound
public java.util.List<E> getResultList();Get the results as a list.
Parameters | |
return |
the result |
Exceptions
ClusterJUserException
if not all parameters are bound
ClusterJDatastoreException
if an exception is reported by the datastore
public void setParameter(java.lang.String parameterName,
java.lang.Object value);Set the value of a parameter. If called multiple times for the same parameter, silently replace the value.
Parameters | |
parameterName |
the name of the parameter |
value |
the value for the parameter |
