18 package com.mysql.clusterj.core.query;
 
   21 import com.mysql.clusterj.ClusterJException;
 
   22 import com.mysql.clusterj.ClusterJFatalInternalException;
 
   23 import com.mysql.clusterj.ClusterJUserException;
 
   25 import com.mysql.clusterj.core.spi.QueryExecutionContext;
 
   26 import com.mysql.clusterj.core.store.IndexScanOperation;
 
   27 import com.mysql.clusterj.core.store.Operation;
 
   28 import com.mysql.clusterj.core.store.ScanFilter;
 
   29 import com.mysql.clusterj.core.store.ScanOperation;
 
   31 import com.mysql.clusterj.core.util.I18NHelper;
 
   32 import com.mysql.clusterj.core.util.Logger;
 
   33 import com.mysql.clusterj.core.util.LoggerFactoryService;
 
   35 import com.mysql.clusterj.query.Predicate;
 
   46     protected QueryDomainTypeImpl<?> 
dobj;
 
   61         assertPredicateImpl(other);
 
   63         assertIdenticalDomainObject(otherPredicateImpl, 
"or");
 
   68         assertPredicateImpl(other);
 
   70         assertIdenticalDomainObject(predicateImpl, 
"and");
 
   72             AndPredicateImpl andPredicateImpl = (AndPredicateImpl)other;
 
   73             return andPredicateImpl.
and(
this);
 
   75             return new AndPredicateImpl(
dobj, 
this, predicateImpl);
 
   85                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
   88     public void operationSetBounds(QueryExecutionContext context,
 
   91                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
   94     public void operationSetLowerBound(QueryExecutionContext context,
 
   95             IndexScanOperation op, 
boolean lastColumn) {
 
   97                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
  100     public void operationSetUpperBound(QueryExecutionContext context,
 
  101             IndexScanOperation op, 
boolean lastColumn){
 
  102         throw new ClusterJFatalInternalException(
 
  103                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
  106     public void operationEqual(QueryExecutionContext context,
 
  108         throw new ClusterJFatalInternalException(
 
  109                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
  112     public void operationEqualFor(QueryExecutionContext context,
 
  113             Operation op, 
String indexName) {
 
  114         throw new ClusterJFatalInternalException(
 
  115                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
  118     public void objectSetValuesFor(QueryExecutionContext context,
 
  119             Object row, 
String indexName) {
 
  120         throw new ClusterJFatalInternalException(
 
  121                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
  132             ScanFilter filter = op.getScanFilter(context);
 
  138         } 
catch (Exception ex) {
 
  140                     local.
message(
"ERR_Get_NdbFilter"), ex);
 
  147                 local.
message(
"ERR_Implementation_Should_Not_Occur"));
 
  150     public void assertIdenticalDomainObject(PredicateImpl other, 
String venue) {
 
  151         QueryDomainTypeImpl<?> otherDomainObject = other.getDomainObject();
 
  152         if (
dobj != otherDomainObject) {
 
  154                     local.
message(
"ERR_Wrong_Domain_Object", venue));
 
  159     void setSatisfied() {
 
  160         throw new UnsupportedOperationException(
"Not yet implemented");
 
  169     private void assertPredicateImpl(Predicate other) {
 
  170         if (!(other instanceof PredicateImpl)) {
 
  171             throw new UnsupportedOperationException(
 
  172                     local.
message(
"ERR_NotImplemented"));
 
  176     private QueryDomainTypeImpl<?> getDomainObject() {
 
  180     public CandidateIndexImpl getBestCandidateIndex(QueryExecutionContext context) {
 
  190             PredicateImpl... predicates) {
 
  195         for (PredicateImpl predicateImpl : predicates) {
 
  196             predicateImpl.markBoundsForCandidateIndices(context, candidateIndices);
 
  207             if (candidateIndex.supportsConditionsOfLength(numberOfConditions)) {
 
  209                 int score = candidateIndex.getScore();
 
  210                 if (logger.isDetailEnabled()) {
 
  211                     logger.detail(
"Score: " + score + 
" from " + candidateIndex);
 
  213                 if (score > highScore) {
 
  214                     bestCandidateIndexImpl = candidateIndex;
 
  219         if (logger.isDetailEnabled()) logger.detail(
"High score: " + highScore
 
  220                 + 
" from " + bestCandidateIndexImpl.getIndexName());
 
  221         return bestCandidateIndexImpl;