Ejemplo n.º 1
0
// replace constant with new or existing ConstantParameter
void CacheWA::replaceWithNewOrOldConstParam
(ConstValue *val, const NAType *typ, ExprValueId& tgt, BindWA &bindWA)
{
  // match ConstantParameters only in complex queries
  Lng32 complexity = (Lng32)CmpCommon::getDefaultNumeric
    (MATCH_CONSTANTS_OF_EQUALITY_PREDICATES);
  if (complexity >= 0 && numberOfScans_ >= complexity) {
    ConstantParameter *cParm;
    if (actuals_.find(val, &cParm)) {
      cParm->addPosition(++posCounter_);
      tgt = cParm; // replace with existing ConstantParameter
      return;
    }
    if (sels_.find(val, (SelParameter**)&cParm)) {
      cParm->addPosition(++posCounter_);
      tgt = cParm; // replace with existing ConstantParameter
      return;
    }
  }
  // query is simple or there is no matching constant.
  // introduce new ConstantParameter.
  ConstantParameter *nParam = new (wHeap()) ConstantParameter
    (val, wHeap(), typ, ++posCounter_);
  addConstParam(nParam, bindWA);
  tgt = nParam;
}
void
CatApiRequest::addParam (char * value)
{
#pragma nowarn(1026)   // warning elimination 
//SQ_LINUX (from (const) to (const Lng32)
  addConstParam ((const char *) value, (const Lng32) strlen(value));
#pragma warn(1026)  // warning elimination 
}
void
CatApiRequest::addParam (char * value, Lng32 length)
{
  addConstParam( (const char *) value, (const Lng32) length );
}
void
CatApiRequest::addParam (Lng32 value)
{
  addConstParam( (const Lng32) value );
}