Commit 150924ab authored by unknown's avatar unknown

wl1804 - ndb - add support for _all_ type in NdbScanFilter + TUP


ndb/include/ndbapi/NdbOperation.hpp:
  change char* -> void*
ndb/include/ndbapi/NdbScanFilter.hpp:
  Add generic cmp-function
  Let "old" function use the new one
ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
  Add support for all types for scan filters
ndb/src/ndbapi/NdbOperationInt.cpp:
  Check length of argument
ndb/src/ndbapi/NdbScanFilter.cpp:
  Add support for all types for scan filters
parent f238eef3
......@@ -577,21 +577,21 @@ public:
* @param Label label to jump to
* @return -1 if unsuccessful
*/
int branch_col_eq(Uint32 ColId, const char * val, Uint32 len,
int branch_col_eq(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_ne(Uint32 ColId, const char * val, Uint32 len,
int branch_col_ne(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_lt(Uint32 ColId, const char * val, Uint32 len,
int branch_col_lt(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_le(Uint32 ColId, const char * val, Uint32 len,
int branch_col_le(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_gt(Uint32 ColId, const char * val, Uint32 len,
int branch_col_gt(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_ge(Uint32 ColId, const char * val, Uint32 len,
int branch_col_ge(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_like(Uint32 ColId, const char *, Uint32 len,
int branch_col_like(Uint32 ColId, const void *, Uint32 len,
bool nopad, Uint32 Label);
int branch_col_notlike(Uint32 ColId, const char *, Uint32 len,
int branch_col_notlike(Uint32 ColId, const void *, Uint32 len,
bool nopad, Uint32 Label);
/**
......@@ -822,7 +822,7 @@ protected:
int read_attr(const NdbColumnImpl* anAttrObject, Uint32 RegDest);
int write_attr(const NdbColumnImpl* anAttrObject, Uint32 RegSource);
int branch_reg_reg(Uint32 type, Uint32, Uint32, Uint32);
int branch_col(Uint32 type, Uint32, const char *, Uint32, bool, Uint32 Label);
int branch_col(Uint32 type, Uint32, const void *, Uint32, bool, Uint32 Label);
int branch_col_null(Uint32 type, Uint32 col, Uint32 Label);
// Handle ATTRINFO signals
......
......@@ -45,7 +45,17 @@ public:
NAND = 3, ///< NOT (x1 AND x2 AND x3)
NOR = 4 ///< NOT (x1 OR x2 OR x3)
};
enum BinaryCondition
{
LE = 0, ///< lower bound
LT = 1, ///< lower bound, strict
GE = 2, ///< upper bound
GT = 3, ///< upper bound, strict
EQ = 4, ///< equality
NE = 5
};
/**
* @name Grouping
* @{
......@@ -74,7 +84,12 @@ public:
* <i>Explanation missing</i>
*/
int isfalse();
/**
* Compare column <b>ColId</b> with <b>val</b>
*/
int cmp(BinaryCondition cond, int ColId, const void *val, Uint32 len);
/**
* @name Integer Comparators
* @{
......@@ -82,80 +97,61 @@ public:
/** Compare column value with integer for equal
* ®return 0 if successful, -1 otherwize
*/
int eq(int ColId, Uint32 value);
int eq(int ColId, Uint32 value) { return cmp(EQ, ColId, &value, 4);}
/** Compare column value with integer for not equal.
* ®return 0 if successful, -1 otherwize
*/
int ne(int ColId, Uint32 value);
int ne(int ColId, Uint32 value) { return cmp(NE, ColId, &value, 4);}
/** Compare column value with integer for less than.
* ®return 0 if successful, -1 otherwize
*/
int lt(int ColId, Uint32 value);
int lt(int ColId, Uint32 value) { return cmp(LT, ColId, &value, 4);}
/** Compare column value with integer for less than or equal.
* ®return 0 if successful, -1 otherwize
*/
int le(int ColId, Uint32 value);
int le(int ColId, Uint32 value) { return cmp(LE, ColId, &value, 4);}
/** Compare column value with integer for greater than.
* ®return 0 if successful, -1 otherwize
*/
int gt(int ColId, Uint32 value);
int gt(int ColId, Uint32 value) { return cmp(GT, ColId, &value, 4);}
/** Compare column value with integer for greater than or equal.
* ®return 0 if successful, -1 otherwize
*/
int ge(int ColId, Uint32 value);
int ge(int ColId, Uint32 value) { return cmp(GE, ColId, &value, 4);}
/** Compare column value with integer for equal. 64-bit.
* ®return 0 if successful, -1 otherwize
*/
int eq(int ColId, Uint64 value);
int eq(int ColId, Uint64 value) { return cmp(EQ, ColId, &value, 8);}
/** Compare column value with integer for not equal. 64-bit.
* ®return 0 if successful, -1 otherwize
*/
int ne(int ColId, Uint64 value);
int ne(int ColId, Uint64 value) { return cmp(NE, ColId, &value, 8);}
/** Compare column value with integer for less than. 64-bit.
* ®return 0 if successful, -1 otherwize
*/
int lt(int ColId, Uint64 value);
int lt(int ColId, Uint64 value) { return cmp(LT, ColId, &value, 8);}
/** Compare column value with integer for less than or equal. 64-bit.
* ®return 0 if successful, -1 otherwize
*/
int le(int ColId, Uint64 value);
int le(int ColId, Uint64 value) { return cmp(LE, ColId, &value, 8);}
/** Compare column value with integer for greater than. 64-bit.
* ®return 0 if successful, -1 otherwize
*/
int gt(int ColId, Uint64 value);
int gt(int ColId, Uint64 value) { return cmp(GT, ColId, &value, 8);}
/** Compare column value with integer for greater than or equal. 64-bit.
* ®return 0 if successful, -1 otherwize
*/
int ge(int ColId, Uint64 value);
int ge(int ColId, Uint64 value) { return cmp(GE, ColId, &value, 8);}
/** @} *********************************************************************/
/** Check if column value is NULL */
int isnull(int ColId);
/** Check if column value is non-NULL */
int isnotnull(int ColId);
/**
* @name String Comparators
* @{
*/
/**
* Compare string against a Char or Varchar column.
*
* By default Char comparison blank-pads both sides to common length.
* Varchar comparison does not blank-pad.
*
* The extra <i>nopad</i> argument can be used to
* force non-padded comparison for a Char column.
* ®return 0 if successful, -1 otherwize
*/
int eq(int ColId, const char * val, Uint32 len, bool nopad=false);
int ne(int ColId, const char * val, Uint32 len, bool nopad=false);
int lt(int ColId, const char * val, Uint32 len, bool nopad=false);
int le(int ColId, const char * val, Uint32 len, bool nopad=false);
int gt(int ColId, const char * val, Uint32 len, bool nopad=false);
int ge(int ColId, const char * val, Uint32 len, bool nopad=false);
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
/**
* Like comparison operator.
* ®return 0 if successful, -1 otherwize
......@@ -167,6 +163,7 @@ public:
*/
int notlike(int ColId, const char * val, Uint32 len, bool nopad=false);
/** @} *********************************************************************/
#endif
private:
#ifndef DOXYGEN_SHOULD_SKIP_INTERNAL
......
......@@ -1818,9 +1818,6 @@ int Dbtup::interpreterNextLab(Signal* signal,
case Interpreter::BRANCH_ATTR_OP_ARG:{
jam();
Uint32 cond = Interpreter::getBinaryCondition(theInstruction);
Uint32 diff = Interpreter::getArrayLengthDiff(theInstruction);
Uint32 vchr = Interpreter::isVarchar(theInstruction);
Uint32 nopad =Interpreter::isNopad(theInstruction);
Uint32 ins2 = TcurrentProgram[TprogramCounter];
Uint32 attrId = Interpreter::getBranchCol_AttrId(ins2) << 16;
Uint32 argLen = Interpreter::getBranchCol_Len(ins2);
......@@ -1839,84 +1836,82 @@ int Dbtup::interpreterNextLab(Signal* signal,
}
tmpHabitant = attrId;
}
AttributeHeader ah(tmpArea[0]);
attrId >>= 16;
AttributeHeader ah(tmpArea[0]);
const char* s1 = (char*)&tmpArea[1];
const char* s2 = (char*)&TcurrentProgram[TprogramCounter+1];
Uint32 attrLen = (4 * ah.getDataSize()) - diff;
if (vchr) {
#if NDB_VERSION_MAJOR >= 3
bool vok = false;
if (attrLen >= 2) {
Uint32 vlen = (s1[0] << 8) | s1[1]; // big-endian
s1 += 2;
attrLen -= 2;
if (attrLen >= vlen) {
attrLen = vlen;
vok = true;
}
}
if (!vok) {
terrorCode = ZREGISTER_INIT_ERROR;
tupkeyErrorLab(signal);
return -1;
}
#else
Uint32 tmp;
if (attrLen >= 2) {
unsigned char* ss = (unsigned char*)&s1[attrLen - 2];
tmp = (ss[0] << 8) | ss[1];
if (tmp <= attrLen - 2)
attrLen = tmp;
}
// XXX handle bad data
#endif
}
bool res = false;
Uint32 attrLen = (4 * ah.getDataSize());
Uint32 TattrDescrIndex = tabptr.p->tabDescriptor +
(attrId << ZAD_LOG_SIZE);
Uint32 TattrDesc1 = tableDescriptor[TattrDescrIndex].tabDescr;
Uint32 TattrDesc2 = tableDescriptor[TattrDescrIndex+1].tabDescr;
Uint32 typeId = AttributeDescriptor::getType(TattrDesc1);
void * cs = 0;
if(AttributeOffset::getCharsetFlag(TattrDesc2))
{
Uint32 pos = AttributeOffset::getCharsetPos(TattrDesc2);
cs = tabptr.p->charsetArray[pos];
}
const NdbSqlUtil::Type& sqlType = NdbSqlUtil::getType(typeId);
bool r1_null = ah.isNULL();
bool r2_null = argLen == 0;
int res;
if(r1_null || r2_null)
{
res = r1_null && r2_null ? 0 : r1_null ? -1 : 1;
}
else
{
res = (*sqlType.m_cmp)(cs, s1, attrLen, s2, argLen, true);
}
switch ((Interpreter::BinaryCondition)cond) {
case Interpreter::EQ:
res = NdbSqlUtil::char_compare(s1, attrLen, s2, argLen, !nopad) == 0;
res = (res == 0);
break;
case Interpreter::NE:
res = NdbSqlUtil::char_compare(s1, attrLen, s2, argLen, !nopad) != 0;
res = (res != 0);
break;
// note the condition is backwards
case Interpreter::LT:
res = NdbSqlUtil::char_compare(s1, attrLen, s2, argLen, !nopad) > 0;
res = (res > 0);
break;
case Interpreter::LE:
res = NdbSqlUtil::char_compare(s1, attrLen, s2, argLen, !nopad) >= 0;
res = (res >= 0);
break;
case Interpreter::GT:
res = NdbSqlUtil::char_compare(s1, attrLen, s2, argLen, !nopad) < 0;
res = (res < 0);
break;
case Interpreter::GE:
res = NdbSqlUtil::char_compare(s1, attrLen, s2, argLen, !nopad) <= 0;
res = (res <= 0);
break;
case Interpreter::LIKE:
res = NdbSqlUtil::char_like(s1, attrLen, s2, argLen, !nopad);
res = NdbSqlUtil::char_like(s1, attrLen, s2, argLen, false);
break;
case Interpreter::NOT_LIKE:
res = ! NdbSqlUtil::char_like(s1, attrLen, s2, argLen, !nopad);
res = ! NdbSqlUtil::char_like(s1, attrLen, s2, argLen, false);
break;
// XXX handle invalid value
// XXX handle invalid value
}
#ifdef TRACE_INTERPRETER
ndbout_c("cond=%u diff=%d vc=%d nopad=%d attr(%d) = >%.*s<(%d) str=>%.*s<(%d) -> res = %d",
cond, diff, vchr, nopad,
attrId >> 16, attrLen, s1, attrLen, argLen, s2, argLen, res);
ndbout_c("cond=%u diff=%d vc=%d nopad=%d attr(%d) = >%.*s<(%d) str=>%.*s<(%d) -> res = %d",
cond, diff, vchr, nopad,
attrId >> 16, attrLen, s1, attrLen, argLen, s2, argLen, res);
#endif
if (res)
TprogramCounter = brancher(theInstruction, TprogramCounter);
else {
Uint32 tmp = (Interpreter::mod4(argLen) >> 2) + 1;
else
{
Uint32 tmp = ((argLen + 3) >> 2) + 1;
ndbout_c("tmp = %d", tmp);
TprogramCounter += tmp;
}
break;
}
case Interpreter::BRANCH_ATTR_EQ_NULL:{
jam();
Uint32 ins2 = TcurrentProgram[TprogramCounter];
......
......@@ -1010,26 +1010,31 @@ NdbOperation::insertCall(Uint32 aCall)
int
NdbOperation::branch_col(Uint32 type,
Uint32 ColId, const char * val, Uint32 len,
Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
if (initial_interpreterCheck() == -1)
return -1;
Interpreter::BinaryCondition c = (Interpreter::BinaryCondition)type;
const NdbDictionary::Column * col =
const NdbColumnImpl * col =
m_currentTable->getColumn(ColId);
if(col == 0){
abort();
}
Uint32 vc = col->getType() == NdbDictionary::Column::Varchar;
Uint32 colLen = col->getLength() + 2 * vc;
Uint32 al = (4 - (colLen & 3)) & 0x3;
Uint32 sizeInBytes = col->m_attrSize * col->m_arraySize;
if(len != 0 && len != sizeInBytes)
{
setErrorCodeAbort(4209);
return -1;
}
if (insertATTRINFO(Interpreter::BranchCol(c, al, vc, nopad)) == -1)
len = sizeInBytes;
if (insertATTRINFO(Interpreter::BranchCol(c, 0, 0, false)) == -1)
return -1;
if (insertBranch(Label) == -1)
......@@ -1047,7 +1052,7 @@ NdbOperation::branch_col(Uint32 type,
Uint32 tmp = 0;
for (Uint32 i = 0; i < len-len2; i++) {
char* p = (char*)&tmp;
p[i] = val[len2+i];
p[i] = ((char*)val)[len2+i];
}
insertATTRINFO(tmp);
}
......@@ -1057,54 +1062,54 @@ NdbOperation::branch_col(Uint32 type,
}
int
NdbOperation::branch_col_eq(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_eq(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_eq %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::EQ, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_ne(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_ne(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_ne %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::NE, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_lt(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_lt(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_lt %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::LT, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_le(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_le(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_le %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::LE, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_gt(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_gt(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_gt %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::GT, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_ge(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_ge(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_ge %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::GE, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_like(Uint32 ColId, const char * val, Uint32 len,
NdbOperation::branch_col_like(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_like %u %.*s(%u,%d) -> %u", ColId, len, val, len, nopad, Label));
return branch_col(Interpreter::LIKE, ColId, val, len, nopad, Label);
}
int
NdbOperation::branch_col_notlike(Uint32 ColId, const char * val, Uint32 len,
bool nopad, Uint32 Label){
NdbOperation::branch_col_notlike(Uint32 ColId, const void * val, Uint32 len,
bool nopad, Uint32 Label){
INT_DEBUG(("branch_col_notlike %u %.*s(%u,%d) -> %u", ColId,len,val,len,nopad,Label));
return branch_col(Interpreter::NOT_LIKE, ColId, val, len, nopad, Label);
}
......
......@@ -48,11 +48,8 @@ class NdbScanFilterImpl {
int cond_col(Interpreter::UnaryCondition, Uint32 attrId);
template<typename T>
int cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, T value);
int cond_col_const(Interpreter::BinaryCondition, Uint32 attrId,
const char * value, Uint32 len, bool nopad);
const void * value, Uint32 len);
};
const Uint32 LabelExit = ~0;
......@@ -247,68 +244,7 @@ NdbScanFilter::isfalse(){
typedef int (NdbOperation:: * Branch1)(Uint32, Uint32 label);
typedef int (NdbOperation:: * Branch2)(Uint32, Uint32, Uint32 label);
typedef int (NdbOperation:: * StrBranch2)(Uint32, const char*,Uint32,bool,Uint32);
struct tab {
Branch2 m_branches[5];
};
static const tab table[] = {
/**
* EQ (AND, OR, NAND, NOR)
*/
{ { 0,
&NdbOperation::branch_ne,
&NdbOperation::branch_eq,
&NdbOperation::branch_eq,
&NdbOperation::branch_ne } }
/**
* NEQ
*/
,{ { 0,
&NdbOperation::branch_eq,
&NdbOperation::branch_ne,
&NdbOperation::branch_ne,
&NdbOperation::branch_eq } }
/**
* LT
*/
,{ { 0,
&NdbOperation::branch_le,
&NdbOperation::branch_gt,
&NdbOperation::branch_gt,
&NdbOperation::branch_le } }
/**
* LE
*/
,{ { 0,
&NdbOperation::branch_lt,
&NdbOperation::branch_ge,
&NdbOperation::branch_ge,
&NdbOperation::branch_lt } }
/**
* GT
*/
,{ { 0,
&NdbOperation::branch_ge,
&NdbOperation::branch_lt,
&NdbOperation::branch_lt,
&NdbOperation::branch_ge } }
/**
* GE
*/
,{ { 0,
&NdbOperation::branch_gt,
&NdbOperation::branch_le,
&NdbOperation::branch_le,
&NdbOperation::branch_gt } }
};
typedef int (NdbOperation:: * StrBranch2)(Uint32, const void*, Uint32, bool, Uint32);
struct tab2 {
Branch1 m_branches[5];
......@@ -334,133 +270,8 @@ static const tab2 table2[] = {
&NdbOperation::branch_col_eq_null } }
};
const int tab_sz = sizeof(table)/sizeof(table[0]);
const int tab2_sz = sizeof(table2)/sizeof(table2[0]);
int
matchType(const NdbDictionary::Column * col){
return 1;
}
template<typename T> int load_const(NdbOperation* op, T value, Uint32 reg);
template<>
int
load_const(NdbOperation* op, Uint32 value, Uint32 reg){
return op->load_const_u32(reg, value);
}
template<>
int
load_const(NdbOperation* op, Uint64 value, Uint32 reg){
return op->load_const_u64(reg, value);
}
template<typename T>
int
NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op,
Uint32 AttrId, T value){
if(op < 0 || op >= tab_sz){
m_operation->setErrorCodeAbort(4262);
return -1;
}
if(m_current.m_group < NdbScanFilter::AND ||
m_current.m_group > NdbScanFilter::NOR){
m_operation->setErrorCodeAbort(4260);
return -1;
}
Branch2 branch = table[op].m_branches[m_current.m_group];
const NdbDictionary::Column * col =
m_operation->m_currentTable->getColumn(AttrId);
if(col == 0){
m_operation->setErrorCodeAbort(4261);
return -1;
}
if(!matchType(col)){
/**
* Code not reached
*/
return -1;
}
if(m_latestAttrib != AttrId){
m_operation->read_attr(&NdbColumnImpl::getImpl(* col), 4);
m_latestAttrib = AttrId;
}
load_const<T>(m_operation, value, 5);
(m_operation->* branch)(4, 5, m_current.m_ownLabel);
return 0;
};
int
NdbScanFilter::eq(int AttrId, Uint32 value){
return m_impl.cond_col_const(Interpreter::EQ, AttrId, value);
}
int
NdbScanFilter::ne(int AttrId, Uint32 value){
return m_impl.cond_col_const(Interpreter::NE, AttrId, value);
}
int
NdbScanFilter::lt(int AttrId, Uint32 value){
return m_impl.cond_col_const(Interpreter::LT, AttrId, value);
}
int
NdbScanFilter::le(int AttrId, Uint32 value){
return m_impl.cond_col_const(Interpreter::LE, AttrId, value);
}
int
NdbScanFilter::gt(int AttrId, Uint32 value){
return m_impl.cond_col_const(Interpreter::GT, AttrId, value);
}
int
NdbScanFilter::ge(int AttrId, Uint32 value){
return m_impl.cond_col_const(Interpreter::GE, AttrId, value);
}
int
NdbScanFilter::eq(int AttrId, Uint64 value){
return m_impl.cond_col_const(Interpreter::EQ, AttrId, value);
}
int
NdbScanFilter::ne(int AttrId, Uint64 value){
return m_impl.cond_col_const(Interpreter::NE, AttrId, value);
}
int
NdbScanFilter::lt(int AttrId, Uint64 value){
return m_impl.cond_col_const(Interpreter::LT, AttrId, value);
}
int
NdbScanFilter::le(int AttrId, Uint64 value){
return m_impl.cond_col_const(Interpreter::LE, AttrId, value);
}
int
NdbScanFilter::gt(int AttrId, Uint64 value){
return m_impl.cond_col_const(Interpreter::GT, AttrId, value);
}
int
NdbScanFilter::ge(int AttrId, Uint64 value){
return m_impl.cond_col_const(Interpreter::GE, AttrId, value);
}
int
NdbScanFilterImpl::cond_col(Interpreter::UnaryCondition op, Uint32 AttrId){
......@@ -570,11 +381,10 @@ static const tab3 table3[] = {
const int tab3_sz = sizeof(table3)/sizeof(table3[0]);
int
NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op,
Uint32 AttrId,
const char * value, Uint32 len, bool nopad){
const void * value, Uint32 len){
if(op < 0 || op >= tab3_sz){
m_operation->setErrorCodeAbort(4260);
return -1;
......@@ -595,49 +405,31 @@ NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition op,
return -1;
}
(m_operation->* branch)(AttrId, value, len, nopad, m_current.m_ownLabel);
(m_operation->* branch)(AttrId, value, len, false, m_current.m_ownLabel);
return 0;
}
int
NdbScanFilter::eq(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::EQ, ColId, val, len, nopad);
}
int
NdbScanFilter::ne(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::NE, ColId, val, len, nopad);
}
int
NdbScanFilter::lt(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::LT, ColId, val, len, nopad);
}
int
NdbScanFilter::le(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::LE, ColId, val, len, nopad);
}
int
NdbScanFilter::gt(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::GT, ColId, val, len, nopad);
}
int
NdbScanFilter::ge(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::GE, ColId, val, len, nopad);
}
int
NdbScanFilter::like(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::LIKE, ColId, val, len, nopad);
}
NdbScanFilter::cmp(BinaryCondition cond, int ColId,
const void *val, Uint32 len)
{
switch(cond){
case LE:
return m_impl.cond_col_const(Interpreter::LE, ColId, val, len);
case LT:
return m_impl.cond_col_const(Interpreter::LT, ColId, val, len);
case GE:
return m_impl.cond_col_const(Interpreter::GE, ColId, val, len);
case GT:
return m_impl.cond_col_const(Interpreter::GT, ColId, val, len);
case EQ:
return m_impl.cond_col_const(Interpreter::EQ, ColId, val, len);
case NE:
return m_impl.cond_col_const(Interpreter::NE, ColId, val, len);
}
return -1;
}
int
NdbScanFilter::notlike(int ColId, const char * val, Uint32 len, bool nopad){
return m_impl.cond_col_const(Interpreter::NOT_LIKE, ColId, val, len, nopad);
}
#if 0
int
......@@ -778,10 +570,4 @@ main(void){
#endif
template class Vector<NdbScanFilterImpl::State>;
#if __SUNPRO_CC != 0x560
#ifndef _FORTEC_
template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint32);
template int NdbScanFilterImpl::cond_col_const(Interpreter::BinaryCondition, Uint32 attrId, Uint64);
#endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment