18 package com.mysql.clusterj.tie;
20 import com.mysql.ndbjtie.ndbapi.NdbIndexScanOperation;
22 import com.mysql.clusterj.ClusterJFatalInternalException;
24 import com.mysql.clusterj.core.store.Column;
25 import com.mysql.clusterj.core.store.IndexScanOperation;
26 import com.mysql.clusterj.core.store.Table;
27 import com.mysql.clusterj.core.util.I18NHelper;
28 import com.mysql.clusterj.core.util.Logger;
29 import com.mysql.clusterj.core.util.LoggerFactoryService;
31 import java.math.BigDecimal;
32 import java.math.BigInteger;
37 class IndexScanOperationImpl
extends ScanOperationImpl implements IndexScanOperation {
40 static final I18NHelper local = I18NHelper
41 .getInstance(IndexScanOperationImpl.class);
44 static final Logger logger = LoggerFactoryService.getFactory()
45 .getInstance(IndexScanOperationImpl.class);
50 ClusterTransactionImpl transaction) {
51 super(storeTable, ndbIndexScanOperation, transaction);
52 this.ndbIndexScanOperation = ndbIndexScanOperation;
55 public void setBoundBigInteger(Column storeColumn, BoundType
type, BigInteger value) {
56 int returnCode = ndbIndexScanOperation.
setBound(storeColumn.getName(), convertBoundType(type),
57 Utility.convertValue(storeColumn, value));
58 handleError(returnCode, ndbIndexScanOperation);
61 public void setBoundByte(Column storeColumn, BoundType type, byte value) {
62 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
63 Utility.convertValue(storeColumn, value));
64 handleError(returnCode, ndbIndexScanOperation);
67 public void setBoundBytes(Column storeColumn, BoundType type, byte[] value) {
68 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
69 Utility.convertValue(storeColumn, value));
70 handleError(returnCode, ndbIndexScanOperation);
73 public void setBoundDecimal(Column storeColumn, BoundType type, BigDecimal value) {
74 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
75 Utility.convertValue(storeColumn, value));
76 handleError(returnCode, ndbIndexScanOperation);
79 public void setBoundDouble(Column storeColumn, BoundType type, Double value) {
80 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
81 Utility.convertValue(storeColumn, value));
82 handleError(returnCode, ndbIndexScanOperation);
85 public void setBoundFloat(Column storeColumn, BoundType type, Float value) {
86 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
87 Utility.convertValue(storeColumn, value));
88 handleError(returnCode, ndbIndexScanOperation);
91 public void setBoundShort(Column storeColumn, BoundType type,
short value) {
92 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
93 Utility.convertValue(storeColumn, value));
94 handleError(returnCode, ndbIndexScanOperation);
97 public void setBoundInt(Column storeColumn, BoundType type, Integer value) {
98 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
99 Utility.convertValue(storeColumn, value));
100 handleError(returnCode, ndbIndexScanOperation);
103 public void setBoundLong(Column storeColumn, BoundType type,
long value) {
104 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
105 Utility.convertValue(storeColumn, value));
106 handleError(returnCode, ndbIndexScanOperation);
109 public void setBoundString(Column storeColumn, BoundType type,
String value) {
110 int returnCode = ndbIndexScanOperation.setBound(storeColumn.getName(), convertBoundType(type),
111 Utility.convertValue(storeColumn, value));
112 handleError(returnCode, ndbIndexScanOperation);
115 private int convertBoundType(BoundType type) {
128 throw new ClusterJFatalInternalException(
129 local.message(
"ERR_Implementation_Should_Not_Occur"));
133 public void endBound(
int rangeNumber) {
134 if (logger.isDetailEnabled()) logger.detail(
"IndexScanOperationImpl.endBound(" + rangeNumber +
")");
135 int returnCode = ndbIndexScanOperation.end_of_bound(rangeNumber);
136 handleError(returnCode, ndbIndexScanOperation);